Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

chenyi před 2 roky
rodič
revize
615b7f821e

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

@@ -62,7 +62,7 @@ public class ReportController {
 
     @RequestMapping(value = "/updateReport", method = RequestMethod.POST)
     @Operation(summary = "修改报告")
-    public String updateReport( String report, List<MultipartFile> files) {
+    public String updateReport( String report, List<MultipartFile> files) throws IOException {
         if (report != null) {
             Report report1 =JSONObject.parseObject(report,Report.class);
             report1.setScenarioId(StringUtils.join(report1.getScenarioList(), ","));

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

@@ -22,11 +22,5 @@ import java.io.IOException;
 @RequestMapping(Constants.REPORT_API + "/reportFile")
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ReportFileController {
-    public final TemplateService templateService;
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
-    @Operation(summary = "添加文件")
-    public  String getTemplateByType(ReportFiles reportFiles,MultipartFile file) throws IOException{
-        return Response.success();
-    }
 
 }

+ 5 - 0
RMS/src/main/java/cn/cslg/report/entity/Features.java

@@ -67,6 +67,11 @@ public class Features extends BaseEntity<Features> {
     @TableField(value = "SPLIT_BY")
     private Integer splitBy;
 
+    /**
+     *  拆分方式
+     */
+    @TableField(value = "SPLIT_Type")
+    private Integer splitType;
     @TableField(value = "RIGHT_NAME")
     private String rightName;
 

+ 7 - 1
RMS/src/main/java/cn/cslg/report/entity/Report.java

@@ -170,9 +170,15 @@ public class Report extends BaseEntity<Report> {
     /**
      * 创建人姓名
      */
-    @Schema(description="拆分类型")
+    @Schema(description="创建人姓名")
     @TableField(value = "CREATE_PERSON_NAME")
     private String createPersonName;
+    /**
+     * 备注
+     */
+    @Schema(description="REMARK")
+    @TableField(value = "REMARK")
+    private String remark;
 
     /**
      * 文件

+ 58 - 65
RMS/src/main/java/cn/cslg/report/service/business/FeatureService.java

@@ -79,10 +79,12 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
      */
     public String splitPatentRight(String patentNo, Integer splitType, Integer splitBy, Integer reportId) throws IOException {
         PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
+        //根据报告ID查询报告
         LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
         queryWrapper.eq(Report::getId, reportId);
+        //未查到报告报错
        if( reportService.list(queryWrapper).size()==0){
-           return Response.error();
+           return Response.error("未查询到报告");
        }
         Report report = reportService.list(queryWrapper).get(0);
         Integer flag = 0;
@@ -92,6 +94,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         if(splitType==null){
             splitType=0;
         }
+        //如果报告未拆分过权要,或者拆分类型不同则更新报告
         if (report.getSplitBy() == null || report.getSplitType() == null || report.getSplitBy() != splitBy || report.getSplitType() != splitType) {
             report.setSplitBy(splitBy);
             report.setSplitType(splitType);
@@ -105,14 +108,15 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         JSONObject jsonObject = JSONObject.parseObject(resBody);
         //解析jason获得标的专利的权要
         List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
+        //给权要进行格式更改
         List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin);
         List<Integer> partRightIds = new ArrayList<>();
         List<String> flags = new ArrayList<>();
         // 当splitType=0仅拆解主权要
-        if (splitType == 0) {
-            partRightIds = patentRights.stream().filter(item -> item.getType() == 1).map(PatentRight::getId).collect(Collectors.toList());
+        if (splitType .equals(0) ) {
+            partRightIds = patentRights.stream().filter(item -> item.getType() .equals(1) ).map(PatentRight::getId).collect(Collectors.toList());
         }// 当splitType=1拆解全部权要
-        else if (splitType == 1) {
+        else if (splitType .equals(1) ) {
             partRightIds = patentRights.stream().map(PatentRight::getId).collect(Collectors.toList());
         }
         //当splitBy=0时仅仅根据“,”拆解
@@ -131,22 +135,23 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
             flags.add(",");
             flags.add(",");
         }
+        Integer a=splitBy;
+        Integer b =splitType;
         Features featureTO = new Features();
         featureTO.setReportId(reportId);
         featureTO.setSignPatentNo(patentNo);
-        //featureTO.setPartnerId();
-        //查询数据库里是否有查询记录
+        featureTO.setPartnerId(personnelVO.getId());
+        featureTO.setSplitType(splitType);
+        featureTO.setSplitBy(splitBy);
+        //查询数据库里是否有拆分记录
         List<Features> featureFromDb = this.queryFeatures(featureTO);
+        //删除所有不符合登录人拆分条件的拆分特征
         LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(Features::getReportId, reportId)
                 .eq(Features::getSignPatentNo, patentNo)
-                .eq(Features::getPartnerId, personnelVO.getId())
-                .ne(Features::getSplitBy,splitBy);
-        if(splitType==1)
-        {wrapper.ne(Features::getSplitBy,-1);}
+                .eq(Features::getPartnerId, personnelVO.getId());
+        wrapper.and(QueryWrapper -> QueryWrapper.ne(Features::getSplitBy,a).or().ne(Features::getSplitType,b));
         this.remove(wrapper);
-
-
         //将拆解的权要和特征装载到对象PatentRightVo
         for (int i = 0; i < patentRights.size(); i++) {
             //特征序号
@@ -156,19 +161,22 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
             String name ="权要"+tems[0].replace(" ","");
             int rightId = patentRights.get(i).getId();
             //对需要拆解的权要进行拆解
-            Integer a=splitBy;
-            if (partRightIds.contains(patentRights.get(i).getId())) {
 
                 if (featureFromDb != null && featureFromDb.size() != 0) {
-                    featuresList = featureFromDb.stream().filter(item -> item.getRightId() .equals(rightId)  && item.getSplitBy().equals(a)  &&item.getPartnerId().equals(personnelVO.getId())).collect(Collectors.toList());
+                    featuresList = featureFromDb.stream().filter(item -> item.getRightId() .equals(rightId) &&item.getSplitBy().equals(a) &&item.getPartnerId().equals(personnelVO.getId())&&item.getSplitType().equals(b)).collect(Collectors.toList());
                 }
                 //如果数据库里无拆解记录则手动插入一条
                 if (featuresList == null || featuresList.size() == 0 || flag == 1) {
                     featuresList = new ArrayList<>();
-                    //获得权要的译文并且拆解
-                    List<String> contentOuts = this.splitStringByFlags(patentRights.get(i).getContentOut(), flags);
-                    //获得权要的原文并且拆解
-                    List<String> contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
+                    List<String> contentOuts = Arrays.asList(patentRights.get(i).getContentOut());
+                    List<String> contents =Arrays.asList(patentRights.get(i).getContent());
+                    //如果是需要拆解的权要
+                    if (partRightIds.contains(patentRights.get(i).getId())) {
+                        //获得权要的译文并且拆解
+                       contentOuts = this.splitStringByFlags(patentRights.get(i).getContentOut(), flags);
+                        //获得权要的原文并且拆解
+                         contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
+                    }
                     //遍历拆解出来的内容并装载到features最后存入列表
                     for (int t = 0; t < contents.size(); t++) {
                         Features features = new Features();
@@ -184,31 +192,12 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
                         features.setRightName(name);
                         features.setFeaturesOrder(order);
                         features.setRightType(patentRights.get(i).getType());
+                        features.setSplitType(splitType);
                         featuresList.add(features);
                         order+=1;
                     }
                     this.saveBatch(featuresList);
                 }
-            }
-            else{
-                featuresList = featureFromDb.stream().filter(item -> item.getRightId() == rightId && item.getSplitBy() == -1 &&item.getPartnerId()==personnelVO.getId()).collect(Collectors.toList());
-                if (featuresList == null || featuresList.size() == 0 || flag == 1) {
-                        Features features = new Features();
-                        features.setRightId(patentRights.get(i).getId());
-                        features.setIsFinal(0);
-                        features.setSignPatentNo(patentNo);
-                        features.setReportId(reportId);
-                        features.setContentOut(patentRights.get(i).getContentOut());
-                        features.setContent(patentRights.get(i).getContent());
-                        features.setSplitBy(-1);
-                        features.setPartnerId(personnelVO.getId());
-                        features.setRightName(name);
-                        features.setFeaturesOrder(1);
-                        features.insert();
-                    featuresList.add(features);
-                }
-            }
-
             //装载到对象PatentRightVo
             PatentRightVo patentRightVo = new PatentRightVo();
             patentRightVo.setPatentId(patentRights.get(i).getPatentId());
@@ -227,7 +216,6 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         map.put("splitBy", report.getSplitBy());
         map.put("splitType", report.getSplitType());
         return Response.success(map);
-
     }
 
     /**
@@ -239,6 +227,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
      */
 
     public String getFeatures(String patentNos, Integer reportId) throws IOException {
+
         LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
         queryWrapper.eq(Report::getId, reportId);
         if(reportService.list(queryWrapper).size()==0){
@@ -261,6 +250,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
      Features featureTO = new Features();
         featureTO.setReportId(reportId);
         featureTO.setSignPatentNo(patentNo);
+        featureTO.setReportId(reportId);
+        featureTO.setSignPatentNo(patentNo);
+        featureTO.setPartnerId(loginUtils.getId());
         //查询数据库里是否有查询记录
         List<Features> featureFromDb = this.queryFeatures(featureTO);
         //将拆解的权要和特征装载到对象PatentRightVo
@@ -270,12 +262,11 @@ 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.getPartnerId()==report.getPersonId()).collect(Collectors.toList());
+                    featuresList = featureFromDb.stream().filter(item -> item.getRightId().equals(rightId)  &&item.getPartnerId().equals(report.getPersonId())).collect(Collectors.toList());
                 }
 
             //装载到对象PatentRightVo
             PatentRightVo patentRightVo = new PatentRightVo();
-
             String name = "权要" + (i + 1);
             patentRightVo.setPatentId(patentRights.get(i).getPatentId());
             patentRightVo.setFeatures(featuresList);
@@ -339,45 +330,49 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         if (features.getReportId() != null) {
             lambdaQueryWrapper.eq(Features::getReportId, features.getReportId());
         }
+        if (features.getSplitType() != null) {
+            lambdaQueryWrapper.eq(Features::getSplitType, features.getSplitType());
+        }
         featureList = this.list(lambdaQueryWrapper);
         return featureList;
     }
 
     /**
-     * @author 沈永艺
+     * @author 李仁杰
      * @deprecated 保存特征
      */
     @Transactional(rollbackFor = Exception.class)
     public String addFeatures(List<PatentRightVo> patentRightVos) {
+        // 获取登录人信息
         PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
+        List<Features> features = new ArrayList<>();
+        //根据登录人Id,报告Id,标的专利号查询特征
         LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
-       Features feature = this.list(wrapper).get(0);
-
         if (patentRightVos.get(0).getReportId() != null && patentRightVos.get(0).getSignPatentNo() != null) {
             wrapper.eq(Features::getReportId, patentRightVos.get(0).getReportId())
                     .eq(Features::getSignPatentNo, patentRightVos.get(0).getSignPatentNo())
                     .eq(Features::getPartnerId, personnelVO.getId());
+            Features feature = this.list(wrapper).get(0);
+            //根据登录人Id,报告Id,标的专利号删除原有特征
             this.remove(wrapper);
-        }
-        List<Features> features = new ArrayList<>();
-        for (int i = 0; i < patentRightVos.size(); i++) {
-             int order=1;
-            PatentRightVo patentRightVo = patentRightVos.get(i);
-            if (patentRightVo.getFeatures() != null && patentRightVo.getFeatures().size() != 0) {
-                List<Features> tem =patentRightVo.getFeatures();
-                for (int t = 0; t < tem.size(); t++) {
-                    tem.get(t).setPartnerId(personnelVO.getId());
-                    tem.get(t).setFeaturesOrder(order);
-                    tem.get(t).setPartnerId(feature.getPartnerId());
-                    tem.get(t).setRightName(feature.getRightName());
-                    tem.get(t).setRightType(feature.getRightType());
-                    order+=1;
-                    features.add(tem.get(t));
+            for (int i = 0; i < patentRightVos.size(); i++) {
+                int order=1;
+                PatentRightVo patentRightVo = patentRightVos.get(i);
+                if (patentRightVo.getFeatures() != null && patentRightVo.getFeatures().size() != 0) {
+                    List<Features> tem =patentRightVo.getFeatures();
+                    for (int t = 0; t < tem.size(); t++) {
+                        tem.get(t).setFeaturesOrder(order);
+                        tem.get(t).setPartnerId(personnelVO.getId());
+                        tem.get(t).setSplitBy(feature.getSplitBy());
+                        tem.get(t).setSplitType(feature.getSplitType());
+                        tem.get(t).setId(null);
+                        order+=1;
+                        features.add(tem.get(t));
+                    }
                 }
             }
         }
-
-        this.saveBatch(features);
+        this.saveOrUpdateBatch(features);
         return Response.success();
     }
 
@@ -399,12 +394,10 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         patentNos.removeAll(signPatentNos);
         if(patentNos.size()==0)
         {return Response.success();}
-
         patentVO.setPatentNos(patentNos);
       String res=  outInterfaceService.getPatentFromPAS(patentVO,1);
-        return res;
-
 
+        return res;
     }
     public Features select(int id){
         LambdaQueryWrapper<Features> queryWrapper = new LambdaQueryWrapper<>();

+ 36 - 12
RMS/src/main/java/cn/cslg/report/service/business/ReportDocumentService.java

@@ -81,7 +81,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
      */
     public String exportReport(Integer reportId,Integer templeId) throws IOException {
           //根据模板ID获得模板
-        Template reportTemplate=  templateService.getById(templeId);
+        Template reportTemplate= templateService.getById(templeId);
         //获得模板路径
         String filePath =fileUtils.getPath(reportTemplate.getTemplatePath());
         // 读取模板后保存生成word的地址
@@ -95,29 +95,38 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         allFeaturesWrapper.eq(Features::getPartnerId, report.getPersonId())
                 .eq(Features::getReportId, report.getId());
         List<Features> allFeatures = featureService.list(allFeaturesWrapper);
-        //查询所有的对比方案并获得Id
+        //根据报告Id 查询出报告下所有的方案
         LambdaQueryWrapper<CompareScenarios> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(CompareScenarios::getReportId, reportId);
         List<CompareScenarios> compareScenarios = compareScenariosService.list(queryWrapper);
         List<Integer> scenarioIds = compareScenarios.stream().map(CompareScenarios::getId).collect(Collectors.toList());
-        //根据对比方案Id 从关联表里获得对比记录特征关联ID
+        //根据对比方案Id 查询所有对比方案和(对比记录-特征)关联信息
         List<AssoScenarIOS> scenariosRecords =new ArrayList<>();
         if(scenarioIds!=null&&scenarioIds.size()!=0) {
             LambdaQueryWrapper<AssoScenarIOS> queryRecordsByIDs = new LambdaQueryWrapper<>();
             queryRecordsByIDs.in(AssoScenarIOS::getScenariosID, scenarioIds);
             scenariosRecords = scenariosRecordsService.list(queryRecordsByIDs);
         }
-
+       //获得对比记录-特征关联ID
         List<Integer> recordfeatureRecordIds = scenariosRecords.stream().map(AssoScenarIOS::getFeatureRecordID).collect(Collectors.toList());
-        //根据关联ID查出报告Id和特征Id
+        //根据对比记录-特征关联ID查出对比记录-特征关联信息
         List<AssoRecordsFeature>  assoRecordsFeatures =new ArrayList<>();
         if(recordfeatureRecordIds!=null&&recordfeatureRecordIds.size()!=0){
         LambdaQueryWrapper<AssoRecordsFeature> wrapper =new LambdaQueryWrapper<>();
         wrapper.in(AssoRecordsFeature::getId,recordfeatureRecordIds);
         assoRecordsFeatures =assoRecordsFeatureService.list(wrapper);}
         List<AssoRecordsFeature> finalAsso =assoRecordsFeatures;
+        //从对比记录-特征关联信息里剔出对比记录Id
         List<Integer> recordIds =assoRecordsFeatures.stream().map(AssoRecordsFeature::getRecordsId).collect(Collectors.toList());
-        //根据对比记录ID查询对比记录
+        //从对比记录-特征关联信息里剔出特征Id
+        List<Integer>  sFeatureIds =assoRecordsFeatures.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
+        //根据特征ID查询出报告所有方案的特征
+        List<Features> sFeatures =new ArrayList<>();
+        LambdaQueryWrapper<Features> sFeaturesWrapper = new LambdaQueryWrapper<>();
+        sFeaturesWrapper.eq(Features::getId, sFeatureIds);
+        if(sFeatures!=null&&sFeatures.size()!=0){
+       sFeatures = featureService.list(sFeaturesWrapper);}
+        //根据对比记录ID查询出报告所有方案的对比记录
         List<CompareRecords> compareRecords =new ArrayList<>();
         if(recordIds!=null&&recordIds.size()!=0){
         LambdaQueryWrapper<CompareRecords> queryPatentByIDs = new LambdaQueryWrapper<>();
@@ -145,6 +154,20 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             applicantJSONs.forEach(tem -> {
                 applicants.append(tem.get("name") + "\r");
             });
+           //填充相关揭露(对比记录文字和特征组合)
+            StringBuffer disclosures =new StringBuffer("");
+            //根据专利号获得对比记录
+     List<CompareRecords> pantentRecords = compareRecords.stream().filter(tem->tem.getPatentNo().equals(item.get("publicNo"))).collect(Collectors.toList());
+            //遍历对比记录根据对比记录获得对比记录-特征关联信息并获得特征ID
+            for (CompareRecords tem:pantentRecords) {
+                //填充对比记录文字
+                disclosures.append(tem.getContent());
+                List<Integer> featuresIds= assoRecordsFeatures.stream().filter(te->te.getRecordsId().equals(tem.getId())).map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
+                //根据特征Id获得特征内容
+                List<String>  feaListContent =sFeatures.stream().filter(te->featuresIds.contains(te.getId())).map(Features::getContent).collect(Collectors.toList());
+                feaListContent.forEach(te->disclosures.append("("+te+")"));
+                disclosures.append("\n");
+            }
             patentListMap.put("name", item.get("name"));
             patentListMap.put("fileName", "D" + (i + 1));
             patentListMap.put("publicDate", item.get("publicDate"));
@@ -155,11 +178,12 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             patentListMap.put("abstractStr", item.get("abstractStr"));
             patentListMap.put("compareFileName", "对比文件" + (i + 1));
             patentListMap.put("applicationDate", item.get("applicationDate"));
-            patentListMap.put("abstractPath", item.get("abstractPath"));
+            patentListMap.put("abstractPath", fileUtils.getSystemPath()+item.get("abstractPath"));
+            patentListMap.put("disclosures",disclosures);
             patentListMaps.add(patentListMap);
+            //给出现的专利添加别名
             OtherName.put(item.get("publicNo").toString(), ("D" + (i + 1)));
         }
-
         //存放对比方案信息的map集合
         List<Map<String, Object>> scenariosMaps = new ArrayList<>();
         //存放所有对比方案所有不重复的rightId
@@ -207,11 +231,12 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
                     patentNo = OtherName.get(patentNo).toString();
                 }
                 //获得解析过程
-                String paresingProcess =record.getParesingProcess()!=null?record.getParesingProcess():"";
-             compareContent =patentNo+":"+content+"("+paresingProcess+")";
+                String paresingProcess =record.getParesingProcess()!=null?"("+record.getParesingProcess()+")":"";
+             compareContent =patentNo+":"+content+paresingProcess;
                 //获取对比专利号
                 map.put("compareContent", compareContent);
-                map.put("figure",record.getFilePath());
+                map.put("figure",fileUtils.getSystemPath()+record.getFilePath());
+                map.put("position",record.getPosition());
                 maps.add(map);
             });
             //方案内容
@@ -240,7 +265,6 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
                         }
                     }
             );
-
             //创造性列表
             List<String> creativeFiles = new ArrayList<>();
             //当前方案所有的特征Id

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

@@ -84,11 +84,25 @@ public class ReportFieldOptionService extends ServiceImpl<ReportFieldOptionMappe
     @Transactional
     public void addBatch(List<ReportFieldOption> optionList, Integer fieldId) {
         if (optionList.size() != 0) {
-            optionList.forEach(item -> item.setFieldId(fieldId));
+            optionList.forEach(item -> {
+                item.setFieldId(fieldId);
+                    }
+            );
             this.saveOrUpdateBatch(optionList);
         }
     }
 
+    @Transactional
+    public void addBatchs(List<ReportFieldOption> optionList, Integer fieldId) {
+        if (optionList.size() != 0) {
+            optionList.forEach(item -> {
+                        item.setFieldId(fieldId);
+                        item.setId(null);
+                    }
+            );
+            this.saveOrUpdateBatch(optionList);
+        }
+    }
     public void edit(ReportFieldOption option) {
         option.updateById();
     }

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

@@ -216,8 +216,6 @@ private  final  AssoTaskPersonelService assoTaskPersonelService;
         reportFields.forEach(p->{
             if(p.getType().equals(1)||p.getType().equals(0)||p.getType().equals(2)){
 
-
-
             }
             if(p.getType().equals(3)||p.getType().equals(4)||p.getType().equals(5)){
                 //根据自定义字段的ID 从表中查出选项列表
@@ -225,7 +223,7 @@ private  final  AssoTaskPersonelService assoTaskPersonelService;
                  wrapper.eq(ReportFieldOption::getFieldId, p.getOriginId());
                 List<ReportFieldOption> reportFieldOptions =reportFieldOptionService.list(wrapper);
 
-                reportFieldOptionService.addBatch(reportFieldOptions,p.getId());
+                reportFieldOptionService.addBatchs(reportFieldOptions,p.getId());
             }
 
             if(p.getType().equals(6)){

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

@@ -401,7 +401,7 @@ public class ReportFieldTreeService extends ServiceImpl<ReportFieldTreeMapper, R
 
     public void addBatchs(List<ReportFieldTree> treeList, Integer fieldid) {
         if (treeList.size() != 0) {
-            treeList.forEach(ite -> ite.setFieldId(fieldid));
+            treeList.forEach(ite -> {ite.setFieldId(fieldid); ite.setId(null);});
             this.saveOrUpdateBatch(treeList);
         }
     }

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

@@ -178,7 +178,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
      * @throws IOException
      */
     @Transactional(rollbackFor = Exception.class)
-    public Boolean updateReport(Report report, List<MultipartFile> files) {
+    public Boolean updateReport(Report report, List<MultipartFile> files) throws IOException {
         // 根据报告Id查询对应的附件Id
         LambdaQueryWrapper<AssoReportFile> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(AssoReportFile::getReportId, report.getId());

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

@@ -46,9 +46,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     private final ReportFieldService reportFieldService;
 
     /**
-     * @function: 根据任务id 删除任务id
      * @param id(Task 任务id)
      * @return
+     * @function: 根据任务id 删除任务id
      */
     @Transactional(rollbackFor = Exception.class)
     public String deleteTask(Integer id) {
@@ -65,17 +65,17 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     }
 
     /**
-     * @function: 根据任务id 删除任务id
      * @param id(Task 任务id)
      * @return
+     * @function: 根据任务id 删除任务id
      */
 
     @Transactional(rollbackFor = Exception.class)
     public Boolean deleteTaskByreportId(Integer id) {
         try {
-            LambdaQueryWrapper<Task> queryWrapper =new LambdaQueryWrapper<>();
-            queryWrapper.eq(Task::getReportId,id);
-            return  this.remove(queryWrapper);
+            LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(Task::getReportId, id);
+            return this.remove(queryWrapper);
         } catch (Exception e) {
             log.error("删除任务异常,异常信息:" + LogExceptionUtil.getMessage(e));
             log.info("删除任务异常,开始回滚! 时间: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
@@ -84,10 +84,11 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
             return false;
         }
     }
+
     /**
-     * @function: 修改导入任务
      * @param Task
      * @return
+     * @function: 修改导入任务
      */
     @Transactional(rollbackFor = Exception.class)
     public String updateTask(Task task) {
@@ -104,9 +105,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     }
 
     /**
-     * @function 查询任务
      * @param taskVO
      * @return
+     * @function 查询任务
      */
     public String queryPageList(TaskVO taskVO) {
         //获得登录人的信息
@@ -141,8 +142,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         }
 
     }
+
     /**
-     *  @function 获取对比任务
+     * @function 获取对比任务
      */
     public String getAllTask() {
         List<Task> taskList = this.list();
@@ -222,12 +224,15 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
     //添加分配任务
     @Transactional(rollbackFor = Exception.class)
     public String addAssTask(AssignTaskVO assignTaskVO) throws ParseException, IOException {
-        PatentVO patentVO =assignTaskVO.getPatentVO();
+        PatentVO patentVO = new PatentVO();
+        if (assignTaskVO.getPatentVO() != null) {
+            patentVO = assignTaskVO.getPatentVO();
+        }
         LambdaQueryWrapper<Report> wrapper1 = new LambdaQueryWrapper<>();
         wrapper1.eq(Report::getId, assignTaskVO.getReportId());
-        Report report =reportService.list(wrapper1).get(0);
+        Report report = reportService.list(wrapper1).get(0);
         //添加分配任务时将报告的状态置为创建中
-        if(report.getStatus()!=2){
+        if (report.getStatus() != 2) {
             report.setStatus(2);
             report.updateById();
         }
@@ -260,17 +265,17 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         List<CompareFiles> compareFiles = compareFilesService.list(wrapper);
         List<String> AllpatentNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
         //无查询条件
-        if (patentVO.getFiledOptions() == null||patentVO.getFiledOptions().size() == 0) {
+        if (patentVO == null || patentVO.getFiledOptions() == null || patentVO.getFiledOptions().size() == 0) {
             patentVO.setPatentNos(AllpatentNos);
         }
         //有查询条件时,自定义字段的专利号和任务的专利号取交集
         else {
-         List<String>   temPatentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
+            List<String> temPatentNos = reportFieldService.getPatentNo(patentVO.getFiledOptions());
             List<String> jiaoList = new ArrayList<>(AllpatentNos);
             jiaoList.retainAll(temPatentNos);
             patentVO.setPatentNos(jiaoList);
         }
-        String res = outInterfaceService.getConPantentNos(patentVO,1);
+        String res = outInterfaceService.getConPantentNos(patentVO, 1);
         JSONObject jsonObject1 = JSONObject.parseObject(res);
         List<String> patentNos = JSONArray.parseArray(jsonObject1.get("data").toString(), String.class);
         if (patentNos.size() > num) {
@@ -300,8 +305,11 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
             task.setSignPatentNo(signPatentNO);
             task.insert();
             //根据数量从分配的专利号列表中截取该数量的专利号,加上分配信息的专利号进行装配
-            List<String> partNos = patentNos.subList(flag, flag + personPatents.get(i).getAssignCount());
-            flag += personPatents.get(i).getAssignCount();
+            List<String> partNos = new ArrayList<>();
+            if (personPatents.get(i).getPatentNos() == null || personPatents.get(i).getPatentNos().size() == 0) {
+                partNos = patentNos.subList(flag, flag + personPatents.get(i).getAssignCount());
+                flag += personPatents.get(i).getAssignCount();
+            }
             partNos.addAll(personPatents.get(i).getPatentNos());
             for (int t = 0; t < partNos.size(); t++) {
                 AssoTaskPersonel assoTaskPersonel = new AssoTaskPersonel();