lwhhszx hace 2 años
padre
commit
5d5df214ad

+ 29 - 1
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -310,7 +310,6 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
-
     public String getClientNameFromPCS(List<Integer> ids) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         String param = new Gson().toJson(ids);
@@ -617,5 +616,34 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+    /**
+     * @title 根据条件获得专利信息
+     * @description 根据条件获得专利信息
+     * @autor lrj
+     */
+    public String getConPantents(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());
+        Report report = reportService.getById(patentVO.getReportId());
+        if (type == 0) {
+            patentVO.setProjectId(report.getProjectId());
+            patentVO.setImportTaskId(taskIds);
+
+        }
+        String param = new Gson().toJson(patentVO);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .build();
+        Request request = new Request.Builder()
+                .url(PASUrl + "/api/v2/system/getConPantents")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
 
 }

+ 52 - 94
RMS/src/main/java/cn/cslg/report/service/business/AssoTaskPersonelService.java

@@ -37,6 +37,7 @@ import java.util.stream.Collectors;
 public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper, AssoTaskPersonel> {
     private final AssoTaskPersonelMapper assoTaskPersonelMapper;
     private final OutInterfaceService outInterfaceService;
+    private final ReportFieldService reportFieldService;
     public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
     @Value("${PCSUrl}")
     private String PCSUrl;
@@ -89,110 +90,67 @@ public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper,
             //专利号
             patentNumber = list.stream().map(AssoTaskPersonel::getPatentNo).collect(Collectors.toList());
         }
+        if(patentVO.getFiledOptions()!=null&&patentVO.getFiledOptions().size()>0) {
+            patentNumber = reportFieldService.getPatentNo1(patentVO.getFiledOptions(), patentVO.getReportId(), patentVO.getTaskId(), patentVO.getTaskStatus());
+        }
 
         patentVO.setPatentNos(patentNumber);
-
-
+        String resNum = outInterfaceService.getConPantents(patentVO, 1);
+        JSONObject jsonObjectNum = JSONObject.parseObject(resNum);
+        List<JSONObject> jsonObjectNums = JSONArray.parseArray(jsonObjectNum.get("data").toString(), JSONObject.class);
+        Integer totalNumber = jsonObjectNums.size();
         if (patentVO.getLocPosition() == 1) {
-            patentVO.setStartNumber(0);
-            patentVO.setEndNumber(1);
-            String res = outInterfaceService.getPatentFromPAS(patentVO, 1);
-            JSONObject jsonObject = JSONObject.parseObject(res);
-            JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
-            List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
-            List<Patents> list = new ArrayList<>();
-
-            for (JSONObject obj : jsonObjects) {
-
-                Patents patent = obj.toJavaObject(obj, Patents.class);
-                list.add(patent);
-
-            }
-            if (list.size() == 0) {
-
-                return Response.success();
-            }
-
-            if (list.size() == 1) {
-                map.put("currentID", list.get(0).getId());
-                map.put("behindID", null);
-                map.put("frontID", null);
-                map.put("totalNumber", list.size());
-                map.put("frontPatentNo", null);
-                map.put("currentPatentNo", list.get(0).getPatentNo());
-                map.put("behindPatentNo", null);
-                map.put("frontNumber", 0);
-                map.put("behindNumber", 0);
-                return Response.success(map);
-
-            }
-            jsonObject1.put("type", "first");
-            map.put("currentID", list.get(0).getId());
-            map.put("behindID", list.get(1).getId());
-            map.put("frontID", null);
-            map.put("totalNumber", list.size());
-            map.put("frontNumber", 0);
-            map.put("behindNumber", list.size() - 1);
-            map.put("location", 1);
-            map.put("frontPatentNo", null);
-            map.put("currentPatentNo", list.get(0).getPatentNo());
-            map.put("behindPatentNo", list.get(1).getPatentNo());
-            return Response.success(map);
+            patentVO.setStartNumber(patentVO.getLocPosition() - 1);
+            patentVO.setEndNumber(patentVO.getLocPosition());
+        } else if (patentVO.getLocPosition() >= totalNumber) {
+            patentVO.setStartNumber(patentVO.getLocPosition() - 2);
+            patentVO.setEndNumber(patentVO.getLocPosition() - 1);
         } else {
             patentVO.setStartNumber(patentVO.getLocPosition() - 2);
             patentVO.setEndNumber(patentVO.getLocPosition());
-            String res = outInterfaceService.getPatentFromPAS(patentVO, 1);
-            JSONObject jsonObject = JSONObject.parseObject(res);
-            JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
-            List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
-            List<Patents> list = new ArrayList<>();
-            for (JSONObject obj : jsonObjects) {
-                Patents patent = obj.toJavaObject(obj, Patents.class);
-                list.add(patent);
-
-            }
-
-            if (list.size() == 1) {
-                map.put("currentID", list.get(0).getId());
-                map.put("behindID", null);
-                map.put("frontID", null);
-                map.put("totalNumber", list.size());
-                map.put("frontPatentNo", null);
-                map.put("currentPatentNo", list.get(0).getPatentNo());
+        }
+        String res = outInterfaceService.getConPantents(patentVO, 1);
+        JSONObject jsonObject = JSONObject.parseObject(res);
+        List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject.get("data").toString(), JSONObject.class);
+        List<Patents> list = new ArrayList<>();
+        for (JSONObject obj : jsonObjects) {
+            Patents patent = obj.toJavaObject(obj, Patents.class);
+            list.add(patent);
+        }
+        map.put("totalNumber", totalNumber);
+        map.put("frontNumber", patentVO.getLocPosition()-1);
+        map.put("behindNumber", totalNumber-patentVO.getLocPosition());
+        if (patentVO.getLocPosition() == 1) {
+            map.put("currentID", list.get(0).getId());
+            map.put("currentPatentNo", list.get(0).getPatentNo());
+            map.put("frontPatentNo", null);
+            map.put("frontID", null);
+            if(list.size()==1) {
                 map.put("behindPatentNo", null);
-                map.put("frontNumber", 0);
-                map.put("behindNumber", 0);
-                return Response.success(map);
-
-            }
-            if (patentVO.getLocPosition() >= list.size()) {
-                map.put("currentID", list.get(list.size() - 1).getId());
                 map.put("behindID", null);
-                map.put("frontID", list.get(list.size() - 2).getId());
-                map.put("totalNumber", list.size());
-                map.put("frontNumber", list.size() - 1);
-                map.put("behindNumber", 0);
-                map.put("location", list.size());
-                map.put("frontPatentNo", list.get(list.size() - 2).getPatentNo());
-                map.put("currentPatentNo", list.get(list.size() - 1).getPatentNo());
-                map.put("behindPatentNo", null);
-                return Response.success(map);
             }
-            map.put("currentID", list.get(patentVO.getLocPosition() - 1).getId());
-            map.put("behindID", list.get(patentVO.getLocPosition()).getId());
-            map.put("frontID", list.get(patentVO.getLocPosition() - 2).getId());
-            map.put("totalNumber", list.size());
-            map.put("frontNumber", patentVO.getLocPosition() - 1);
-            map.put("behindNumber", list.size() - patentVO.getLocPosition());
-            map.put("location", patentVO.getLocPosition());
-            map.put("frontPatentNo", list.get(patentVO.getLocPosition() - 2).getPatentNo());
-            map.put("currentPatentNo", list.get(patentVO.getLocPosition() - 1).getPatentNo());
-            map.put("behindPatentNo", list.get(patentVO.getLocPosition()).getPatentNo());
+            else {
+                map.put("behindPatentNo", list.get(1).getPatentNo());
+                map.put("behindID", list.get(1).getId());
+            }
             return Response.success(map);
-
-
+        } else if (patentVO.getLocPosition() >= totalNumber) {
+            map.put("currentID", list.get(1).getId());
+            map.put("currentPatentNo", list.get(1).getPatentNo());
+            map.put("frontPatentNo", list.get(0).getPatentNo());
+            map.put("frontID", list.get(0).getId());
+            map.put("behindPatentNo", null);
+            map.put("behindID", null);
+            return Response.success(map);
+        } else {
+            map.put("currentID", list.get(1).getId());
+            map.put("currentPatentNo", list.get(1).getPatentNo());
+            map.put("frontPatentNo", list.get(0).getPatentNo());
+            map.put("frontID", list.get(0).getId());
+            map.put("behindPatentNo", list.get(2).getPatentNo());
+            map.put("behindID", list.get(2).getId());
         }
-
-
+        return Response.success(map);
     }
+
 }

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

@@ -33,7 +33,6 @@ public class CopyService {
     private final ReportFieldOptionService reportFieldOptionService;
     private final ReportFieldTreeService reportFieldTreeService;
     private final ReportFieldPatentLinkService reportFieldPatentLinkService;
-
     //复制对比文件
     @Transactional(rollbackFor = Exception.class)
     public Boolean CopyComparePatents(Integer oldReportId, Integer newReportId) {
@@ -50,7 +49,6 @@ public class CopyService {
         }
         return true;
     }
-
     //复制标引信息
     @Transactional(rollbackFor = Exception.class)
     public void CopyPatentLabels(List<ReportField> oldFields, List<ReportField> newFields) {

+ 9 - 15
RMS/src/main/java/cn/cslg/report/service/business/FeatureService.java

@@ -56,26 +56,20 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
 
     public List<PatentRight> FormatPatentRights(List<PatentRight> patentRights) {
         List<PatentRight> retList = new ArrayList<>();
+        if(patentRights==null){
+            patentRights=new ArrayList<>();
+        }
         for (int i = 0; i < patentRights.size(); i++) {
-            String str = patentRights.get(i).getContent();
+           String str = patentRights.get(i).getContent();
             str = str.replace(" ", "");
             str = str.replace("\r", "");
-            Pattern p = Pattern.compile("^[0-9]+(\\.||'、').*");
-            Matcher m = p.matcher(str);
-            if (m.matches()) {
-                retList.add(patentRights.get(i));
-            } else {
-                if (retList.size() != 0) {
-                    retList.get(retList.size() - 1).setContent(retList.get(retList.size() - 1).getContent() + patentRights.get(i).getContent());
-                    if (patentRights.get(i).getContentOut() != null) {
-                        retList.get(retList.size() - 1).setContentOut(retList.get(retList.size() - 1).getContentOut() + patentRights.get(i).getContentOut());
-                    }
-                }
-
+            str =str.replace("\n","");
+            if(str.equals("")){
+                patentRights.remove(i);
+            }
+            else{patentRights.get(i).setContent(str);
             }
-
         }
-
         return patentRights;
     }
 

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

@@ -270,7 +270,6 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             patentListMaps.add(patentListMap);
 
         }
-
         //存放对比方案信息的map集合
         List<Map<String, Object>> scenariosMaps = new ArrayList<>(compareFiles.size());
         //存放所有对比方案所有不重复的rightId

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

@@ -88,25 +88,23 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             report.setCreatePersonId(reportDto.getCreatePersonId());
         }
         //负责人
-        if(reportDto.getPersonId()!=null){
+        if (reportDto.getPersonId() != null) {
             report.setPersonId(reportDto.getPersonId());
         }
         //类型
         report.setType(reportDto.getType());
         //装载状态
-        if (reportDto.getType().equals(4) || reportDto.getType().equals(5)) {
-            report.setStatus(2);
-        } else if(reportDto.getStatus()==null||reportDto.getStatus()!=3) {
+
+        if (reportDto.getStatus() == null) {
             report.setStatus(1);
-        }
-        else {
+        } else {
             report.setStatus(reportDto.getStatus());
         }
         // 装载客户
         report.setClientId(reportDto.getClientId());
         //装载应用场景
         if (reportDto.getScenarioList() != null) {
-            report.setScenarioId(StringUtils.join(report.getScenarioList(), ","));
+            report.setScenarioId(StringUtils.join(reportDto.getScenarioList(), ","));
         }
         //装载核心论述
         report.setCronConclusion(reportDto.getCronConclusion());
@@ -134,6 +132,9 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
      */
     @Transactional(rollbackFor = Exception.class)
     public Integer addReport(ReportDTO reportDto, List<MultipartFile> files) throws IOException {
+        if (reportDto.getType().equals(4) || reportDto.getType().equals(5)) {
+            reportDto.setStatus(2);
+        }
         //新增报告
         Report report = this.loadReport(reportDto);
         report.insert();
@@ -145,14 +146,13 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             assoReportFileService.addAsso(report.getId(), fileIds);
         }
         //当报告是已完成时
-        if (reportDto.getTrack()!=null&&reportDto.getTrack()) {
+        if (reportDto.getTrack() != null && reportDto.getTrack()) {
             //复制父报告自定义栏位
             LambdaQueryWrapper<ReportField> fieldWrapper = new LambdaQueryWrapper<>();
             fieldWrapper.eq(ReportField::getReportId, reportDto.getAssociateReportId());
             List<ReportField> fields = reportFieldService.list(fieldWrapper);
-
-          String re =  JSONObject.toJSON(fields).toString();
-            List<ReportField> oldFields = JSONArray.parseArray(re,ReportField.class);
+            String re = JSONObject.toJSON(fields).toString();
+            List<ReportField> oldFields = JSONArray.parseArray(re, ReportField.class);
             if (fields.size() != 0) {
                 for (ReportField reportField : fields) {
                     reportField.setId(null);
@@ -163,13 +163,13 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             //复制
             if (reportDto.getCopyIds() != null) {
                 //复制对比文件
-                List<Integer> c1s =new ArrayList<>(Arrays.asList(0,2,4,6));
-                if ( !Collections.disjoint (reportDto.getCopyIds(),c1s)) {
+                List<Integer> c1s = new ArrayList<>(Arrays.asList(0, 2, 4, 6));
+                if (!Collections.disjoint(reportDto.getCopyIds(), c1s)) {
                     copyService.CopyComparePatents(reportDto.getAssociateReportId(), report.getId());
                 }
-                List<Integer> c2s =new ArrayList<>(Arrays.asList(1,3,5,7));
+                List<Integer> c2s = new ArrayList<>(Arrays.asList(1, 3, 5, 7));
                 //复制标引信息
-                if ( !Collections.disjoint (reportDto.getCopyIds(),c2s)) {
+                if (!Collections.disjoint(reportDto.getCopyIds(), c2s)) {
                     copyService.CopyPatentLabels(oldFields, fields);
                 }
             }
@@ -229,17 +229,17 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             queryWrapper.in(Report::getType, reportVO.getTypes());
         }
         //根据状态查询报告
-        if(reportVO.getStatuses()!=null&&reportVO.getStatuses().size()>0){
-            queryWrapper.in(Report::getStatus,reportVO.getStatuses());
+        if (reportVO.getStatuses() != null && reportVO.getStatuses().size() > 0) {
+            queryWrapper.in(Report::getStatus, reportVO.getStatuses());
         }
         if (reportVO.getCronIds() != null && reportVO.getCronIds().size() > 0) {
             StringBuilder strs = new StringBuilder();
             for (int i = 0; i < reportVO.getCronIds().size(); i++) {
                 Integer item = reportVO.getCronIds().get(i);
                 if (i == 0) {
-                    strs.append("(FIND_IN_SET(" + item + ",REPLACE(CONCLUSION_ID, '/', ','))");
+                    strs.append("(FIND_IN_SET(" + item + ",CONCLUSION_ID)");
                 } else {
-                    strs.append("or FIND_IN_SET(" + item + ",REPLACE(CONCLUSION_ID, '/', ','))");
+                    strs.append("or FIND_IN_SET(" + item + ",CONCLUSION_ID)");
                 }
             }
             strs.append(")");
@@ -252,7 +252,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (reportVO.getSize() != null && reportVO.getCurrent() != null) {
             SecurityUtils.startDataScope("/pcs/report/query");
             List<Report> reports = this.page(new Page<>(reportVO.getCurrent(), reportVO.getSize()), queryWrapper).getRecords();
-            if(reports.size()>0){
+            if (reports.size() > 0) {
                 reports = this.reportData(reports);
             }
 
@@ -370,7 +370,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             }
             //装载核心结论
             if (StringUtils.isNotEmpty(item.getConclusionId())) {
-                List<String> ids = StringUtils.changeStringToString(item.getConclusionId(), "/");
+                List<String> ids = StringUtils.changeStringToString(item.getConclusionId(), ",");
                 item.setConclusionIds(ids);
                 List<String> names = new ArrayList<>();
                 for (Map<String, Object> temMap : conclusions) {
@@ -684,7 +684,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     public Boolean addConclusions(ConclusionDTO conclusionDTO) {
         Report report = this.getById(conclusionDTO.getReportId());
         report.setCronConclusion(conclusionDTO.getCronConclusion());
-        if (report.getConclusionIds() != null) {
+        if (conclusionDTO.getConclusionIds() != null) {
             report.setConclusionId(StringUtils.join(conclusionDTO.getConclusionIds(), ","));
         }
 

+ 2 - 9
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 addTask(String taskVOStr, List<MultipartFile> file) throws ParseException, IOException {
         TaskVO taskVO = JSONObject.parseObject(taskVOStr, TaskVO.class);
+        taskVO.getReport().setStatus(0);
         //先添加一个报告
         Integer reportId = reportService.addReport(taskVO.getReport(), file);
 
@@ -674,16 +675,8 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
 
         }
 
-
         List<Task> records = this.page(new Page<>(taskVO.getCurrent(), taskVO.getSize()), lambdaQueryWrapper).getRecords();
-        for (Task task : records) {
-            Integer createID = task.getCreateID();
-            Integer handlePersonId = task.getHandlePersonId();
-            PersonnelVO loginUser = cacheUtils.getLoginUser(createID);
-            task.setCreateName(loginUser.getName());
-            PersonnelVO loginUser1 = cacheUtils.getLoginUser(handlePersonId);
-            task.setHandlePersonName(loginUser1.getName());
-        }
+             records =this.reTasks(records);
         Long count = this.count(lambdaQueryWrapper);
         return Response.success(records, DataUtils.setPageColumn(taskVO.getSize(), taskVO.getCurrent(), Math.toIntExact(count)));
 

+ 1 - 1
RMS/src/main/resources/application-testNetOut.yml

@@ -33,7 +33,7 @@ spring:
     url: jdbc:mysql://47.101.137.223:3306/RMS_TEST?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     driver-class-name: com.mysql.cj.jdbc.Driver
     username: root
-    password: rrzTwWAYX8Gxh5JH
+    password: TU5x6IeBi7rl
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       stat-view-servlet: