浏览代码

Merge remote-tracking branch 'origin/dev2' into dev2

lwhhszx 2 年之前
父节点
当前提交
71c3cce015
共有 52 个文件被更改,包括 555 次插入193 次删除
  1. 6 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentAgentParams.java
  2. 9 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentInstructionTextParams.java
  3. 15 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentInventorParams.java
  4. 12 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentLicensorParams.java
  5. 9 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentPledgeParams.java
  6. 2 2
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentRightParams.java
  7. 9 0
      PAS/src/main/java/cn/cslg/pas/common/model/params/PatentSimpleFamilyParams.java
  8. 0 8
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ApplicationScenarioEventNumberVO.java
  9. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/EventListItemVO.java
  10. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/InvestigationTypeProjectNumberVO.java
  11. 12 13
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductMarketDataTrendVO.java
  12. 34 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProjectImportPatentVO.java
  13. 25 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskParams.java
  14. 6 2
      PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java
  15. 3 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadSettingVO.java
  16. 9 5
      PAS/src/main/java/cn/cslg/pas/common/utils/ExcelUtils.java
  17. 5 5
      PAS/src/main/java/cn/cslg/pas/common/utils/UploadPatentBatchUtil.java
  18. 4 4
      PAS/src/main/java/cn/cslg/pas/controller/EventController.java
  19. 1 4
      PAS/src/main/java/cn/cslg/pas/controller/PermissionRecordController.java
  20. 3 6
      PAS/src/main/java/cn/cslg/pas/domain/Authority.java
  21. 1 1
      PAS/src/main/java/cn/cslg/pas/domain/Patent.java
  22. 3 2
      PAS/src/main/java/cn/cslg/pas/domain/PatentAgent.java
  23. 2 4
      PAS/src/main/java/cn/cslg/pas/domain/PatentImage.java
  24. 0 1
      PAS/src/main/java/cn/cslg/pas/domain/PatentInstructionText.java
  25. 3 4
      PAS/src/main/java/cn/cslg/pas/domain/PatentLicensor.java
  26. 4 1
      PAS/src/main/java/cn/cslg/pas/domain/ProjectField.java
  27. 9 3
      PAS/src/main/java/cn/cslg/pas/domain/SystemDict.java
  28. 2 4
      PAS/src/main/java/cn/cslg/pas/domain/Task.java
  29. 3 2
      PAS/src/main/java/cn/cslg/pas/mapper/PatentSimpleFamilyLinkMapper.java
  30. 2 2
      PAS/src/main/java/cn/cslg/pas/service/IEventService.java
  31. 1 0
      PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java
  32. 9 0
      PAS/src/main/java/cn/cslg/pas/service/PatentAgencyService.java
  33. 17 0
      PAS/src/main/java/cn/cslg/pas/service/PatentAgentLinkService.java
  34. 19 0
      PAS/src/main/java/cn/cslg/pas/service/PatentAgentService.java
  35. 11 0
      PAS/src/main/java/cn/cslg/pas/service/PatentApplicantLinkService.java
  36. 15 10
      PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java
  37. 12 4
      PAS/src/main/java/cn/cslg/pas/service/PatentImageService.java
  38. 16 4
      PAS/src/main/java/cn/cslg/pas/service/PatentInstructionTextService.java
  39. 3 0
      PAS/src/main/java/cn/cslg/pas/service/PatentInventorLinkService.java
  40. 6 0
      PAS/src/main/java/cn/cslg/pas/service/PatentInventorService.java
  41. 16 0
      PAS/src/main/java/cn/cslg/pas/service/PatentLicensorService.java
  42. 16 0
      PAS/src/main/java/cn/cslg/pas/service/PatentPledgeService.java
  43. 8 4
      PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java
  44. 11 6
      PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java
  45. 22 2
      PAS/src/main/java/cn/cslg/pas/service/ProjectFieldService.java
  46. 11 0
      PAS/src/main/java/cn/cslg/pas/service/ProjectService.java
  47. 16 0
      PAS/src/main/java/cn/cslg/pas/service/TaskService.java
  48. 94 34
      PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java
  49. 19 20
      PAS/src/main/java/cn/cslg/pas/service/impl/EventServiceImpl.java
  50. 5 4
      PAS/src/main/java/cn/cslg/pas/service/impl/PermissionRecordServiceImpl.java
  51. 17 22
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java
  52. 16 5
      PAS/src/main/resources/mapper/PatentSimpleFamilyLinkMapper.xml

+ 6 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentAgentParams.java

@@ -6,6 +6,12 @@ import java.util.List;
 
 @Data
 public class PatentAgentParams {
+    /**
+     * 专利id
+     */
     private Integer patentId;
+    /**
+     * 代理人名称集合
+     */
     private List<String> agent;
 }

+ 9 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentInstructionTextParams.java

@@ -4,7 +4,16 @@ import lombok.Data;
 
 @Data
 public class PatentInstructionTextParams {
+    /**
+     * 说明书
+     */
     private String manual;
+    /**
+     * 说明书(译文)
+     */
     private String manualOut;
+    /**
+     * 专利id
+     */
     private Integer patentId;
 }

+ 15 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentInventorParams.java

@@ -6,9 +6,24 @@ import java.util.List;
 
 @Data
 public class PatentInventorParams {
+    /**
+     * 专利id
+     */
     private Integer patentId;
+    /**
+     * 发明人地址
+     */
     private List<String> addressList;
+    /**
+     * 合并前发明人名称
+     */
     private List<String> nameList;
+    /**
+     * 第一发明人名称
+     */
     private String firstName;
+    /**
+     * 第一发明人地址
+     */
     private String firstAddress;
 }

+ 12 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentLicensorParams.java

@@ -6,8 +6,20 @@ import java.util.List;
 
 @Data
 public class PatentLicensorParams {
+    /**
+     * 专利id
+     */
     private Integer patentId;
+    /**
+     * 许可人
+     */
     private List<String> licensor;
+    /**
+     * 被许可人
+     */
     private List<String> licensee;
+    /**
+     * 许可类型
+     */
     private List<String> type;
 }

+ 9 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentPledgeParams.java

@@ -6,7 +6,16 @@ import java.util.List;
 
 @Data
 public class PatentPledgeParams {
+    /**
+     * 专利id
+     */
     private Integer patentId;
+    /**
+     * 质押人
+     */
     private List<String> pledgor;
+    /**
+     * 质权人
+     */
     private List<String> pledgee;
 }

+ 2 - 2
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentRightParams.java

@@ -18,11 +18,11 @@ public class PatentRightParams {
      */
     private String patentNo;
     /**
-     * 原文
+     * 权要原文
      */
     private String content;
     /**
-     * 译文
+     * 权要译文
      */
     private String contentOut;
     /**

+ 9 - 0
PAS/src/main/java/cn/cslg/pas/common/model/params/PatentSimpleFamilyParams.java

@@ -6,8 +6,17 @@ import java.util.List;
 
 @Data
 public class PatentSimpleFamilyParams {
+    /**
+     * 专利id
+     */
     private Integer patentId;
+    /**
+     * 专利号
+     */
     private String patentNo;
+    /**
+     * 简单同族
+     */
     private List<String> simpleFamily;
     private List<String> inpadocFamily;
     private List<String> patSnapFamily;

+ 0 - 8
PAS/src/main/java/cn/cslg/pas/common/model/vo/ApplicationScenarioEventNumberVO.java

@@ -23,14 +23,6 @@ public class ApplicationScenarioEventNumberVO implements Serializable {
      */
     private String applicationScenarioName;
     /**
-     * 应用场景直接对应的事件数量
-     */
-    //private Integer eventNumberFromEvent;
-    /**
-     * 应用场景对应的专题库中事件的数量
-     */
-    //private Integer eventNumberFromProject;
-    /**
      * 事件数量
      */
     private Integer eventNumber;

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

@@ -20,7 +20,7 @@ import java.util.List;
 @Data
 public class EventListItemVO implements Serializable {
     /**
-     * 主键
+     * 事件id
      */
     private Integer id;
     /**

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

@@ -13,7 +13,7 @@ import java.io.Serializable;
 @Data
 public class InvestigationTypeProjectNumberVO implements Serializable {
     /**
-     * 调查类型
+     * 调查类型数值
      */
     private Integer investigationType;
     /**

+ 12 - 13
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductMarketDataTrendVO.java

@@ -4,7 +4,6 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 
-
 /**
  * 产品营销数据返回的数据VO
  *
@@ -15,20 +14,20 @@ import lombok.experimental.Accessors;
 @Data
 public class ProductMarketDataTrendVO {
 
-        /**
-         * 时间(季度/月份/年份)
-         */
-        private String marketDate;
+    /**
+     * 时间(季度/月份/年份)
+     */
+    private String marketDate;
 
-        /**
-         * 销售额
-         */
-        private Double saleTotalMoney;
+    /**
+     * 销售额
+     */
+    private Double saleTotalMoney;
 
-        /**
-         * 自定义许可费(销售量 * 自定义许可费率)
-         */
-        private Double customLicenseMoney;
+    /**
+     * 自定义许可费(销售量 * 自定义许可费率)
+     */
+    private Double customLicenseMoney;
 
 
 }

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

@@ -6,25 +6,58 @@ import java.util.List;
 
 @Data
 public class ProjectImportPatentVO {
+    /**
+     * 专题库id
+     */
     private Integer projectId;
+    /**
+     * 数据来源(1.智慧芽 2.合享 3.Patentics)
+     */
+    private String sourceId;
+    /**
+     * 自定义字段ids
+     */
     private List<Field> fieldList;
+    /**
+     * 文件夹ids
+     */
     private List<Integer> folderIds;
-    private String sourceId;
 
     @Data
     public static class Field {
+        /**
+         * 自定义字段id
+         */
         private Integer fieldId;
+        /**
+         * 自定义字段类型(6为树)
+         */
         private Integer type;
+        /**
+         * 选项id
+         */
         private Integer optionId;
         private String text;
     }
 
     @Data
     public static class Folder {
+        /**
+         * 文件夹id
+         */
         private Integer id;
+        /**
+         * 上级文件夹id
+         */
         private Integer parentId;
+        /**
+         * 文件夹名称
+         */
         private String name;
         private Boolean selected;
+        /**
+         * 子级文件夹们
+         */
         private List<Folder> children;
     }
 }

+ 25 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskParams.java

@@ -1,6 +1,5 @@
 package cn.cslg.pas.common.model.vo;
 
-import cn.hutool.poi.excel.ExcelReader;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
@@ -11,19 +10,44 @@ import java.util.Map;
 @Data
 @Accessors(chain = true)
 public class TaskParams implements Serializable {
+    /**
+     * 任务类型(1.上传,2导出)
+     */
     private Integer taskType;
+    /**
+     * 任务id
+     */
     private Integer taskId;
+    /**
+     * 创建人id
+     */
     private String userId;
+    /**
+     * 文件路径
+     */
     private String path;
     private String token;
     private String ids;
+    /**
+     * 专题库id
+     */
     private Integer projectId;
     private String selected;
+    /**
+     * Excel中的全部专利的数据(key:表头(如"公开号")  value:表头对应的专利内容(如"CN204445352U"))
+     */
     private List<Map<Object, Object>> rowList;
+    /**
+     * 文件原始名称
+     */
     private String oldName;
+    /**
+     * 专利总数量
+     */
     private Integer total;
     private Integer index;
     private Integer productId;
+
     public TaskParams() {
 
     }

+ 6 - 2
PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java

@@ -17,15 +17,19 @@ public class UploadParamsVO {
      * 专利
      */
     private Patent patent;
+    /**
+     * 法律状态
+     */
     private String patentSimpleStatus;
 
     /**
      * 权利要求
      */
     private PatentRight patentRight;
+    /**
+     * 独立权要
+     */
     private String selfContent;
-
-
     /**
      * 说明书(文本)
      */

+ 3 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadSettingVO.java

@@ -6,6 +6,8 @@ import lombok.experimental.Accessors;
 import java.util.List;
 
 /**
+ * uploadSetting.json数据源配置文件实体类
+ *
  * @author 沈永艺
  * @date 2022/7/1
  * @description 用于存储从配置文件(Json类型)中解析出来的配置参数
@@ -15,7 +17,7 @@ import java.util.List;
 @Accessors(chain = true)
 public class UploadSettingVO {
     /**
-     * 数据来源 ID
+     * 数据来源id(1.智慧芽 2.合享 3.Patentics)
      */
     private String sourceId;
 

+ 9 - 5
PAS/src/main/java/cn/cslg/pas/common/utils/ExcelUtils.java

@@ -1,8 +1,5 @@
 package cn.cslg.pas.common.utils;
 
-import cn.cslg.pas.common.utils.DateUtils;
-import cn.cslg.pas.common.utils.FileUtils;
-import cn.cslg.pas.common.utils.SpringUtils;
 import cn.hutool.core.util.IdUtil;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
@@ -26,6 +23,7 @@ public class ExcelUtils {
         if (!filePath.endsWith(".xls") && !filePath.endsWith(".xlsx") && !filePath.endsWith(".XLS") && !filePath.endsWith(".XLSX")) {
             System.out.println("文件不是excel类型");
         }
+
         FileInputStream fis = null;
         Workbook wookbook = null;
         Sheet sheet = null;
@@ -51,6 +49,7 @@ public class ExcelUtils {
             }
         }
         Map<String, PictureData> maplist = null;
+        //拿到excel表格的第一个sheet工作簿
         sheet = wookbook.getSheetAt(0);
         // 判断用07还是03的方法获取图片
         if (filePath.endsWith(".xls") || filePath.endsWith(".XLS")) {
@@ -70,7 +69,7 @@ public class ExcelUtils {
      * @throws IOException
      */
     public static Map<String, PictureData> getPictures1(HSSFSheet sheet) throws IOException {
-        Map<String, PictureData> map = new HashMap<String, PictureData>();
+        Map<String, PictureData> map = new HashMap();
         if (sheet.getDrawingPatriarch() != null) {
             List<HSSFShape> list = sheet.getDrawingPatriarch().getChildren();
             for (HSSFShape shape : list) {
@@ -94,7 +93,7 @@ public class ExcelUtils {
      * @throws IOException
      */
     public static Map<String, PictureData> getPictures2(XSSFSheet sheet) throws IOException {
-        Map<String, PictureData> map = new HashMap<String, PictureData>();
+        Map<String, PictureData> map = new HashMap();
         List<POIXMLDocumentPart> list = sheet.getRelations();
         for (POIXMLDocumentPart part : list) {
             if (part instanceof XSSFDrawing) {
@@ -115,6 +114,11 @@ public class ExcelUtils {
         return map;
     }
 
+    /**
+     * @param pictureData 图片
+     * @return 返回图片的文件路径和文件名称
+     * @throws IOException 抛出IO异常
+     */
     public static Map<String, String> savePicture(PictureData pictureData) throws IOException {
         FileUtils fileUtils = SpringUtils.getBean(FileUtils.class);
         Map<String, String> result = new HashMap<>();

+ 5 - 5
PAS/src/main/java/cn/cslg/pas/common/utils/UploadPatentBatchUtil.java

@@ -32,14 +32,14 @@ public class UploadPatentBatchUtil {
      * @description 通过与前段传入参数中的数据源ID进行比对从而得到对应数据源的配置项目
      */
     public static List<UploadSettingVO.Column> parsingConfigurationFiles(ProjectImportPatentVO projectImportPatentVO, String getSettingJson) {
-        //将 Json 转换为 对象数组
-        List<UploadSettingVO> test = JsonUtils.jsonToList(getSettingJson, UploadSettingVO.class);
+        //将uploadSetting.json数据源配置文件的json字符串转换为UploadSettingVO对象(即实体类)集合
+        List<UploadSettingVO> uploadSettingVOs = JsonUtils.jsonToList(getSettingJson, UploadSettingVO.class);
         //创建一个存放单一数据源的对象 这个对象存放的是 我们需要使用哪一个数据源的配置数据 所以只存一个 正常在Json文件里面会有多个数据源 也就是多条数据
         List<UploadSettingVO.Column> jsonData = new ArrayList<>();
-        //开始将前端传入的数据源参数与 Json 中解析出来的 sourceId(数据来源ID) 进行比对 并将比对中的那一条数据放入上方定义的 jsonData 中 用于后续使用
-        for (int i = 0; i < Objects.requireNonNull(test).size(); i++) {
+        //遍历uploadSettingVOs,
+        for (int i = 0; i < Objects.requireNonNull(uploadSettingVOs).size(); i++) {
             //提取一个常量
-            UploadSettingVO constant = Objects.requireNonNull(test).get(i);
+            UploadSettingVO constant = Objects.requireNonNull(uploadSettingVOs).get(i);
             //判断 如果说 Json 解析出来的 List<T> 中的 sourceId 和传入参数的 sourceId 匹配成功 则开始装配数据
             if (constant.getSourceId().equals(projectImportPatentVO.getSourceId())) {
                 //填充数据

+ 4 - 4
PAS/src/main/java/cn/cslg/pas/controller/EventController.java

@@ -30,10 +30,10 @@ import java.util.List;
 public class EventController {
     private final IEventService eventService;
 
-    @Operation(summary = "新增事件")
+    @Operation(summary = "新增专题库时批量新增新事件(无事件id)")
     @PostMapping("/addNew")
     public String addNew(@RequestBody List<EventAddNewDTO> eventAddNewDTOs) {
-        log.info("开始处理【新增事件】的请求,请求参数为:{}", eventAddNewDTOs);
+        log.info("开始处理【新增专题库时批量新增新事件(无事件id)】的请求,请求参数为:{}", eventAddNewDTOs);
         List<Integer> eventIds;
         try {
             eventIds = eventService.addNew(eventAddNewDTOs);
@@ -43,10 +43,10 @@ public class EventController {
         return Response.success(eventIds);
     }
 
-    @Operation(summary = "专题库中新增事件")
+    @Operation(summary = "新增事件")
     @PostMapping("/addNewEvent")
     public String addNewEvent(@RequestBody ProjectEventAddNewDTO projectEventAddNewDTO) {
-        log.info("开始处理【专题库中新增事件】的请求,请求参数为:{}", projectEventAddNewDTO);
+        log.info("开始处理【新增事件】的请求,请求参数为:{}", projectEventAddNewDTO);
         try {
             eventService.addNewEvent(projectEventAddNewDTO);
         } catch (XiaoShiException e) {

+ 1 - 4
PAS/src/main/java/cn/cslg/pas/controller/PermissionRecordController.java

@@ -70,7 +70,7 @@ public class PermissionRecordController {
 
     @Operation(summary = "根据专利号分页查询许可记录数据信息")
     @PostMapping("/query")
-    public String query(@RequestBody QueryPREntity queryPREntity){
+    public String query(@RequestBody QueryPREntity queryPREntity) {
         List<PermissionRecordVO> queryResult = permissionRecordService.findAllByPage(queryPREntity);
         PageHelperT pageHelperT = new PageHelperT();
         pageHelperT.setList(queryResult);
@@ -80,6 +80,3 @@ public class PermissionRecordController {
         return Response.success(pageHelperT);
     }
 }
-
-
-

+ 3 - 6
PAS/src/main/java/cn/cslg/pas/domain/Authority.java

@@ -11,7 +11,6 @@ import java.util.List;
 @Data
 @TableName("Authority")
 public class Authority extends BaseEntity<AdminUser> {
-
     /**
      * 内容
      */
@@ -23,7 +22,7 @@ public class Authority extends BaseEntity<AdminUser> {
     @TableField("contentOut")
     private String contentOut;
     /**
-     * 0代表主权要1代表次权要
+     * 0代表主权要 1代表次权要
      */
     @TableField("contentOut")
     private Integer type;
@@ -43,14 +42,12 @@ public class Authority extends BaseEntity<AdminUser> {
     @TableField("SID")
     private String SID;
     /**
-     *父id
+     * 父id
      */
     private List<Integer> fatherID;
     /**
-     *子id
+     * 子id
      */
     private List<Integer> sonID;
 
-
-
 }

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

@@ -274,7 +274,7 @@ public class Patent extends BaseEntity<Patent> {
     private String notPatentQuote;
 
     /**
-     * 摘要附图
+     * 摘要附图路径
      */
     private String abstractPath;
 

+ 3 - 2
PAS/src/main/java/cn/cslg/pas/domain/PatentAgent.java

@@ -16,12 +16,13 @@ import lombok.Data;
 @Data
 @TableName("os_patent_agent")
 public class PatentAgent extends BaseEntity<PatentAgent> {
-
     /**
      * 代理人
      */
     private String name;
-
+    /**
+     * 专利id
+     */
     @TableField(exist = false)
     private Integer patentId;
 }

+ 2 - 4
PAS/src/main/java/cn/cslg/pas/domain/PatentImage.java

@@ -16,9 +16,8 @@ import lombok.Data;
 @Data
 @TableName("os_patent_img")
 public class PatentImage extends BaseEntity<PatentImage> {
-
     /**
-     * 摘要附图 
+     * 摘要附图
      */
     private Integer status;
 
@@ -27,9 +26,8 @@ public class PatentImage extends BaseEntity<PatentImage> {
      */
     @TableField("address")
     private String url;
-
     /**
-     * 专利信息ID
+     * 专利ID
      */
     @TableField("pid")
     private Integer patentId;

+ 0 - 1
PAS/src/main/java/cn/cslg/pas/domain/PatentInstructionText.java

@@ -15,7 +15,6 @@ import lombok.Data;
 @Data
 @TableName(value ="os_patent_instruction_text")
 public class PatentInstructionText extends BaseEntity<PatentInstructionText> {
-
     /**
      * 专利ID
      */

+ 3 - 4
PAS/src/main/java/cn/cslg/pas/domain/PatentLicensor.java

@@ -15,22 +15,21 @@ import lombok.Data;
 @Data
 @TableName("os_patent_licensor")
 public class PatentLicensor extends BaseEntity<PatentLicensor> {
-
     /**
      * 被许可人
      */
     private String licensee;
-
     /**
      * 许可人
      */
     private String licensor;
-
     /**
      * 许可类型
      */
     private String type;
-
+    /**
+     * 专利id
+     */
     private Integer patentId;
 
 }

+ 4 - 1
PAS/src/main/java/cn/cslg/pas/domain/ProjectField.java

@@ -35,7 +35,7 @@ public class ProjectField extends BaseEntity<ProjectField> {
     private Integer type;
 
     /**
-     * 状态(正常、关闭)
+     * 状态(1正常、0关闭)
      */
     private Integer status;
 
@@ -88,6 +88,9 @@ public class ProjectField extends BaseEntity<ProjectField> {
     @TableField(exist = false)
     private String projectName;
 
+    /**
+     * 数据来源对象
+     */
     @Data
     public static class dataType {
         private String name;

+ 9 - 3
PAS/src/main/java/cn/cslg/pas/domain/SystemDict.java

@@ -15,11 +15,17 @@ import lombok.Data;
 @Data
 @TableName("os_system_dict")
 public class SystemDict extends BaseEntity<SystemDict> {
-
+    /**
+     * 名称
+     */
     private String label;
-
+    /**
+     * 数值
+     */
     private String value;
-
+    /**
+     * 类型
+     */
     private String type;
 
     public SystemDict() {

+ 2 - 4
PAS/src/main/java/cn/cslg/pas/domain/Task.java

@@ -59,11 +59,9 @@ public class Task extends BaseEntity<Task> {
     private Integer endTime;
 
     /**
-     * 0.队列中
-     * 1.进行中
-     * 2.成功
-     * 3.失败
+     * 0.队列中 1.进行中 2.成功 3.失败
      */
+    @TableField("status")
     private Integer status;
 
     /**

+ 3 - 2
PAS/src/main/java/cn/cslg/pas/mapper/PatentSimpleFamilyLinkMapper.java

@@ -18,7 +18,8 @@ import java.util.List;
 public interface PatentSimpleFamilyLinkMapper extends BaseMapper<PatentSimpleFamilyLink> {
 
 
- List<PatentSimpleFamilyLink> getPatentFamilyLinkByPatentNo(@Param("patentNos") List<String> patentNos,@Param("type")Integer type);
-   List<PatentSimpleFamily> getDirtyData(Integer type);
+    List<PatentSimpleFamilyLink> getPatentFamilyLinkByPatentNo(@Param("patentNos") List<String> patentNos, @Param("type") Integer type);
+
+    List<PatentSimpleFamily> getDirtyData(Integer type);
 
 }

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

@@ -18,7 +18,7 @@ import java.util.List;
  */
 public interface IEventService extends IService<Event> {
     /**
-     * 批量新增事件
+     * 新增专题库时批量新增事件(无事件id)
      *
      * @param eventAddNewDTOs 新增事件的DTO类对象集合
      * @return 返回事件eventIds
@@ -27,7 +27,7 @@ public interface IEventService extends IService<Event> {
     List<Integer> addNew(List<EventAddNewDTO> eventAddNewDTOs);
 
     /**
-     * 专题库中新增事件
+     * 新增事件
      *
      * @param projectEventAddNewDTO 专题库新增事件的DTO类对象集合
      */

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java

@@ -50,6 +50,7 @@ public interface IProductCategoryService {
 
     /**
      * 查询产品架构趋势图
+     *
      * @param dto
      * @autor lrj
      */

+ 9 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentAgencyService.java

@@ -37,15 +37,24 @@ public class PatentAgencyService extends ServiceImpl<PatentAgencyMapper, PatentA
     }
 
     public String getAgencyStringIdByName(String name) {
+        //根据代理机构名称查询os_patent_agency表
         LambdaQueryWrapper<PatentAgency> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentAgency::getName, name);
         PatentAgency temp = this.getOne(queryWrapper);
+        //若没有,则将该代理机构新增入库
         if (temp == null) {
             temp = this.add(name);
         }
+        //若有,则直接拿到代理机构id,并将id转成String类型返回
         return String.valueOf(temp.getId());
     }
 
+    /**
+     * 新增代理机构入表"os_patent_agency"
+     *
+     * @param name 代理机构名称
+     * @return 返回代理机构数据
+     */
     public PatentAgency add(String name) {
         PatentAgency agency = new PatentAgency();
         agency.setName(name);

+ 17 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentAgentLinkService.java

@@ -38,18 +38,35 @@ public class PatentAgentLinkService extends ServiceImpl<PatentAgentLinkMapper, P
         return this.list(queryWrapper);
     }
 
+    /**
+     * 更新代理人关联专利表“os_patent_agent_link”数据
+     *
+     * @param patentId 专利id
+     * @param ids      代理人ids
+     */
     public void updatePatentAgentLink(Integer patentId, List<Integer> ids) {
+        //根据专利id删除表中原数据
         this.deleteByPatentId(patentId);
+
+        //代理人关联专利表实体类集合装载数据
         List<PatentAgentLink> dataList = ids.stream().map(item -> {
             PatentAgentLink link = new PatentAgentLink();
             link.setAgentId(item);
             link.setPatentId(patentId);
             return link;
         }).collect(Collectors.toList());
+
+        //数据批量插入代理人关联专利表“os_patent_agent_link”
         this.saveOrUpdateBatch(dataList);
     }
 
+    /**
+     * 根据专利id删除代理人关联专利表“os_patent_agent_link”数据
+     *
+     * @param patentId 专利id
+     */
     public void deleteByPatentId(Integer patentId) {
         this.remove(Wrappers.<PatentAgentLink>lambdaQuery().eq(PatentAgentLink::getPatentId, patentId));
     }
+
 }

+ 19 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentAgentService.java

@@ -102,24 +102,43 @@ public class PatentAgentService extends ServiceImpl<PatentAgentMapper, PatentAge
         }
     }
 
+    /**
+     * 代理人数据入代理人表“os_patent_agent”,代理人ids和专利id入代理人与专利关联表“os_patent_agent_link”
+     *
+     * @param patentAgentParams 代理人相关参数
+     */
     public void updatePatentAgent(PatentAgentParams patentAgentParams) {
         if (patentAgentParams.getAgent() == null || patentAgentParams.getAgent().size() == 0) {
             return;
         }
+
+        //创建ids集合,用于存放代理人ids
         List<Integer> ids = new ArrayList<>();
+        //根据代理人名称集合查询代理人表“os_patent_agent”数据
         LambdaQueryWrapper<PatentAgent> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(PatentAgent::getName, patentAgentParams.getAgent());
         List<PatentAgent> tempList = this.list(queryWrapper);
+        //遍历代理人名称集合
         patentAgentParams.getAgent().forEach(name -> {
+            //将从表中查询出来的代理人集合进行过滤,过滤出与当前遍历的代理人相同的数据
             PatentAgent agent = tempList.stream().filter(item -> item.getName().equals(name)).findFirst().orElse(null);
+            //判断若数据为null,则表示表中没有当前遍历的代理人,则新增该代理人入表“os_patent_agent”
             if (agent == null) {
                 agent = this.add(name);
             }
             ids.add(agent.getId());
         });
+
+        //更新代理人关联专利表“os_patent_agent_link”数据
         patentAgentLinkService.updatePatentAgentLink(patentAgentParams.getPatentId(), ids);
     }
 
+    /**
+     * 新增代理人入专利信息代理人表“os_patent_agent”
+     *
+     * @param name 代理人名称
+     * @return 返回代理人数据
+     */
     public PatentAgent add(String name) {
         PatentAgent agent = new PatentAgent();
         agent.setName(name);

+ 11 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantLinkService.java

@@ -42,13 +42,24 @@ public class PatentApplicantLinkService extends ServiceImpl<PatentApplicantLinkM
         return this.list(queryWrapper);
     }
 
+    /**
+     * 更新申请人表"os_patent_applicant"和申请人属性关联表"os_applicant_attr"数据
+     *
+     * @param name 申请人/权利人
+     * @param shortName 标准申请人/标准权利人
+     * @param type 类型(1权利人 2申请人)
+     * @param patentId 专利id
+     * @param patentApplicantList 申请人/权利人/标准申请人/标准权利人集合
+     */
     public void updatePatentApplicantLink(List<String> name, List<String> shortName, Integer type, Integer patentId, List<PatentApplicant> patentApplicantList) {
         if (shortName == null) {
             shortName = new ArrayList<>();
         }
         List<Integer> applicableIds = patentApplicantService.updatePatentApplicant(name, shortName, patentApplicantList);
         if (applicableIds.size() != 0) {
+            //先根据专利id删除申请人属性表”os_applicant_attr“原数据
             this.remove(Wrappers.<PatentApplicantLink>lambdaQuery().eq(PatentApplicantLink::getPatentId, patentId).eq(PatentApplicantLink::getType, type));
+            //遍历新增数据入申请人属性表”os_applicant_attr“原数据
             for (int i = 0; i < applicableIds.size(); i++) {
                 PatentApplicantLink patentApplicantLink = new PatentApplicantLink();
                 patentApplicantLink.setApplicantId(applicableIds.get(i));

+ 15 - 10
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java

@@ -67,6 +67,7 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
         List<PatentApplicant> patentApplicantList = this.getPatentApplicantByIds(applicantIds);
         return this.setPatentApplicantDataList(patentApplicantLinkList, patentApplicantList);
     }
+
     private List<PatentApplicant> setPatentApplicantDataList(List<PatentApplicantLink> patentApplicantLinkList, List<PatentApplicant> patentApplicantList) {
         List<PatentApplicant> dataList = new ArrayList<>();
         patentApplicantLinkList.forEach(attribute -> {
@@ -90,6 +91,7 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
         });
         return dataList;
     }
+
     public IPage<PatentApplicant> getPageList(PatentApplicantVO params) {
         IPage<PatentApplicant> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
         List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList("COUNTRIES"));
@@ -232,38 +234,41 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
      * @param name      权利人 通过分割符 | 分割后的List
      * @param shortName 【标】权利人 通过分割符 | 分割后的List
      */
-    public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName,List<PatentApplicant> patentApplicantList) {
+    public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName, List<PatentApplicant> patentApplicantList) {
         //生成一个存放ID的List
         List<Integer> ids = new ArrayList<>();
         //判断当前名称是否为空
         if (name != null) {
             for (int i = 0; i < name.size(); i++) {
-                String s = i < shortName.size() ? shortName.get(i) :"";
+                String s = i < shortName.size() ? shortName.get(i) : "";
                 s = s.replace((char) 12288, ' ');    // 将中文空格替换为英文空格
-                 s= s.trim();
+                s = s.trim();
                 String nam = name.get(i);
-            PatentApplicant temp = patentApplicantList.stream().filter(item->item.getMerge().equals(false)&&item.getName().equals(nam)).findFirst().orElse(null);
+                PatentApplicant temp = patentApplicantList.stream().filter(item -> item.getMerge().equals(false) && item.getName().equals(nam)).findFirst().orElse(null);
                 if (temp == null) {
                     temp = this.add(name.get(i), s);
-                } else if (name.size()==1) {
+                } else if (name.size() == 1) {
                     temp.setShortName(s);
                     temp.updateById();
                 }
-                if(!ids.contains(temp.getId()))
-                { ids.add(temp.getId());}
+                if (!ids.contains(temp.getId())) {
+                    ids.add(temp.getId());
+                }
 
             }
         } else {
             for (String s : shortName) {
-                List<PatentApplicant>   temp = patentApplicantList.stream().filter(item->item.getMerge().equals(0)&&item.getName().equals(s)).collect(Collectors.toList());
+                List<PatentApplicant> temp = patentApplicantList.stream().filter(item -> item.getMerge().equals(0) && item.getName().equals(s)).collect(Collectors.toList());
                 PatentApplicant patentApplicant = new PatentApplicant();
                 if (temp.size() == 0) {
                     patentApplicant = this.add(s, s);
                 } else {
-                        patentApplicant = temp.get(0);
+                    patentApplicant = temp.get(0);
                 }
 
-                 if(!ids.contains(patentApplicant.getId())){ids.add(patentApplicant.getId());}
+                if (!ids.contains(patentApplicant.getId())) {
+                    ids.add(patentApplicant.getId());
+                }
             }
         }
 

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

@@ -61,18 +61,26 @@ public class PatentImageService extends ServiceImpl<PatentImageMapper, PatentIma
         return this.getOne(queryWrapper);
     }
 
+    /**
+     * 新增专利摘要附图方法
+     *
+     * @param patentId    专利id
+     * @param pictureData 摘要附图
+     * @return 返回摘要附图路径
+     * @throws IOException 抛出IO异常
+     */
     public String updatePatentImage(Integer patentId, PictureData pictureData) throws IOException {
-        //先删除该专利号下的对应摘要图片 以免上传重复
+        //专利附图表"os_patent_img"根据专利id删除该专利的摘要图片数据,以免上传重复
         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();
     }

+ 16 - 4
PAS/src/main/java/cn/cslg/pas/service/PatentInstructionTextService.java

@@ -14,16 +14,22 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
-* @author Administrator
-* @description 针对表【os_patent_instruction_text(专利说明书(文本))】的数据库操作Service
-* @createDate 2022-04-16 08:38:10
-*/
+ * @author Administrator
+ * @description 针对表【os_patent_instruction_text(专利说明书(文本))】的数据库操作Service
+ * @createDate 2022-04-16 08:38:10
+ */
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class PatentInstructionTextService extends ServiceImpl<PatentInstructionTextMapper, PatentInstructionText> {
 
     private final PatentService patentService;
 
+    /**
+     * 根据专利id查询说明书表“os_patent_instruction_text”数据
+     *
+     * @param patentId 专利id
+     * @return 返回说明书数据
+     */
     public PatentInstructionText getPatentInstructionTextByPatentId(Integer patentId) {
         LambdaQueryWrapper<PatentInstructionText> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentInstructionText::getPatentId, patentId);
@@ -54,13 +60,19 @@ public class PatentInstructionTextService extends ServiceImpl<PatentInstructionT
     }
 
     public void updatePatentInstructionText(PatentInstructionTextParams params) {
+        //根据专利id查询说明书文本表“os_patent_instruction_text”数据
         PatentInstructionText patentInstructionText = this.getPatentInstructionTextByPatentId(params.getPatentId());
+        //若不存在则new说明书表实体类
         if (patentInstructionText == null) {
             patentInstructionText = new PatentInstructionText();
         }
+        //装载专利id
         patentInstructionText.setPatentId(params.getPatentId());
+        //装载说明书
         patentInstructionText.setManual(params.getManual());
+        //装载说明书(译)
         patentInstructionText.setManualOut(params.getManualOut());
+        //新增或更新表数据
         patentInstructionText.insertOrUpdate();
     }
 }

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

@@ -41,7 +41,9 @@ public class PatentInventorLinkService extends ServiceImpl<PatentInventorLinkMap
     }
 
     public void updatePatentInventLink(List<Integer> inventorIds, Integer patentId, Integer firstId) {
+        //先根据专利id删除专利与发明人关联表"os_patent_inventor_relation"原数据
         this.deleteByPatentId(patentId);
+        //创建专利与发明人关联表"os_patent_inventor_relation"实体类对象集合,准备批量插入数据
         List<PatentInventorLink> dataList = inventorIds.stream().map(id -> {
             PatentInventorLink patentInventorLink = new PatentInventorLink();
             patentInventorLink.setPatentId(patentId);
@@ -50,6 +52,7 @@ public class PatentInventorLinkService extends ServiceImpl<PatentInventorLinkMap
             return patentInventorLink;
         }).collect(Collectors.toList());
         if (dataList.size() != 0) {
+            //专利与发明人关联数据插入专利与发明人关联表"os_patent_inventor_relation"
             this.saveOrUpdateBatch(dataList);
         }
     }

+ 6 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentInventorService.java

@@ -191,9 +191,13 @@ public class PatentInventorService extends ServiceImpl<PatentInventorMapper, Pat
 
     public void updatePatentInventor(PatentInventorParams params) {
         if (params.getNameList() != null && params.getNameList().size() != 0) {
+            //创建发明人表"os_patent_inventor"实体类集合,准备批量插入数据
             List<PatentInventor> dataList = new ArrayList<>();
+            //遍历发明人名称
             for (int i = 0; i < params.getNameList().size(); i++) {
+                //根据名称查询发明人表"os_patent_inventor"数据
                 PatentInventor patentInventor = this.getPatentInventorByName(params.getNameList().get(i));
+                //判断若没有该发明人,则发明人实体类装载数据新增发明人(若已有,则更新已有数据)
                 if (patentInventor == null) {
                     patentInventor = new PatentInventor();
                 }
@@ -212,8 +216,10 @@ public class PatentInventorService extends ServiceImpl<PatentInventorMapper, Pat
                 }
                 dataList.add(patentInventor);
             }
+            //批量插入或更新专利发明人表"os_patent_inventor"数据
             this.saveOrUpdateBatch(dataList);
             PatentInventor first = dataList.stream().filter(item -> item.getName().equals(params.getFirstName())).findFirst().orElse(null);
+            //准备将专利与发明人关联数据插入专利与发明人关联表"os_patent_inventor_relation"
             patentInventorLinkService.updatePatentInventLink(dataList.stream().map(PatentInventor::getId).collect(Collectors.toList()), params.getPatentId(), first == null ? 0 : first.getId());
         }
     }

+ 16 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentLicensorService.java

@@ -45,13 +45,23 @@ public class PatentLicensorService extends ServiceImpl<PatentLicensorMapper, Pat
         this.saveOrUpdateBatch(patentLicensorList);
     }
 
+    /**
+     * 插入或更新专利信息许可人表“os_patent_licensor”数据
+     *
+     * @param patentLicensorParams 许可人相关信息
+     */
     public void updatePatentLicensor(PatentLicensorParams patentLicensorParams) {
         if (patentLicensorParams.getLicensor() == null || patentLicensorParams.getLicensee() == null || patentLicensorParams.getType() == null) {
             return;
         }
+
+        //判断若许可人、被许可人、许可类型三者数量相同则开始进行保存操作
         if (patentLicensorParams.getLicensor().size() == patentLicensorParams.getLicensee().size() && patentLicensorParams.getLicensee().size() == patentLicensorParams.getType().size() && patentLicensorParams.getType().size() != 0) {
+            //根据专利id删除专利信息许可人表“os_patent_licensor”原数据
             this.deletePatentLicensorByPatentId(patentLicensorParams.getPatentId());
+            //创建专利信息许可人表实体类集合,准备批量插入数据
             List<PatentLicensor> patentLicensorList = new ArrayList<>();
+            //遍历集合,创建实体类装载数据
             for (int i = 0; i < patentLicensorParams.getLicensor().size(); i++) {
                 PatentLicensor patentLicensor = new PatentLicensor();
                 patentLicensor.setType(patentLicensorParams.getType().get(i));
@@ -60,10 +70,16 @@ public class PatentLicensorService extends ServiceImpl<PatentLicensorMapper, Pat
                 patentLicensor.setPatentId(patentLicensorParams.getPatentId());
                 patentLicensorList.add(patentLicensor);
             }
+            //批量插入或更新数据
             this.saveOrUpdateBatch(patentLicensorList);
         }
     }
 
+    /**
+     * 根据专利id删除专利信息许可人表“os_patent_licensor”数据
+     *
+     * @param patentId 专利id
+     */
     public void deletePatentLicensorByPatentId(Integer patentId) {
         this.remove(Wrappers.<PatentLicensor>lambdaQuery().eq(PatentLicensor::getPatentId, patentId));
     }

+ 16 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentPledgeService.java

@@ -45,13 +45,23 @@ public class PatentPledgeService extends ServiceImpl<PatentPledgeMapper, PatentP
         this.saveOrUpdateBatch(patentPledgeList);
     }
 
+    /**
+     * 新增或更新专利信息质押质权人表“os_patent_pledge”数据
+     *
+     * @param patentPledgeParams 质押质权人相关信息
+     */
     public void updatePatentPledge(PatentPledgeParams patentPledgeParams) {
         if (patentPledgeParams.getPledgee() == null || patentPledgeParams.getPledgor() == null) {
             return;
         }
+
+        //判断若有质押人与质权人并且两方数量相同
         if (patentPledgeParams.getPledgee().size() == patentPledgeParams.getPledgor().size() && patentPledgeParams.getPledgor().size() != 0) {
+            //先根据专利id删除专利信息质押质权人表“os_patent_pledge”原数据
             this.deletePatentPledgeByPatentId(patentPledgeParams.getPatentId());
+            //创建专利信息质押质权人表实体类集合,准备批量插入数据
             List<PatentPledge> patentPledgeList = new ArrayList<>();
+            //遍历实体类集合装载数据
             for (int i = 0; i < patentPledgeParams.getPledgor().size(); i++) {
                 PatentPledge patentPledge = new PatentPledge();
                 patentPledge.setPledgee(patentPledgeParams.getPledgee().get(i));
@@ -59,10 +69,16 @@ public class PatentPledgeService extends ServiceImpl<PatentPledgeMapper, PatentP
                 patentPledge.setPatentId(patentPledgeParams.getPatentId());
                 patentPledgeList.add(patentPledge);
             }
+            //新增或更新专利信息质押质权人表“os_patent_pledge”数据
             this.saveOrUpdateBatch(patentPledgeList);
         }
     }
 
+    /**
+     * 根据专利id删除专利信息质押质权人表“os_patent_pledge”数据
+     *
+     * @param patentId 专利id
+     */
     public void deletePatentPledgeByPatentId(Integer patentId) {
         this.remove(Wrappers.<PatentPledge>lambdaQuery().eq(PatentPledge::getPatentId, patentId));
     }

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

@@ -431,16 +431,20 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
     }
 
     /**
-     * 格式化权要、拆分并理清父子级,insert/update DB
+     * 1.格式化权要 2.理出主次权要父子关系 3.权要表"os_patent_right"更新或新增权要
      *
-     * @param params 权利要求
+     * @param params 权利要求相关数据
      */
     public void updatePatentRight(PatentRightParams params) {
-        //调用拆分权要工具类格式化并拆分权要理清父子级
+        //调用拆分权要工具类
         List<PatentRight> patentRights = PatentRightUtils.formatPatentRight(params);
-        //删除库表中原有该权要
+
         if (patentRights.size() > 0) {
+            //TODO 先根据专利id查询库中原权要,与当前权要比对,若不同则更新,若相同则不更新
+
+            //删除库表中原有该权要
             this.deleteByPatentId(params.getPatentId());
+            //权要数据入表"os_patent_right"
             this.saveOrUpdateBatch(patentRights);
         }
 

+ 11 - 6
PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java

@@ -73,6 +73,9 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
         this.updatePatentSimpleFamily(patentSimpleFamilyParams);
     }
 
+    /**
+     * @param params 简单同族相关信息
+     */
     public void updatePatentSimpleFamily(PatentSimpleFamilyParams params) {
         if (params.getSimpleFamily() != null && params.getSimpleFamily().size() != 0) {
             this.updateData(params.getSimpleFamily(), params.getPatentNo(), params.getPatentId(), 1);
@@ -85,6 +88,13 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
         }
     }
 
+    /**
+     * 专利信息简单同族关联表"os_patent_simplefamily"新增数据
+     *
+     * @param type     1是简单同族 2.INPADOC同族
+     * @param patentNO 公开号
+     * @return 返回新增后的数据
+     */
     public PatentSimpleFamily add(Integer type, String patentNO) {
         PatentSimpleFamily patentSimpleFamily = new PatentSimpleFamily();
         patentSimpleFamily.setType(type);
@@ -101,7 +111,7 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
         //1.根据专利号(faimlyNo + patentNo)从专利基础信息表中获取专利数据,以受理国家、申请日由小到大排序
         List<Patent> patent1s = patentService.getPublicDateAndPatentNoByPatentNo(familyNo);
 
-        //2.从1步取得的专利清单获取第一个CN专利号,为插入Family表中的专利号,如果没有CN专利,取第一个专利号
+        //2.从1步取得的专利清单获取第一个CN专利号,为插入Family表中的专利号,如果没有CN专利,取第一个专利号
         String temPatentNo = "";
         if (patent1s != null) {
             Patent patentTem = patent1s.stream().filter(item -> PatentUtils.getPatentCountry(item.getPatentNo()) == "CN").findFirst().orElse(null);
@@ -184,10 +194,5 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
         }
     }
 
-    public static void main(String[] args) {
-
-    }
-
-
 
 }

+ 22 - 2
PAS/src/main/java/cn/cslg/pas/service/ProjectFieldService.java

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,6 +34,7 @@ import java.util.stream.Collectors;
  * @author 王岩
  * @since 2021-12-16
  */
+@Slf4j
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ProjectFieldService extends ServiceImpl<ProjectFieldMapper, ProjectField> {
@@ -226,28 +228,43 @@ public class ProjectFieldService extends ServiceImpl<ProjectFieldMapper, Project
     }
 
     public Map<String, Object> getCustomField(Integer projectId) {
+        //创建map用于装载:1.自定义字段(标引/非树类型字段、分类/树类型字段)  2.文件夹  3.数据来源,和返回结果
         Map<String, Object> result = new HashMap<>();
+
+        //创建非树类型字段集合
         List<ProjectField> indexs = new ArrayList<>();
+        //创建树类型字段集合
         List<Object> classifys = new ArrayList<>();
+
+        //1、自定义字段(标引和分类):根据专题库projectId查询自定义字段表“os_patent_field”列表
         List<ProjectField> fieldList = this.getProjectFieldByProjectId(projectId);
+        //根据自定义字段ids(自定义字段列表fieldList过滤出ids集合)查询自定义字段多选关联表“os_patent_field_multiple”列表
         List<ProjectFieldOption> optionList = projectFieldOptionService.getFieldOptionList(fieldList.stream().map(ProjectField::getId).collect(Collectors.toList()));
+        //遍历自定义字段列表fieldList,给每个自定义字段装载选项 ↓
         fieldList.forEach(item -> {
+            //标引(非树类型字段) -> 装载当前自定义字段id对应的选项(遍历自定义字段多选关联表列表optionList,根据多选的自定义字段id与当前遍历的自定义字段id相同过滤出选项)
             if (item.getType() != 6) {
                 item.setOption(optionList.stream().filter(option -> option.getFieldId().equals(item.getId())).collect(Collectors.toList()));
                 indexs.add(item);
+                //分类(树类型字段) -> 装载当前自定义字段id对应的树(使用装载树方法)
             } else {
                 item.setOption(JsonUtils.jsonToList(JsonUtils.objectToJson(projectFieldTreeService.getProjectFieldTreeNodeByFieldId(item.getId())), ProjectFieldOption.class));
                 classifys.add(item);
             }
         });
+
+        //2、文件夹:根据专题库projectId查询文件夹主表“os_portfolio”列表
         List<ProjectFolder> folderList = projectFolderService.getProjectFolderOptionByProjectId(projectId);
         result.put("index", indexs);
         result.put("classify", classifys);
         result.put("folder", projectFolderService.getProjectFolderTreeNode(projectId, folderList));
 
-        //数据源名称
+        //3、数据来源(analysisJsonFile()方法 -> 拿到uploadSetting.json文件并按行读取文件字符流,返回整个文件字符串)
         String getSettingJson = fileUtils.analysisJsonFile();
+        //将文件字符串转换为数据来源对象UploadSettingVO集合
         List<UploadSettingVO> settingJsonList = JsonUtils.jsonToList(getSettingJson, UploadSettingVO.class);
+
+        //手动创建数据来源对象集合dataTypesLst,装载数据
         List<ProjectField.dataType> dataTypesLst = new ArrayList<>();
         Objects.requireNonNull(settingJsonList).forEach(item -> {
             ProjectField.dataType dataType = new ProjectField.dataType();
@@ -257,6 +274,7 @@ public class ProjectFieldService extends ServiceImpl<ProjectFieldMapper, Project
         });
         result.put("dataType", dataTypesLst);
 
+        //返回结果(包含1.自定义字段(标引/非树类型字段、分类/树类型字段)  2.文件夹  3.数据来源)
         return result;
     }
 
@@ -315,8 +333,9 @@ public class ProjectFieldService extends ServiceImpl<ProjectFieldMapper, Project
         }
         return projectField;
     }
+
     public IPage<ProjectField> getPageList(ProjectFieldVO params) throws IOException {
-        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         //分页查询列表
         params.setTenantId(personnelVO.getTenantId());
         IPage<ProjectField> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
@@ -342,6 +361,7 @@ public class ProjectFieldService extends ServiceImpl<ProjectFieldMapper, Project
 
         return pageList;
     }
+
     public ProjectField getByProjectIdAndNameAndType(String name, Integer type, Integer projectId) {
         LambdaQueryWrapper<ProjectField> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ProjectField::getName, name);

+ 11 - 0
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -646,14 +646,25 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     }
 
     public TaskParams getImportPatentTaskParams(MultipartFile file, Integer projectId) {
+        //将包含多件专利的Excel文件上传至本地,并返回文件对象fileDTO
         UploadFileDTO fileDTO = fileUtils.uploadFile(file);
+        //获得文件路径
         String path = fileUtils.getPath(fileDTO.getPath());
+
+        //创建集合rowList,准备装载Excel中所有行数据(元素个数=总行数,元素=行数据,第一个元素=表头行数据)
         List<List<Object>> rowList = new ArrayList<>();
+        //集合mapList,准备装载Excel中的全部专利的数据(每一个元素的key:表头(如"公开号")  value:表头对应的专利内容(如"CN204445352U"))
         List<Map<Object, Object>> mapList = new ArrayList<>();
+
+        //使用excel工具类解析读取文件(通过Sax方式按行读取),将内容装载到集合rowList(元素数量=总行数,元素=行数据,第一个元素=表头行数据)
         ExcelUtil.readBySax(path, -1, (sheetIndex, rowIndex, row) -> rowList.add(row));
+
+        //遍历rowList集合,将集合第一个元素(表头行内容)作为keys,其余元素(专利行内容)作为values,将键列表keys和值列表values转换为Map集合
         for (int i = 1; i < rowList.size(); i++) {
             mapList.add(IterUtil.toMap(rowList.get(0), rowList.get(i)));
         }
+
+        //新增任务(专利导入导出任务表)
         Integer taskId = taskService.add(fileDTO, projectId, null, rowList.size() - 1, 1, 0, file.getOriginalFilename());
         TaskParams taskParams = new TaskParams();
         taskParams.setTaskId(taskId);

+ 16 - 0
PAS/src/main/java/cn/cslg/pas/service/TaskService.java

@@ -57,23 +57,39 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     }
 
     public Integer add(UploadFileDTO fileDTO, Integer projectId, Integer productId, Integer total, Integer type, Integer fieldNum, String oldName) {
+        //创建任务表实体类,准备装载数据 ↓
         Task task = new Task();
+
+        //任务开始时间
         task.setStartTime(DateUtils.getDateTime());
+        //任务状态(0.队列中 1.进行中 2.成功 3.失败)
         task.setStatus(0);
         if (projectId != null) {
+            //专题库id
             task.setProjectId(projectId);
         }
         if (productId != null) {
+            //产品id
             task.setProductId(productId);
         }
+        //文件名称
         task.setFileName(fileDTO.getFileName());
+        //文件路径
         task.setUrl(fileDTO.getPath());
+        //文件的专利总数量
         task.setTotal(total);
+        //文件大小
         task.setFileSize(fileDTO.getFileSize());
+        //任务类型 (1.上传 2导出)
         task.setType(type);
+        //导入导出字段数量
         task.setFieldNum(fieldNum);
+        //创建人id
         task.setCreateBy(loginUtils.getId());
+        //文件原始名称
         task.setOldName(oldName);
+
+        //数据入任务表
         task.insert();
         return task.getId();
     }

+ 94 - 34
PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java

@@ -58,39 +58,43 @@ public class UploadPatentBatchService {
 
     @Async("singleThreadAsyncTaskExecutor")
     public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
+        //获得专利总数量
         Integer total = params.getRowList().size();
         try {
-            //先解析Json文件 获得配置文件的Json
+            //拿到存放在服务器的专利数据来源配置文件uploadSetting.json并按行读取文件字符流,返回整个文件字符
             String getSettingJson = fileUtils.analysisJsonFile();
-            //查找需求数据源的对应配置
+            //查找并装载本次导入的专利需要的数据源(如智慧芽)的对应配置(如前台传来的数据来源id是1,即“智慧芽”,那么jsonData装载的就是智慧芽的数据源配置)
             List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
 
+            //装载所有专利的摘要附图(key:专利行数  value:专利行数对应的专利的摘要附图图片数据)
             Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
-            //将数据进行装配并进行数据库操作
+            //遍历所有专利(专利总数量),将数据进行装配并进行数据库操作
             for (int i = 0; i < params.getRowList().size(); i++) {
                 //获取每一行的数据
                 Map<Object, Object> row = params.getRowList().get(i);
-                //基础数据装配
+                //专利基础数据装配(此步与数据源配置文件对象相关)
                 UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
-                //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
+                //专利基础数据入库(专利表"os_patent"):专利基础数据根据UploadParamsVO中patent对象装载的专利号patentNo查询专利表“os_patent”,如果存在就将表中专利的Id装载到patent的id属性上,如果不存在就先将该专利数据入表后再装载Id
                 getOneOrInsertOne(uploadParamsVO);
-                //专利信息需要特殊处理部分
-                //专利信息(摘要附图)数据装配
+
+                //摘要附图数据装配及入库(摘要附图表"os_patent_img")
                 PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
                 if (uploadParamsVO.getPatent() != null) {
                     if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
                         uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
                     }
                 }
-                //专利信息(代理机构)数据装配
+                //代理机构数据装配及入库(代理机构表"os_patent_agency")
                 if (uploadParamsVO.getPatent() != null) {
                     if (uploadParamsVO.getPatent().getAgencyId() != null) {
                         uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
                     }
 
                 }
+
                 //将装配对象中的数据保存到数据库
                 dataToDB(params, uploadParamsVO, projectImportPatentVO);
+
                 //通过WebSocket 在每一次循环结束后 向前端发送完成进度
                 WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
                         .setTaskId(params.getTaskId())
@@ -201,7 +205,7 @@ public class UploadPatentBatchService {
     @Transactional(rollbackFor = Exception.class)
     public void dataToDB(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
         try {
-            //专利信息 OS_PATENT
+            //保存法律状态(表"os_patent")
             if (uploadParamsVO.getPatent() != null) {
                 List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
                 Integer simpleStatus = Integer.parseInt(systemDictList.stream()
@@ -211,57 +215,73 @@ public class UploadPatentBatchService {
                 uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
                 uploadParamsVO.getPatent().updateById();
             }
-            //权利要求 OS_PATENT_RIGHT
+
+            //保存权利要求(表"os_patent_right")
             patentRightBusiness(uploadParamsVO);
 
-            //说明书(文本) OS_PATENT_INSTRUCTION_TEXT
+            //保存说明书(表"os_patent_instruction_text")
             if (uploadParamsVO.getPatentInstructionText() != null) {
                 patentInstructionTextBusiness(uploadParamsVO);
             }
-            //代理人 OS_PATENT_AGENT
+
+            //保存代理人(表"os_patent_agent"、表"os_patent_agent_link")
             if (uploadParamsVO.getPatentAgentList() != null) {
                 patentAgentBusiness(uploadParamsVO);
             }
-            //质押质权人 OS_PATENT_PLEDGE
+
+            //保存简单同族(表"")
+            patentSimplyFamilyBusiness(uploadParamsVO);
+
+            //保存质押质权人(表"os_patent_pledge")
             if (uploadParamsVO.getPatentPledgeList() != null) {
                 patentPledgeBusiness(uploadParamsVO);
             }
-            //许可人 OS_PATENT_LICENSOR
+
+            //保存许可人(表"os_patent_licensor")
             if (uploadParamsVO.getPatentLicensorList() != null) {
                 patentLicensorBusiness(uploadParamsVO);
             }
-            //简单同族 OS_PATENT_SIMPLEFAMILY
-            patentSimplyFamilyBusiness(uploadParamsVO);
-            //发明人 OS_PATENT_INVENTOR
+
+            //保存发明人(表"os_patent_inventor"、表"os_patent_inventor_relation")
             patentInventorBusiness(uploadParamsVO);
-            //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
+
+            //保存申请人(原始)/权利人(当前)(表"os_patent_applicant"、表"os_applicant_attr")
             patentApplicationBusiness(uploadParamsVO);
-            //申请人地址 OS_PATENT_APPLICATION
+
+            //保存申请人地址(表"")
             patentApplicationAddressBusiness(uploadParamsVO);
-            //专题库关联专利信息 OS_THEMATIC_PID
+
+            //保存专题库关联专利信息(表"os_thematic_pid")
             if (uploadParamsVO.getPatent() != null) {
                 patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO);
             }
-            //标引内容关联专利信息 OS_PATENT_FIELD_PATENT_LINK
+
+            //保存标引内容关联专利信息(表"os_patent_field_patent_link"、"os_patent_field_text")
             if (uploadParamsVO.getPatent() != null) {
                 patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
             }
-            //文件夹管理 OS_PORTFOLIO_LINK
+
+            //保存文件夹关联专利信息(表"os_portfolio_link")
             if (uploadParamsVO.getPatent() != null) {
                 patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
             }
-            //标签 OS_PATENT_LABEL
+
+            //保存标签(表"os_patent_label")
             if (uploadParamsVO.getPatentLabelList() != null) {
                 patentLabelBusiness(uploadParamsVO, projectImportPatentVO);
             }
-            //分类号关联 OS_PATENT_TYPENO
+
+            //保存分类号关联(表"os_patent_typeno")
             patentTypeNoBusiness(uploadParamsVO);
-            //事务信息 OS_PATENT_AFFAIR
+
+            //保存事务信息(表"os_patent_affair")
             patentAffairBusiness(uploadParamsVO);
-            //自定义字段
+
+            //保存自定义字段
             if (uploadParamsVO.getCustomerFieldList() != null) {
                 patentFieldBusiness(params, uploadParamsVO, projectImportPatentVO);
             }
+
         } catch (Exception e) {
             e.printStackTrace();
             if (uploadParamsVO.getPatent() != null) {
@@ -366,106 +386,146 @@ public class UploadPatentBatchService {
         }
     }
 
+    //权利要求
     private void patentRightBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentRightParams对象保存权要基本信息
         PatentRightParams patentRightParams = new PatentRightParams();
+        //装载专利id
         patentRightParams.setPatentId(uploadParamsVO.getPatent().getId());
+        //装载专利号
         patentRightParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
         if (uploadParamsVO.getPatentRight() != null) {
+            //装载权利要求原文
             patentRightParams.setContent(uploadParamsVO.getPatentRight().getContent());
+            //装载权利要求译文
             patentRightParams.setContentOut(uploadParamsVO.getPatentRight().getContentOut());
         }
         if (uploadParamsVO.getSelfContent() != null) {
+            //装载独立权要
             patentRightParams.setSelfContent(uploadParamsVO.getSelfContent());
         }
+        //开始保存权要入库(1.格式化权要 2.理出主次权要父子关系 3.权要入表"os_patent_right")
         patentRightService.updatePatentRight(patentRightParams);
+        //暂未使用
         patentRightService.importAuthority(patentRightParams);
     }
 
+    //说明书文本
     private void patentInstructionTextBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentInstructionTextParams对象装载说明书相关数据
         PatentInstructionTextParams patentInstructionTextParams = new PatentInstructionTextParams();
+        //装载专利id
         patentInstructionTextParams.setPatentId(uploadParamsVO.getPatent().getId());
+        //装载说明书
         patentInstructionTextParams.setManual(uploadParamsVO.getPatentInstructionText().getManual());
+        //装载说明书(译)
         patentInstructionTextParams.setManualOut(uploadParamsVO.getPatentInstructionText().getManualOut());
 
+        //开始保存说明书入表“os_patent_instruction_text”
         patentInstructionTextService.updatePatentInstructionText(patentInstructionTextParams);
     }
 
     //代理人
     private void patentAgentBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentAgentParams对象装载代理人相关数据
         PatentAgentParams patentAgentParams = new PatentAgentParams();
+        //装载专利id
         patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
         List<String> agentList = uploadParamsVO.getPatentAgentList().stream().map(PatentAgent::getName).collect(Collectors.toList());
+        //装载代理人集合
         patentAgentParams.setAgent(agentList);
+        //开始保存代理人信息入表“os_patent_agent”
         patentAgentService.updatePatentAgent(patentAgentParams);
     }
 
-    //质押质权人 OS_PATENT_PLEDGE
+    //质押质权人
     private void patentPledgeBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentPledgeParams对象装载质押质权人相关数据
         PatentPledgeParams patentPledgeParams = new PatentPledgeParams();
+        //装载专利id
         patentPledgeParams.setPatentId(uploadParamsVO.getPatent().getId());
         List<String> pledgeeList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgee).collect(Collectors.toList());
         List<String> pledgorList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgor).collect(Collectors.toList());
+        //装载质权人集合
         patentPledgeParams.setPledgee(pledgeeList);
+        //装载质押人集合
         patentPledgeParams.setPledgor(pledgorList);
-
+        //开始保存质押质权人信息入表“os_patent_pledge”
         patentPledgeService.updatePatentPledge(patentPledgeParams);
     }
 
 
-    //许可人 OS_PATENT_LICENSOR
+    //许可人
     private void patentLicensorBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentLicensorParams对象装载许可人相关数据
         PatentLicensorParams patentLicensorParams = new PatentLicensorParams();
+        //装载专利id
         patentLicensorParams.setPatentId(uploadParamsVO.getPatent().getId());
         List<String> licensorList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensor).collect(Collectors.toList());
         List<String> licenseeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensee).collect(Collectors.toList());
         List<String> typeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getType).collect(Collectors.toList());
+        //装载许可人
         patentLicensorParams.setLicensor(licensorList);
+        //装载被许可人
         patentLicensorParams.setLicensee(licenseeList);
+        //装载许可类型
         patentLicensorParams.setType(typeList);
-
+        //开始保存许可人相关信息入专利信息许可人表“os_patent_licensor”
         patentLicensorService.updatePatentLicensor(patentLicensorParams);
     }
 
 
     //简单同族
     private void patentSimplyFamilyBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentSimpleFamilyParams对象装载简单同族相关数据
         PatentSimpleFamilyParams patentSimpleFamilyParams = new PatentSimpleFamilyParams();
         if (uploadParamsVO.getSimpleFamily() != null) {
+            //装载简单同族
             patentSimpleFamilyParams.setSimpleFamily(uploadParamsVO.getSimpleFamily());
         }
         if (uploadParamsVO.getPatSnapFamily() != null) {
+            //装载
             patentSimpleFamilyParams.setPatSnapFamily(uploadParamsVO.getPatSnapFamily());
         }
         if (uploadParamsVO.getInpadocFamily() != null) {
+            //装载
             patentSimpleFamilyParams.setInpadocFamily(uploadParamsVO.getInpadocFamily());
         }
+        //装载专利id
         patentSimpleFamilyParams.setPatentId(uploadParamsVO.getPatent().getId());
+        //装载专利号
         patentSimpleFamilyParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
-
+        //开始
         patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
     }
 
-    //发明人 OS_PATENT_INVENTOR
+    //发明人
     private void patentInventorBusiness(UploadParamsVO uploadParamsVO) {
+        //创建PatentInventorParams对象装载发明人相关数据
         PatentInventorParams patentInventorParams = new PatentInventorParams();
         if (uploadParamsVO.getPatentInventorList() != null) {
             List<String> addressList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getAddress).filter(Objects::nonNull).collect(Collectors.toList());
+            //装载发明人地址集合
             patentInventorParams.setAddressList(addressList);
             List<String> nameList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getName).collect(Collectors.toList());
+            //装载发明人名称集合
             patentInventorParams.setNameList(nameList);
         }
         if (uploadParamsVO.getFirstName() != null) {
+            //装载第一发明人名称
             patentInventorParams.setFirstName(uploadParamsVO.getFirstName());
         }
         if (uploadParamsVO.getFirstAddress() != null) {
+            //装载第一发明人地址
             patentInventorParams.setFirstAddress(uploadParamsVO.getFirstAddress());
         }
+        //装载专利号
         patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
-
+        //开始装载发明人表实体类相关信息、专利与发明人关联表实体类集合相关信息,然后各自数据分别插入这两张表
         patentInventorService.updatePatentInventor(patentInventorParams);
     }
 
-    //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
+    //申请人(原始)/权利人(当前)
     private void patentApplicationBusiness(UploadParamsVO uploadParamsVO) {
         // 根据本条数据的名字查询所有的申请人信息
         List<String> name = new ArrayList<>();

+ 19 - 20
PAS/src/main/java/cn/cslg/pas/service/impl/EventServiceImpl.java

@@ -52,14 +52,14 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
     private final LoginUtils loginUtils;
 
     /**
-     * 新增事件
+     * 新增专题库时批量新增事件中的新事件
      *
      * @param eventAddNewDTOs 新增事件的DTO类对象集合
      * @return 返回事件eventIds
      */
     @Override
     public List<Integer> addNew(List<EventAddNewDTO> eventAddNewDTOs) {
-        log.info("开始处理【批量新增事件】的业务,参数为:{}", eventAddNewDTOs);
+        log.info("开始处理【新增专题库时批量新增事件(无事件id)】的业务,参数为:{}", eventAddNewDTOs);
 
         //获取当前登陆人信息取出登陆人id、登陆人名称、租户id
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
@@ -92,6 +92,11 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
             List<Integer> applicationScenarios = eventAddNewDTO.getApplicationScenarios();
             //若有应用场景,则将应用场景集合转换成以逗号拼接的字符串,并赋值给实体类对应参数
             if (applicationScenarios != null && applicationScenarios.size() > 0) {
+                //StringBuilder builder = new StringBuilder();
+                //for (Integer applicationScenario : applicationScenarios) {
+                //    builder.append(applicationScenario).append(",");
+                //}
+                //String applicationScenario = builder.substring(0, builder.lastIndexOf(","));
                 String applicationScenario = applicationScenarios.stream().map(String::valueOf).collect(Collectors.joining(","));
                 event.setApplicationScenario(applicationScenario);
             }
@@ -110,13 +115,13 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
     }
 
     /**
-     * 专题库中新增事件
+     * 新增事件
      *
      * @param projectEventAddNewDTO 专题库新增事件的DTO类对象集合
      */
     @Override
     public void addNewEvent(ProjectEventAddNewDTO projectEventAddNewDTO) {
-        log.info("开始处理【专题库中新增事件】的业务,参数为:{}", projectEventAddNewDTO);
+        log.info("开始处理【新增事件】的业务,参数为:{}", projectEventAddNewDTO);
 
         //新增事件
         List<EventAddNewDTO> eventAddNewDTOs = projectEventAddNewDTO.getEventAddNewDTOs();
@@ -124,16 +129,17 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
         List<Integer> eventIds = new ArrayList<>();
         //过滤去除已有事件↓(根据是否有id来过滤,有id则为已有事件无需新增,只做关联)
         List<EventAddNewDTO> oldEventAddNewDTOs = eventAddNewDTOs.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
-        eventAddNewDTOs.removeAll(oldEventAddNewDTOs);
+        //遍历已有事件,将事件id添加进事件ids集合
+        for (EventAddNewDTO oldEventAddNewDTO : oldEventAddNewDTOs) {
+            eventIds.add(oldEventAddNewDTO.getId());
+        }
 
         //过滤后为新事件↓,新事件需要先新增事件,拿到事件ids后再和专题库做关联
+        eventAddNewDTOs.removeAll(oldEventAddNewDTOs);
         if (eventAddNewDTOs.size() > 0) {
             List<Integer> newEventIds = this.addNew(eventAddNewDTOs);
             eventIds.addAll(newEventIds);
         }
-        for (EventAddNewDTO oldEventAddNewDTO : oldEventAddNewDTOs) {
-            eventIds.add(oldEventAddNewDTO.getId());
-        }
         //新增事件和专题库关联
         assoEventProjectService.addNew(eventIds, projectId);
 
@@ -167,6 +173,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
         if (current != null && size != null) {
             PageHelper.startPage(current, size);
         }
+
+        //开始查询事件
         List<EventListItemVO> queryResults = eventMapper.queryList(eventQueryPageDTO);
         //将以逗号拼接的字符串应用场景applicationScenario转化为应用场景value集合
         for (EventListItemVO queryResult : queryResults) {
@@ -177,7 +185,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
                 for (String n : applicationScenarioArr) {
                     applicationScenarioValues.add(Integer.parseInt(n));
                 }
-                //List<Integer> applicationScenarioIds = Arrays.stream(applicationScenario.split(",")).map(Integer::parseInt).collect(Collectors.toList());
                 queryResult.setApplicationScenarios(applicationScenarioValues);
             }
         }
@@ -193,14 +200,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
 
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         Integer tenantId = personnelVO.getTenantId();
-        /*
-         * 原先学到的野方法直接在sql中装载好,只需以下几行代码返回给前台(但是杰哥说这样访问数据库效率降到最低,故舍弃)
-         *         List<ApplicationScenarioEventNumberVO> applicationScenarioEventNumberVOS = eventMapper.queryApplicationScenarioEventNumber(tenantId);
-         *         //遍历给事件数量属性赋上值 (事件数量=应用场景直接对应的事件数量+应用场景对应的专题库对应的事件数量(且该部分事件没有直接应用场景))
-         *         for (ApplicationScenarioEventNumberVO n : applicationScenarioEventNumberVOS) {
-         *             n.setEventNumber(n.getEventNumberFromEvent() + n.getEventNumberFromProject());
-         *         }
-         */
 
         //查询所有应用场景(目前为9个应用场景)
         List<ApplicationScenario> applicationScenarios = eventMapper.queryApplicationScenarios();
@@ -208,7 +207,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
         //查询所有事件(分为两类:1.有应用场景的事件;2.没有应用场景的事件(该部分事件使用它们所属的专题库的应用场景))
         List<EventListItemVO> eventsDirectApplicationScenario = eventMapper.queryEventsDirectApplicationScenario(tenantId);
         List<EventListItemVO> eventsInDirectApplicationScenario = eventMapper.queryEventsInDirectApplicationScenario(tenantId);
-        //装载上述两类事件的应用场景
+        //装载上述两类事件的应用场景
         ArrayList<String> applicationScenarioStrs = new ArrayList<>();
         if (eventsDirectApplicationScenario != null) {
             for (EventListItemVO n : eventsDirectApplicationScenario) {
@@ -221,7 +220,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
             }
         }
 
-        //开始装载9大应用场景分别对应的事件数量
+        //开始装载9大应用场景(应用场景value、应用场景名称、事件数量)↓
         ArrayList<ApplicationScenarioEventNumberVO> results = new ArrayList<>();
         //遍历所有9大应用场景
         for (ApplicationScenario applicationScenario : applicationScenarios) {
@@ -362,7 +361,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
     }
 
     /**
-     * 根据id删除事件
+     * 根据专题库id删除关联的事件
      *
      * @param eventId   事件id
      * @param projectId 专题库id

+ 5 - 4
PAS/src/main/java/cn/cslg/pas/service/impl/PermissionRecordServiceImpl.java

@@ -43,6 +43,7 @@ public class PermissionRecordServiceImpl implements IPermissionRecordService {
     @Override
     public void add(PermissionRecordDTO permissionRecordDTO) {
         log.info("开始处理【新增许可记录】的业务,参数为:{}", permissionRecordDTO);
+
         //DTO赋值给许可记录表实体类
         PermissionRecord permissionRecord = new PermissionRecord();
         BeanUtils.copyProperties(permissionRecordDTO, permissionRecord);
@@ -75,14 +76,14 @@ public class PermissionRecordServiceImpl implements IPermissionRecordService {
         PermissionRecord permissionRecord = new PermissionRecord();
         BeanUtils.copyProperties(permissionRecordUpdateDTO, permissionRecord);
 
-        //根据id修改产品表数据
+        //根据id修改许可记录表数据
         log.info("修改许可记录表数据");
         int rows = permissionRecordMapper.update(permissionRecord);
         if (rows != 1) {
             String message = "修改许可记录失败,服务器忙请稍后再试";
             log.info("修改许可记录表数据失败,{}", message);
         }
-        log.info("产品修改完成");
+        log.info("许可记录修改完成");
     }
 
     /**
@@ -111,10 +112,10 @@ public class PermissionRecordServiceImpl implements IPermissionRecordService {
     }
 
     @Override
-    public Integer countByPatentNo(String patentNo){
+    public Integer countByPatentNo(String patentNo) {
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         Integer tenantId = personnelVO.getTenantId();
-        return  permissionRecordMapper.countByPatentNo(patentNo,tenantId);
+        return permissionRecordMapper.countByPatentNo(patentNo, tenantId);
     }
 
 

+ 17 - 22
PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java

@@ -119,9 +119,11 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
     public JsonPage query(ProductCategoryQueryPageDTO productCategoryQueryPageDTO) {
         log.info("开始处理【分页查询产品类别】的业务,参数为:{}", productCategoryQueryPageDTO);
 
+        //获取登陆人信息(取出租户id,控制查询权限)
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         productCategoryQueryPageDTO.setTenantId(personnelVO.getTenantId());
 
+        //分页查询
         Integer current = productCategoryQueryPageDTO.getCurrent();
         Integer size = productCategoryQueryPageDTO.getSize();
         if (current != null && size != null) {
@@ -141,6 +143,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
     public void update(ProductCategoryUpdateDTO productCategoryUpdateDTO, List<MultipartFile> files) {
         log.info("开始处理【修改产品类别】的业务,参数为:{}, {}", productCategoryUpdateDTO, files);
 
+        //获取登陆人信息(取出租户id,控制权限)
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         Integer tenantId = personnelVO.getTenantId();
 
@@ -150,18 +153,14 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         log.info("检查尝试修改的数据是否存在");
         int count = productCategoryMapper.countById(productCategoryId);
         if (count == 0) {
-            String message = "修改产品类别失败,尝试访问的数据已不存在";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
+            ThrowException.throwXiaoShiException("修改产品类别失败,尝试访问的数据已不存在");
         }
 
         //检查尝试修改的产品类别名称是否被占用
         log.info("检查尝试修改的产品类别名称是否被占用");
         count = productCategoryMapper.countByIdAndName(productCategoryId, productCategoryName, tenantId);
         if (count > 0) {
-            String message = "修改产品类别失败,类别名称【" + productCategoryName + "】已存在,请尝试更换名称";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
+            ThrowException.throwXiaoShiException("修改产品类别失败,类别名称【" + productCategoryName + "】已存在,请尝试更换名称");
         }
 
         //产品类别DTO对象赋值给实体类
@@ -171,9 +170,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         log.info("修改产品类别");
         int rows = productCategoryMapper.updateById(productCategory);
         if (rows != 1) {
-            String message = "修改产品类别失败,服务器忙请稍后再次尝试!";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
+            ThrowException.throwXiaoShiException("修改产品类别失败,服务器忙请稍后再次尝试!");
         }
 
         //先通过产品类别id查询出所有原来的图片文件id
@@ -190,14 +187,16 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             Integer newOldPictureId = productCategoryPictureUpateDTO.getId();
             newOldPictureIds.add(newOldPictureId);
         }
-        //图片id集合去重,保留下来的即被删除的图片id
+        //集合去重
         oldPictureIds.removeAll(newOldPictureIds);
 
+        //判断若去重后的集合(即被前台删除的图片文件)仍有长度,则根据该图片id集合删除产品类别与图片关联表数据
         if (oldPictureIds.size() > 0) {
             log.info("产品类别图片关联表删除被删除的图片");
             assoProductCategoryPictureMapper.deleteByIds(oldPictureIds);
         }
 
+        //判断若有上传新的图片文件,则上传图片并入库
         if (files != null && files.size() != 0) {
             ArrayList<AssoProductCategoryPicture> assoProductCategoryPictures = new ArrayList<>();
             for (MultipartFile file : files) {
@@ -236,9 +235,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             log.info("产品类别图片关联表删除数据");
             int rows = assoProductCategoryPictureMapper.deleteByProductCategoryId(id);
             if (rows != count) {
-                String message = "删除产品类别失败,产品类别图片关联表删除数据失败,服务器忙请稍后再试!";
-                log.info("{}", message);
-                throw new XiaoShiException(message);
+                ThrowException.throwXiaoShiException("删除产品类别失败,产品类别图片关联表删除数据失败,服务器忙请稍后再试!");
             }
         }
 
@@ -246,9 +243,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         log.info("删除产品类别");
         int rows = productCategoryMapper.deleteById(id);
         if (rows != 1) {
-            String message = "删除产品类别失败,服务器忙请稍后再试!";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
+            ThrowException.throwXiaoShiException("删除产品类别失败,服务器忙请稍后再试!");
         }
 
         log.info("删除产品类别完成");
@@ -258,20 +253,20 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
     //返回总的营销数据以及每个的营销数据
     @Override
     public List<ProductCategoryTrendVO> showTrend(ProductCategoryDTO dto) {
-        //判断架构id是否有内容,没有的话直接返回null
+        //判断产品类别id是否有内容,没有的话直接返回null
         if (dto.getCategoryId() == null || dto.getCategoryId() == 0) {
             return null;
         }
-        //存储各个产品信息和营销数据
+        //存储每个产品类别信息和营销数据
         List<ProductCategoryTrendVO> trendVOS = new ArrayList<>();
-        //存储所有产品营销数据
+        //存储所有产品类别营销数据
         List<ProductMarketDataTrendVO> saleVOS = new ArrayList<>();
         //存储所有
         ProductCategoryTrendVO totalTrendVO = new ProductCategoryTrendVO();
         //返回总的营销数据 将id设为0
         totalTrendVO.setProductId(0);
         totalTrendVO.setProductName("总产品");
-        //查询架构id返回的总体营销数据
+        //查询产品类别id返回的总体营销数据
         List<ProductMarketDataTrendVO> totalSaleVOS = new ArrayList<>();
         if (dto.getTimeUnit() == 2) {//按照年份返回营销数据
             totalSaleVOS = productCategoryMapper.categoryQueryByYear(dto.getCategoryId(), dto.getCategoryArea(), dto.getCompanyName());
@@ -286,7 +281,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         //根据传入的类别id、公司名称以及营销地区查询产品id
         List<ProductIdAndNameVO> idNameVOS = new ArrayList<>();
         idNameVOS = productCategoryMapper.queryProductIdAndNameByCategoryId(dto.getCategoryId(), dto.getCompanyName());
-        //返回根据架构id查询到的每个产品id的营销数据
+        //返回根据产品类别id查询到的每个产品id的营销数据
         //遍历
         for (ProductIdAndNameVO idNameVO : idNameVOS) {//遍历类取得id和名称
             ProductCategoryTrendVO trendVO = new ProductCategoryTrendVO();
@@ -321,7 +316,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
     public List<String> getCompanyList(Integer id) {
 
         List<String> areaList = new ArrayList<>();
-        //根据架构id获得产品
+        //根据产品类别id获得产品
         LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();
         productWrapper.eq(Product::getProductCategoryId, id);
         List<Product> products = productService.list(productWrapper);

+ 16 - 5
PAS/src/main/resources/mapper/PatentSimpleFamilyLinkMapper.xml

@@ -2,11 +2,22 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 
 <mapper namespace="cn.cslg.pas.mapper.PatentSimpleFamilyLinkMapper">
-    <select id="getPatentFamilyLinkByPatentNo"  resultType="cn.cslg.pas.domain.PatentSimpleFamilyLink">
-        select a.* from os_patent_simplefamily_link a left join os_patent_simplefamily b on a.family_id=b.id where b.type=#{type}
-        and a.patent_no in <foreach collection="patentNos" item="id" open="(" separator="," close=")"> #{id}</foreach>
+    <select id="getPatentFamilyLinkByPatentNo" resultType="cn.cslg.pas.domain.PatentSimpleFamilyLink">
+        select a.* from os_patent_simplefamily_link a
+        left join os_patent_simplefamily b on a.family_id=b.id
+        where
+        b.type = #{type}
+        and a.patent_no in
+        <foreach collection="patentNos" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
     </select>
-    <select id="getDirtyData"  resultType="cn.cslg.pas.domain.PatentSimpleFamily">
-        select *,count(*) as count from os_patent_simplefamily where type =#{type} group by patent_no having  count(*)>1 limit 10000
+    <select id="getDirtyData" resultType="cn.cslg.pas.domain.PatentSimpleFamily">
+        select *, count(*) as count
+        from os_patent_simplefamily
+        where type = #{type}
+        group by patent_no
+        having count(*) > 1
+        limit 10000
     </select>
 </mapper>