瀏覽代碼

修改对比记录接口 2022/11/28

lwhhszx 2 年之前
父節點
當前提交
c77a618fce

+ 1 - 2
RMS/src/main/java/cn/cslg/report/controller/CompareRecordsController.java

@@ -26,7 +26,6 @@ public class CompareRecordsController {
     @PostMapping(value = "/addCompareRecords")
     @Operation(summary = "增加对比记录数据")
     public String addCompareRecords(@RequestBody CompareRecords compareRecords)throws IOException{
-//       compareRecords.setPersonId(loginUtils.getId());
         return compareRecordsService.addCompareRecord(compareRecords);
     }
     @RequestMapping(value = "/deleCompareRecords", method = RequestMethod.GET)
@@ -46,7 +45,7 @@ public class CompareRecordsController {
     @Operation(summary ="查询对比记录")
     public String getCompareRecords(@RequestBody CompareRecords compareRecord)throws IOException{
 
-      return compareRecordsService.getCompareRecords(compareRecord.getReportId(), compareRecord.getPatentNo());
+      return compareRecordsService.getCompareRecords(compareRecord);
     }
 
     }

+ 4 - 0
RMS/src/main/java/cn/cslg/report/entity/CompareRecords.java

@@ -72,6 +72,10 @@ public class CompareRecords extends BaseEntity<CompareRecords> {
     @TableField(value = "REPORT_ID")
     private int reportId;
 
+    @Schema(description = "任务ID")
+    @TableField(value = "TASK_ID")
+    private Integer taskId;
+
     /**
      * 结果
      */

+ 48 - 53
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -44,9 +44,10 @@ public class OutInterfaceService {
     private String PASUrl;
     public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
     private final CacheUtils cacheUtils;
-    private final  LoginUtils loginUtils;
+    private final LoginUtils loginUtils;
     private final ReportService reportService;
     private final ImportTaskService importTaskService;
+
     /**
      * @title 获取验证码
      * @description 接口来源:PCS
@@ -130,7 +131,7 @@ public class OutInterfaceService {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
                 .url(PCSUrl + "/permission/api/system/getPermissionList?code=" + code)
-           .addHeader("Cookie", LoginUtils.getToken())
+                .addHeader("Cookie", LoginUtils.getToken())
                 .get()
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
@@ -168,25 +169,17 @@ public class OutInterfaceService {
      * @title 获取所有人员(无权限控制)
      * @description 接口来源:PCS
      */
-    public String getPartPersonnelID(Integer ID)throws IOException{
+    public String getPartPersonnelID(Integer ID) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
-          Request request = new Request.Builder()
-                    .url(PCSUrl + "/permission/api/personnel/getPerson?id="+ID)
-                    .addHeader("Cookie", LoginUtils.getToken())
-                     .get()
-                    .build();
-          return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+        Request request = new Request.Builder()
+                .url(PCSUrl + "/permission/api/personnel/getPerson?id=" + ID)
+                .addHeader("Cookie", LoginUtils.getToken())
+                .get()
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
     public String getAllPersonnelFromPCS() throws IOException {
-//        if(id!=null){
-//            OkHttpClient okHttpClient = new OkHttpClient();
-//            Request request = new Request.Builder()
-//                    .url(PCSUrl + "/permission/api/system/getPerson?id=id")
-//                    .get()
-//                    .build();
-//            return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
-//        }
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
                 .url(PCSUrl + "/permission/api/system/getAllPersonnel")
@@ -201,10 +194,9 @@ public class OutInterfaceService {
      */
     public String getPartPersonnelFromPCS(PersonnelVO personnelVO) throws IOException {
         Map<String, Object> map = new HashMap<>();
-if(personnelVO.getName()==null)
-{
-    personnelVO.setName("");
-}
+        if (personnelVO.getName() == null) {
+            personnelVO.setName("");
+        }
         map.put("name", personnelVO.getName());
         map.put("tenant", personnelVO.getTenant());
         map.put("size", personnelVO.getSize());
@@ -245,7 +237,7 @@ if(personnelVO.getName()==null)
     public String getAllClientFromPCS() throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
-                .url(PASUrl + "/api/v2/client/getAllClient?id="+cacheUtils.getLoginUser(loginUtils.getId()).getTenantId())
+                .url(PASUrl + "/api/v2/client/getAllClient?id=" + cacheUtils.getLoginUser(loginUtils.getId()).getTenantId())
                 .get()
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
@@ -265,6 +257,7 @@ if(personnelVO.getName()==null)
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     /**
      * @title 根据专利号获得专利信息
      * @description 接口来源:PCS
@@ -276,9 +269,10 @@ if(personnelVO.getName()==null)
 //                .addHeader("Cookie", LoginUtils.getToken())
                 .get()
                 .build();
-        String a=Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+        String a = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     /**
      * @title 根据专利号获得专利信息
      * @description 接口来源:PCS
@@ -302,10 +296,10 @@ if(personnelVO.getName()==null)
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
-    public String getPersonNameAndDepart(Integer personId ,Integer departId) throws IOException {
+    public String getPersonNameAndDepart(Integer personId, Integer departId) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
-                .url(PCSUrl + "/permission/api/system/getPersonNameAndDepart?personId=" + personId+"&departId="+departId)
+                .url(PCSUrl + "/permission/api/system/getPersonNameAndDepart?personId=" + personId + "&departId=" + departId)
                 .get()
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
@@ -321,8 +315,8 @@ if(personnelVO.getName()==null)
     }
 
     public String getDictsFromPAS() throws IOException {
-        List<String> dicts =new ArrayList<>();
-    dicts.add(Constants.ENTERPRISE_APPLICATION_SCENARIO);
+        List<String> dicts = new ArrayList<>();
+        dicts.add(Constants.ENTERPRISE_APPLICATION_SCENARIO);
         String param = new Gson().toJson(dicts);
         RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
         OkHttpClient okHttpClient = new OkHttpClient();
@@ -333,22 +327,23 @@ if(personnelVO.getName()==null)
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
-    public String getPatentFromPAS(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());}
+    public String getPatentFromPAS(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("size", patentVO.getSize());
         map.put("current", patentVO.getCurrent());
-        map.put("patentNos",patentVO.getPatentNos());
-        map.put("notInPatentNos",patentVO.getNotInPatentNos());
+        map.put("patentNos", patentVO.getPatentNos());
+        map.put("notInPatentNos", patentVO.getNotInPatentNos());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
         OkHttpClient okHttpClient = new OkHttpClient();
@@ -360,18 +355,18 @@ if(personnelVO.getName()==null)
     }
 
     public String getComPatentNos(PatentVO patentVO) throws IOException {
-        LambdaQueryWrapper<ImportTask> queryWrapper =new LambdaQueryWrapper<>();
-        queryWrapper.eq(ImportTask::getReportId,patentVO.getReportId());
-        Map<String,Object> map =new HashMap<>();
-            Report report = reportService.getById(patentVO.getReportId());
-            map.put("projectId", report.getProjectId());
-            List<ImportTask> importTasks = importTaskService.list(queryWrapper);
-            List<Integer> taskIds = importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
-            map.put("importTaskId", taskIds);
+        LambdaQueryWrapper<ImportTask> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ImportTask::getReportId, patentVO.getReportId());
+        Map<String, Object> map = new HashMap<>();
+        Report report = reportService.getById(patentVO.getReportId());
+        map.put("projectId", report.getProjectId());
+        List<ImportTask> importTasks = importTaskService.list(queryWrapper);
+        List<Integer> taskIds = importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
+        map.put("importTaskId", taskIds);
 
-        map.put("startNumber",patentVO.getStartNumber());
-        map.put("endNumber",patentVO.getEndNumber());
-        map.put("patentNos",patentVO.getPatentNos());
+        map.put("startNumber", patentVO.getStartNumber());
+        map.put("endNumber", patentVO.getEndNumber());
+        map.put("patentNos", patentVO.getPatentNos());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
         OkHttpClient okHttpClient = new OkHttpClient();
@@ -386,7 +381,7 @@ if(personnelVO.getName()==null)
         OkHttpClient httpClient = new OkHttpClient.Builder()
                 .pingInterval(40, TimeUnit.SECONDS) // 设置 PING 帧发送间隔
                 .build();
-            String param = new Gson().toJson(taskParams);
+        String param = new Gson().toJson(taskParams);
         RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
         Request request = new Request.Builder()
                 .url(PASUrl + "/api/v2/project/import/sysPatent")

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

@@ -20,10 +20,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.lang.reflect.Array;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -36,6 +34,14 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
 
     @Transactional(rollbackFor = Exception.class)
     public String addCompareFile(CompareFilesVO compareFilesVO) throws IOException {
+        //查询标的专利信息
+        Report report = reportService.getById(compareFilesVO.getReportId());
+        //根据标的专利号获得专利信息
+        String res1 = outInterfaceService.getPatentFromPAS( report.getSignPatentNo());
+        JSONObject res1Object = JSONObject.parseObject(res1);
+        JSONObject patentNoJSON = JSONObject.parseObject(res1Object.get("data").toString());
+            String quote =patentNoJSON.get("quote").toString().replace(" ","");
+            List<String> quotes = Arrays.asList(quote.split("\\|"));
         LambdaQueryWrapper<CompareFiles> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(CompareFiles::getReportId, compareFilesVO.getReportId());
         List<CompareFiles> compareFile1 = this.list(queryWrapper);
@@ -56,6 +62,9 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
             CompareFiles compareFiles1 = new CompareFiles();
             compareFiles1.setPatentNo(item);
             compareFiles1.setReportId(compareFilesVO.getReportId());
+            if(quotes.contains(item)){
+                compareFiles1.setRemark("引");
+            }
             compareFiles.add(compareFiles1);
         });
         this.saveBatch(compareFiles);
@@ -74,11 +83,11 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
             res = outInterfaceService.getPatentFromPAS(patentVO, 1);
 
         } else {
-            LambdaQueryWrapper<Report> wrapper1 =new LambdaQueryWrapper<>();
+            LambdaQueryWrapper<Report> wrapper1 = new LambdaQueryWrapper<>();
             wrapper1.select(Report::getSignPatentNo);
-            wrapper1.eq(Report::getId,patentVO.getReportId());
+            wrapper1.eq(Report::getId, patentVO.getReportId());
             String signPatentNO = reportService.list(wrapper1).get(0).getSignPatentNo();
-             patentNos.add(signPatentNO);
+            patentNos.add(signPatentNO);
             patentVO.setNotInPatentNos(patentNos);
             res = outInterfaceService.getPatentFromPAS(patentVO, 0);
 
@@ -137,7 +146,7 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
         if (compareFilesVO.getIsAdd() != null) {
             patentNos.addAll(compareFilesVO.getIsAdd());
         }
-        if(patentNos.size()!=0) {
+        if (patentNos.size() != 0) {
             LambdaQueryWrapper<CompareFiles> lambdaQueryWrapper = new LambdaQueryWrapper<>();
             lambdaQueryWrapper.in(CompareFiles::getPatentNo, patentNos);
             this.remove(lambdaQueryWrapper);

+ 23 - 10
RMS/src/main/java/cn/cslg/report/service/business/CompareRecordsService.java

@@ -56,19 +56,26 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
 
     @Transactional
     public String updateCompareRecords(CompareRecords compareRecord) throws IOException {
-        String str = StringUtils.join(compareRecord.getFeaturesIdList(), ",");
-        Integer id = compareRecord.getId();
-        compareRecordsMapper.updateCompareRecords(str, id);
+        LambdaQueryWrapper<AssoRecordsFeature> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoRecordsFeature::getRecordsId,compareRecord.getId());
+        assoRecordsFeatureService.remove(queryWrapper);
+        List<AssoRecordsFeature> assoRecordsFeatures = compareRecord.getAssoRecordsFeatures();
+        assoRecordsFeatures.forEach(item -> item.setRecordsId(compareRecord.getId()));
+        assoRecordsFeatureService.saveBatch(assoRecordsFeatures);
         return Response.success();
     }
 
-    public String getCompareRecords(int reportId, String patentNo) throws IOException {
-        Integer personId = loginUtils.getId();
+    public String getCompareRecords(CompareRecords compareRecord) throws IOException {
+
         LambdaQueryWrapper<CompareRecords> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CompareRecords::getReportId, reportId)
-                .eq(CompareRecords::getPersonId, personId);
-        if (patentNo != null) {
-            wrapper.eq(CompareRecords::getPatentNo, patentNo);
+        wrapper.eq(CompareRecords::getReportId, compareRecord.getReportId());
+
+        if (compareRecord.getPatentNo() != null) {
+            wrapper.eq(CompareRecords::getPatentNo, compareRecord.getPatentNo());
+        }
+        if(compareRecord.getTaskId()!=null){
+
+           wrapper.eq(CompareRecords::getTaskId,compareRecord.getTaskId());
         }
         List<CompareRecords> list = new ArrayList<>();
         List<CompareRecords> compareRecords = this.list(wrapper);
@@ -90,6 +97,7 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
             features = featureService.list(featuresLambdaQueryWrapper);
 
         }
+        List<String> headerPatentNos = new ArrayList<>();
         for (CompareRecords records : compareRecords) {
             List<AssoRecordsFeature> assoRecordsFeatures1 = assoRecordsFeatures.stream().filter(item -> item.getRecordsId().equals(records.getId())).collect(Collectors.toList());
             List<Integer> featureId = assoRecordsFeatures1.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
@@ -97,8 +105,13 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
             List<Features> featuresList = features.stream().filter(item -> featureId.contains(item.getId())).collect(Collectors.toList());
             records.setFeaturesIdList(featureId);
             records.setFeatures(featuresList);
+            if(!headerPatentNos.contains(records.getPatentNo())){
+            headerPatentNos.add(records.getPatentNo());}
         }
-        return Response.success(compareRecords);
+        Map<String,Object> map =new HashMap<>();
+        map.put("tableHeader",headerPatentNos);
+        map.put("records",compareRecords);
+        return Response.success(map);
     }
 
 }

+ 2 - 2
RMS/src/main/resources/application.yml

@@ -67,6 +67,6 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
   mapper-locations: classpath:mapper/*.xml
-PCSUrl: http://192.168.1.17:8880
-PASUrl: http://192.168.1.17:8879
+PCSUrl: http://192.168.1.10:8880
+PASUrl: http://192.168.1.10:8879
 

文件差異過大導致無法顯示
+ 10090 - 0
logs/rms/rms-debug.2022-11-25.0.log


文件差異過大導致無法顯示
+ 864 - 0
logs/rms/rms-info.2022-11-25.0.log