|
@@ -6,6 +6,7 @@ package com.jeeplus.sys.controller;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.aliyun.oss.OSSClient;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -37,22 +38,21 @@ import com.jeeplus.sys.utils.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.security.core.parameters.P;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.ConstraintViolationException;
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.Validator;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -96,6 +96,16 @@ public class UserController {
|
|
|
@ApiOperation(value = "查询用户")
|
|
|
public ResponseEntity queryById(@RequestParam("id") String id) {
|
|
|
UserDTO userDTO = userService.get ( id );
|
|
|
+ if(ObjectUtil.isNotEmpty(userDTO)) {
|
|
|
+ if(CollectionUtil.isNotEmpty(userDTO.getCertDTOList())){
|
|
|
+ userDTO.getCertDTOList().stream().forEach(item->{
|
|
|
+ if (StringUtils.isNotBlank(item.getFileUrl())){
|
|
|
+ String fileTemporaryLookUrl = this.getFileTemporaryLookUrl(item.getFileUrl());
|
|
|
+ item.setFileLsUrl(fileTemporaryLookUrl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
//根据office.id 查询部门的所有父节点信息
|
|
|
if(null != userDTO.getOfficeDTO() && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId())){
|
|
|
OfficeDTO office = officeService.getOfficeById(userDTO.getOfficeDTO().getId());
|
|
@@ -625,4 +635,45 @@ public class UserController {
|
|
|
public Boolean isAdmin() {
|
|
|
return UserUtils.getCurrentUserDTO().isAdmin();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.aliyunUrl}")
|
|
|
+ private String aliyunUrl;
|
|
|
+ @Value("${config.accessory.aliyun.aliyunDownloadUrl}")
|
|
|
+ private String aliyunDownloadUrl;
|
|
|
+ @Value("${config.accessory.aliyun.endpoint}")
|
|
|
+ private String endpoint;
|
|
|
+ @Value("${config.accessory.aliyun.accessKeyId}")
|
|
|
+ private String accessKeyId;
|
|
|
+ @Value("${config.accessory.aliyun.accessKeySecret}")
|
|
|
+ private String accessKeySecret;
|
|
|
+ @Value("${config.accessory.aliyun.bucketName}")
|
|
|
+ private String bucketName;
|
|
|
+ /**
|
|
|
+ * 阿里云获取临时文件查看url
|
|
|
+ * @param url
|
|
|
+ */
|
|
|
+ public String getFileTemporaryLookUrl(String url){
|
|
|
+ url = url.replace("amp;","");
|
|
|
+ String cons = "";
|
|
|
+ if (url.contains(aliyunUrl)){
|
|
|
+ cons = aliyunUrl;
|
|
|
+ }else if (url.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
|
|
|
+ cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
|
+ }else {
|
|
|
+ cons = aliyunDownloadUrl;
|
|
|
+ }
|
|
|
+ String key = "";
|
|
|
+ String[] split = url.split(cons + "/");
|
|
|
+ if(split.length>1){
|
|
|
+ key = split[1];
|
|
|
+ }else{
|
|
|
+ key = url;
|
|
|
+ }
|
|
|
+ // 指定过期时间为24小时。
|
|
|
+ Date expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 );
|
|
|
+ //初始化OSSClient
|
|
|
+ OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
|
|
|
+ return ossClient.generatePresignedUrl(bucketName, key, expiration).toString();
|
|
|
+ }
|
|
|
}
|