Browse Source

添加分配任务(带筛选) 2022/12/12

lwhhszx 2 years ago
parent
commit
b17cedb2f9

+ 0 - 2
RMS/src/main/java/cn/cslg/report/common/model/vo/PatentVO.java

@@ -77,7 +77,5 @@ public class PatentVO extends BaseVO {
 
     @Schema(description = "标题")
     private String patentName;
-    @Schema(description = "总数")
-    private Integer total;
 
 }

+ 1 - 1
RMS/src/main/java/cn/cslg/report/service/business/CompareFilesService.java

@@ -194,7 +194,7 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
         }
         //有查询条件时,自定义字段的专利号和任务的专利号取交集
         else {
-          patentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
+          patentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions(),AllpatentNos);
             List<String> jiaoList = new ArrayList<>(AllpatentNos);
             jiaoList.retainAll(patentNos);
             patentVO.setPatentNos(jiaoList);

+ 27 - 22
RMS/src/main/java/cn/cslg/report/service/business/ReportFieldService.java

@@ -297,7 +297,6 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
      * @return
      * @function 查询自定义字段,统计与之相关的专利的数量
      */
-
     public List<PatentQueryFieldSourceVO> getPatentQuerySourcePageList(PatentQueryFieldSourceVO params) {
         List<PatentQueryFieldSourceVO> list = new ArrayList<>();
         //根据fieldId 从patent_field中获得 自定义字段对象
@@ -387,10 +386,9 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
             allNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
 
         }
-
         //记录已被选择的数量
-        Integer choosed=0;
-        for (PatentQueryFieldSourceVO tem:list) {
+        Integer choosed = 0;
+        for (PatentQueryFieldSourceVO tem : list) {
             List<ReportFieldPatentLink> part = reportFieldPatentLinks.stream().filter(tm -> tm.getFieldId().equals(params.getFieldId()) && tm.getOptionId().equals(tem.getKey()
             )).collect(Collectors.toList());
             //如果是任务清单列表
@@ -402,7 +400,7 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
                 choosed += jiaoList.size();
             } else {
                 tem.setCount(part.size());
-                choosed+=part.size();
+                choosed += part.size();
             }
             tem.setType(type1);
         }
@@ -411,7 +409,8 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
         patentQueryFieldSourceVO.setFieldId(params.getFieldId());
         patentQueryFieldSourceVO.setKey(null);
         patentQueryFieldSourceVO.setLabel("未选择");
-        patentQueryFieldSourceVO.setCount(allNos.size()-choosed);
+        patentQueryFieldSourceVO.setCount(allNos.size() - choosed);
+        list.add(patentQueryFieldSourceVO);
         //获得所有未选择的数量
         //根据值id从ReportFieldPatentLink表中获得信息
         return list;
@@ -424,13 +423,21 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
      * @throws IOException
      * @funtion 查询标引内容关联专利
      */
-    public List<String> getString(SourceVO params) throws IOException {
+    public List<String> getString(SourceVO params,List<String> allPatentNos) throws IOException {
         List<String> list = new ArrayList<>();
+        List<ReportFieldPatentLink> reportFieldPatentLinks =new ArrayList<>();
         LambdaQueryWrapper<ReportFieldPatentLink> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-        lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId, params.getFieldId()).eq(ReportFieldPatentLink::getOptionId, params.getKey());
-        List<ReportFieldPatentLink> reportFieldPatentLinks = reportFieldPatentLinkService.list(lambdaQueryWrapper);
-        for (ReportFieldPatentLink reportFieldPatentLink : reportFieldPatentLinks) {
-            list.add(reportFieldPatentLink.getPatentNo());
+        lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId, params.getFieldId());
+        if (params.getKey() != null) {
+            lambdaQueryWrapper.eq(ReportFieldPatentLink::getOptionId, params.getKey());
+            reportFieldPatentLinks = reportFieldPatentLinkService.list(lambdaQueryWrapper);
+            list=    reportFieldPatentLinks.stream().map(ReportFieldPatentLink::getPatentNo).collect(Collectors.toList());
+        }
+       else {
+            reportFieldPatentLinks = reportFieldPatentLinkService.list(lambdaQueryWrapper);
+            List<String> patentNos =reportFieldPatentLinks.stream().map(ReportFieldPatentLink::getPatentNo).collect(Collectors.toList());
+             allPatentNos.removeAll(patentNos);
+            list=allPatentNos;
         }
 
         return list;
@@ -480,25 +487,25 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
      * @throws IOException
      */
 
-    public List<String> getPatentNo(List<SourceVO> params) throws IOException {
+    public List<String> getPatentNo(List<SourceVO> params,List<String> allPatentNos) throws IOException {
 
         if (params.size() == 0) {
             List<String> list = new ArrayList<>();
             return list;
         } else {
-            return this.getPatentNos(params);
+            return this.getPatentNos(params,allPatentNos);
         }
 
     }
 
-    public List<String> getPatentNos(List<SourceVO> params) throws IOException {
+    public List<String> getPatentNos(List<SourceVO> params,List<String> allPatentNos) throws IOException {
         if (params.size() == 1) {
-            return this.getString(params.get(0));
+            return this.getString(params.get(0),allPatentNos);
         }
-        return this.gather1(params);
+        return this.gather1(params,allPatentNos);
     }
 
-    public List<String> gather1(List<SourceVO> params) throws IOException {
+    public List<String> gather1(List<SourceVO> params,List<String> allPatentNos) throws IOException {
         //为了求并集
         List<List<String>> str = new ArrayList<>();
         //定义新集合保留老集合
@@ -510,32 +517,30 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
                 if (params.get(i).getFieldId().equals(list.get(j).getFieldId())) {
                     sourceVO.add(list.get(j));
                     list.remove(list.get(j));
-
                 }
             }
             if (sourceVO.size() != 0) {
                 map.put(i, sourceVO);
             }
-
         }
         if (map.size() != 0) {
             for (List<SourceVO> sourceVOS : map.values()) {
                 List<String> str1 = new ArrayList<>();
                 for (SourceVO sourceVO : sourceVOS) {
-                    List<String> string = this.getString(sourceVO);
+                    List<String> string = this.getString(sourceVO,allPatentNos);
                     str1.addAll(string);
                 }
                 str1.stream().distinct().collect(Collectors.toList());
                 str.add(str1);
             }
             for (SourceVO sourceVO : list) {
-                List<String> string = this.getString(sourceVO);
+                List<String> string = this.getString(sourceVO,allPatentNos);
                 str.add(string);
             }
 
         } else {
             for (SourceVO sourceVO : list) {
-                List<String> string = this.getString(sourceVO);
+                List<String> string = this.getString(sourceVO,allPatentNos);
                 str.add(string);
             }
         }

+ 2 - 2
RMS/src/main/java/cn/cslg/report/service/business/TaskService.java

@@ -270,7 +270,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         }
         //有查询条件时,自定义字段的专利号和任务的专利号取交集
         else {
-            List<String> temPatentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
+            List<String> temPatentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions(),AllpatentNos);
             List<String> jiaoList = new ArrayList<>(AllpatentNos);
             jiaoList.retainAll(temPatentNos);
             patentVO.setPatentNos(jiaoList);
@@ -358,7 +358,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         }
         //有查询条件时,自定义字段的专利号和任务的专利号取交集
         else {
-            List<String> patentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
+            List<String> patentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions(),taskPatentNos);
             List<String> jiaoList = new ArrayList<>(taskPatentNos);
             jiaoList.retainAll(patentNos);
             patentVO.setPatentNos(jiaoList);