Ver código fonte

增删 2022/11/22

lwhhszx 2 anos atrás
pai
commit
313d43f973

+ 13 - 4
RMS/src/main/java/cn/cslg/report/controller/FeatureController.java

@@ -32,15 +32,24 @@ public class FeatureController {
     @Operation(summary = "拆分权要")
     @Parameters(value = {
             @Parameter(name = "patentNo",description = "专利号",required = true),
-            @Parameter(name = "splitType",description = "拆分类型(0仅拆主权要,1全部拆分)",required = true),
-            @Parameter(name = "splitBy",description = "拆分符号(0  ',',1';',2','和';')",required = true),
-            @Parameter(name = "ReportId",description = "报告Id",required = true),
+            @Parameter(name = "splitType",description = "拆分类型(0仅拆主权要,1全部拆分)"),
+            @Parameter(name = "splitBy",description = "拆分符号(0  ',',1';',2','和';')"),
+            @Parameter(name = "ReportId",description = "报告Id"),
     })
     public String splitPatentRight(String patentNo,Integer splitType ,Integer splitBy,Integer ReportId) throws IOException {
      String res =   featureService.splitPatentRight(patentNo,splitType,splitBy,ReportId);
         return res;
     }
-
+    @RequestMapping(value = "/getFeatures", method = RequestMethod.GET)
+    @Operation(summary = "获得报告创建人查询的特征")
+    @Parameters(value = {
+            @Parameter(name = "patentNo",description = "专利号",required = true),
+            @Parameter(name = "ReportId",description = "报告Id"),
+    })
+    public String getFeatures(String patentNo,Integer ReportId) throws IOException {
+        String res =   featureService.getFeatures(patentNo,ReportId);
+        return res;
+    }
     @RequestMapping(value = "/addPatentRight", method = RequestMethod.POST)
     @Operation(summary = "保存权要")
     public String addPatentRight(@RequestBody List<PatentRightVo>  patentRightVos) throws IOException {

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

@@ -124,7 +124,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
 
                 if (featureFromDb != null && featureFromDb.size() != 0) {
                     int rightId = patentRights.get(i).getId();
-                    featuresList = featureFromDb.stream().filter(item -> item.getRightId() == rightId && item.getSplitBy() == splitBy).collect(Collectors.toList());
+                    featuresList = featureFromDb.stream().filter(item -> item.getRightId() == rightId && item.getSplitBy() == splitBy &&item.getPartnerId()==personnelVO.getId()).collect(Collectors.toList());
                 }
                 //如果数据库里无拆解记录则手动插入一条
                 if (featuresList == null || featuresList.size() == 0 || flag == 1) {
@@ -178,6 +178,54 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
 
     }
 
+    public String getFeatures(String patentNo, Integer reportId) throws IOException {
+        LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
+        queryWrapper.eq(Report::getId, reportId);
+        Report report = reportService.list(queryWrapper).get(0);
+        //权要(带拆分的特征)列表
+        List<PatentRightVo> patentRightVos = new ArrayList<>();
+        //从pas获得权要信息
+        String resBody = outInterfaceService.getPatentRightFromPAS(patentNo);
+        JSONObject jsonObject = JSONObject.parseObject(resBody);
+        //解析jason获得标的专利的权要
+        List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
+        List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin);
+     Features featureTO = new Features();
+        featureTO.setReportId(reportId);
+        featureTO.setSignPatentNo(patentNo);
+        //查询数据库里是否有查询记录
+        List<Features> featureFromDb = this.queryFeatures(featureTO);
+        //将拆解的权要和特征装载到对象PatentRightVo
+        for (int i = 0; i < patentRights.size(); i++) {
+            List<Features> featuresList = new ArrayList<>();
+            //对需要拆解的权要进行拆解
+                if (featureFromDb != null && featureFromDb.size() != 0) {
+                    int rightId = patentRights.get(i).getId();
+                    featuresList = featureFromDb.stream().filter(item -> item.getRightId() == rightId &&item.getPartnerId()==report.getPersonId()).collect(Collectors.toList());
+                }
+
+            //装载到对象PatentRightVo
+            PatentRightVo patentRightVo = new PatentRightVo();
+            String name = "权要" + (i + 1);
+            patentRightVo.setPatentId(patentRights.get(i).getPatentId());
+            patentRightVo.setFeatures(featuresList);
+            patentRightVo.setContent(patentRights.get(i).getContent());
+            patentRightVo.setSort(patentRights.get(i).getSort());
+            patentRightVo.setType(patentRights.get(i).getType());
+            patentRightVo.setContentOut(patentRights.get(i).getContentOut());
+            patentRightVo.setReportId(reportId);
+            patentRightVo.setRightName(name);
+            patentRightVo.setSignPatentNo(patentNo);
+            patentRightVos.add(patentRightVo);
+        }
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("patentRightVos", patentRightVos);
+        map.put("splitBy", report.getSplitBy());
+        map.put("splitType", report.getSplitType());
+        return Response.success(map);
+
+    }
+
     //根据符号拆分字符串
     public List<String> splitStringByFlags(String sentence, List<String> flags) {
         List<String> sectences = new ArrayList<>();

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

@@ -121,10 +121,6 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
 
         return reports;
     }
-//    public String reportDele(int id) throws IOException{
-//        this.removeById(id);
-//        return Response.success();
-//    }
     public String reportDele(int id) throws IOException{
        int  dele  = reportMapper.dele(id);
         if(dele>0){