|
@@ -49,14 +49,6 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
Integer taskId = splitVO.getTaskId();
|
|
|
Boolean ifReSplit = splitVO.getIfReSplit();
|
|
|
|
|
|
- //当未传入拆分信息时,设置默认值
|
|
|
- if (splitBy == null) {
|
|
|
- splitBy = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if (splitType == null) {
|
|
|
- splitType = 0;
|
|
|
- }
|
|
|
// PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
personnelVO.setId("1");
|
|
@@ -72,29 +64,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
|
|
|
//查询拆分下的权要
|
|
|
List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
|
|
|
- List<String> flags = new ArrayList<>();
|
|
|
|
|
|
- List<Integer> partRightSorts = new ArrayList<>(); //权要sorts
|
|
|
- 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仅拆解主权要
|
|
|
- partRightSorts = patentRights.stream().filter(item -> item.getType().equals(1)).map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
|
- } else if (splitType.equals(1)) { //当splitType=1拆解全部权要
|
|
|
- partRightSorts = patentRights.stream().map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //
|
|
|
LambdaQueryWrapper<PatentSplitMessage> splitWrapper = new LambdaQueryWrapper<>();
|
|
|
splitWrapper.eq(PatentSplitMessage::getPatentNo, patentNo);
|
|
|
splitWrapper.eq(PatentSplitMessage::getProjectId, projectId);
|
|
@@ -104,7 +74,6 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
wrapper.eq(Feature::getProjectId, projectId)
|
|
|
.eq(Feature::getPatentNo, patentNo);
|
|
|
List<Feature> allFeatures = new ArrayList<>();
|
|
|
-
|
|
|
//如果是不重拆
|
|
|
if (!ifReSplit) {
|
|
|
//如果拆分过
|
|
@@ -113,129 +82,29 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
}
|
|
|
//如果没有拆分过
|
|
|
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);
|
|
|
-
|
|
|
- }
|
|
|
- //查询不到则新建
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //保存拆分记录
|
|
|
+ allFeatures = this.splitFeature(splitBy,splitType,patentNo,projectId,patentRights);
|
|
|
patentSplitMessage = new PatentSplitMessage();
|
|
|
patentSplitMessage.setPatentNo(patentNo);
|
|
|
patentSplitMessage.setProjectId(projectId);
|
|
|
patentSplitMessage.setTenantId(personnelVO.getTenantId());
|
|
|
patentSplitMessage.setCreateId(personnelVO.getId());
|
|
|
patentSplitMessage.insert();
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
//当重拆时新建
|
|
|
else {
|
|
|
//清除原本的
|
|
|
this.remove(wrapper);
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
+ allFeatures = this.splitFeature(splitBy,splitType,patentNo,projectId,patentRights);
|
|
|
//更新拆分信息
|
|
|
patentSplitMessage.setCreateTime(new Date());
|
|
|
patentSplitMessage.setCreateId(personnelVO.getId());
|
|
|
patentSplitMessage.updateById();
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//装载信息并返回
|
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
|
- //将拆解的权要和特征装载到对象PatentRightVo
|
|
|
- for (int i = 0; i < patentRights.size(); i++) {
|
|
|
- List<Feature> featureList = new ArrayList<>();
|
|
|
- Integer sort = patentRights.get(i).getSort();
|
|
|
-
|
|
|
- featureList = allFeatures.stream().filter(item -> item.getRightSort().equals(sort)).collect(Collectors.toList());
|
|
|
-
|
|
|
- PatentRightVo patentRightVo = new PatentRightVo();
|
|
|
- patentRightVo.setPatentNo(patentRights.get(i).getPatentNo());
|
|
|
- patentRightVo.setFeatures(featureList);
|
|
|
- patentRightVo.setContent(patentRights.get(i).getContent());
|
|
|
- patentRightVo.setSort(patentRights.get(i).getSort());
|
|
|
- patentRightVo.setType(patentRights.get(i).getType());
|
|
|
- patentRightVo.setContentOut(patentRights.get(i).getContentOut());
|
|
|
- patentRightVo.setProjectId(projectId);
|
|
|
- patentRightVo.setRightName("权要" + sort);
|
|
|
- patentRightVo.setSignPatentNo(patentNo);
|
|
|
- patentRightVos.add(patentRightVo);
|
|
|
- }
|
|
|
+ patentRightVos=this.loadPatentRightVO(patentRights,allFeatures,projectId,patentNo);
|
|
|
return patentRightVos;
|
|
|
}
|
|
|
|
|
@@ -381,4 +250,83 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
|
|
|
return patentRightContents;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public List<Feature> splitFeature(Integer splitBy,Integer splitType,String patentNo,Integer projectId,List<RePatentClaim> patentRights) throws IOException {
|
|
|
+ List<Feature> allFeatures =new ArrayList<>();
|
|
|
+ PersonnelVO personnelVO = new PersonnelVO();
|
|
|
+ personnelVO.setId("1");
|
|
|
+ personnelVO.setTenantId(1);
|
|
|
+ List<String> flags = new ArrayList<>();
|
|
|
+ List<Integer> partRightSorts = new ArrayList<>(); //权要sorts
|
|
|
+ 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仅拆解主权要
|
|
|
+ partRightSorts = patentRights.stream().filter(item -> item.getType().equals(1)).map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
|
+ } else if (splitType.equals(1)) { //当splitType=1拆解全部权要
|
|
|
+ partRightSorts = patentRights.stream().map(RePatentClaim::getSort).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ //遍历权要保存特征
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return allFeatures;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PatentRightVo> loadPatentRightVO(List<RePatentClaim> patentRights,List<Feature>allFeatures,Integer projectId,String patentNo){
|
|
|
+ List<PatentRightVo> patentRightVos =new ArrayList<>();
|
|
|
+ //将拆解的权要和特征装载到对象PatentRightVo
|
|
|
+ for (int i = 0; i < patentRights.size(); i++) {
|
|
|
+ List<Feature> featureList = new ArrayList<>();
|
|
|
+ Integer sort = patentRights.get(i).getSort();
|
|
|
+
|
|
|
+ featureList = allFeatures.stream().filter(item -> item.getRightSort().equals(sort)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ PatentRightVo patentRightVo = new PatentRightVo();
|
|
|
+ patentRightVo.setPatentNo(patentRights.get(i).getPatentNo());
|
|
|
+ patentRightVo.setFeatures(featureList);
|
|
|
+ patentRightVo.setContent(patentRights.get(i).getContent());
|
|
|
+ patentRightVo.setSort(patentRights.get(i).getSort());
|
|
|
+ patentRightVo.setType(patentRights.get(i).getType());
|
|
|
+ patentRightVo.setContentOut(patentRights.get(i).getContentOut());
|
|
|
+ patentRightVo.setProjectId(projectId);
|
|
|
+ patentRightVo.setRightName("权要" + sort);
|
|
|
+ patentRightVo.setSignPatentNo(patentNo);
|
|
|
+ patentRightVos.add(patentRightVo);
|
|
|
+ }
|
|
|
+ return patentRightVos;
|
|
|
+ }
|
|
|
}
|