|
@@ -1,19 +1,18 @@
|
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
+import cn.cslg.pas.common.TreeBuild;
|
|
|
+import cn.cslg.pas.common.dto.QuerySplitDTO;
|
|
|
import cn.cslg.pas.common.dto.business.SelectClaimDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.PatentRightUtils;
|
|
|
-import cn.cslg.pas.common.vo.PatentRightParams;
|
|
|
-import cn.cslg.pas.common.vo.PatentRightVo;
|
|
|
-import cn.cslg.pas.common.vo.RePatentClaim;
|
|
|
+import cn.cslg.pas.common.vo.*;
|
|
|
import cn.cslg.pas.common.vo.business.SplitVO;
|
|
|
import cn.cslg.pas.domain.business.Feature;
|
|
|
import cn.cslg.pas.domain.business.ReportProject;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.FeatureMapper;
|
|
|
import cn.cslg.pas.service.business.es.EsService;
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -80,7 +79,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
List<String> flags = new ArrayList<>();
|
|
|
|
|
|
List<Integer> partRightSorts = new ArrayList<>(); //权要sorts
|
|
|
- if (!ifUpdate) {
|
|
|
+ if (ifUpdate) {
|
|
|
if (splitBy == 0) { //当splitBy=0时仅仅根据“,”拆解
|
|
|
flags.add(",");
|
|
|
flags.add(",");
|
|
@@ -106,7 +105,23 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
List<Feature> allFeatures = new ArrayList<>();
|
|
|
if (!ifUpdate) {
|
|
|
allFeatures = this.list(wrapper);
|
|
|
+ } else {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
|
//将拆解的权要和特征装载到对象PatentRightVo
|
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
@@ -114,26 +129,44 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
Integer sort = patentRights.get(i).getSort();
|
|
|
//当更新拆分时
|
|
|
if (ifUpdate) {
|
|
|
- //删除原来的拆分特征
|
|
|
- this.remove(wrapper);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
- //根据拆分方式返回特征
|
|
|
- List<String> contents = Arrays.asList(patentRights.get(i).getContent());
|
|
|
+ } 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());
|
|
|
- featureList.add(feature);
|
|
|
+ //如果是需要拆解的权要
|
|
|
+ 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);
|
|
@@ -145,7 +178,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
|
|
|
}
|
|
|
PatentRightVo patentRightVo = new PatentRightVo();
|
|
|
- patentRightVo.setPatentId(patentRights.get(i).getPatentId());
|
|
|
+ patentRightVo.setPatentNo(patentRights.get(i).getPatentNo());
|
|
|
patentRightVo.setFeatures(featureList);
|
|
|
patentRightVo.setContent(patentRights.get(i).getContent());
|
|
|
patentRightVo.setSort(patentRights.get(i).getSort());
|
|
@@ -213,4 +246,90 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
|
|
|
});
|
|
|
return patentRights;
|
|
|
}
|
|
|
+
|
|
|
+ //获得专利拆分信息
|
|
|
+ public QuerySplitVO getSplitMessage(QuerySplitDTO splitDTO) {
|
|
|
+ QuerySplitVO splitVO = new QuerySplitVO();
|
|
|
+ //根据项目id和专利号查询拆分信息
|
|
|
+ LambdaQueryWrapper<ReportProject> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(ReportProject::getProjectId, splitDTO.getProjectId());
|
|
|
+ ReportProject reportProject = reportProjectService.getOne(lambdaQueryWrapper, false);
|
|
|
+ if (reportProject == null) {
|
|
|
+ throw new XiaoShiException("未查询到报告");
|
|
|
+ }
|
|
|
+ Integer splitType = reportProject.getSplitType();
|
|
|
+ Integer splitBy = reportProject.getSplitBy();
|
|
|
+ if (splitBy != null && splitType != null) {
|
|
|
+ splitVO.setSplitBy(splitBy);
|
|
|
+ splitVO.setSplitType(splitType);
|
|
|
+ } else {
|
|
|
+ splitVO.setSplitBy(0);
|
|
|
+ splitVO.setSplitType(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return splitVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<RePatentClaim> getPatentRight(String patentNo) {
|
|
|
+ try {
|
|
|
+ List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
|
|
|
+ return patentRights;
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new XiaoShiException("系统错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PatentRightTree> getPatentRightTree(String patentNo) {
|
|
|
+ try {
|
|
|
+ List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
|
|
|
+
|
|
|
+ List<PatentRightTree> treeNodeList = new ArrayList<>();
|
|
|
+ //装载权要原文
|
|
|
+ PatentRightParams params = new PatentRightParams();
|
|
|
+ params.setPatentNo(patentNo);
|
|
|
+ params.setContent("");
|
|
|
+
|
|
|
+
|
|
|
+ //判断若处理后的权要集合只有1个元素并且类型type=-1、排序号sort=-1,则表示本次拆分失败,则直接返回整个权要
|
|
|
+ if (patentRights.size() == 1 && patentRights.get(0).getType() == -1 && patentRights.get(0).getSort() == -1) {
|
|
|
+ treeNodeList.add(new PatentRightTree(patentRights.get(0).getSort(), null, patentRights.get(0).getContent()));
|
|
|
+ return treeNodeList;
|
|
|
+ }
|
|
|
+ List<PatentRightContent> patentRightContents = this.loadPatentRightContent(patentRights);
|
|
|
+ for (PatentRightContent patentRightContent : patentRightContents) {
|
|
|
+ treeNodeList.add(new PatentRightTree(patentRightContent.getSort(), patentRightContent.getParentSorts(), patentRightContent.getContent()));
|
|
|
+ }
|
|
|
+ //开始进行权要树装载
|
|
|
+ try {
|
|
|
+ TreeBuild treeBuild = new TreeBuild(treeNodeList);
|
|
|
+ treeNodeList = treeBuild.buildTree();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return treeNodeList;
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new XiaoShiException("系统错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<PatentRightContent> loadPatentRightContent(List<RePatentClaim> rePatentClaims) {
|
|
|
+ List<PatentRightContent> patentRightContents = new ArrayList<>();
|
|
|
+ rePatentClaims.forEach(item -> {
|
|
|
+ List<Integer> sorts = new ArrayList<>();
|
|
|
+ String[] a = item.getParentSort().split(",");
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ sorts.add(Integer.parseInt(a[i]));
|
|
|
+ }
|
|
|
+ PatentRightContent patentRightContent = new PatentRightContent();
|
|
|
+ patentRightContent.setContent(item.getContent());
|
|
|
+ patentRightContent.setType(item.getType());
|
|
|
+ patentRightContent.setSort(item.getSort());
|
|
|
+ patentRightContent.setParentSorts(sorts);
|
|
|
+ patentRightContents.add(patentRightContent);
|
|
|
+ });
|
|
|
+
|
|
|
+ return patentRightContents;
|
|
|
+ }
|
|
|
}
|