瀏覽代碼

代码合并

lwhhszx 2 年之前
父節點
當前提交
2d6e6cc3cc
共有 27 個文件被更改,包括 1119 次插入211 次删除
  1. 2 3
      RMS/src/main/java/cn/cslg/report/common/model/dto/FeaturesDTO.java
  2. 7 0
      RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsDTO.java
  3. 77 0
      RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsDetailsDTO.java
  4. 57 0
      RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsListDTO.java
  5. 2 1
      RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/InvalidReasonDTO.java
  6. 80 0
      RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ArgumentsDetailsVO.java
  7. 68 0
      RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ArgumentsListVO.java
  8. 4 0
      RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ProofVO.java
  9. 12 1
      RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/QueryInvalidReasonVO.java
  10. 15 12
      RMS/src/main/java/cn/cslg/report/controller/CompareFilesController.java
  11. 14 6
      RMS/src/main/java/cn/cslg/report/controller/FeatureController.java
  12. 42 25
      RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/ArgumentsController.java
  13. 1 3
      RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/InvalidReasonController.java
  14. 11 0
      RMS/src/main/java/cn/cslg/report/controller/ReportFileController.java
  15. 2 7
      RMS/src/main/java/cn/cslg/report/entity/invalidReReport/Arguments.java
  16. 2 5
      RMS/src/main/java/cn/cslg/report/entity/invalidReReport/AssoFeatureProof.java
  17. 1 1
      RMS/src/main/java/cn/cslg/report/entity/invalidReReport/InvalidReason.java
  18. 5 1
      RMS/src/main/java/cn/cslg/report/entity/invalidReReport/Scratch.java
  19. 4 1
      RMS/src/main/java/cn/cslg/report/mapper/InvalidReReport/ArgumentsMapper.java
  20. 16 5
      RMS/src/main/java/cn/cslg/report/service/business/CompareFilesService.java
  21. 179 27
      RMS/src/main/java/cn/cslg/report/service/business/FeatureService.java
  22. 334 88
      RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ArgumentsService.java
  23. 13 0
      RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/AssoFeatureProofService.java
  24. 125 23
      RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/InvalidReasonService.java
  25. 23 1
      RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ProofGroupService.java
  26. 9 1
      RMS/src/main/java/cn/cslg/report/service/business/ReportFileService.java
  27. 14 0
      RMS/src/main/resources/mapper/ArgumentsMapper.xml

+ 2 - 3
RMS/src/main/java/cn/cslg/report/common/model/dto/FeaturesDTO.java

@@ -49,13 +49,12 @@ public class FeaturesDTO {
      */
     private Integer reportId;
 
-    @TableField(value = "RIGHT_NAME")
+
     private String rightName;
 
-    @TableField(value = "RIGHT_TYPE")
+
     private Integer rightType;
 
-    @TableField(value = "FEATURES_ORDER")
     private Integer featuresOrder;
 
 }

+ 7 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsDTO.java

@@ -34,6 +34,10 @@ public class ArgumentsDTO  {
      * 无效证据
      */
     private String proofStr;
+    /**
+     * 无效证据Id
+     */
+    private Integer proofStrId;
 
     /**
      * 陈述意见
@@ -73,4 +77,7 @@ public class ArgumentsDTO  {
      * 划词专利
      */
     private String patentNo ;
+
+
+    private String featureContent;
 }

+ 77 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsDetailsDTO.java

@@ -0,0 +1,77 @@
+package cn.cslg.report.common.model.dto.invalidReReport;
+
+import lombok.Data;
+
+/**
+ * 陈述意见DTO类
+ *
+ * @Author 李仁杰
+ * @Date 2023/7/4
+ */
+@Data
+public class ArgumentsDetailsDTO {
+    private Integer id;
+
+    private String reportId ;
+    /**
+     * 划词内容
+     */
+    private String content ;
+
+    /**
+     * 划词类型
+     */
+    private String scratchType ;
+
+    /**
+     * 划词颜色
+     */
+    private String color ;
+
+    /**
+     * 划词栏位
+     */
+    private String scratchField ;
+
+    /**
+     * 划词位置
+     */
+    private Integer position ;
+
+    /**
+     * 划词专利
+     */
+    private String patentNo ;
+
+    /**
+     * 权要id
+     */
+    private Integer rightId;
+
+    /**
+     * 特征id
+     */
+    private Integer featureId;
+
+
+    /**
+     * 陈述意见
+     */
+    private String argumentStr;
+
+    /**
+     * 证据id
+     */
+    private Integer proofId;
+
+    /**
+     * 无效证据
+     */
+    private String proofStr;
+    /**
+     * 无效证据
+     */
+    private Integer proofStrId;
+
+
+}

+ 57 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/ArgumentsListDTO.java

@@ -0,0 +1,57 @@
+package cn.cslg.report.common.model.dto.invalidReReport;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 陈述意见DTO类
+ *
+ * @Author 李仁杰
+ * @Date 2023/7/4
+ */
+@Data
+public class ArgumentsListDTO {
+
+
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+    /**
+     * 权要序号
+     */
+    private Integer rightSort;
+
+
+    /**
+     * 特征id
+     */
+    private Integer featureId;
+    /**
+     * 无效证据
+     */
+    private String proofStr;
+    /**
+     * 无效证据
+     */
+    private Integer proofStrId;
+    /**
+     * 证据id
+     */
+    private Integer proofId;
+    /**
+     * 陈述意见
+     */
+    private List<ArgumentIn> arguments;
+
+
+    /**
+     * 陈述意见
+     */
+    @Data
+    public static  class  ArgumentIn{
+        private Integer id;
+        private String argumentStr;
+    }
+}

+ 2 - 1
RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/InvalidReasonDTO.java

@@ -10,6 +10,7 @@ import java.util.List;
 
 @Data
 public class InvalidReasonDTO {
+    private Integer id;
     /**
      * 无效理由(0权利要求不清楚 1说明书公开不充分 2不具备创造性 3不具备新颖性)
      */
@@ -38,7 +39,7 @@ public class InvalidReasonDTO {
     /**
      * 陈述意见
      */
-    private String argument_str;
+    private String argumentStr;
 
     /**
      * 复审委意见

+ 80 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ArgumentsDetailsVO.java

@@ -0,0 +1,80 @@
+package cn.cslg.report.common.model.vo.invalidReReport;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 陈述意见DTO类
+ *
+ * @Author 李仁杰
+ * @Date 2023/7/4
+ */
+@Data
+public class ArgumentsDetailsVO {
+    private Integer id;
+
+    private String reportId ;
+    /**
+     * 划词内容
+     */
+    private String content ;
+
+    /**
+     * 划词类型
+     */
+    private String scratchType ;
+
+    /**
+     * 划词颜色
+     */
+    private String color ;
+
+    /**
+     * 划词栏位
+     */
+    private String scratchField ;
+
+    /**
+     * 划词位置
+     */
+    private Integer position ;
+
+    /**
+     * 划词专利
+     */
+    private String patentNo ;
+
+    /**
+     * 权要id
+     */
+    private Integer rightId;
+
+    /**
+     * 特征id
+     */
+    private Integer featureId;
+
+
+    /**
+     * 陈述意见
+     */
+    private String argumentStr;
+
+    /**
+     * 证据id
+     */
+    private Integer proofId;
+
+    /**
+     * 无效证据
+     */
+    private String proofStr;
+    /**
+     * 无效证据
+     */
+    private Integer proofStrId;
+
+
+}

+ 68 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ArgumentsListVO.java

@@ -0,0 +1,68 @@
+package cn.cslg.report.common.model.vo.invalidReReport;
+
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 陈述意见DTO类
+ *
+ * @Author 李仁杰
+ * @Date 2023/7/4
+ */
+@Data
+public class ArgumentsListVO {
+
+    /**
+     * 权要序号
+     */
+    private Integer rightSort;
+
+    /**
+     * 权要内容
+     */
+    private  String rightContent;
+    /**
+     * 权要名称
+     */
+    private  String rightName;
+
+    /**
+     * 特征id
+     */
+    private Integer featureId;
+    /**
+     * 特征名称
+     */
+    private String featureName;
+    /**
+     * 特征内容
+     */
+    private String featureContent;
+
+    /**
+     * 无效证据
+     */
+    private String proofStr;
+    /**
+     * 无效证据
+     */
+    private Integer proofStrId;
+
+    private Integer proofId;
+    /**
+     * 陈述意见
+     */
+    private List<ArgumentIn> arguments;
+
+
+    /**
+     * 陈述意见
+     */
+    @Data
+    public static  class  ArgumentIn{
+        private Integer id;
+        private String argumentStr;
+    }
+}

+ 4 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/ProofVO.java

@@ -6,6 +6,7 @@ import java.util.List;
 
 @Data
 public class ProofVO {
+    private Integer id;
     /**
      * 排序
      */
@@ -25,5 +26,8 @@ public class ProofVO {
      */
     private String remark;
 
+    private Integer type;
+    private String proofConditions;
+
 
 }

+ 12 - 1
RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/QueryInvalidReasonVO.java

@@ -1,6 +1,7 @@
 package cn.cslg.report.common.model.vo.invalidReReport;
 
 import cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonDTO;
+import cn.cslg.report.entity.invalidReReport.Proof;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 
@@ -30,7 +31,7 @@ public class QueryInvalidReasonVO {
     /**
      * 陈述意见
      */
-    private String argument_str;
+    private String argumentStr;
 
     /**
      * 复审委意见
@@ -81,6 +82,16 @@ public class QueryInvalidReasonVO {
         private String argument_str;
 
         private List<Integer> proofIds;
+        private List<proofIn> proofs;
+    }
+    @Data
+    public static class proofIn{
+
+        private Integer id;
+        private Integer sort;
+        private Integer fileType;
+        private String patentNo;
+        private Integer fileId;
     }
 
     @Data

+ 15 - 12
RMS/src/main/java/cn/cslg/report/controller/CompareFilesController.java

@@ -34,29 +34,32 @@ public class CompareFilesController {
     private final ReportFieldPatentLinkService fieldPatentLinkService;
 
     @GetMapping("/index/setting/all")
-    @Operation(summary ="获取当前所有的,传过来报告(int)id,和(String)专利号")
-    public String settingAll(Integer reportId, String patentNos)throws IOException{
-         return Response.success(compareFilesService.setAll(reportId,patentNos));
+    @Operation(summary = "获取当前所有的,传过来报告(int)id,和(String)专利号")
+    public String settingAll(Integer reportId, String patentNos) throws IOException {
+        return Response.success(compareFilesService.setAll(reportId, patentNos));
     }
+
     @PostMapping("/index/setting")
     @Operation(summary = "获取专利标引情况")
     public String getPatentIndexSetting(@RequestBody PatentIndexSettingVO params) throws IOException {
-            compareFilesService.getPatentIndexSetting(params);
-       return Response.success();
+        compareFilesService.getPatentIndexSetting(params);
+        return Response.success();
     }
+
     @PostMapping("/index/setting/update")
     @Operation(summary = "获取专利标引情况")
-    public String getPatentIndexSetting2(@RequestBody PatentIndexSettingVO params) throws IOException {
+    public String getPatentIndexSetting2(@RequestBody PatentIndexSettingVO params)  {
         fieldPatentLinkService.updatePatentIndexSetting2(params);
         return Response.success();
     }
 
-@PostMapping("/order/add")
-@Operation(summary = "给对比专利添加顺序")
-public String addOrder(@RequestBody CompareOrderDTO compareOrderDTO) throws IOException {
-    compareFilesService.addOrder(compareOrderDTO);
-    return Response.success();
-}
+    @PostMapping("/order/add")
+    @Operation(summary = "给对比专利添加顺序")
+    public String addOrder(@RequestBody CompareOrderDTO compareOrderDTO) throws IOException {
+        compareFilesService.addOrder(compareOrderDTO);
+        return Response.success();
+    }
+
     @GetMapping("/order/query")
     @Operation(summary = "查找顺序列表")
     public String getOrder(Integer reportId) throws IOException {

+ 14 - 6
RMS/src/main/java/cn/cslg/report/controller/FeatureController.java

@@ -75,15 +75,23 @@ public class FeatureController {
     }
 
 
-    @RequestMapping(value = "/addSingleFeature", method = RequestMethod.GET)
+    @RequestMapping(value = "/addSingleFeature", method = RequestMethod.POST)
     @Operation(summary = "添加单个特征")
     public String addSingleFeature(@RequestBody FeaturesDTO featuresDTO) throws IOException {
-        Boolean flag = featureService.addSingleFeature(featuresDTO);
-        if (!flag) {
-            return Response.error();
-        }
-        return Response.success();
+        return featureService.addSingleFeature(featuresDTO);
     }
+    @RequestMapping(value = "/deleteSingleFeature", method = RequestMethod.GET)
+    @Operation(summary = "删除单个特征")
+    public String deleteSingleFeature(Integer featureId) throws IOException {
 
+        return featureService.deleteSingleFeature(featureId);
+    }
+
+    @RequestMapping(value = "/getFeatureList", method = RequestMethod.GET)
+    @Operation(summary = "查询特征列表")
+    public String getFeatureList(Integer reportId,Integer rightSort) throws IOException {
+
+        return featureService.getFeatureList(reportId,rightSort);
+    }
 
 }

+ 42 - 25
RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/ArgumentsController.java

@@ -2,18 +2,23 @@ package cn.cslg.report.controller.InvalidReReport;
 
 import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.dto.ShareReportDTO;
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsDTO;
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsDetailsDTO;
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsListDTO;
 import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.entity.invalidReReport.AssoFeatureProof;
+import cn.cslg.report.service.business.AssoRecordsFeatureService;
+import cn.cslg.report.service.business.InvalidReReport.ArgumentsService;
+import cn.cslg.report.service.business.InvalidReReport.AssoFeatureProofService;
 import cn.cslg.report.service.business.asso.AssoReportPersonService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
  * 报告分享管理的Controller层
@@ -28,36 +33,48 @@ import java.io.IOException;
 @RequestMapping(Constants.REPORT_API + "/arguments")
 public class ArgumentsController {
     private final AssoReportPersonService assoReportPersonService;
-
+    private final ArgumentsService argumentsService;
+    private final AssoFeatureProofService assoFeatureProofService;
     @Operation(summary = "添加陈述意见")
-    @PostMapping("/add")
-    public String add(@RequestBody ShareReportDTO shareReportDTO) {
-        Integer flag = assoReportPersonService.shareReport(shareReportDTO);
-        return Response.success(flag);
+    @PostMapping("/addArguments")
+    public String addArguments(@RequestBody ArgumentsDTO argumentsDTO) throws IOException {
+        return argumentsService.addArguments(argumentsDTO);
     }
 
     @Operation(summary = "删除陈述意见")
-    @PostMapping("/delete")
-    public String delete(@RequestBody ShareReportDTO shareReportDTO) {
-        assoReportPersonService.removeShare(shareReportDTO);
-        return Response.success();
+    @PostMapping("/deleteArguments")
+    public String deleteArguments(@RequestBody List<Integer> argumentsIds) {
+        argumentsService.deleteArguments(argumentsIds);
+        return Response.success("删除成功");
     }
 
     @Operation(summary = "修改陈述意见")
-    @PostMapping("/update")
-    public String update(@RequestBody ShareReportDTO shareReportDTO) throws IOException {
-        return Response.success(assoReportPersonService.showShare(shareReportDTO));
+    @PostMapping("/updateArgument")
+    public String updateArgument(@RequestBody ArgumentsDetailsDTO argumentsDTO) throws IOException {
+        return argumentsService.updateArgument(argumentsDTO);
+    }
+
+    @Operation(summary = "查询陈述意见划词详情")
+    @GetMapping("/queryScratchs")
+    public String query(Integer proofId) throws IOException {
+        return Response.success(argumentsService.queryScratchs(proofId));
     }
 
-    @Operation(summary = "查询陈述意见")
-    @PostMapping("/query")
-    public String query(@RequestBody ShareReportDTO shareReportDTO) throws IOException {
-        return Response.success(assoReportPersonService.showShare(shareReportDTO));
+    @Operation(summary = "批量添加或更新陈述意见")
+    @PostMapping("/addOrUpdatePoofArguments")
+    public String addOrUpdatePoofArguments(@RequestBody List<ArgumentsListDTO> argumentsListDTOS) {
+        return argumentsService.addOrUpdatePoofArguments(argumentsListDTOS);
     }
 
-//    @Operation(summary = "根据文件id和权要查询陈述意见")
-//    @PostMapping("/query")
-//    public String query(@RequestBody ShareReportDTO shareReportDTO) throws IOException {
-//        return Response.success(assoReportPersonService.showShare(shareReportDTO));
-//    }
+    @Operation(summary = "查询陈述意见列表")
+    @GetMapping("/queryPoofArguments")
+    public String queryPoofArguments(Integer proofId, Integer rightSort, Integer reportId) throws IOException {
+        return Response.success(argumentsService.queryPoofArguments(proofId,rightSort,reportId));
+    }
+
+    @Operation(summary = "根据特征查询相关证据")
+    @GetMapping("/queryProofStr")
+    public String queryProofStr(Integer proofId, Integer featureId) throws IOException {
+        return Response.success(assoFeatureProofService.queryProofStr(proofId,featureId));
+    }
 }

+ 1 - 3
RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/InvalidReasonController.java

@@ -4,7 +4,6 @@ import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.dto.invalidReReport.CheckReFeaturesDTO;
 import cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonDTO;
 import cn.cslg.report.common.model.dto.invalidReReport.QueryInvalidReasonDTO;
-import cn.cslg.report.common.model.vo.invalidReReport.PagingVO;
 import cn.cslg.report.common.model.vo.invalidReReport.QueryInvalidReasonVO;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.entity.invalidReReport.InvalidReason;
@@ -57,7 +56,7 @@ public class InvalidReasonController {
     @Operation(summary = "更新无效理由和证据")
     @PostMapping("/updateInvalidReason")
     public String updateInvalidReason(@RequestBody InvalidReasonDTO invalidReasonDTO) throws IOException {
-
+             invalidReasonService.updateInvalidReason(invalidReasonDTO);
         return Response.success();
     }
 
@@ -72,7 +71,6 @@ public class InvalidReasonController {
         }
     }
 
-
     @Operation(summary = "查询无效理由和证据详情")
     @GetMapping("/queryInvalidReasonDetail")
     public String queryInvalidReasonDetail(Integer id) throws IOException {

+ 11 - 0
RMS/src/main/java/cn/cslg/report/controller/ReportFileController.java

@@ -4,6 +4,7 @@ import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.entity.ReportFiles;
 
+import cn.cslg.report.service.business.ReportFileService;
 import cn.cslg.report.service.business.TemplateService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -16,11 +17,21 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
 @SuppressWarnings({"all"})
 @Tag(name = "文件")
 @RestController
 @RequestMapping(Constants.REPORT_API + "/reportFile")
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ReportFileController {
+   private static ReportFileService reportFileService;
+    //根据文件id查询文件
+    @RequestMapping(value = "/getFile", method = RequestMethod.GET)
+    @Operation(summary = "根据id获得文件路径")
+    public String getFile(Integer fileId) throws IOException {
+        return Response.success(reportFileService.getFile(fileId));
+    }
 
 }

+ 2 - 7
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/Arguments.java

@@ -25,7 +25,7 @@ public class Arguments extends BaseEntity<Arguments> {
     /**
      * 权要id
      */
-    @TableField("RIGHT_ID")
+    @TableField("RIGHT_SORT")
     private Integer rightId;
 
     /**
@@ -34,11 +34,6 @@ public class Arguments extends BaseEntity<Arguments> {
     @TableField("FEATURE_ID")
     private Integer featureId;
 
-    /**
-     * 无效证据
-     */
-    @TableField("PROOF_STR")
-    private String proofStr;
 
     /**
      * 陈述意见
@@ -49,7 +44,7 @@ public class Arguments extends BaseEntity<Arguments> {
     /**
      * 证据id
      */
-    @TableField("PROOF_ID")
+    @TableField("COMPARE_FILE_ID")
     private Integer proofId;
 
     /**

+ 2 - 5
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/AssoFeatureProof.java

@@ -17,11 +17,8 @@ import java.util.Date;
 @TableName(value = "ASSO_FEATURE_PROOF")
 public class AssoFeatureProof extends BaseEntity<AssoFeatureProof> {
 
-    @TableField("ID")
-    private Integer ID ;
-
     @TableField("FEATURE_ID")
-    private String feature_ID ;
+    private Integer featureId;
 
     /**
      * 划词内容
@@ -33,7 +30,7 @@ public class AssoFeatureProof extends BaseEntity<AssoFeatureProof> {
      * 文件id
      */
     @TableField("COMPARE_FILE_ID")
-    private String compareFileId ;
+    private Integer compareFileId ;
 
 
 }

+ 1 - 1
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/InvalidReason.java

@@ -51,7 +51,7 @@ public class InvalidReason extends BaseEntity<InvalidReason> {
      * 陈述意见
      */
     @TableField("ARGUMENT_STR")
-    private String argument_str;
+    private String argumentStr;
 
     /**
      * 复审委意见

+ 5 - 1
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/Scratch.java

@@ -17,7 +17,7 @@ import java.util.Date;
 @TableName(value = "SCRATCH")
 public class Scratch extends BaseEntity<Scratch> {
     @TableField("REPORT_ID")
-    private String reportId ;
+    private Integer reportId ;
     /**
      * 划词内容
      */
@@ -53,6 +53,9 @@ public class Scratch extends BaseEntity<Scratch> {
      */
     @TableField("PATENT_NO")
     private String patentNo ;
+    @TableField("ARGUMENT_ID")
+    private Integer argumentId ;
+
 
     /**
      * 创建人
@@ -65,4 +68,5 @@ public class Scratch extends BaseEntity<Scratch> {
      */
     @TableField("CREATE_TIME")
     private Date createTime;
+
 }

+ 4 - 1
RMS/src/main/java/cn/cslg/report/mapper/InvalidReReport/ArgumentsMapper.java

@@ -1,10 +1,13 @@
 package cn.cslg.report.mapper.InvalidReReport;
 
+import cn.cslg.report.common.model.vo.invalidReReport.ArgumentsListVO;
 import cn.cslg.report.entity.invalidReReport.Arguments;
 import cn.cslg.report.entity.invalidReReport.AssoArguments;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  *
  *陈述意见Mapper层
@@ -13,7 +16,7 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface ArgumentsMapper extends BaseMapper<Arguments> {
-
+  public List<Arguments> getArguments(List<ArgumentsListVO> argumentsListVOS);
 
 }
 

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

@@ -638,7 +638,6 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
         return compareFiles.getId();
     }
 
-
     /**
      * 分页查询证据
      *
@@ -668,23 +667,36 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
 
     private List<ProofVO> loadProof(List<CompareFiles> proofs) {
         List<ProofVO> proofVOS = new ArrayList<>();
+        //筛选出文件id
+       List<Integer> fileId = proofs.stream().filter(item->item.getFileType().equals(2)).map(CompareFiles::getFileId).collect(Collectors.toList());
+       //根据文件id获得所有的文件
+        List<ReportFiles> reportFiles =new ArrayList<>();
+        if(fileId.size()!=0){
+            LambdaQueryWrapper<ReportFiles> reportFilesLambdaQueryWrapper =new LambdaQueryWrapper<>();
+            reportFilesLambdaQueryWrapper.in(ReportFiles::getId,fileId);
+          reportFiles =  reportFileService.list(reportFilesLambdaQueryWrapper);
+        }
+        List<ReportFiles> reportFile =reportFiles;
         proofs.forEach(item -> {
             ProofVO proofVO = new ProofVO();
             if (item.getFileType().equals(1)) {
                 proofVO.setProofType("专利文献");
-                proofVO.setProofName(item.getPatentNo());
+                proofVO.setProofConditions(item.getPatentNo());
             } else if (item.getFileType().equals(2)) {
+            ReportFiles reportFiles1 =    reportFile.stream().filter(tem->tem.getId().equals(item.getFileId())).findFirst().orElse(null);
+                proofVO.setProofConditions(reportFiles1.getUrl());
                 proofVO.setProofType("非专利文献");
-                proofVO.setProofName(item.getFileName());
             }
             proofVO.setSortStr("D" + item.getSysOrder());
-
+            proofVO.setType(item.getFileType());
+            proofVO.setId(item.getId());
             proofVO.setProofName(item.getFileName());
             proofVO.setRemark(item.getRemark());
             proofVOS.add(proofVO);
         });
         return proofVOS;
     }
+
     //上传非专利文献证据
     public void addProofByFile(ProofAddNewDTO proofAddNewDTO, List<MultipartFile> files) {
         log.info("开始处理【上传非专利文献证据】的业务,参数为:{}, {}", proofAddNewDTO, files);
@@ -709,7 +721,6 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
             }
 
         }
-
         CompareFiles proof = new CompareFiles();
         BeanUtils.copyProperties(proofAddNewDTO, proof);  //DTO赋值给实体类(装载报告id、证据名称、备注)
         proof.setFileType(2);  //装载证据类型

+ 179 - 27
RMS/src/main/java/cn/cslg/report/service/business/FeatureService.java

@@ -2,10 +2,12 @@ package cn.cslg.report.service.business;
 
 import cn.cslg.report.common.model.PatentRightParams;
 import cn.cslg.report.common.model.dto.FeaturesDTO;
+import cn.cslg.report.common.model.dto.invalidReReport.CheckReFeaturesDTO;
 import cn.cslg.report.common.model.vo.PatentRightVo;
 import cn.cslg.report.common.model.vo.PatentVO;
 import cn.cslg.report.common.model.vo.PersonnelVO;
 import cn.cslg.report.common.model.vo.SplitVO;
+import cn.cslg.report.common.model.vo.invalidReReport.QueryAllFeaturesVO;
 import cn.cslg.report.common.utils.CacheUtils;
 import cn.cslg.report.common.utils.PatentRightUtils;
 import cn.cslg.report.common.utils.Response;
@@ -14,8 +16,15 @@ import cn.cslg.report.entity.*;
 import cn.cslg.report.entity.asso.AssoRecordsFeature;
 import cn.cslg.report.entity.asso.AssoTaskPatentSplit;
 import cn.cslg.report.entity.asso.AssoTaskPersonel;
+import cn.cslg.report.entity.invalidReReport.Arguments;
+import cn.cslg.report.entity.invalidReReport.AssoFeatureProof;
+import cn.cslg.report.entity.invalidReReport.AssoPositionFeatures;
+import cn.cslg.report.entity.invalidReReport.Proof;
 import cn.cslg.report.mapper.FeatureMapper;
 import cn.cslg.report.service.OutInterfaceService;
+import cn.cslg.report.service.business.InvalidReReport.ArgumentsService;
+import cn.cslg.report.service.business.InvalidReReport.AssoFeatureProofService;
+import cn.cslg.report.service.business.InvalidReReport.InvalidReasonService;
 import cn.dev33.satoken.stp.StpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -50,6 +59,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
     private final TaskService taskService;
     private final CompareMessageService compareMessageService;
     private final PatentRightUtils patentRightUtils;
+    private final InvalidReasonService invalidReasonService;
+    private final AssoFeatureProofService assoFeatureProofService;
+    private final ArgumentsService argumentsService;
 
     /**
      * @param patentRights(专利权利要求)
@@ -57,15 +69,14 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
      * @function 对权要进行合并操作
      */
 
-    public List<PatentRight> FormatPatentRights(List<PatentRight> patentRights,String patentNo) {
+    public List<PatentRight> FormatPatentRights(List<PatentRight> patentRights, String patentNo) {
 
 
-
-        StringBuilder stringBuilder =new StringBuilder();
-    patentRights.forEach(item->{
-        stringBuilder.append(item.getContent());
-    });
-        PatentRightParams params =new PatentRightParams();
+        StringBuilder stringBuilder = new StringBuilder();
+        patentRights.forEach(item -> {
+            stringBuilder.append(item.getContent());
+        });
+        PatentRightParams params = new PatentRightParams();
         params.setPatentNo(patentNo);
         params.setPatentId(-1);
         params.setContent(stringBuilder.toString());
@@ -157,7 +168,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         //解析jason获得标的专利的权要
         List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
         //给权要进行格式更改
-        List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin,patentNo);
+        List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin, patentNo);
         List<Integer> partRightIds = new ArrayList<>();
         List<String> flags = new ArrayList<>();
         // 当splitType=0仅拆解主权要
@@ -303,7 +314,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         //解析jason获得标的专利的权要
         List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
         //处理权要
-        List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin,patentNo);
+        List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin, patentNo);
         Features featureTO = new Features();
         featureTO.setReportId(reportId);
         featureTO.setSignPatentNo(patentNo);
@@ -359,7 +370,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
                         attrs.set(v, attrs.get(v) + flags.get(i));
                     }
                     if (attrs.get(v).equals("其特征在于" + flags.get(i))) {
-                        tem.set(tem.size() - 1,tem.get(tem.size() - 1)+attrs.get(v));
+                        tem.set(tem.size() - 1, tem.get(tem.size() - 1) + attrs.get(v));
                     } else {
                         tem.add(attrs.get(v));
                     }
@@ -535,36 +546,177 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         this.remove(queryWrapper);
         return 1;
     }
+
     @Transactional(rollbackFor = Exception.class)
     public List<PatentRight> getRightNames(String patentNo) throws IOException {
-        Map<Integer,Object> map =new HashMap<>();
+        Map<Integer, Object> map = new HashMap<>();
         String resBody = outInterfaceService.getPatentRightFromPAS(patentNo);
         JSONObject jsonObject = JSONObject.parseObject(resBody);
         //解析jason获得标的专利的权要
         List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
-        StringBuilder stringBuilder =new StringBuilder();
+        StringBuilder stringBuilder = new StringBuilder();
         patentRightsOrgin.forEach(
-                item->{stringBuilder.append(item.getContent());}
+                item -> {
+                    stringBuilder.append(item.getContent());
+                }
         );
-PatentRightParams params =new PatentRightParams();
-params.setContent(stringBuilder.toString());
-params.setPatentNo(patentNo);
-List<PatentRight> patentRights = PatentRightUtils.formatPatentRight(params);
-patentRights.forEach(item->{
-    item.setRightName("权要"+(item.getSort()+1));
-});
-    return patentRights;
+        PatentRightParams params = new PatentRightParams();
+        params.setContent(stringBuilder.toString());
+        params.setPatentNo(patentNo);
+        List<PatentRight> patentRights = PatentRightUtils.formatPatentRight(params);
+        patentRights.forEach(item -> {
+            item.setRightName("权要" + (item.getSort() + 1));
+        });
+        return patentRights;
     }
+
+    /**
+     * 添加单个特征
+     * @param featuresDTO
+     * @return
+     * @throws IOException
+     */
     @Transactional(rollbackFor = Exception.class)
-    public Boolean addSingleFeature(FeaturesDTO featuresDTO) throws IOException {
-        if(featuresDTO.getReportId()==null||featuresDTO.getRightId()==null){
-            return false;
+    public String addSingleFeature(FeaturesDTO featuresDTO) throws IOException {
+        //判断报告id和权要序号是否为空
+        if (featuresDTO.getReportId() == null || featuresDTO.getRightId() == null) {
+            return Response.error("判断报告id或权要序号为空");
         }
-        Features features =new Features();
-        BeanUtils.copyProperties(featuresDTO,features);
-        return features.insert();
+        Report report = reportService.getById(featuresDTO.getReportId());
+        String patentNo = report.getSignPatentNo();
+        //装载检查特征类
+        CheckReFeaturesDTO checkReFeaturesDTO = new CheckReFeaturesDTO();
+        checkReFeaturesDTO.setReportId(featuresDTO.getReportId());
+        checkReFeaturesDTO.setRightSort(featuresDTO.getRightId());
+        CheckReFeaturesDTO.featuresIn featuresIn = new CheckReFeaturesDTO.featuresIn();
+        featuresIn.setFeatureStr(featuresDTO.getContent());
+        checkReFeaturesDTO.setFeatures(Arrays.asList(featuresIn));
+        //检查权要是否有此特征
+        checkReFeaturesDTO = this.getFeaturePosition(checkReFeaturesDTO, patentNo);
+        if (checkReFeaturesDTO == null) {
+            return Response.error("权要里无此特征");
+        } else if (checkReFeaturesDTO.getFeatures().get(0).getPosition() == null) {
+            return Response.error("特征已被添加");
+        }
+        Boolean flag = invalidReasonService.checkReFeatures(checkReFeaturesDTO);
+
+        if (!flag) {
+            return Response.error("特征有交集");
+        }
+        //查询证据表,取出该报告已有证据最大排序序号
+        List<Features> featuresList = this.list(new LambdaQueryWrapper<Features>().eq(Features::getReportId, featuresDTO.getReportId()).eq(Features::getRightId, featuresDTO.getRightId()).orderByDesc(Features::getFeaturesOrder));
+        Integer biggestSort;
+        //若该报告目前没有证据,则最大排序序号设为0;若有则最大排序序号就是当前按序号倒序的第一个证据的排序序号
+        if (featuresList == null || featuresList.size() == 0) {
+            biggestSort = 1;
+        } else {
+            biggestSort = featuresList.get(0).getFeaturesOrder()+1;
+        }
+        Features features = new Features();
+        features.setContent(featuresDTO.getContent());
+        features.setRightId(featuresDTO.getRightId());
+        features.setReportId(featuresDTO.getReportId());
+        features.setFeaturesOrder(biggestSort);
+        features.setSignPatentNo(patentNo);
+        features.insert();
+        AssoPositionFeatures assoPositionFeatures = new AssoPositionFeatures();
+        assoPositionFeatures.setFeaturesID(features.getId());
+        assoPositionFeatures.setPosition(checkReFeaturesDTO.getFeatures().get(0).getPosition());
+        assoPositionFeatures.insert();
+        return Response.success(features.getId());
+    }
+
+    //获得特征的位置
+    public CheckReFeaturesDTO getFeaturePosition(CheckReFeaturesDTO checkReFeaturesDTO, String patentNo) throws IOException {
+        List<PatentRight> patentRights = this.getRightNames(patentNo);
+        //获得权要
+        PatentRight patentRight = patentRights.stream().filter(item -> item.getSort().equals(checkReFeaturesDTO.getRightSort())).findFirst().orElse(null);
+        String patentRightContent = patentRight.getContent();
+        //获得特征
+        String featureStr = checkReFeaturesDTO.getFeatures().get(0).getFeatureStr();
+        //获得所有的特征起始位置
+        List<Integer> indexs = new ArrayList<>();
+        Integer index = patentRightContent.indexOf(featureStr);
+        indexs.add(index);
+        while (index != -1) {
+            //这里 Index+1 是为了检索下一个的时候,位置需要向后挪1个字符,而不是挪 son.length 长度
+            index += 1;
+            index = patentRightContent.indexOf(featureStr, index);
+            indexs.add(index);
+        }
+        //获得已经保存的特征
+        List<QueryAllFeaturesVO> queryAllFeaturesVOS = featureMapper.queryAllFeatures(checkReFeaturesDTO.getReportId(), checkReFeaturesDTO.getRightSort());
+        if (indexs.size() == 0||(indexs.size()==1&&indexs.get(0).equals(-1))) {
+            return null;
+        }
+        //遍历寻找未选择的特征
+        for (Integer item :indexs){
+            QueryAllFeaturesVO queryAllFeaturesVO = queryAllFeaturesVOS.stream().filter(tem -> tem.getFeatureStr().equals(featureStr) && tem.getPosition().equals(item)).findFirst().orElse(null);
+            if (queryAllFeaturesVO == null&&item!=-1) {
+                checkReFeaturesDTO.getFeatures().get(0).setPosition(item);
+                break ;
+            }
+        }
+        return checkReFeaturesDTO;
+
     }
 
 
+    private void CalculateNum(String father, String son, Integer reportId, Integer rightId) {
+        int index = father.indexOf(son);
+        while (index != -1) {
+            //这里 Index+1 是为了检索下一个的时候,位置需要向后挪1个字符,而不是挪 son.length 长度
+            index += 1;
+            index = father.indexOf(son, index);
+        }
+        List<QueryAllFeaturesVO> queryAllFeaturesVOS = featureMapper.queryAllFeatures(reportId, rightId);
+    }
+
+    /**
+     * 添加单个特征
+     * @param featuresDTO
+     * @return
+     * @throws IOException
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String deleteSingleFeature(Integer featureId) throws IOException {
+        if(featureId==null){
+return Response.error("请选择特征");
+        }
+        //检查陈述意见是否有关联的特征
+        LambdaQueryWrapper<Arguments> argumentsWrapper=new LambdaQueryWrapper<>();
+        argumentsWrapper.eq(Arguments::getFeatureId,featureId);
+        List<Arguments> arguments =argumentsService.list(argumentsWrapper);
+        if(arguments.size()>0){
+            return Response.error("此特征和陈述意见有关联");
+        }
+        this.removeById(featureId);
+        LambdaQueryWrapper<AssoFeatureProof> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(AssoFeatureProof::getFeatureId,featureId);
+        assoFeatureProofService.remove(wrapper);
+        return Response.success();
+    }
 
+ //获得特征列表
+    public String getFeatureList(Integer reportId,Integer rightSort){
+        List<Map<String,Object>> mapList =new ArrayList<>();
+        if(reportId==null||rightSort==null){
+            return Response.error("请输入报告id和权要序号");
+        }
+        Report report =reportService.getById(reportId);
+        LambdaQueryWrapper<Features> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(Features::getRightId,rightSort)
+                .eq(Features::getReportId,reportId)
+                .eq(Features::getSignPatentNo,report.getSignPatentNo())
+                .orderByAsc(Features::getFeaturesOrder);
+        List<Features> features =this.list(queryWrapper);
+        features.forEach(item->{
+            Map<String,Object> map =new HashMap<>();
+            map.put("featureId",item.getId());
+            map.put("content",item.getContent());
+            map.put("featureName","特征"+item.getFeaturesOrder());
+            mapList.add(map);
+        });
+        return Response.success(mapList);
+    }
 }

+ 334 - 88
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ArgumentsService.java

@@ -1,26 +1,38 @@
 package cn.cslg.report.service.business.InvalidReReport;
 
+import cn.cslg.report.common.model.dto.FeaturesDTO;
 import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsDTO;
-import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsQueryDTO;
-import cn.cslg.report.common.model.vo.invalidReReport.ArgumentsVO;
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsDetailsDTO;
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsListDTO;
+import cn.cslg.report.common.model.vo.invalidReReport.ArgumentsDetailsVO;
+import cn.cslg.report.common.model.vo.invalidReReport.ArgumentsListVO;
+import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.entity.CompareFiles;
 import cn.cslg.report.entity.Features;
+import cn.cslg.report.entity.PatentRight;
+import cn.cslg.report.entity.Report;
 import cn.cslg.report.entity.invalidReReport.*;
 import cn.cslg.report.mapper.InvalidReReport.ArgumentsMapper;
-import cn.cslg.report.mapper.InvalidReReport.AssoArgumentsMapper;
+
+import cn.cslg.report.service.business.CompareFilesService;
 import cn.cslg.report.service.business.FeatureService;
+import cn.cslg.report.service.business.ReportService;
+
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.swagger.v3.oas.models.security.SecurityScheme;
+
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.HashMap;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
 
@@ -28,22 +40,57 @@ import java.util.stream.Collectors;
 @Slf4j
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
-    private static ProofService proofService;
-    private static LoginUtils loginUtils;
-    private static ScratchService scratchService;
-    private static AssoArgumentsService assoArgumentsService;
-    private static FeatureService featureService;
-    private static AssoFeatureProofService assoFeatureProofService;
+    private final ProofService proofService;
+    private final LoginUtils loginUtils;
+    private final ScratchService scratchService;
+    private final AssoArgumentsService assoArgumentsService;
+    private final FeatureService featureService;
+    private final AssoFeatureProofService assoFeatureProofService;
+    private final ArgumentsService argumentsService;
+    private final ReportService reportService;
+    private final CompareFilesService compareFilesService;
+
 
     /**
      * 添加陈述意见
      *
      * @param argumentsDTO
      */
-    public void addArguments(ArgumentsDTO argumentsDTO) {
+    public String addArguments(ArgumentsDTO argumentsDTO) throws IOException {
         // 检验参数
-        if (argumentsDTO == null || argumentsDTO.getReportId() == null || argumentsDTO.getFeatureId() == null || argumentsDTO.getRightId() == null || argumentsDTO.getProofId() == null) {
-            return;
+        if (argumentsDTO == null || argumentsDTO.getReportId() == null  || argumentsDTO.getRightId() == null || argumentsDTO.getProofId() == null || argumentsDTO.getProofStr() == null) {
+            return Response.error("参数不正确");
+        }
+       if(argumentsDTO.getFeatureId()==null){
+           FeaturesDTO featuresDTO=new FeaturesDTO();
+           featuresDTO.setReportId(argumentsDTO.getReportId());
+           featuresDTO.setRightId(argumentsDTO.getRightId());
+           featuresDTO.setContent(argumentsDTO.getFeatureContent());
+      String ret =  featureService.addSingleFeature(featuresDTO);
+      Response response =JSONObject.parseObject(ret,Response.class);
+      if(response.getCode().equals(0)){
+          return  ret;
+      }
+      else{
+          argumentsDTO.setFeatureId(Integer.parseInt(response.getData().toString()));
+      }
+       }
+        AssoFeatureProof assoFeatureProof = new AssoFeatureProof();
+        //根据特征id和文件id查询
+        LambdaQueryWrapper<AssoFeatureProof> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(AssoFeatureProof::getCompareFileId, argumentsDTO.getProofId())
+                .eq(AssoFeatureProof::getFeatureId, argumentsDTO.getFeatureId());
+        List<AssoFeatureProof> assoFeatureProofs = assoFeatureProofService.list(wrapper);
+        //添加相关证据文本
+        if (assoFeatureProofs.size() <= 0) {
+            assoFeatureProof.setFeatureId(argumentsDTO.getFeatureId());
+            assoFeatureProof.setCompareFileId(argumentsDTO.getProofId());
+            assoFeatureProof.setProofStr(argumentsDTO.getProofStr());
+            assoFeatureProof.insert();
+        } else if (assoFeatureProofs.size() > 0) {
+            assoFeatureProof = assoFeatureProofs.get(0);
+            assoFeatureProof.setProofStr(argumentsDTO.getProofStr());
+            assoFeatureProof.updateById();
         }
         Integer loginId = loginUtils.getId();
         //装载陈述意见实体类
@@ -56,44 +103,15 @@ public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
             Scratch scratch = new Scratch();
             BeanUtils.copyProperties(argumentsDTO, scratch);
             //根据证据类型获得证据的专利号
-            Proof proof = proofService.getById(arguments.getProofId());
+            CompareFiles proof = compareFilesService.getById(arguments.getProofId());
             String patenNo = proof.getPatentNo();
             scratch.setPatentNo(patenNo);
             scratch.setCreateId(loginId);
+            scratch.setArgumentId(arguments.getId());
+            scratch.setReportId(argumentsDTO.getReportId());
             scratch.insert();
         }
-
-    }
-
-    /**
-     * 查询陈述意见详情
-     *
-     * @param argumentsId
-     */
-    public ArgumentsVO queryArgumentsDetail(Integer argumentsId) {
-        //判断argumentsId是否为空
-        if (argumentsId == null) {
-            return null;
-        }
-        ArgumentsVO argumentsVO = new ArgumentsVO();
-        //根据argumentsId查询陈述意见
-        Arguments arguments = this.getById(argumentsId);
-        BeanUtils.copyProperties(arguments, argumentsVO);
-        //根据证据id获得专利号
-        Proof proof = proofService.getById(arguments.getProofId());
-        if (proof.getPatentNo() != null) {
-            //根据专利号和报告id获得划词内容
-            LambdaQueryWrapper<Scratch> scratchLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            scratchLambdaQueryWrapper.eq(Scratch::getPatentNo, proof.getPatentNo());
-            scratchLambdaQueryWrapper.eq(Scratch::getReportId, arguments.getReportId());
-            List<Scratch> scratchList = scratchService.list(scratchLambdaQueryWrapper);
-            if (scratchList.size() > 0) {
-                Scratch scratch = scratchList.get(0);
-                BeanUtils.copyProperties(scratch, argumentsVO);
-            }
-        }
-
-        return argumentsVO;
+        return Response.success("添加成功");
     }
 
     /**
@@ -103,7 +121,7 @@ public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
      */
     public void deleteArguments(List<Integer> argumentsIds) {
         //判断argumentsId是否为空
-        if (argumentsIds == null) {
+        if (argumentsIds == null || argumentsIds.size() == 0) {
             return;
         }
         //判断陈述意见方案中是否有正在使用的陈述意见
@@ -119,10 +137,10 @@ public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
         List<Arguments> arguments = this.list(argumentsWrapper);
         List<Integer> proofIds = arguments.stream().map(Arguments::getProofId).collect(Collectors.toList());
         //根据proofIds获得proof
-        LambdaQueryWrapper<Proof> proofWrapper = new LambdaQueryWrapper<>();
-        proofWrapper.in(Proof::getId, proofIds);
-        List<Proof> proofs = proofService.list(proofWrapper);
-        List<String> patentNos = proofs.stream().map(Proof::getPatentNo).collect(Collectors.toList());
+        LambdaQueryWrapper<CompareFiles> proofWrapper = new LambdaQueryWrapper<>();
+        proofWrapper.in(CompareFiles::getId, proofIds);
+        List<CompareFiles> proofs = compareFilesService.list(proofWrapper);
+        List<String> patentNos = proofs.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
         if (patentNos.size() > 0) {
             //根据专利号和报告id获得划词内容
             LambdaQueryWrapper<Scratch> scratchLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -135,50 +153,105 @@ public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
     }
 
     /**
-     * 查询陈述意见列表
+     * 查询划词陈述意见
      *
-     * @param argumentsQueryDTO
+     * @param
      */
-    public void queryArguments(ArgumentsQueryDTO argumentsQueryDTO) {
-        //判断reportId是否为空
-        if (argumentsQueryDTO.getReportId() == null) {
-            return;
+    public  List<ArgumentsDetailsVO>  queryScratchs(Integer fileId) {
+        List<ArgumentsDetailsVO> argumentsDetailsVOS =new ArrayList<>();
+        //根据文件id查询文件
+        CompareFiles compareFiles = compareFilesService.getById(fileId);
+        String patentNo = compareFiles.getPatentNo();
+        //根据报告id获得标的专利号
+        Report report = reportService.getById(compareFiles.getReportId());
+        Integer reportId = report.getId();
+        String signPatentNo = report.getSignPatentNo();
+        // 根据报告id和权要id获得所有特征
+        LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Features::getReportId, reportId);
+        List<Features> features = featureService.list(wrapper);
+        List<Integer> featureIds = features.stream().map(Features::getId).collect(Collectors.toList());
+
+        //根据特征和文件id获得证据
+        LambdaQueryWrapper<AssoFeatureProof> featureProofWrapper = new LambdaQueryWrapper<>();
+        featureProofWrapper.in(AssoFeatureProof::getFeatureId, featureIds)
+                .eq(AssoFeatureProof::getCompareFileId, fileId);
+        List<AssoFeatureProof> assoFeatureProofs = assoFeatureProofService.list(featureProofWrapper);
+        //查询划词信息
+        LambdaQueryWrapper<Scratch> scratchLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        scratchLambdaQueryWrapper.eq(Scratch::getPatentNo, patentNo);
+        scratchLambdaQueryWrapper.eq(Scratch::getReportId, reportId);
+        List<Scratch> scratchList = scratchService.list(scratchLambdaQueryWrapper);
+        //获得陈述意见
+        List<Arguments> arguments = new ArrayList<>();
+        List<Integer> argumentIds = scratchList.stream().map(Scratch::getArgumentId).collect(Collectors.toList());
+        if (argumentIds.size() > 0) {
+            LambdaQueryWrapper<Arguments> wrapper1 = new LambdaQueryWrapper<>();
+            wrapper1.in(Arguments::getId, argumentIds);
+            arguments = argumentsService.list(wrapper1);
         }
-        LambdaQueryWrapper<Arguments> argumentsLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        argumentsLambdaQueryWrapper.eq(Arguments::getReportId, argumentsQueryDTO.getReportId());
-        if (argumentsQueryDTO.getReportId() != null) {
-            argumentsLambdaQueryWrapper.eq(Arguments::getRightId, argumentsQueryDTO.getRightId());
+        for (Scratch item : scratchList) {
+            ArgumentsDetailsVO argumentsDetailsVO = new ArgumentsDetailsVO();
+            argumentsDetailsVO.setColor(item.getScratchColor());
+            BeanUtils.copyProperties(item, argumentsDetailsVO);
+            Arguments argument = arguments.stream().filter(tem -> tem.getId().equals(item.getArgumentId())).findFirst().orElse(null);
+            BeanUtils.copyProperties(argument,argumentsDetailsVO);
+       AssoFeatureProof assoFeatureProof=     assoFeatureProofs.stream().filter(tem->tem.getFeatureId().equals(argument.getFeatureId())).findFirst().orElse(null);
+            if(assoFeatureProof!=null) {
+                argumentsDetailsVO.setArgumentStr(assoFeatureProof.getProofStr());
+                argumentsDetailsVO.setProofStrId(assoFeatureProof.getId());
+            }
+            argumentsDetailsVOS.add(argumentsDetailsVO);
         }
+        return argumentsDetailsVOS;
     }
 
     /**
      * 添加陈述意见
      *
      * @param argumentsDTO
+     * @return
      */
-    public void updateArgumentsBatch(ArgumentsDTO argumentsDTO) {
+    public String updateArgument(ArgumentsDetailsDTO argumentsDTO) {
         // 检验参数
         if (argumentsDTO == null || argumentsDTO.getReportId() == null || argumentsDTO.getFeatureId() == null || argumentsDTO.getRightId() == null || argumentsDTO.getProofId() == null) {
-            return;
+            return Response.error("参数不正确");
         }
-        Integer loginId = loginUtils.getId();
-        //装载陈述意见实体类
-        Arguments arguments = new Arguments();
-        BeanUtils.copyProperties(argumentsDTO, arguments);
-        arguments.setCreateId(loginId);
-        arguments.insert();
-        //若划词不为空
-        if (argumentsDTO.getContent() != null) {
-            Scratch scratch = new Scratch();
-            BeanUtils.copyProperties(argumentsDTO, scratch);
-            //根据证据类型获得证据的专利号
-            Proof proof = proofService.getById(arguments.getProofId());
-            String patenNo = proof.getPatentNo();
-            scratch.setPatentNo(patenNo);
-            scratch.setCreateId(loginId);
-            scratch.insert();
+        //根据划词id查询划词信息
+        Integer scratchId=argumentsDTO.getId();
+        //根据划词id获得划词信息
+        Scratch scratch =scratchService.getById(scratchId);
+        //装载划词信息并更新
+        scratch.setScratchColor(argumentsDTO.getColor());
+        scratch.setScratchType(argumentsDTO.getScratchType());
+        scratch.updateById();
+        //根据陈述意见id更新陈述意见
+        Arguments arguments = this.getById(scratch.getArgumentId());
+        arguments.setArgumentStr(argumentsDTO.getArgumentStr());
+        arguments.setRightId(argumentsDTO.getRightId());
+        arguments.setFeatureId(argumentsDTO.getFeatureId());
+        arguments.updateById();
+        //装载并更新证据
+        //根据特征和文件id获得证据
+        LambdaQueryWrapper<AssoFeatureProof> featureProofWrapper = new LambdaQueryWrapper<>();
+        featureProofWrapper.in(AssoFeatureProof::getFeatureId, argumentsDTO.getFeatureId())
+                .eq(AssoFeatureProof::getCompareFileId, arguments.getProofId());
+        List<AssoFeatureProof> assoFeatureProofs = assoFeatureProofService.list(featureProofWrapper);
+        if(assoFeatureProofs.size()==0){
+            AssoFeatureProof assoFeatureProof =new AssoFeatureProof();
+            assoFeatureProof.setFeatureId(argumentsDTO.getFeatureId());
+            assoFeatureProof.setFeatureId(arguments.getProofId());
+            assoFeatureProof.setProofStr(argumentsDTO.getProofStr());
+            assoFeatureProof.insert();
         }
+        else{
+            AssoFeatureProof assoFeatureProof = assoFeatureProofs.get(0);
+            assoFeatureProof.setProofStr(argumentsDTO.getProofStr());
+            assoFeatureProof.updateById();
 
+        }
+
+       return Response.success("修改成功");
     }
 
 
@@ -187,21 +260,194 @@ public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
      *
      * @param
      */
-    public void queryPoofArguments(Integer fileId, Integer rightSort, Integer reportId) {
+    public List<ArgumentsListVO> queryPoofArguments(Integer fileId, Integer rightSort, Integer reportId) throws IOException {
+        PatentRight patentRight = this.getPatentRight(reportId, rightSort);
+        List<ArgumentsListVO> argumentsListVOS = new ArrayList<>();
         // 根据报告id和权要id获得所有特征
         LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(Features::getReportId, reportId)
                 .eq(Features::getRightId, rightSort);
         List<Features> features = featureService.list(wrapper);
-        List<Integer> featureIds =features.stream().map(Features::getId).collect(Collectors.toList());
+        List<Integer> featureIds = features.stream().map(Features::getId).collect(Collectors.toList());
         //根据特征和文件id获得证据
-        LambdaQueryWrapper<AssoFeatureProof> featureProofWrapper =new LambdaQueryWrapper<>();
-        featureProofWrapper.in(AssoFeatureProof::getFeature_ID,featureIds)
-                .eq(AssoFeatureProof::getCompareFileId,fileId);
-        List<AssoFeatureProof> assoFeatureProofs =assoFeatureProofService.list();
-        List<Integer> assoFeatureProofIds =assoFeatureProofs.stream().map(AssoFeatureProof::getID).collect(Collectors.toList());
+        LambdaQueryWrapper<AssoFeatureProof> featureProofWrapper = new LambdaQueryWrapper<>();
+        featureProofWrapper.in(AssoFeatureProof::getFeatureId, featureIds)
+                .eq(AssoFeatureProof::getCompareFileId, fileId);
+        List<AssoFeatureProof> assoFeatureProofs = assoFeatureProofService.list(featureProofWrapper);
+        //遍历装载特征和相关证据到实体类
+        assoFeatureProofs.forEach(item -> {
+            Features features1 = features.stream().filter(tem -> tem.getId().equals(item.getFeatureId())).findFirst().orElse(null);
+
+            ArgumentsListVO argumentsListVO = new ArgumentsListVO();
+            //装载权要
+            argumentsListVO.setRightSort(patentRight.getSort());
+            argumentsListVO.setRightContent(patentRight.getContent());
+            argumentsListVO.setRightName("权要" + (patentRight.getSort() + 1));
+            //装载特征
+            argumentsListVO.setFeatureId(features1.getId());
+            argumentsListVO.setFeatureContent(features1.getContent());
+            argumentsListVO.setFeatureName("特征" + features1.getFeaturesOrder());
+
+            argumentsListVO.setProofStrId(item.getId());
+            argumentsListVO.setProofStr(item.getProofStr());
+            argumentsListVO.setProofId(fileId);
+            argumentsListVOS.add(argumentsListVO);
+        });
+
         //根据特征和证据id获得陈述意见
+        List<Arguments> arguments = this.baseMapper.getArguments(argumentsListVOS);
+
+//装载陈述意见
+        argumentsListVOS.forEach(
+                item -> {
+                    item.setArguments(new ArrayList<>());
+                    List<Arguments> temArguments = arguments.stream().filter(tem -> item.getFeatureId().equals(tem.getFeatureId())).collect(Collectors.toList());
+                    temArguments.forEach(tem -> {
+                        ArgumentsListVO.ArgumentIn argumentIn = new ArgumentsListVO.ArgumentIn();
+                        argumentIn.setArgumentStr(tem.getArgumentStr());
+                        argumentIn.setId(tem.getId());
+                        item.getArguments().add(argumentIn);
+                    });
+
+                }
+        );
+        return argumentsListVOS;
+
+    }
+
+    /**
+     * 根据排序获得权利要求
+     *
+     * @param reportId
+     * @param sort
+     * @return
+     * @throws IOException
+     */
+    private PatentRight getPatentRight(Integer reportId, Integer sort) throws IOException {
+        //获得标的专利号
+        Report report = reportService.getById(reportId);
+        //根据标的专利号获得权要
+        List<PatentRight> patentRights = featureService.getRightNames(report.getSignPatentNo());
+        PatentRight patentRight = patentRights.stream().filter(item ->
+                sort.equals(item.getSort())
+        ).findFirst().orElse(null);
+        return patentRight;
+    }
+
+    /**
+     * 批量添加或者更新陈述意见和证据
+     *
+     * @param argumentsListDTOS
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String addOrUpdatePoofArguments(List<ArgumentsListDTO> argumentsListDTOS) {
+        //当dto的大小为0时返回
+        if (argumentsListDTOS == null && argumentsListDTOS.size() <= 0) {
+            return Response.error("请输入信息");
+        }
+//        Integer createId = loginUtils.getId();
+        Integer createId = 1;
+        List<AssoFeatureProof> assoFeatureProofs = new ArrayList<>();
+        List<Arguments> arguments = new ArrayList<>();
+        List<Integer> featureIds = new ArrayList<>();
+        Integer proofId = argumentsListDTOS.get(0).getProofId();
+        argumentsListDTOS.forEach(item -> {
+            //获得特征ids
+            featureIds.add(item.getFeatureId());
+            //装载无效证据
+            AssoFeatureProof assoFeatureProof = new AssoFeatureProof();
+            assoFeatureProof.setCompareFileId(item.getProofId());
+            assoFeatureProof.setId(item.getProofStrId());
+            assoFeatureProof.setProofStr(item.getProofStr());
+            assoFeatureProof.setFeatureId(item.getFeatureId());
+            assoFeatureProofs.add(assoFeatureProof);
+            //装载陈述意见
+            List<ArgumentsListDTO.ArgumentIn> argumentIns = item.getArguments();
+            argumentIns.forEach(tem -> {
+                Arguments argument = new Arguments();
+                argument.setCreateId(createId);
+                argument.setFeatureId(item.getFeatureId());
+                argument.setArgumentStr(tem.getArgumentStr());
+                argument.setId(tem.getId());
+                argument.setProofId(item.getProofId());
+                argument.setRightId(item.getRightSort());
+                argument.setReportId(item.getReportId());
+                arguments.add(argument);
+            });
+        });
+        this.deleteOrUpdateArguments(arguments, featureIds, proofId);
+        if (!this.deleteOrUpdateProofStr(assoFeatureProofs, featureIds, proofId)) {
+            return Response.error("同一特征有多个证据");
+        }
+
+        return Response.success("添加成功");
+    }
+
+
+    /**
+     * 批量添加或者更新陈述意见
+     *
+     * @param
+     */
+    public void deleteOrUpdateArguments(List<Arguments> arguments, List<Integer> featureIds, Integer proofId) {
+        LambdaQueryWrapper<Arguments> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(Arguments::getFeatureId, featureIds)
+                .eq(Arguments::getProofId, proofId);
+        List<Arguments> dbArguments = this.list(wrapper);
+        //作差获得要删除的陈述意见
+        List<Integer> dbIds = dbArguments.stream().map(Arguments::getId).collect(Collectors.toList());
+        List<Integer> ids = arguments.stream().map(Arguments::getId).collect(Collectors.toList());
+        List<Integer> removeIds = dbIds;
+        removeIds.removeAll(ids);
+        //删除陈述意见
+        if (removeIds.size() > 0) {
+            this.deleteArguments(removeIds);
+        }
+        this.saveOrUpdateBatch(arguments);
 
     }
 
+    /**
+     * 批量删除或者更新证据详情
+     *
+     * @param assoFeatureProofs
+     * @param featureIds
+     * @param proofId
+     * @return
+     */
+    public boolean deleteOrUpdateProofStr(List<AssoFeatureProof> assoFeatureProofs, List<Integer> featureIds, Integer proofId) {
+        LambdaQueryWrapper<AssoFeatureProof> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(AssoFeatureProof::getFeatureId, featureIds)
+                .eq(AssoFeatureProof::getCompareFileId, proofId);
+        List<AssoFeatureProof> dbAssoFeatureProof = assoFeatureProofService.list(wrapper);
+        //作差获得要删除的相关证据
+        List<Integer> dbIds = dbAssoFeatureProof.stream().map(AssoFeatureProof::getId).collect(Collectors.toList());
+        List<Integer> ids = assoFeatureProofs.stream().map(AssoFeatureProof::getId).collect(Collectors.toList());
+        List<Integer> removeIds = dbIds;
+        removeIds.removeAll(ids);
+        //检查一个特征是否有多个陈述证据
+        for (AssoFeatureProof item : assoFeatureProofs) {
+            {
+                //查询是否存在多个相同
+                List<AssoFeatureProof> assoFeatureProofs1 = assoFeatureProofs.stream().filter(tem ->
+                        item.getFeatureId().equals(tem.getFeatureId())
+                                && item.getCompareFileId().equals(tem.getCompareFileId())).collect(Collectors.toList());
+                if (assoFeatureProofs1.size() > 1) {
+                    return false;
+                }
+            }
+        }
+        //删除陈述意见
+        assoFeatureProofService.removeByIds(removeIds);
+        assoFeatureProofService.saveOrUpdateBatch(assoFeatureProofs);
+
+        return true;
+    }
+
+
+    public static void main(String[] args) {
+        String a =Response.error();
+      Response av =  JSONObject.parseObject(a,Response.class);
+    System.out.println(av.getCode());
+    }
 }

+ 13 - 0
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/AssoFeatureProofService.java

@@ -35,5 +35,18 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class AssoFeatureProofService extends ServiceImpl<AssoFeatureProofMapper, AssoFeatureProof> {
 
+    public AssoFeatureProof queryProofStr(Integer proofId, Integer featureId){
+                 LambdaQueryWrapper<AssoFeatureProof> queryWrapper =new LambdaQueryWrapper<>();
+                 queryWrapper.eq(AssoFeatureProof::getCompareFileId,proofId)
+                             .eq(AssoFeatureProof::getFeatureId,featureId);
+                 List<AssoFeatureProof> assoFeatureProofs =this.list(queryWrapper);
+                 AssoFeatureProof assoFeatureProof =new AssoFeatureProof();
+                 if(assoFeatureProofs.size()>0){
+                     assoFeatureProof=   assoFeatureProofs.get(0);
+                 }
+                return  assoFeatureProof;
+
+
+    }
 
 }

+ 125 - 23
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/InvalidReasonService.java

@@ -12,14 +12,13 @@ import cn.cslg.report.common.utils.CacheUtils;
 import cn.cslg.report.common.utils.DataUtils;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.entity.CompareFiles;
 import cn.cslg.report.entity.Features;
 import cn.cslg.report.entity.Report;
-import cn.cslg.report.entity.invalidReReport.AssoPositionFeatures;
-import cn.cslg.report.entity.invalidReReport.AssoProofGroup;
-import cn.cslg.report.entity.invalidReReport.InvalidReason;
-import cn.cslg.report.entity.invalidReReport.ProofGroup;
+import cn.cslg.report.entity.invalidReReport.*;
 import cn.cslg.report.mapper.FeatureMapper;
 import cn.cslg.report.mapper.InvalidReReport.InvalidReasonMapper;
+import cn.cslg.report.service.business.CompareFilesService;
 import cn.cslg.report.service.business.FeatureService;
 import cn.cslg.report.service.business.ReportService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -53,12 +52,12 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
     private final ProofGroupService proofGroupService;
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
-
+    private final CompareFilesService compareFilesService;
     /**
      * 判断特征是否有重复的方法
      * @param checkReFeaturesDTO
      */
-    public Boolean checkReFeatures(CheckReFeaturesDTO checkReFeaturesDTO){
+    public Boolean checkReFeatures(CheckReFeaturesDTO checkReFeaturesDTO) {
         //查出表中制定报告和权要的全部特征内容和位置
          List<QueryAllFeaturesVO> queryAllFeaturesVOS = featureMapper.queryAllFeatures(checkReFeaturesDTO.getReportId(), checkReFeaturesDTO.getRightSort());
         //List<QueryAllFeaturesVO> list = queryAllFeaturesVOS.stream().sorted(Comparator.comparing(QueryAllFeaturesVO::getPosition)).collect(Collectors.toList());
@@ -120,8 +119,6 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
         }
         return true;
     }
-
-
     /**
      * 添加无效理由和证据
      * @param invalidReasonDTO 无效理由和证据Dto类
@@ -141,6 +138,9 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
             invalidReason.insert();
         } else if(invalidName.equals(0)){//若类型为0,则为“权利要求不清楚”,需要选择涉及内容(content)并输入相关证据(proofStr)
             if(invalidReasonDTO.getProofStr() != null && invalidReasonDTO.getProofStr() != ""){
+                if(invalidReasonDTO.getInvalidName()==1){
+                    invalidReasonDTO.setContent(-1);
+                }
                 //复制DTO类字段到InvalidReason实体类并保存入库
                 BeanUtils.copyProperties(invalidReasonDTO, invalidReason);
                 //获取当前登陆人信息
@@ -218,6 +218,7 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
                     proofGroupDTO.setDescription(proofGroupIn.getDescription());//描述
                     proofGroupDTO.setArgument_str(proofGroupIn.getArgument_str());//陈述意见
                     proofGroupDTO.setProofIds(proofGroupIn.getProofIds());//证据ids
+                    proofGroupDTOS.add(proofGroupDTO);
                 }
                 proofGroupService.addProofGroup(proofGroupDTOS);
             } else {
@@ -252,21 +253,104 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
      */
     @Transactional(rollbackFor = Exception.class)
     public  String updateInvalidReason(@RequestBody InvalidReasonDTO invalidReasonDTO) {
-        //判断invalidName的类型
-        // 若类型为2,3则proofGroups不能为空,features不能为空
-        //复制DTO类字段到InvalidReason实体类并更新入库
-        //若类型为2,3根据proofGroups更新 proofGroup
-           //查询该无效应对报告的所有证据组合
-           //过滤出proofGroups的id,和无效应对报告的所有证据组合id作差,并且删除所有的差值证据组合
-          //若 proofGroups里的对象的id为空则直接插入
-          //若 proofGroups里的对象的id不为空则更新
-        //若类型为2,3检查features是否有交集(根据位置和字符串长度判断)若有则返回
-        //查询该无效应对报告的所有特征和无效理由关联记录
-        //过滤出features的id,和无效应对报告的所有特征和无效理由关联记录的特征id作差,并且删除所有的差值的特征和无效理由关联记录;
-     //若类型为2,3检查id为空的features和查出来的features以及本列表中的features是否有交集(根据位置和字符串长度判断)若有则抛出异常
-        //无则插入
-        return Response.success();
-
+        if(invalidReasonDTO.getId()==null){
+            return  Response.error("请选择无效理由");
+        }
+        Integer invalidName =invalidReasonDTO.getInvalidName();
+        InvalidReason invalidReason = this.getById(invalidReasonDTO.getId());
+        if(invalidName.equals(1)) {//若类型为1,则为说明书公开不充分,涉及内容为说明书,手动输入无效证据
+            BeanUtils.copyProperties(invalidReasonDTO, invalidReason);
+            //说明书公开不充分入表
+            invalidReason.updateById();
+        } else if(invalidName.equals(0)){//若类型为0,则为“权利要求不清楚”,需要选择涉及内容(content)并输入相关证据(proofStr)
+            if(invalidReasonDTO.getProofStr() != null && invalidReasonDTO.getProofStr() != ""){
+                if(invalidReasonDTO.getInvalidName()==1){
+                    invalidReasonDTO.setContent(-1);
+                }
+                //复制DTO类字段到InvalidReason实体类并保存入库
+                BeanUtils.copyProperties(invalidReasonDTO, invalidReason);
+                //权要排序字段 值为content
+                invalidReason.setRightSort(invalidReasonDTO.getContent());
+                //无效理由入表
+                invalidReason.updateById();
+                //有可能为特征不清楚
+                //判断是否传入特征集合 (更新无特征更新,可取消)
+                if(invalidReasonDTO.getFeatures() != null && invalidReasonDTO.getFeatures().size() > 0) {
+                    //若类型为0检查features是否有交集(根据位置和字符串长度判断)若有则返回
+                    Features features = new Features();
+                    //特征内容
+                    List<InvalidReasonDTO.featuresIn> featuresIns = invalidReasonDTO.getFeatures();
+                    //过滤带有不带有特征id的特征
+                    featuresIns=featuresIns.stream().filter(item->item.getId()==null).collect(Collectors.toList());
+                    //检查特征内容是否有交集(根据位置和字符串长度判断)若有则返回
+                    //装载检查重复需要的类
+                    CheckReFeaturesDTO checkReFeaturesDTO = new CheckReFeaturesDTO();
+                    checkReFeaturesDTO.setReportId(invalidReasonDTO.getReportId());
+                    checkReFeaturesDTO.setRightSort(invalidReasonDTO.getContent());
+                    List<CheckReFeaturesDTO.featuresIn> checkFeatureIns = new ArrayList<>();
+                    for(InvalidReasonDTO.featuresIn featuresIn : featuresIns){
+                        CheckReFeaturesDTO.featuresIn featuresIn1 = new CheckReFeaturesDTO.featuresIn();
+                        BeanUtils.copyProperties(featuresIn,featuresIn1);
+                        checkFeatureIns.add(featuresIn1);
+                    }
+                    checkReFeaturesDTO.setFeatures(checkFeatureIns);
+                    Boolean isFlag = this.checkReFeatures(checkReFeaturesDTO);
+                    if (isFlag == false) {
+                        return Response.error("特征内容重复");
+                    }
+                    //不重复则需要入表
+                    //标的专利号,权要id,特征内容,报告id
+                    //通过报告id查询标的专利号
+                    Integer reportId = invalidReasonDTO.getReportId();
+                    LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.select(Report::getSignPatentNo);
+                    queryWrapper.eq(Report::getId, reportId);
+                    Report report = reportService.getOne(queryWrapper);
+                    features.setSignPatentNo(report.getSignPatentNo());
+                    //权要id(DTO类的content字段)
+                    features.setRightId(invalidReasonDTO.getContent());
+                    //报告id
+                    features.setReportId(reportId);
+                    //遍历特征内容集合,保存到表(类型为0)
+                    for (int i = 0; i < featuresIns.size(); i++) {
+                        //若类型为0,保存到特征表
+                        InvalidReasonDTO.featuresIn featuresIn = featuresIns.get(i);
+                        features.setContent(featuresIn.getFeatureStr());
+                        features.insert();
+                        //若类型为0,保存到特征与位置关联表(特征id,位置)
+                        AssoPositionFeatures assoPositionFeatures = new AssoPositionFeatures();
+                        assoPositionFeatures.setFeaturesID(features.getId());
+                        assoPositionFeatures.setPosition(featuresIn.getPosition());
+                        assoPositionFeatures.insert();
+                    }
+                }
+                //判断是否传入特征集合 (更新无特征更新,可取消)
+            } else {
+                return Response.error("相关证据不能为空");
+            }
+        } else if(invalidName.equals(2) || invalidName.equals(3)){//若类型为2,3则proofGroups不能为空
+            if(invalidReasonDTO.getProofGroups()!= null){
+                //复制DTO类字段到InvalidReason实体类并保存入库
+                BeanUtils.copyProperties(invalidReasonDTO, invalidReason);
+                invalidReason.updateById();
+                //删除无效理由的证据组合
+                proofGroupService.deleteProofGroupByInvalid(invalidReason.getId());
+                //根据proofGroups保存proofGroup
+                List<ProofGroupDTO> proofGroupDTOS = new ArrayList<>();
+                for(InvalidReasonDTO.proofGroupIn proofGroupIn:invalidReasonDTO.getProofGroups()){
+                    ProofGroupDTO proofGroupDTO = new ProofGroupDTO();
+                    proofGroupDTO.setInvalidReasonId(invalidReason.getId());//无效理由id
+                    proofGroupDTO.setDescription(proofGroupIn.getDescription());//描述
+                    proofGroupDTO.setArgument_str(proofGroupIn.getArgument_str());//陈述意见
+                    proofGroupDTO.setProofIds(proofGroupIn.getProofIds());//证据ids
+                    proofGroupDTOS.add(proofGroupDTO);
+                }
+                proofGroupService.addProofGroup(proofGroupDTOS);
+            } else {
+                return Response.error("证据组合不能为空");
+            }
+        }
+        return Response.success("更新成功");
     }
 
     /**
@@ -354,7 +438,25 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
                             proofGroupIn.setDescription(proofGroup.getDescription());
                             proofGroupIn.setArgument_str(proofGroup.getArgument_str());
                             List<Integer> proofIds = assoProofGroups.stream().filter(item->item.getGroupId().equals(proofGroup.getId())).map(AssoProofGroup::getProofId).collect(Collectors.toList());
+                           //根据证据id查询证据
+                            List<CompareFiles> proofs =new ArrayList<>();
+                            if(proofIds.size()>0) {
+                                LambdaQueryWrapper<CompareFiles> proofLambdaQueryWrapper = new LambdaQueryWrapper<CompareFiles>();
+                                proofLambdaQueryWrapper.in(CompareFiles::getId, proofIds);
+                               proofs =compareFilesService.list(proofLambdaQueryWrapper);
+                            }
+                            List<QueryInvalidReasonVO.proofIn> proofIns =new ArrayList<>();
+                            proofs.forEach(item->{
+                                QueryInvalidReasonVO.proofIn proof=new QueryInvalidReasonVO.proofIn();
+                                proof.setId(item.getId());
+                                proof.setSort(item.getSysOrder());
+                                proof.setPatentNo(item.getPatentNo());
+                                proof.setFileId(item.getFileId());
+                                proof.setFileType(item.getFileType());
+                                proofIns.add(proof);
+                            });
                             proofGroupIn.setProofIds(proofIds);
+                            proofGroupIn.setProofs(proofIns);
                             proofGroupIns.add(proofGroupIn);
                         }
                         return proofGroupIns;

+ 23 - 1
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ProofGroupService.java

@@ -60,7 +60,7 @@ public class ProofGroupService extends ServiceImpl<ProofGroupMapper,ProofGroup>
                     assoProofGroup.setGroupId(proofGroup.getId());
                     assoProofGroup.setProofId(proofGroupDTO.getProofIds().get(i));
                     assoProofGroup.setCreateId(personnelVO.getId());
-    //                assoProofGroup.setCreateId(1);
+    //
                     assoProofGroups.add(assoProofGroup);
                 }
                 assoProofGroupService.saveBatch(assoProofGroups);
@@ -90,6 +90,28 @@ public class ProofGroupService extends ServiceImpl<ProofGroupMapper,ProofGroup>
     }
 
     /**
+     *批量删除证据组合
+     * @param  证据组合ids
+     * @return
+     */
+    public void deleteProofGroupByInvalid(Integer invalidId) {
+        //根据无效理由id获得证据组合
+        LambdaQueryWrapper<ProofGroup> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(ProofGroup::getInvalidReasonId,invalidId);
+        List<ProofGroup> proofGroups =this.list(wrapper);
+        List<Integer> ids =proofGroups.stream().map(ProofGroup::getId).collect(Collectors.toList());;
+        if(ids != null && ids.size() != 0) {
+            //根据证据组合id批量删除证据组合-证据关联
+            LambdaQueryWrapper<AssoProofGroup> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.in(AssoProofGroup::getGroupId, ids);
+            assoProofGroupService.remove(queryWrapper);
+            //根据ids批量删除证据组合
+            this.removeByIds(ids);
+        } else {
+            throw new XiaoShiException("删除错误");
+        }
+    }
+    /**
      * 更新证据组合
      * @param proofGroupDTO
      * @return

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

@@ -95,6 +95,14 @@ public class ReportFileService extends ServiceImpl<ReportFileMapper, ReportFiles
         List<ReportFiles> file = this.list(queryWrapper);
         return file;
     }
-
+    public String getFile(Integer fileId) {
+        LambdaQueryWrapper<ReportFiles> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ReportFiles::getId, fileId);
+        List<ReportFiles> file = this.list(queryWrapper);
+        if(file.size()>0){
+            return file.get(0).getUrl();
+        }
+        return "";
+    }
 
 }

+ 14 - 0
RMS/src/main/resources/mapper/ArgumentsMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.cslg.report.mapper.InvalidReReport.ArgumentsMapper">
+
+    <select id="getArguments" parameterType="cn.cslg.report.common.model.vo.invalidReReport.ArgumentsListVO" resultType="cn.cslg.report.entity.invalidReReport.Arguments">
+        select * from ARGUMENTS
+        <where>
+            <foreach collection="argumentsListVOS" item="item" separator=" or ">
+              (FEATURE_ID=#{item.featureId} and COMPARE_FILE_ID=#{item.proofId})
+            </foreach>
+        </where>
+
+    </select>
+</mapper>