Преглед изворни кода

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

lwhhszx пре 2 година
родитељ
комит
b1361792a4

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

@@ -35,8 +35,8 @@ public class AssignTaskVO extends BaseVO {
     private Date endTime;
     @Schema(description = "备注")
     private String remark;
-    @Schema(description = "自定义字段")
-    private List<SourceVO> filedOptions;
+    @Schema(description = "筛选条件")
+    private PatentVO patentVO;
 
     @Data
     public static class assignPatents{

+ 43 - 0
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -369,6 +369,49 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
+    public String getConPantentNos(PatentVO patentVO, int type) throws IOException {
+        LambdaQueryWrapper<ImportTask> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ImportTask::getReportId, patentVO.getReportId());
+        List<ImportTask> importTasks = importTaskService.list(queryWrapper);
+        List<Integer> taskIds = importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
+        Map<String, Object> map = new HashMap<>();
+        Report report = reportService.getById(patentVO.getReportId());
+        if (type == 0) {
+            map.put("projectId", report.getProjectId());
+            map.put("importTaskId", taskIds);
+            map.put("startNumber", patentVO.getStartNumber());
+            map.put("endNumber", patentVO.getEndNumber());
+        }
+        //专利名称
+        map.put("patentName",patentVO.getPatentName());
+        //专利摘要
+        map.put("abstractStr",patentVO.getAbstractStr());
+        map.put("size", patentVO.getSize());
+        map.put("current", patentVO.getCurrent());
+        map.put("patentNos", patentVO.getPatentNos());
+        //申请人名字
+        map.put("applicationName",patentVO.getApplicationName());
+        //申请号
+        map.put("applicationNo",patentVO.getApplicationNo());
+        //专利号
+        map.put("patentNo",patentVO.getPatentNo());
+        //权利人名字
+        map.put("obligeeName" ,patentVO.getObligeeName());
+        map.put("notInPatentNos", patentVO.getNotInPatentNos());
+        //分类号(IPC,UPC,CPC)
+        map.put("numberCpc",patentVO.getNumberCpc());
+        map.put("numberIpc",patentVO.getNumberIpc());
+        map.put("numberUpc",patentVO.getNumberUpc());
+        JSONObject json = new JSONObject(map);
+        RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
+        OkHttpClient okHttpClient = new OkHttpClient();
+        Request request = new Request.Builder()
+                .url(PASUrl + "/api/v2/system/getConPantentNos")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
     //根据专利号列表获得专利详情
   public String  getPatentDTOListForRMS(PatentVO patentVO) throws  IOException{
       Map<String, Object> map = new HashMap<>();

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

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

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

@@ -222,6 +222,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     //添加分配任务
     @Transactional(rollbackFor = Exception.class)
     public String addAssTask(AssignTaskVO assignTaskVO) throws ParseException, IOException {
+        PatentVO patentVO =assignTaskVO.getPatentVO();
         LambdaQueryWrapper<Report> wrapper1 = new LambdaQueryWrapper<>();
         wrapper1.eq(Report::getId, assignTaskVO.getReportId());
         Report report =reportService.list(wrapper1).get(0);
@@ -235,7 +236,6 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         List<String> selectedNos = new ArrayList<>();
         //记录所有人的id
         List<Integer> personIds = new ArrayList<>();
-
         //记录总共专利号数量
         int num = 0;
         List<AssignTaskVO.assignPatents> personPatents = assignTaskVO.getAssigns();
@@ -258,7 +258,21 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
                 .eq(CompareFiles::getReportId, assignTaskVO.getReportId())
                 .eq(CompareFiles::getState, 0);
         List<CompareFiles> compareFiles = compareFilesService.list(wrapper);
-        List<String> patentNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
+        List<String> AllpatentNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
+        //无查询条件
+        if (patentVO.getFiledOptions() == null||patentVO.getFiledOptions().size() == 0) {
+            patentVO.setPatentNos(AllpatentNos);
+        }
+        //有查询条件时,自定义字段的专利号和任务的专利号取交集
+        else {
+         List<String>   temPatentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
+            List<String> jiaoList = new ArrayList<>(AllpatentNos);
+            jiaoList.retainAll(temPatentNos);
+            patentVO.setPatentNos(jiaoList);
+        }
+        String res = outInterfaceService.getConPantentNos(patentVO,1);
+        JSONObject jsonObject1 = JSONObject.parseObject(res);
+        List<String> patentNos = JSONArray.parseArray(jsonObject1.get("data").toString(), String.class);
         if (patentNos.size() > num) {
             return Response.error("分配数量超过未分配总数");
         }