Bladeren bron

沈永艺 2022/7/1 自建Feature分支

沈永艺 3 jaren geleden
bovenliggende
commit
1f39c60f18
26 gewijzigde bestanden met toevoegingen van 427 en 18 verwijderingen
  1. 4 0
      PAS/src/main/java/cn/cslg/pas/Application.java
  2. 24 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ImportDataVo.java
  3. 1 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProjectImportPatentVO.java
  4. 9 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java
  5. 44 3
      PAS/src/main/java/cn/cslg/pas/common/utils/FileUtils.java
  6. 10 2
      PAS/src/main/java/cn/cslg/pas/controller/CommonController.java
  7. 25 7
      PAS/src/main/java/cn/cslg/pas/controller/ProjectImportController.java
  8. 6 0
      PAS/src/main/java/cn/cslg/pas/domain/Area.java
  9. 3 0
      PAS/src/main/java/cn/cslg/pas/domain/Client.java
  10. 6 1
      PAS/src/main/java/cn/cslg/pas/domain/Department.java
  11. 7 0
      PAS/src/main/java/cn/cslg/pas/domain/Patent.java
  12. 3 0
      PAS/src/main/java/cn/cslg/pas/domain/PatentApplicantLink.java
  13. 6 0
      PAS/src/main/java/cn/cslg/pas/domain/PatentClassNumberLink.java
  14. 3 0
      PAS/src/main/java/cn/cslg/pas/domain/PatentImage.java
  15. 55 0
      PAS/src/main/java/cn/cslg/pas/domain/SystemDictAssociate.java
  16. 7 0
      PAS/src/main/java/cn/cslg/pas/mapper/SystemDictAssociateMapper.java
  17. 7 0
      PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java
  18. 4 0
      PAS/src/main/java/cn/cslg/pas/service/PatentImageService.java
  19. 4 0
      PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java
  20. 3 0
      PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java
  21. 48 2
      PAS/src/main/java/cn/cslg/pas/service/ProjectService.java
  22. 62 0
      PAS/src/main/java/cn/cslg/pas/service/SystemDictAssociateService.java
  23. 2 0
      PAS/src/main/java/cn/cslg/pas/service/SystemDictService.java
  24. 80 0
      PAS/src/main/java/cn/cslg/pas/service/UploadSettingTest.java
  25. 3 3
      PAS/src/main/resources/application-dev.yml
  26. 1 0
      PAS/src/main/resources/application.yml

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/Application.java

@@ -4,6 +4,9 @@ import cn.hutool.cron.CronUtil;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 @SpringBootApplication
 public class Application {
 
@@ -11,6 +14,7 @@ public class Application {
         SpringApplication.run(Application.class, args);
         CronUtil.setMatchSecond(true);
         CronUtil.start();
+        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "后台程序已启动,请运行前台");
     }
 
 }

+ 24 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ImportDataVo.java

@@ -0,0 +1,24 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+public class ImportDataVo {
+    private String sourceId;
+    private String sourceName;
+    private List<Column> column;
+
+    @Data
+    public static class Column {
+        private String setName;
+        private String column;
+        private String type;
+        private String splitSymbol;
+        private String handler;
+    }
+
+}

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProjectImportPatentVO.java

@@ -9,6 +9,7 @@ public class ProjectImportPatentVO {
     private Integer projectId;
     private List<Field> fieldList;
     private List<Integer> folderIds;
+    private String sourceId;
 
     @Data
     public static class Field {

+ 9 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java

@@ -0,0 +1,9 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+
+@Data
+public class UploadParamsVO {
+    private String patentNo;
+    private Integer applicationDate;
+}

+ 44 - 3
PAS/src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -7,9 +7,8 @@ import org.springframework.boot.system.ApplicationHome;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.annotation.Resource;
-import java.io.File;
-import java.util.List;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
 
 @Service
 public class FileUtils {
@@ -19,24 +18,38 @@ public class FileUtils {
     public static final String BACKUP_FILE = "backup";
 
     public static String getStaticPath(String fileName) {
+        //ApplicationHome类 返回target目录层级
         ApplicationHome ah = new ApplicationHome(FileUtils.class);
+        //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
         File file = ah.getSource();
+        //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
         String rootPath = file.getParentFile().toString() + FILE_SEPARATOR + fileName;
+        //根据上方生成的根目录路径 生成对应文件夹 没有就新建
         File root = new File(rootPath);
         if (!root.exists()) {
             root.mkdir();
         }
+        //返回的最终形式为 盘符:\项目层级\target\file
         return rootPath;
     }
 
     public UploadFileDTO uploadFile(MultipartFile file) {
         UploadFileDTO fileDTO = new UploadFileDTO();
+        //以下操作为 先取得传入文件的完整文件名 (文件名 + 后缀) 然后用FileUtil分别取出 文件名 和 不带 "." 的后缀 然后将这些内容装配进 实体中
+        //file.getOriginFilename 获取源文件
+        //FileUtil.getPrefix 返回主文件名
         fileDTO.setName(FileUtil.getPrefix(file.getOriginalFilename()));
+        //FileUtil.extName 获取文件的扩展名(后缀名),扩展名不带 "."
         fileDTO.setExtName(FileUtil.extName(file.getOriginalFilename()));
+        //获取目录名 用时间作为目录名称
         String directoryName = this.getDirectoryName();
+        //用IdUtil生成的UUID 与实体中的 extName(后缀名) 拼接后作为文件名 simpleUUID与randomUUID的区别是 simpleUUID 没有 "-"
         String fileName = IdUtil.simpleUUID() + "." + fileDTO.getExtName();
+        //将完整文件名进行装配
         fileDTO.setFileName(fileName);
+        //生成存储文件的路径
         String savePath = this.getSavePath(directoryName);
+        //根据生成存储文件的路径 生成对应文件夹 没有就新建
         File directory = new File(savePath);
         if (!directory.exists()) {
             directory.mkdir();
@@ -102,5 +115,33 @@ public class FileUtils {
         return getStaticPath(COMMON_FILE) + url;
     }
 
+    public String analysisJsonFile() {
+        String settingFilePath = "E:\\uploadSetting.json";
+        BufferedReader reader = null;
+        StringBuilder last = new StringBuilder();
+        InputStreamReader inputStreamReader;
+        try (FileInputStream fileInputStream = new FileInputStream(settingFilePath)) {
+            inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
+
+            reader = new BufferedReader(inputStreamReader);
+            String tempString;
+            while ((tempString = reader.readLine()) != null) {
+                last.append(tempString);
+            }
+            reader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return last.toString();
+    }
+
 }
 

+ 10 - 2
PAS/src/main/java/cn/cslg/pas/controller/CommonController.java

@@ -3,7 +3,9 @@ package cn.cslg.pas.controller;
 import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.domain.SystemDict;
+import cn.cslg.pas.domain.SystemDictAssociate;
 import cn.cslg.pas.service.AreaService;
+import cn.cslg.pas.service.SystemDictAssociateService;
 import cn.cslg.pas.service.SystemDictService;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
@@ -18,13 +20,11 @@ import cn.hutool.poi.excel.ExcelWriter;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
-import org.apache.commons.io.FilenameUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.util.FileCopyUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -46,6 +46,7 @@ public class CommonController {
     private final CacheUtils cacheUtils;
     private final AreaService areaService;
     private final SystemDictService systemDictService;
+    private final SystemDictAssociateService systemDictAssociateService;
     private final FileUtils fileUtils;
 
     @GetMapping("area")
@@ -66,6 +67,13 @@ public class CommonController {
         return Response.success(map);
     }
 
+    @GetMapping("getDictTreeByParentDictValue")
+    @Operation(summary = "获取字典项之间的级联关系")
+    public String getDictTreeByParentDictValue(@RequestParam(value = "value") List<String> value, String type, Integer flag) {
+        List<SystemDictAssociate> systemDictAssociates = systemDictAssociateService.getDictTreeByParentDictValue(value, type, flag);
+        return Response.success(systemDictAssociates);
+    }
+
     @GetMapping("static")
     @Operation(summary = "获取静态文件")
     public String getStaticFile(String path, String type, HttpServletResponse response, HttpServletRequest request) {

+ 25 - 7
PAS/src/main/java/cn/cslg/pas/controller/ProjectImportController.java

@@ -2,22 +2,33 @@ package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.annotation.Permission;
 import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.core.exception.PermissionException;
-import cn.cslg.pas.common.model.vo.*;
+import cn.cslg.pas.common.model.vo.ImportDataVo;
+import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
+import cn.cslg.pas.common.model.vo.ProjectImportVO;
+import cn.cslg.pas.common.model.vo.TaskParams;
 import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.domain.Project;
-import cn.cslg.pas.domain.ProjectExport;
-import cn.cslg.pas.domain.User;
-import cn.cslg.pas.service.*;
+import cn.cslg.pas.service.ProjectImportService;
+import cn.cslg.pas.service.ProjectImportStatusService;
+import cn.cslg.pas.service.ProjectService;
+import cn.cslg.pas.service.UploadSettingTest;
 import cn.dev33.satoken.stp.StpUtil;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -38,6 +49,9 @@ public class ProjectImportController {
     private final ProjectImportService projectImportService;
     private final ProjectImportStatusService projectImportStatusService;
 
+    private final UploadSettingTest uploadSettingTest;
+    private final FileUtils fileUtils;
+
     @Permission(roles = {2})
     @PostMapping("patent")
     @Operation(summary = "为专题库导入专利")
@@ -48,6 +62,10 @@ public class ProjectImportController {
         }
         TaskParams taskParams = projectService.getImportPatentTaskParams(file, params.getProjectId());
         projectService.importPatent(taskParams, params);
+
+        String getSettingJson = fileUtils.analysisJsonFile();
+        uploadSettingTest.processData(taskParams, params, getSettingJson);
+
         return Response.success(true);
     }
 

+ 6 - 0
PAS/src/main/java/cn/cslg/pas/domain/Area.java

@@ -58,8 +58,14 @@ public class Area implements Serializable {
      */
     private Integer level;
 
+    /**
+     * 创建时间
+     */
     private Date createdAt;
 
+    /**
+     * 修改时间
+     */
     private Date updatedAt;
 
 }

+ 3 - 0
PAS/src/main/java/cn/cslg/pas/domain/Client.java

@@ -38,6 +38,9 @@ public class Client extends BaseEntity<Client> {
      */
     private String remark;
 
+    /**
+     * 创建时间
+     */
     @TableField("ctime")
     private Integer createTime;
 

+ 6 - 1
PAS/src/main/java/cn/cslg/pas/domain/Department.java

@@ -17,7 +17,9 @@ import lombok.Data;
 @TableName("os_branch")
 public class Department extends BaseEntity<Department> {
 
-
+    /**
+     * 部门名称
+     */
     private String name;
 
     /**
@@ -26,6 +28,9 @@ public class Department extends BaseEntity<Department> {
     @TableField("pid")
     private Integer parentId;
 
+    /**
+     * 状态
+     */
     private Integer status;
 
     /**

+ 7 - 0
PAS/src/main/java/cn/cslg/pas/domain/Patent.java

@@ -192,6 +192,9 @@ public class Patent extends BaseEntity<Patent> {
     @TableField("inpadocfamilynum")
     private Integer inpadocFamilyNum;
 
+    /**
+     * PatSnap同族数量
+     */
     @TableField("patsnapfamilynum")
     private Integer patSnapFamilyNum;
 
@@ -288,6 +291,9 @@ public class Patent extends BaseEntity<Patent> {
      */
     private Integer inpadocFamily;
 
+    /**
+     * PatSnap同族ID
+     */
     @TableField("patsnap_family")
     private Integer patSnapFamily;
 
@@ -297,6 +303,7 @@ public class Patent extends BaseEntity<Patent> {
     @TableField("epcountry")
     private String epStatus;
 
+
     @TableField(exist = false)
     private Integer read;
 }

+ 3 - 0
PAS/src/main/java/cn/cslg/pas/domain/PatentApplicantLink.java

@@ -34,6 +34,9 @@ public class PatentApplicantLink extends BaseEntity<PatentApplicantLink> {
     @TableField("pid")
     private Integer patentId;
 
+    /**
+     * 申请人顺序(0为第一申请人)
+     */
     @TableField("`order`")
     public Integer order;
 }

+ 6 - 0
PAS/src/main/java/cn/cslg/pas/domain/PatentClassNumberLink.java

@@ -28,7 +28,13 @@ public class PatentClassNumberLink extends BaseEntity<PatentClassNumberLink> {
      */
     private Integer main;
 
+    /**
+     * 分类号类型
+     */
     private Integer type;
 
+    /**
+     * 分类号
+     */
     private String code;
 }

+ 3 - 0
PAS/src/main/java/cn/cslg/pas/domain/PatentImage.java

@@ -34,5 +34,8 @@ public class PatentImage extends BaseEntity<PatentImage> {
     @TableField("pid")
     private Integer patentId;
 
+    /**
+     * 文件名称
+     */
     private String fileName;
 }

+ 55 - 0
PAS/src/main/java/cn/cslg/pas/domain/SystemDictAssociate.java

@@ -0,0 +1,55 @@
+package cn.cslg.pas.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName(value = "OS_SYSTEM_DICT_ASSOCIATE")
+public class SystemDictAssociate {
+    /**
+     * 主键ID
+     */
+    @TableField(value = "id")
+    private Integer id;
+
+    /**
+     * 字典项父项Value值
+     */
+    private String dictParentValue;
+
+    /**
+     * 字典项父项Label值
+     */
+    private String dictParentLabel;
+
+    /**
+     * 字典项父项Type值
+     */
+    private String dictParentType;
+
+    /**
+     * 字典项子项VALUE值
+     */
+    private String dictChildValue;
+
+    /**
+     * 字典项子项LABEL值
+     */
+    private String dictChildLabel;
+
+    /**
+     * 字典项子项TYPE值
+     */
+    private String dictChildType;
+
+    /**
+     * 字典项子项状态(1必选流程 0可选流程)
+     */
+    private String dictChildStatus;
+
+    /**
+     * 字典项关联关系说明(用|分割)
+     */
+    private String description;
+}

+ 7 - 0
PAS/src/main/java/cn/cslg/pas/mapper/SystemDictAssociateMapper.java

@@ -0,0 +1,7 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.SystemDictAssociate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface SystemDictAssociateMapper extends BaseMapper<SystemDictAssociate> {
+}

+ 7 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java

@@ -229,7 +229,14 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
         }
     }
 
+    /**
+     *
+     * @param name 权利人 通过分割符 | 分割后的List
+     * @param shortName 【标】权利人 通过分割符 | 分割后的List
+     * @return
+     */
     public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName) {
+        //生成 一个存放ID的List
         List<Integer> ids = new ArrayList<>();
         for (int i = 0; i < name.size(); i++) {
             String s = i < shortName.size() ? shortName.get(i) : null;

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentImageService.java

@@ -66,13 +66,17 @@ public class PatentImageService extends ServiceImpl<PatentImageMapper, PatentIma
     }
 
     public String updatePatentImage(Integer patentId, PictureData pictureData) throws IOException {
+        //先删除该专利号下的对应摘要图片 以免上传重复
         this.deleteByPatentIdAndStatus(patentId, 1);
+        //将文件生成到文件夹下 并将 文件名 和 文件路径 返回出来
         Map<String, String> result = ExcelUtils.savePicture(pictureData);
+        //装配数据
         PatentImage patentImage = new PatentImage();
         patentImage.setStatus(1);
         patentImage.setPatentId(patentId);
         patentImage.setUrl(result.get("path"));
         patentImage.setFileName(result.get("name"));
+        //插入对应数据
         patentImage.insert();
         return patentImage.getUrl();
     }

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java

@@ -61,10 +61,14 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
 
     public void updatePatentRight(PatentRightParams params) {
         List<PatentRight> patentRightList = new ArrayList<>();
+        //获取国家 公开号前两位
         String country = PatentUtils.getPatentCountry(params.getPatentNo());
         String code;
+        //权利要求
         String content = params.getContent();
+        //权利要求(译)
         String contentOut = params.getContentOut();
+        //独立权利要求
         String selfContent = params.getSelfContent();
         if (StringUtils.isNotEmpty(content)) {
             this.deleteByPatentId(params.getPatentId());

+ 3 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java

@@ -84,11 +84,14 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
     }
 
     public void updateData(List<String> familyNo, String patentNo, Integer patentId, Integer type) {
+        //用专利号 获取同族关联专利表的信息
         List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByPatentNo(patentNo);
         PatentSimpleFamily family;
+        //没有就新建一条
         if (patentSimpleFamilyLinkList == null || patentSimpleFamilyLinkList.size() == 0) {
             family = this.add(type);
         } else {
+            //如果用PatentNo查出来数据了
             PatentSimpleFamily patentSimpleFamily = this.getPatentSimpleFamilyByIdsAndType(patentSimpleFamilyLinkList.stream().map(PatentSimpleFamilyLink::getFamilyId).collect(Collectors.toList()), type);
             if (patentSimpleFamily == null) {
                 family = this.add(type);

+ 48 - 2
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -476,24 +476,44 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                     Map<Object, Object> row = params.getRowList().get(i);
                     Object patentNo = row.get("公开(公告)号");
                     if (StringUtils.isNotNull(patentNo)) {
+
+                        PatentCustomFieldParams patentCustomFieldParams = new PatentCustomFieldParams();
+
+                        //用专利号查找专利的相关信息 并装配到 Patent 中
                         Patent patent = patentService.getByPatentNo(patentNo.toString());
+                        //法律状态/事件|INPADOC法律状态|法律状态更新时间|简单法律状态
                         PatentAffairParams patentAffairParams = new PatentAffairParams();
+                        //当前申请(专利权)人
                         List<String> patentApplicantCurrentName = new ArrayList<>();
+                        //原始申请(专利权)人
                         List<String> patentApplicantOriginalName = new ArrayList<>();
+                        //[标]当前申请(专利权)人
                         List<String> patentApplicantStandardCurrentName = new ArrayList<>();
+                        //[标]原始申请(专利权)人
                         List<String> patentApplicantStandardOriginalName = new ArrayList<>();
+                        //发明人|第一发明人
                         PatentInventorParams patentInventorParams = new PatentInventorParams();
+                        //简单同族|PatSnap同族|INPADOC同族
                         PatentSimpleFamilyParams patentSimpleFamilyParams = new PatentSimpleFamilyParams();
+                        //IPC分类号|UPC分类号|LOC分类号|CPC分类号|IPC主分类号|UPC主分类号
                         PatentClassNumberParams patentClassNumberParams = new PatentClassNumberParams();
-                        PatentCustomFieldParams patentCustomFieldParams = new PatentCustomFieldParams();
+                        //许可人|被许可人|许可类型
                         PatentLicensorParams patentLicensorParams = new PatentLicensorParams();
+                        //质押人|质权人
                         PatentPledgeParams patentPledgeParams = new PatentPledgeParams();
+                        //代理人
                         PatentAgentParams patentAgentParams = new PatentAgentParams();
+                        //当前申请(专利权)人地址|当前申请(专利权)人国家|当前第一申请(专利权)人地址|原始申请(专利权)人地址|原始申请(专利权)人国家
                         PatentApplicantAddressParams patentApplicantAddressParams = new PatentApplicantAddressParams();
+                        //发明人地址|第一发明人地址
                         PatentInventorAddressParams patentInventorAddressParams = new PatentInventorAddressParams();
+                        //说明书|说明书(译)
                         PatentInstructionTextParams patentInstructionTextParams = new PatentInstructionTextParams();
+                        //权利要求|独立权利要求|权利要求(译)
                         PatentRightParams patentRightParams = new PatentRightParams();
+                        //标签
                         PatentLabelParams patentLabelParams = new PatentLabelParams();
+
                         if (patent == null) {
                             patent = new Patent();
                             patent.setPatentNo(patentNo.toString());
@@ -518,12 +538,17 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                         patentRightParams.setPatentNo(patent.getPatentNo());
                         patentLabelParams.setPatentId(patent.getId());
                         patentLabelParams.setProjectId(projectImportPatentVO.getProjectId());
+
+
+                        //keySet() 返回map中所有key值的列别
                         for (Object object : row.keySet()) {
                             String key = object.toString();
                             if (key.equals("摘要附图")) {
                                 PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
                                 if (pictureData != null) {
+                                    //1.先把Excel里的图片存到文件夹里 路径大致是 ../target/file/时间/文件.png 2.生成完文件并存完后 将文件的路径和名称存到表里 OS_PATENT_IMAGE 然后最终得到摘要图片的存储路径
                                     String abstractPath = patentImageService.updatePatentImage(patent.getId(), pictureData);
+                                    //将路径进行装配
                                     patent.setAbstractPath(abstractPath);
                                 }
                             }
@@ -656,6 +681,11 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                                         patentRightParams.setContentOut(value.toString());
                                         break;
                                     case "权利要求数量":
+//                                        if ("该数据不支持导出".equals(value.toString())) {
+//                                            patent.setSelfRightContentNum(0);
+//                                        } else {
+//
+//                                        }
                                         patent.setSelfRightContentNum(Integer.parseInt(value.toString()));
                                         break;
                                     case "IPC分类号":
@@ -781,19 +811,34 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                             }
                         }
                         patent.updateById();
+                        //专利权利要求表
                         patentRightService.updatePatentRight(patentRightParams);
+                        //专利说明书(文本)
                         patentInstructionTextService.updatePatentInstructionText(patentInstructionTextParams);
+                        //代理人 (代理人关联专利)
                         patentAgentService.updatePatentAgent(patentAgentParams);
+                        //专利信息质押质权人
                         patentPledgeService.updatePatentPledge(patentPledgeParams);
+                        //专利信息许可人
                         patentLicensorService.updatePatentLicensor(patentLicensorParams);
+                        //专利信息事务信息
                         patentAffairService.updatePatientAffair(patentAffairParams);
+
+                        // TODO: 2022/7/1 待完成事项 申请人 发明人 同族
+                        //申请人关联
                         patentApplicantLinkService.updatePatentApplicantLink(patentApplicantCurrentName, patentApplicantStandardCurrentName, 1, patent.getId());
                         patentApplicantLinkService.updatePatentApplicantLink(patentApplicantOriginalName, patentApplicantStandardOriginalName, 2, patent.getId());
+                        //
                         patentApplicantService.updatePatentApplicantAddress(patentApplicantAddressParams);
+                        //专利信息发明人
                         patentInventorService.updatePatentInventor(patentInventorParams);
                         patentInventorService.updatePatentInventorAddress(patentInventorAddressParams);
+                        //专利信息简单同族关联
                         patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
+
+                        //专利分类号关联
                         patentClassNumberLinkService.updatePatentClassNumberLink(patentClassNumberParams);
+
                         projectPatentLinkService.updateProjectPatent(projectImportPatentVO.getProjectId(), patent.getId());
                         projectFieldPatentLinkService.updateProjectFieldPatentLink(projectImportPatentVO, patent.getId());
                         projectFolderPatentLinkService.updateProjectFolderLink(projectImportPatentVO, patent.getId());
@@ -1085,6 +1130,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         return sb.toString();
     }
 
+    //主页面 导出列表功能
     public void exportProject(HttpServletResponse response) {
         try {
             ProjectVO params = new ProjectVO();
@@ -1108,7 +1154,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
             OutputStream out = response.getOutputStream();
             writer.write(rows, true);
             response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
-            response.setHeader("Content-Disposition","attachment;filename=" + IdUtil.simpleUUID() + ".xlsx");
+            response.setHeader("Content-Disposition", "attachment;filename=" + IdUtil.simpleUUID() + ".xlsx");
             writer.flush(out, true);
             writer.close();
             IoUtil.close(out);

+ 62 - 0
PAS/src/main/java/cn/cslg/pas/service/SystemDictAssociateService.java

@@ -0,0 +1,62 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.domain.SystemDictAssociate;
+import cn.cslg.pas.mapper.SystemDictAssociateMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author 沈永艺
+ * @date 2022.6.22
+ * @description 获取字典项 (应用场景 与 调查类型) 的业务逻辑处理层
+ */
+
+@Service
+public class SystemDictAssociateService extends ServiceImpl<SystemDictAssociateMapper, SystemDictAssociate> {
+    /**
+     * @param value 父项(应用场景) 参数 Value 值
+     * @param type  字典项(应用场景) Key 值
+     * @param flag  查询标记 1为in操作查询 0为 notIn操作查询
+     * @return 返回一个 SystemDictAssociate 类型的 List
+     * @author 沈永艺
+     * @date 2022.6.21
+     * @description 通过传入Value值参数 以及Type(Key) 值 对 应用场景和调查类型之间的关联关系做业务查询
+     */
+    public List<SystemDictAssociate> getDictTreeByParentDictValue(List<String> value, String type, Integer flag) {
+        LambdaQueryWrapper<SystemDictAssociate> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.select(SystemDictAssociate::getDictChildLabel, SystemDictAssociate::getDictChildType, SystemDictAssociate::getDictChildValue);
+        List<SystemDictAssociate> systemDictAssociateList;
+
+        if (flag == 1) {
+            if (value == null || value.isEmpty()) {
+                return new ArrayList<>();
+            }
+            queryWrapper.in(SystemDictAssociate::getDictParentValue, value).eq(SystemDictAssociate::getDictParentType, type);
+        } else if (flag == 0) {
+            LambdaQueryWrapper<SystemDictAssociate> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.select(SystemDictAssociate::getDictChildLabel, SystemDictAssociate::getDictChildType, SystemDictAssociate::getDictChildValue);
+            queryWrapper1.in(SystemDictAssociate::getDictParentValue, value).eq(SystemDictAssociate::getDictParentType, type);
+            List<SystemDictAssociate> systemDictAssociateList1 = this.list(queryWrapper1).stream().distinct().collect(Collectors.toList());
+
+            queryWrapper.notIn(SystemDictAssociate::getDictParentValue, value).eq(SystemDictAssociate::getDictParentType, type);
+            List<SystemDictAssociate> systemDictAssociateList2 = this.list(queryWrapper).stream().distinct().collect(Collectors.toList());
+
+            for (int i = 0; i < systemDictAssociateList1.size(); i++) {
+                for (int j = 0; j < systemDictAssociateList2.size(); j++) {
+                    int finalI = i;
+                    systemDictAssociateList2.removeIf(a -> a.getDictChildLabel().equals(systemDictAssociateList1.get(finalI).getDictChildLabel()));
+                }
+            }
+
+            return systemDictAssociateList2;
+        }
+        systemDictAssociateList = this.list(queryWrapper).stream().distinct().collect(Collectors.toList());
+        return systemDictAssociateList;
+    }
+
+}

+ 2 - 0
PAS/src/main/java/cn/cslg/pas/service/SystemDictService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service;
 
 import cn.cslg.pas.domain.SystemDict;
+import cn.cslg.pas.domain.SystemDictAssociate;
 import cn.cslg.pas.mapper.SystemDictMapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -42,4 +43,5 @@ public class SystemDictService extends ServiceImpl<SystemDictMapper, SystemDict>
         }
         return "";
     }
+
 }

+ 80 - 0
PAS/src/main/java/cn/cslg/pas/service/UploadSettingTest.java

@@ -0,0 +1,80 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.model.vo.ImportDataVo;
+import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
+import cn.cslg.pas.common.model.vo.TaskParams;
+import cn.cslg.pas.common.model.vo.UploadParamsVO;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.JsonUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ReflectionUtils;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+public class UploadSettingTest {
+
+    public void processData(TaskParams taskParams, ProjectImportPatentVO projectImportPatentVO, String getSettingJson) {
+        //将 Json 转换为 对象数组
+        List<ImportDataVo> test = JsonUtils.jsonToList(getSettingJson, ImportDataVo.class);
+        /*
+         *  创建一个存放单一数据源的对象
+         *  这个对象存放的是 我们需要使用哪一个数据源的配置数据 所以只存一个
+         *  正常在Json文件里面会有多个数据源 也就是多条数据
+         * */
+        List<ImportDataVo.Column> jsonData = new ArrayList<>();
+        /*
+         *   开始将前端传入的数据源参数与 Json 中解析出来的 sourceId(数据来源ID) 进行比对
+         *   并将比对中的那一条数据放入上方定义的 jsonData 中 用于后续使用
+         * */
+        for (int i = 0; i < Objects.requireNonNull(test).size(); i++) {
+            //提取一个常量
+            ImportDataVo constant = Objects.requireNonNull(test).get(i);
+            //判断 如果说 Json 解析出来的 List<T> 中的 sourceId 和传入参数的 sourceId 匹配成功 则开始装配数据
+            if (constant.getSourceId().equals(projectImportPatentVO.getSourceId())) {
+                //装配数据
+                jsonData = constant.getColumn();
+            }
+        }
+
+        try {
+            for (int i = 0; i < taskParams.getRowList().size(); i++) {
+                Map<Object, Object> row = taskParams.getRowList().get(i);
+                Class<UploadParamsVO> clazz = UploadParamsVO.class;
+                UploadParamsVO uploadParamsVO = clazz.newInstance();
+                for (Object object : row.keySet()) {
+                    String key = object.toString();
+                    Object value = row.get(key);
+                    for (ImportDataVo.Column jsonDatum : jsonData) {
+                        if (jsonDatum.getSetName().equals(key)) {
+                            Field propertyList = clazz.getDeclaredField(jsonDatum.getColumn());
+                            ReflectionUtils.makeAccessible(propertyList);
+                            switch (jsonDatum.getType()) {
+                                case "Date":
+                                    ReflectionUtils.setField(propertyList, uploadParamsVO, DateUtils.getDateTime(value.toString()));
+                                    break;
+                                case "String":
+                                    ReflectionUtils.setField(propertyList, uploadParamsVO, value.toString());
+                                    break;
+                                case "Integer":
+                                    ReflectionUtils.setField(propertyList, uploadParamsVO, Integer.parseInt(value.toString()));
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                }
+                System.out.println(uploadParamsVO.getPatentNo());
+                System.out.println(uploadParamsVO.getApplicationDate());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+

+ 3 - 3
PAS/src/main/resources/application-dev.yml

@@ -1,13 +1,13 @@
 spring:
   redis:
-    host: 192.168.80.128
+    host: 127.0.0.1
     port: 6379
     database: 2
     timeout: 1000
   datasource:
-    url: jdbc:mysql://192.168.80.128:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://192.168.0.57:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     username: root
-    password: 123456789
+    password: 123456
     driver-class-name: com.mysql.cj.jdbc.Driver
     type: com.alibaba.druid.pool.DruidDataSource
     druid:

+ 1 - 0
PAS/src/main/resources/application.yml

@@ -2,6 +2,7 @@ server:
   servlet:
     context-path: /
   port: 8879
+  address: 192.168.0.57
 sa-token:
   activity-timeout: 18000
   token-name: token