hanqingsong před 1 rokem
rodič
revize
16bd58f9dd

+ 7 - 0
src/main/java/com/chinaitop/DepotBasicApplication.java

@@ -8,6 +8,8 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
8 8
 import org.springframework.cloud.openfeign.EnableFeignClients;
9 9
 
10 10
 import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
11
+import org.springframework.context.annotation.Bean;
12
+import org.springframework.web.client.RestTemplate;
11 13
 
12 14
 //import springfox.documentation.swagger2.annotations.EnableSwagger2;
13 15
 
@@ -24,4 +26,9 @@ public class DepotBasicApplication {
24 26
 		System.setProperty("druid.validationQuery", "SELECT 1 FROM DUAL");
25 27
 		SpringApplication.run(DepotBasicApplication.class, args);
26 28
 	}
29
+
30
+	@Bean
31
+	public RestTemplate restTemplate() {
32
+		return new RestTemplate();
33
+	}
27 34
 }

+ 8 - 1
src/main/java/com/chinaitop/depot/basic/model/DRyxxsjyVO.java

@@ -4,6 +4,7 @@ import java.util.Date;
4 4
 import java.util.List;
5 5
 
6 6
 import com.chinaitop.depot.basic.model.vo.*;
7
+import com.chinaitop.depot.basic.param.FileObject;
7 8
 import com.fasterxml.jackson.annotation.JsonFormat;
8 9
 import io.swagger.annotations.ApiModel;
9 10
 import io.swagger.annotations.ApiModelProperty;
@@ -145,7 +146,7 @@ public class DRyxxsjyVO {
145 146
 	 * 岗位代码,11:后勤,12:业务,13:财务,14:统计,15:仓储,16:化验,17:管理,18:防治,19:保安,20:其他
146 147
 	 */
147 148
 	@ApiModelProperty("岗位代码,11:后勤,12:业务,13:财务,14:统计,15:仓储,16:化验,17:管理,18:防治,19:保安,20:其他")
148
-	private Integer gwdm;
149
+	private String gwdm;
149 150
 
150 151
 	/**
151 152
 	 * 技术职称代码,401:仓储管理员,402:农产品检验员,403:其他
@@ -335,4 +336,10 @@ public class DRyxxsjyVO {
335 336
 	private List<Object> otherVoList;
336 337
 	@ApiModelProperty(value = "职务类型变更记录")
337 338
 	private List<ZwlxbgjlVO> zwlxbgjlVOList;
339
+
340
+	// 文件对象
341
+	@ApiModelProperty(value = "文件url")
342
+	private String fileUrl;
343
+	@ApiModelProperty(value = "文件名称")
344
+	private String fileName;
338 345
 }

+ 7 - 0
src/main/java/com/chinaitop/depot/basic/model/vo/CertificatesVO.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.basic.model.vo;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModelProperty;
4 5
 import lombok.Data;
5 6
 
6 7
 import java.util.Date;
@@ -21,4 +22,10 @@ public class CertificatesVO {
21 22
     private Date acquisitionTime;
22 23
     // 证书附件
23 24
     private String fjid;
25
+
26
+    // 文件对象
27
+    @ApiModelProperty(value = "文件url")
28
+    private String fileUrl;
29
+    @ApiModelProperty(value = "文件名称")
30
+    private String fileName;
24 31
 }

+ 7 - 0
src/main/java/com/chinaitop/depot/basic/model/vo/ReportVO.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.basic.model.vo;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModelProperty;
4 5
 import lombok.Data;
5 6
 
6 7
 import java.util.Date;
@@ -32,4 +33,10 @@ public class ReportVO {
32 33
     private String occupation;
33 34
     // 证书附件
34 35
     private String fjid;
36
+
37
+    // 文件对象
38
+    @ApiModelProperty(value = "文件url")
39
+    private String fileUrl;
40
+    @ApiModelProperty(value = "文件名称")
41
+    private String fileName;
35 42
 }

+ 7 - 0
src/main/java/com/chinaitop/depot/basic/model/vo/RotaterotateVO.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.basic.model.vo;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModelProperty;
4 5
 import lombok.Data;
5 6
 
6 7
 import java.util.Date;
@@ -20,4 +21,10 @@ public class RotaterotateVO {
20 21
     private Date businessTime;
21 22
     // 文件编号
22 23
     private String serialNumber;
24
+
25
+    // 文件对象
26
+    @ApiModelProperty(value = "文件url")
27
+    private String fileUrl;
28
+    @ApiModelProperty(value = "文件名称")
29
+    private String fileName;
23 30
 }

+ 27 - 0
src/main/java/com/chinaitop/depot/basic/param/FileObject.java

@@ -0,0 +1,27 @@
1
+package com.chinaitop.depot.basic.param;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+import java.io.Serializable;
7
+import java.util.Date;
8
+
9
+/**
10
+ * @author qingsong.han
11
+ * @description:
12
+ * @create 2024-11-26 17:45
13
+ */
14
+@Getter
15
+@Setter
16
+public class FileObject implements Serializable {
17
+    private static final long serialVersionUID = 1020140835552562036L;
18
+    private Integer id;
19
+    private Integer version;
20
+    private Date createTime;
21
+    private String createByPeople;
22
+    private String name;
23
+    private Integer fileSize;
24
+    private String link;
25
+    private String businessId;
26
+    private String status;
27
+}

+ 19 - 0
src/main/java/com/chinaitop/depot/basic/param/FileParam.java

@@ -0,0 +1,19 @@
1
+package com.chinaitop.depot.basic.param;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * @author qingsong.han
9
+ * @description:
10
+ * @create 2024-11-26 17:29
11
+ */
12
+@Data
13
+public class FileParam implements Serializable {
14
+    private static final long serialVersionUID = 7294849869061545523L;
15
+    private String status;
16
+    private Integer infoCode;
17
+    private String msg;
18
+    private FileObject data;
19
+}

+ 50 - 2
src/main/java/com/chinaitop/depot/basic/service/impl/DRyxxsjyServiceImpl.java

@@ -1,13 +1,18 @@
1 1
 package com.chinaitop.depot.basic.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSON;
3 4
 import com.chinaitop.depot.basic.mapper.DRyxxsjyMapper;
4 5
 import com.chinaitop.depot.basic.model.DRyxxsjyVO;
5 6
 import com.chinaitop.depot.basic.model.vo.*;
6 7
 import com.chinaitop.depot.basic.param.DRyxxsjyPageParam;
8
+import com.chinaitop.depot.basic.param.FileObject;
9
+import com.chinaitop.depot.basic.param.FileParam;
7 10
 import com.chinaitop.depot.basic.service.DRyxxsjyService;
11
+import com.chinaitop.depot.utils.FileUrlUtil;
12
+import org.springframework.beans.factory.annotation.Value;
8 13
 import org.springframework.stereotype.Service;
9
-import org.springframework.util.CollectionUtils;
10
-import org.springframework.util.ObjectUtils;
14
+import org.springframework.util.*;
15
+import org.springframework.web.client.RestTemplate;
11 16
 
12 17
 import javax.annotation.Resource;
13 18
 import java.util.List;
@@ -18,9 +23,12 @@ import java.util.List;
18 23
  * @create 2024-11-21 20:05
19 24
  */
20 25
 @Service
26
+@SuppressWarnings("all")
21 27
 public class DRyxxsjyServiceImpl implements DRyxxsjyService {
22 28
     @Resource
23 29
     private DRyxxsjyMapper dRyxxsjyMapper;
30
+    @Resource
31
+    private FileUrlUtil fileUrlUtil;
24 32
 
25 33
     @Override
26 34
     public List<DRyxxsjyVO> getPageList(DRyxxsjyPageParam pageParam) {
@@ -33,6 +41,16 @@ public class DRyxxsjyServiceImpl implements DRyxxsjyService {
33 41
         if (ObjectUtils.isEmpty(dRyxxsjyVO)) {
34 42
             return dRyxxsjyVO;
35 43
         }
44
+
45
+        // 获取文件
46
+        if (StringUtils.hasText(dRyxxsjyVO.getAvatorUrl())) {
47
+            FileObject data = fileUrlUtil.getData(dRyxxsjyVO.getAvatorUrl());
48
+            if (!ObjectUtils.isEmpty(data)) {
49
+                dRyxxsjyVO.setFileUrl(data.getLink());
50
+                dRyxxsjyVO.setFileName(data.getName());
51
+            }
52
+        }
53
+
36 54
         // 学历学位情况
37 55
         // 全日制
38 56
         List<EducationVO> educationVOList = dRyxxsjyMapper.getQuanById(rybh);
@@ -48,6 +66,16 @@ public class DRyxxsjyServiceImpl implements DRyxxsjyService {
48 66
         List<RotaterotateVO> rotaterotateVOList = dRyxxsjyMapper.getRotaterotateById(rybh);
49 67
         if (!CollectionUtils.isEmpty(rotaterotateVOList)) {
50 68
             dRyxxsjyVO.setRotaterotateVOList(rotaterotateVOList);
69
+            // 文件
70
+            rotaterotateVOList.forEach(rotateVO -> {
71
+                if (StringUtils.hasText(rotateVO.getSerialNumber())) {
72
+                    FileObject data = fileUrlUtil.getData(rotateVO.getSerialNumber());
73
+                    if (!ObjectUtils.isEmpty(data)) {
74
+                        rotateVO.setFileUrl(data.getLink());
75
+                        rotateVO.setFileName(data.getName());
76
+                    }
77
+                }
78
+            });
51 79
         }
52 80
         // 技能等级
53 81
         List<SkillVO> skillVOList = dRyxxsjyMapper.getSkillListById(rybh);
@@ -58,11 +86,31 @@ public class DRyxxsjyServiceImpl implements DRyxxsjyService {
58 86
         List<ReportVO> reportVOList = dRyxxsjyMapper.getReportListById(rybh);
59 87
         if (!CollectionUtils.isEmpty(reportVOList)) {
60 88
             dRyxxsjyVO.setReportVOList(reportVOList);
89
+            // 文件
90
+            reportVOList.forEach(reportVO -> {
91
+                if (StringUtils.hasText(reportVO.getFjid())) {
92
+                    FileObject data = fileUrlUtil.getData(reportVO.getFjid());
93
+                    if (!ObjectUtils.isEmpty(data)) {
94
+                        reportVO.setFileUrl(data.getLink());
95
+                        reportVO.setFileName(data.getName());
96
+                    }
97
+                }
98
+            });
61 99
         }
62 100
         // 上岗其它证书
63 101
         List<CertificatesVO> certificatesVOList = dRyxxsjyMapper.getCertificatesListById(rybh);
64 102
         if (!CollectionUtils.isEmpty(certificatesVOList)) {
65 103
             dRyxxsjyVO.setCertificatesVOList(certificatesVOList);
104
+            // 文件
105
+            certificatesVOList.forEach(certificatesVO -> {
106
+                if (StringUtils.hasText(certificatesVO.getFjid())) {
107
+                    FileObject data = fileUrlUtil.getData(certificatesVO.getFjid());
108
+                    if (!ObjectUtils.isEmpty(data)) {
109
+                        certificatesVO.setFileUrl(data.getLink());
110
+                        certificatesVO.setFileName(data.getName());
111
+                    }
112
+                }
113
+            });
66 114
         }
67 115
         // 其它附件-暂无
68 116
         // 职务类型变更记录

+ 48 - 0
src/main/java/com/chinaitop/depot/utils/FileUrlUtil.java

@@ -0,0 +1,48 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.chinaitop.depot.basic.param.FileObject;
5
+import com.chinaitop.depot.basic.param.FileParam;
6
+import org.springframework.beans.factory.annotation.Value;
7
+import org.springframework.stereotype.Component;
8
+import org.springframework.util.LinkedMultiValueMap;
9
+import org.springframework.util.MultiValueMap;
10
+import org.springframework.util.ObjectUtils;
11
+import org.springframework.web.client.RestTemplate;
12
+
13
+import javax.annotation.Resource;
14
+
15
+/**
16
+ * @author qingsong.han
17
+ * @description:
18
+ * @create 2024-11-27 10:50
19
+ */
20
+@Component
21
+public class FileUrlUtil {
22
+    @Resource
23
+    private RestTemplate restTemplate;
24
+    @Value("${sptFile}")
25
+    private String sptFile;
26
+
27
+    /**
28
+     * 获取市平台文件url
29
+     *
30
+     * @param fileId
31
+     * @return
32
+     */
33
+    public FileObject getData(String fileId) {
34
+        MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
35
+        sendMap.add("id", fileId);
36
+        String forObject = restTemplate.postForObject(String.format("%s%s", sptFile, "/file/findById"), sendMap, String.class);
37
+        if (!ObjectUtils.isEmpty(forObject)) {
38
+            FileParam fileParam = JSON.parseObject(forObject, FileParam.class);
39
+            if (200 == fileParam.getInfoCode()) {
40
+                FileObject data = fileParam.getData();
41
+                data.setLink(String.format("%s%s", sptFile, data.getLink()));
42
+                return data;
43
+            }
44
+        }
45
+        return null;
46
+    }
47
+
48
+}

+ 3 - 1
src/main/resources/bootstrap.yml

@@ -93,4 +93,6 @@ web:
93 93
 
94 94
 logging:
95 95
   level:
96
-    com.chinaitop.depot.basic.mapper: debug
96
+    com.chinaitop.depot.basic.mapper: debug
97
+# 调用市平台获取文件-紫光云
98
+sptFile: http://101.36.160.140:8097/file/