|
@@ -9,6 +9,7 @@ import cn.cslg.pas.common.utils.PatentRightUtils;
|
|
import cn.cslg.pas.common.vo.*;
|
|
import cn.cslg.pas.common.vo.*;
|
|
import cn.cslg.pas.common.vo.business.SplitVO;
|
|
import cn.cslg.pas.common.vo.business.SplitVO;
|
|
import cn.cslg.pas.domain.business.Feature;
|
|
import cn.cslg.pas.domain.business.Feature;
|
|
|
|
+import cn.cslg.pas.domain.business.PatentSplitMessage;
|
|
import cn.cslg.pas.domain.business.ReportProject;
|
|
import cn.cslg.pas.domain.business.ReportProject;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.mapper.FeatureMapper;
|
|
import cn.cslg.pas.mapper.FeatureMapper;
|
|
@@ -36,6 +37,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
@Autowired
|
|
@Autowired
|
|
private ReportProjectService reportProjectService;
|
|
private ReportProjectService reportProjectService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private PatentSplitMessageService patentSplitMessageService;
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public List<PatentRightVo> splitPatentFeature(SplitVO splitVO) throws IOException {
|
|
public List<PatentRightVo> splitPatentFeature(SplitVO splitVO) throws IOException {
|
|
String patentNo = splitVO.getPatentNo();
|
|
String patentNo = splitVO.getPatentNo();
|
|
@@ -43,7 +47,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
Integer splitType = splitVO.getSplitType();
|
|
Integer splitType = splitVO.getSplitType();
|
|
Integer splitBy = splitVO.getSplitBy();
|
|
Integer splitBy = splitVO.getSplitBy();
|
|
Integer taskId = splitVO.getTaskId();
|
|
Integer taskId = splitVO.getTaskId();
|
|
- Boolean ifUpdate = false;
|
|
|
|
|
|
+ Boolean ifReSplit = splitVO.getIfReSplit();
|
|
|
|
|
|
//当未传入拆分信息时,设置默认值
|
|
//当未传入拆分信息时,设置默认值
|
|
if (splitBy == null) {
|
|
if (splitBy == null) {
|
|
@@ -65,33 +69,24 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
if (reportProjects.size() == 0) {
|
|
if (reportProjects.size() == 0) {
|
|
throw new XiaoShiException("未查询到报告");
|
|
throw new XiaoShiException("未查询到报告");
|
|
}
|
|
}
|
|
- ReportProject report = reportProjectService.list(queryWrapper).get(0);
|
|
|
|
- //如果报告未拆分过权要,或者拆分类型不同则更新报告
|
|
|
|
- if (report.getSplitBy() == null || report.getSplitType() == null || report.getSplitBy() != splitBy || report.getSplitType() != splitType) {
|
|
|
|
- report.setSplitBy(splitBy);
|
|
|
|
- report.setSplitType(splitType);
|
|
|
|
- report.updateById();
|
|
|
|
- ifUpdate = true;
|
|
|
|
- }
|
|
|
|
|
|
|
|
//查询拆分下的权要
|
|
//查询拆分下的权要
|
|
List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
|
|
List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
|
|
List<String> flags = new ArrayList<>();
|
|
List<String> flags = new ArrayList<>();
|
|
|
|
|
|
List<Integer> partRightSorts = new ArrayList<>(); //权要sorts
|
|
List<Integer> partRightSorts = new ArrayList<>(); //权要sorts
|
|
- if (ifUpdate) {
|
|
|
|
- if (splitBy == 0) { //当splitBy=0时仅仅根据“,”拆解
|
|
|
|
- flags.add(",");
|
|
|
|
- flags.add(",");
|
|
|
|
- } else if (splitBy == 1) { //当splitBy=1时仅仅根据“;“拆解
|
|
|
|
- flags.add(";");
|
|
|
|
- flags.add(";");
|
|
|
|
- } else if (splitBy == 2) { //当splitBy=2时根据“;“和”,”拆解
|
|
|
|
- flags.add(";");
|
|
|
|
- flags.add(";");
|
|
|
|
- flags.add(",");
|
|
|
|
- flags.add(",");
|
|
|
|
- }
|
|
|
|
|
|
+ if (splitBy == 0) { //当splitBy=0时仅仅根据“,”拆解
|
|
|
|
+ flags.add(",");
|
|
|
|
+ flags.add(",");
|
|
|
|
+ } else if (splitBy == 1) { //当splitBy=1时仅仅根据“;“拆解
|
|
|
|
+ flags.add(";");
|
|
|
|
+ flags.add(";");
|
|
|
|
+ } else if (splitBy == 2) { //当splitBy=2时根据“;“和”,”拆解
|
|
|
|
+ flags.add(";");
|
|
|
|
+ flags.add(";");
|
|
|
|
+ flags.add(",");
|
|
|
|
+ flags.add(",");
|
|
|
|
+
|
|
if (splitType.equals(0)) { //当splitType=0仅拆解主权要
|
|
if (splitType.equals(0)) { //当splitType=0仅拆解主权要
|
|
partRightSorts = patentRights.stream().filter(item -> item.getType().equals(1)).map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
partRightSorts = patentRights.stream().filter(item -> item.getType().equals(1)).map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
} else if (splitType.equals(1)) { //当splitType=1拆解全部权要
|
|
} else if (splitType.equals(1)) { //当splitType=1拆解全部权要
|
|
@@ -99,84 +94,139 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //
|
|
|
|
+ LambdaQueryWrapper<PatentSplitMessage> splitWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ splitWrapper.eq(PatentSplitMessage::getPatentNo, patentNo);
|
|
|
|
+ splitWrapper.eq(PatentSplitMessage::getProjectId, projectId);
|
|
|
|
+ PatentSplitMessage patentSplitMessage = patentSplitMessageService.getOne(splitWrapper, false);
|
|
|
|
+
|
|
LambdaQueryWrapper<Feature> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<Feature> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(Feature::getProjectId, projectId)
|
|
wrapper.eq(Feature::getProjectId, projectId)
|
|
.eq(Feature::getPatentNo, patentNo);
|
|
.eq(Feature::getPatentNo, patentNo);
|
|
List<Feature> allFeatures = new ArrayList<>();
|
|
List<Feature> allFeatures = new ArrayList<>();
|
|
- if (!ifUpdate) {
|
|
|
|
- allFeatures = this.list(wrapper);
|
|
|
|
- } else {
|
|
|
|
|
|
+
|
|
|
|
+ //如果是不重拆
|
|
|
|
+ if (!ifReSplit) {
|
|
|
|
+ //如果拆分过
|
|
|
|
+ if (patentSplitMessage != null) {
|
|
|
|
+ allFeatures = this.list(wrapper);
|
|
|
|
+ }
|
|
|
|
+ //如果没有拆分过
|
|
|
|
+ else {
|
|
|
|
+ LambdaQueryWrapper<PatentSplitMessage> haveSplitWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ haveSplitWrapper.eq(PatentSplitMessage::getPatentNo, patentNo)
|
|
|
|
+ .eq(PatentSplitMessage::getTenantId, personnelVO.getTenantId());
|
|
|
|
+ haveSplitWrapper.orderByDesc(PatentSplitMessage::getCreateTime);
|
|
|
|
+ List<PatentSplitMessage> patentSplitMessages = patentSplitMessageService.list(haveSplitWrapper);
|
|
|
|
+ //如果查询到原本拆分信息则复制
|
|
|
|
+ if (patentSplitMessages.size() > 0) {
|
|
|
|
+ PatentSplitMessage doneMessage = patentSplitMessages.get(0);
|
|
|
|
+ //根据报告id和专利号查询特征
|
|
|
|
+ LambdaQueryWrapper<Feature> featureLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ featureLambdaQueryWrapper.eq(Feature::getPatentNo, doneMessage.getPatentNo())
|
|
|
|
+ .eq(Feature::getProjectId, doneMessage.getProjectId());
|
|
|
|
+ List<Feature> features = this.list(featureLambdaQueryWrapper);
|
|
|
|
+ features.forEach(item -> {
|
|
|
|
+ item.setCreateId(personnelVO.getId());
|
|
|
|
+ item.setId(null);
|
|
|
|
+ item.setProjectId(projectId);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ allFeatures = new ArrayList<>(features);
|
|
|
|
+ //保存拆分记录
|
|
|
|
+ patentSplitMessage = new PatentSplitMessage();
|
|
|
|
+ patentSplitMessage.setPatentNo(patentNo);
|
|
|
|
+ patentSplitMessage.setProjectId(projectId);
|
|
|
|
+ patentSplitMessage.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ patentSplitMessage.setCreateId(personnelVO.getId());
|
|
|
|
+ patentSplitMessage.insert();
|
|
|
|
+ }
|
|
|
|
+ //查询不到则新建
|
|
|
|
+ else {
|
|
|
|
+ allFeatures = new ArrayList<>();
|
|
|
|
+ //遍历权要保存特征
|
|
|
|
+ for (int i = 0; i < patentRights.size(); i++) {
|
|
|
|
+ List<Feature> featureList = new ArrayList<>();
|
|
|
|
+ //根据拆分方式返回特征
|
|
|
|
+ List<String> contents = Arrays.asList(patentRights.get(i).getContent());
|
|
|
|
+
|
|
|
|
+ //如果是需要拆解的权要
|
|
|
|
+ if (partRightSorts.contains(patentRights.get(i).getSort())) {
|
|
|
|
+ //获得权要的原文并且拆解
|
|
|
|
+ contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
|
|
|
|
+ }
|
|
|
|
+ for (int t = 0; t < contents.size(); t++) {
|
|
|
|
+ Feature feature = new Feature();
|
|
|
|
+ feature.setRightSort(patentRights.get(i).getSort());
|
|
|
|
+ feature.setPatentNo(patentNo);
|
|
|
|
+ feature.setProjectId(projectId);
|
|
|
|
+ feature.setContent(contents.get(t));
|
|
|
|
+ feature.setCreateId(personnelVO.getId());
|
|
|
|
+ feature.setRightType(patentRights.get(i).getType());
|
|
|
|
+ feature.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ featureList.add(feature);
|
|
|
|
+ }
|
|
|
|
+ if (featureList.size() > 0) {
|
|
|
|
+ this.saveBatch(featureList);
|
|
|
|
+ allFeatures.addAll(featureList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //更新拆分信息
|
|
|
|
+ patentSplitMessage.setCreateTime(new Date());
|
|
|
|
+ patentSplitMessage.setCreateId(personnelVO.getId());
|
|
|
|
+ patentSplitMessage.updateById();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //当重拆时新建
|
|
|
|
+ else {
|
|
|
|
+ //清除原本的
|
|
this.remove(wrapper);
|
|
this.remove(wrapper);
|
|
- // 查询出拆分方式和专利号都和此专利一样的专利
|
|
|
|
- LambdaQueryWrapper<Feature> featureLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
- featureLambdaQueryWrapper.eq(Feature::getSplitBy, splitBy)
|
|
|
|
- .eq(Feature::getSplitType, splitType)
|
|
|
|
- .eq(Feature::getPatentNo, patentNo);
|
|
|
|
- Feature feature = this.getOne(featureLambdaQueryWrapper, false);
|
|
|
|
- if (feature != null) {
|
|
|
|
- LambdaQueryWrapper<Feature> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
- wrapper1
|
|
|
|
- .eq(Feature::getProjectId, feature.getProjectId())
|
|
|
|
- .eq(Feature::getPatentNo, patentNo);
|
|
|
|
- allFeatures = this.list(wrapper1);
|
|
|
|
|
|
+ allFeatures = new ArrayList<>();
|
|
|
|
+ //遍历权要保存特征
|
|
|
|
+ for (int i = 0; i < patentRights.size(); i++) {
|
|
|
|
+ List<Feature> featureList = new ArrayList<>();
|
|
|
|
+ //根据拆分方式返回特征
|
|
|
|
+ List<String> contents = Arrays.asList(patentRights.get(i).getContent());
|
|
|
|
+
|
|
|
|
+ //如果是需要拆解的权要
|
|
|
|
+ if (partRightSorts.contains(patentRights.get(i).getSort())) {
|
|
|
|
+ //获得权要的原文并且拆解
|
|
|
|
+ contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
|
|
|
|
+ }
|
|
|
|
+ for (int t = 0; t < contents.size(); t++) {
|
|
|
|
+ Feature feature = new Feature();
|
|
|
|
+ feature.setRightSort(patentRights.get(i).getSort());
|
|
|
|
+ feature.setPatentNo(patentNo);
|
|
|
|
+ feature.setProjectId(projectId);
|
|
|
|
+ feature.setContent(contents.get(t));
|
|
|
|
+ feature.setCreateId(personnelVO.getId());
|
|
|
|
+ feature.setRightType(patentRights.get(i).getType());
|
|
|
|
+ feature.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ featureList.add(feature);
|
|
|
|
+ }
|
|
|
|
+ if (featureList.size() > 0) {
|
|
|
|
+ this.saveBatch(featureList);
|
|
|
|
+ allFeatures.addAll(featureList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ //更新拆分信息
|
|
|
|
+ patentSplitMessage.setCreateTime(new Date());
|
|
|
|
+ patentSplitMessage.setCreateId(personnelVO.getId());
|
|
|
|
+ patentSplitMessage.updateById();
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //装载信息并返回
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
//将拆解的权要和特征装载到对象PatentRightVo
|
|
//将拆解的权要和特征装载到对象PatentRightVo
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
List<Feature> featureList = new ArrayList<>();
|
|
List<Feature> featureList = new ArrayList<>();
|
|
Integer sort = patentRights.get(i).getSort();
|
|
Integer sort = patentRights.get(i).getSort();
|
|
- //当更新拆分时
|
|
|
|
- if (ifUpdate) {
|
|
|
|
- featureList = allFeatures.stream().filter(item -> item.getRightSort().equals(sort)).collect(Collectors.toList());
|
|
|
|
- if (featureList.size() > 0) {
|
|
|
|
- for (Feature item : featureList) {
|
|
|
|
- Feature feature = new Feature();
|
|
|
|
- feature.setRightSort(item.getRightSort());
|
|
|
|
- feature.setPatentNo(patentNo);
|
|
|
|
- feature.setProjectId(projectId);
|
|
|
|
- feature.setContent(item.getContent());
|
|
|
|
- feature.setCreateId(personnelVO.getId());
|
|
|
|
- feature.setRightType(item.getRightType());
|
|
|
|
- feature.setTenantId(personnelVO.getTenantId());
|
|
|
|
- feature.setSplitBy(splitBy);
|
|
|
|
- feature.setSplitType(splitType);
|
|
|
|
- featureList.add(feature);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- //根据拆分方式返回特征
|
|
|
|
- List<String> contents = Arrays.asList(patentRights.get(i).getContent());
|
|
|
|
|
|
|
|
- //如果是需要拆解的权要
|
|
|
|
- if (partRightSorts.contains(patentRights.get(i).getSort())) {
|
|
|
|
- //获得权要的原文并且拆解
|
|
|
|
- contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
|
|
|
|
- }
|
|
|
|
- for (int t = 0; t < contents.size(); t++) {
|
|
|
|
- Feature feature = new Feature();
|
|
|
|
- feature.setRightSort(patentRights.get(i).getSort());
|
|
|
|
- feature.setPatentNo(patentNo);
|
|
|
|
- feature.setProjectId(projectId);
|
|
|
|
- feature.setContent(contents.get(t));
|
|
|
|
- feature.setCreateId(personnelVO.getId());
|
|
|
|
- feature.setRightType(patentRights.get(i).getType());
|
|
|
|
- feature.setTenantId(personnelVO.getTenantId());
|
|
|
|
- feature.setSplitBy(splitBy);
|
|
|
|
- feature.setSplitType(splitType);
|
|
|
|
- featureList.add(feature);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (featureList.size() > 0) {
|
|
|
|
- this.saveBatch(featureList);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //当不更新时,返回信息
|
|
|
|
- else {
|
|
|
|
- featureList = allFeatures.stream().filter(item -> item.getRightSort().equals(sort)).collect(Collectors.toList());
|
|
|
|
|
|
+ featureList = allFeatures.stream().filter(item -> item.getRightSort().equals(sort)).collect(Collectors.toList());
|
|
|
|
|
|
- }
|
|
|
|
PatentRightVo patentRightVo = new PatentRightVo();
|
|
PatentRightVo patentRightVo = new PatentRightVo();
|
|
patentRightVo.setPatentNo(patentRights.get(i).getPatentNo());
|
|
patentRightVo.setPatentNo(patentRights.get(i).getPatentNo());
|
|
patentRightVo.setFeatures(featureList);
|
|
patentRightVo.setFeatures(featureList);
|