Sfoglia il codice sorgente

5.26 整理接口时添加注释与优化

chendayu 2 anni fa
parent
commit
e75104b77b

+ 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;
 }

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

@@ -34,7 +34,7 @@ public class TaskParams implements Serializable {
     private Integer projectId;
     private String selected;
     /**
-     * Excel中的全部专利的数据(每一个元素的key:表头(如"公开号")  value:表头对应的专利内容(如"CN204445352U"))
+     * Excel中的全部专利的数据(key:表头(如"公开号")  value:表头对应的专利内容(如"CN204445352U"))
      */
     private List<Map<Object, Object>> rowList;
     /**

+ 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;
 }

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

@@ -42,6 +42,15 @@ 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<>();

+ 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());
+                }
             }
         }
 

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

@@ -60,7 +60,7 @@ public class PatentInstructionTextService extends ServiceImpl<PatentInstructionT
     }
 
     public void updatePatentInstructionText(PatentInstructionTextParams params) {
-        //根据专利id查询说明书表“os_patent_instruction_text”数据
+        //根据专利id查询说明书文本表“os_patent_instruction_text”数据
         PatentInstructionText patentInstructionText = this.getPatentInstructionTextByPatentId(params.getPatentId());
         //若不存在则new说明书表实体类
         if (patentInstructionText == null) {
@@ -72,7 +72,7 @@ public class PatentInstructionTextService extends ServiceImpl<PatentInstructionT
         patentInstructionText.setManual(params.getManual());
         //装载说明书(译)
         patentInstructionText.setManualOut(params.getManualOut());
-        //数据入表“os_patent_instruction_text”
+        //新增或更新表数据
         patentInstructionText.insertOrUpdate();
     }
 }

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

@@ -646,20 +646,20 @@ 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中所有行数据(元素个数即行数,第一个元素即为表头行数据,第二个元素开始即为每个专利内容)
+        //创建集合rowList,准备装载Excel中所有行数据(元素数量=总行数,元素=行数据,第一个元素=表头行数据)
         List<List<Object>> rowList = new ArrayList<>();
         //集合mapList,准备装载Excel中的全部专利的数据(每一个元素的key:表头(如"公开号")  value:表头对应的专利内容(如"CN204445352U"))
         List<Map<Object, Object>> mapList = new ArrayList<>();
 
-        //使用excel工具类解析读取excel文件,装载数据到rowList
+        //使用excel工具类解析读取文件(通过Sax方式按行读取)将内容装载到集合rowList(元素数量=总行数,元素=行数据,第一个元素=表头行数据)
         ExcelUtil.readBySax(path, -1, (sheetIndex, rowIndex, row) -> rowList.add(row));
 
-        //集合mapList装载数据()
+        //遍历rowList集合,将集合第一个元素(表头行内容)作为keys,其余元素(专利行内容)作为values,将键列表keys和值列表values转换为Map集合
         for (int i = 1; i < rowList.size(); i++) {
             mapList.add(IterUtil.toMap(rowList.get(0), rowList.get(i)));
         }

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

@@ -61,9 +61,9 @@ public class UploadPatentBatchService {
         //获得专利总数量
         Integer total = params.getRowList().size();
         try {
-            //先解析Json文件,获得配置文件的Json串 (拿到存放在服务器的专利数据来源配置文件uploadSetting.json并按行读取文件字符流,返回整个文件字符串
+            //拿到存放在服务器的专利数据来源配置文件uploadSetting.json并按行读取文件字符流,返回整个文件字符串
             String getSettingJson = fileUtils.analysisJsonFile();
-            //装载数据源的对应配置(如前台传来的数据来源id是1,即“智慧芽”,那么jsonData装载的就是智慧芽的数据源配置)
+            //查找并装载本次请求需要的数据源(如智慧芽)的对应配置(如前台传来的数据来源id是1,即“智慧芽”,那么jsonData装载的就是智慧芽的数据源配置)
             List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
 
             //装载所有专利的摘要附图(key:下标即专利行数  value:摘要附图图片数据)
@@ -74,9 +74,9 @@ public class UploadPatentBatchService {
                 Map<Object, Object> row = params.getRowList().get(i);
                 //基础数据装配
                 UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
-                //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
+                //根据上一步uploadParamsVO对象中的专利号查询专利表“os_patent”,判断当前专利是否存在库中,如果存在就装载专利patentId到uploadParamsVO对象,如果不存在就新增该专利数据入库后再装载专利patentId到uploadParamsVO对象
                 getOneOrInsertOne(uploadParamsVO);
-                //专利信息需要特殊处理部分
+
                 //专利信息(摘要附图)数据装配
                 PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
                 if (uploadParamsVO.getPatent() != null) {