|
@@ -40,13 +40,19 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
|
|
|
public String addCompareRecord(CompareRecords compareRecord) throws IOException {
|
|
|
compareRecord.insert();
|
|
|
//对比方案与对比记录关联表对比文件添加
|
|
|
- List<AssoRecordsFeature> assoRecordsFeatures = compareRecord.getList();
|
|
|
+ List<AssoRecordsFeature> assoRecordsFeatures = compareRecord.getAssoRecordsFeatures();
|
|
|
assoRecordsFeatures.forEach(item -> item.setRecordsId(compareRecord.getId()));
|
|
|
assoRecordsFeatureService.saveBatch(assoRecordsFeatures);
|
|
|
return Response.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
public String deleCompareRecords(int id) throws IOException {
|
|
|
this.removeById(id);
|
|
|
return Response.success();
|
|
@@ -54,31 +60,13 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String updateCompareRecords(CompareRecords compareRecord) throws IOException {
|
|
|
-
|
|
|
- //根据对比文件的id 获取对比方案与对比记录关联表的内容
|
|
|
-
|
|
|
- LambdaQueryWrapper<AssoRecordsFeature> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AssoRecordsFeature::getRecordsId, compareRecord.getId());
|
|
|
- //删除获取的内容
|
|
|
- List<AssoRecordsFeature> list = assoRecordsFeatureService.list(queryWrapper);
|
|
|
+ LambdaQueryWrapper<AssoRecordsFeature> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoRecordsFeature::getRecordsId,compareRecord.getId());
|
|
|
assoRecordsFeatureService.remove(queryWrapper);
|
|
|
- List<Integer> collect = list.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
|
|
|
- List<Features> features = compareRecord.getAssoRecordsFeatures();
|
|
|
- LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(Features::getId,collect);
|
|
|
- featureService.remove(wrapper);
|
|
|
- featureService.saveBatch(features);
|
|
|
- List<AssoRecordsFeature> list1 =new ArrayList<>();
|
|
|
- for(Features f :features){
|
|
|
- AssoRecordsFeature a=new AssoRecordsFeature();
|
|
|
- a.setRecordsId(compareRecord.getId());
|
|
|
- a.setFeatureId(f.getId());
|
|
|
- list1.add(a);
|
|
|
-
|
|
|
- }
|
|
|
- assoRecordsFeatureService.saveBatch(list1);
|
|
|
- return Response.success();
|
|
|
-
|
|
|
+ List<AssoRecordsFeature> assoRecordsFeatures = compareRecord.getAssoRecordsFeatures();
|
|
|
+ assoRecordsFeatures.forEach(item -> item.setRecordsId(compareRecord.getId()));
|
|
|
+ assoRecordsFeatureService.saveBatch(assoRecordsFeatures);
|
|
|
+ return Response.success();
|
|
|
}
|
|
|
/**
|
|
|
* @function: 根据对比记录的报告id,任务
|
|
@@ -128,11 +116,11 @@ public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, Com
|
|
|
List<AssoRecordsFeature> assoRecordsFeatures1 = assoRecordsFeatures.stream().filter(item -> item.getRecordsId().equals(records.getId())).collect(Collectors.toList());
|
|
|
//获取特征id
|
|
|
List<Integer> featureId = assoRecordsFeatures1.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
|
|
|
- records.setList(assoRecordsFeatures1);
|
|
|
+ records.setAssoRecordsFeatures(assoRecordsFeatures1);
|
|
|
//根据获取的过滤
|
|
|
List<Features> featuresList = features.stream().filter(item -> featureId.contains(item.getId())).collect(Collectors.toList());
|
|
|
records.setFeaturesIdList(featureId);
|
|
|
- records.setAssoRecordsFeatures(featuresList);
|
|
|
+ records.setFeatures(featuresList);
|
|
|
if(!headerPatentNos.contains(records.getPatentNo())){
|
|
|
headerPatentNos.add(records.getPatentNo());}
|
|
|
}
|