瀏覽代碼

查询权要权利要求树

lwhhszx 1 年之前
父節點
當前提交
d9a1762023

+ 72 - 70
src/main/java/cn/cslg/pas/common/TreeBuild.java

@@ -1,5 +1,7 @@
 package cn.cslg.pas.common;
 
+import cn.cslg.pas.common.vo.PatentRightTree;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -8,76 +10,76 @@ import java.util.List;
  * @date 2023/8/31
  */
 public class TreeBuild {
-//
-//    // 保存参与构建树形的所有数据(通常数据库查询结果)
-//    public List<TreeNode> nodeList;
-//
-//    /**
-//     * 构造方法
-//     *
-//     * @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。
-//     */
-//    public TreeBuild(List<TreeNode> nodeList) {
-//        this.nodeList = nodeList;
-//    }
-//
-//    /**
-//     * 获取需构建的所有根节点(顶级节点) "-1"
-//     *
-//     * @return 所有根节点List集合
-//     */
-//    public List<TreeNode> getRootNode() {
-//        // 保存所有根节点(所有根节点的数据)
-//        List<TreeNode> rootNodeList = new ArrayList<>();
-//        // TreeNode:查询出的每一条数据(节点)
-//        for (TreeNode treeNode : nodeList) {
-//            // 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
-//            if (treeNode.getParentSorts().contains(-1)) {
-//                // 是,添加
-//                rootNodeList.add(treeNode);
-//            }
-//        }
-//        return rootNodeList;
-//    }
-//
-//    /**
-//     * 根据每一个顶级节点(根节点)进行构建树形结构
-//     *
-//     * @return 构建整棵树
-//     */
-//    public List<TreeNode> buildTree() {
-//        // TreeNodes:保存一个顶级节点所构建出来的完整树形
-//        List<TreeNode> TreeNodes = new ArrayList<>();
-//        // getRootNode():获取所有的根节点
-//        for (TreeNode treeRootNode : getRootNode()) {
-//            // 将顶级节点进行构建子树
-//            treeRootNode = buildChildTree(treeRootNode);
-//            // 完成一个顶级节点所构建的树形,增加进来
-//            TreeNodes.add(treeRootNode);
-//        }
-//        return TreeNodes;
-//    }
-//
-//    /**
-//     * 递归-----构建子树形结构
-//     *
-//     * @param pNode 根节点(顶级节点)
-//     * @return 整棵树
-//     */
-//    public TreeNode buildChildTree(TreeNode pNode) {
-//        List<TreeNode> childTree = new ArrayList<>();
-//        // nodeList:所有节点集合(所有数据)
-//        for (TreeNode treeNode : nodeList) {
-//            // 判断当前节点的父节点ID是否等于根节点的ID,即当前节点是否为其下的子节点
-//            if (treeNode.getParentSorts().contains(pNode.getSort())) {
-//                // 再递归进行判断当前节点的情况,调用自身方法
-//                childTree.add(buildChildTree(treeNode));
-//            }
-//        }
-//        // for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
-//        pNode.setChildren(childTree);
-//        return pNode;
-//    }
+
+    // 保存参与构建树形的所有数据(通常数据库查询结果)
+    public List<PatentRightTree> nodeList;
+
+    /**
+     * 构造方法
+     *
+     * @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。
+     */
+    public TreeBuild(List<PatentRightTree> nodeList) {
+        this.nodeList = nodeList;
+    }
+
+    /**
+     * 获取需构建的所有根节点(顶级节点) "-1"
+     *
+     * @return 所有根节点List集合
+     */
+    public List<PatentRightTree> getRootNode() {
+        // 保存所有根节点(所有根节点的数据)
+        List<PatentRightTree> rootNodeList = new ArrayList<>();
+        // TreeNode:查询出的每一条数据(节点)
+        for (PatentRightTree treeNode : nodeList) {
+            // 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
+            if (treeNode.getParentSorts().contains(-1)) {
+                // 是,添加
+                rootNodeList.add(treeNode);
+            }
+        }
+        return rootNodeList;
+    }
+
+    /**
+     * 根据每一个顶级节点(根节点)进行构建树形结构
+     *
+     * @return 构建整棵树
+     */
+    public List<PatentRightTree> buildTree() {
+        // TreeNodes:保存一个顶级节点所构建出来的完整树形
+        List<PatentRightTree> TreeNodes = new ArrayList<>();
+        // getRootNode():获取所有的根节点
+        for (PatentRightTree treeRootNode : getRootNode()) {
+            // 将顶级节点进行构建子树
+            treeRootNode = buildChildTree(treeRootNode);
+            // 完成一个顶级节点所构建的树形,增加进来
+            TreeNodes.add(treeRootNode);
+        }
+        return TreeNodes;
+    }
+
+    /**
+     * 递归-----构建子树形结构
+     *
+     * @param pNode 根节点(顶级节点)
+     * @return 整棵树
+     */
+    public PatentRightTree buildChildTree(PatentRightTree pNode) {
+        List<PatentRightTree> childTree = new ArrayList<>();
+        // nodeList:所有节点集合(所有数据)
+        for (PatentRightTree treeNode : nodeList) {
+            // 判断当前节点的父节点ID是否等于根节点的ID,即当前节点是否为其下的子节点
+            if (treeNode.getParentSorts().contains(pNode.getSort())) {
+                // 再递归进行判断当前节点的情况,调用自身方法
+                childTree.add(buildChildTree(treeNode));
+            }
+        }
+        // for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
+        pNode.setChildren(childTree);
+        return pNode;
+    }
 
 
 }

+ 9 - 0
src/main/java/cn/cslg/pas/common/dto/QuerySplitDTO.java

@@ -0,0 +1,9 @@
+package cn.cslg.pas.common.dto;
+
+import lombok.Data;
+
+@Data
+public class QuerySplitDTO {
+private Integer projectId;
+private Integer patentNo;
+}

+ 8 - 8
src/main/java/cn/cslg/pas/common/utils/PatentRightUtils.java

@@ -130,7 +130,7 @@ public class PatentRightUtils {
                                 }
                             }
                             RePatentClaim patentRight = new RePatentClaim()
-                                    .setPatentId(params.getPatentId())
+                                    .setPatentNo(params.getPatentNo())
                                     .setType(0)
                                     .setContent(strs[i])
                                     .setSort(i)
@@ -147,7 +147,7 @@ public class PatentRightUtils {
                         } else if (matcher1.find()) {
                             String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
                             RePatentClaim patentRight = new RePatentClaim()
-                                    .setPatentId(params.getPatentId())
+                                    .setPatentNo(params.getPatentNo())
                                     .setType(0)
                                     .setContent(strs[i])
                                     .setSort(i)
@@ -160,7 +160,7 @@ public class PatentRightUtils {
 
                     } else {
                         RePatentClaim patentRight = new RePatentClaim()
-                                .setPatentId(params.getPatentId())
+                                .setPatentNo(params.getPatentNo())
                                 .setType(1)
                                 .setContent(strs[i])
                                 .setSort(i)
@@ -239,7 +239,7 @@ public class PatentRightUtils {
                                 }
                             }
                             RePatentClaim patentRight = new RePatentClaim()
-                                    .setPatentId(params.getPatentId())
+                                    .setPatentNo(params.getPatentNo())
                                     .setType(0)
                                     .setContent(strs[i])
                                     .setSort(i)
@@ -256,7 +256,7 @@ public class PatentRightUtils {
                         } else if (matcher1.find()) {
                             String parentNum = matcher1.group().substring(matcher1.group().indexOf("m") + 2);
                             RePatentClaim patentRight = new RePatentClaim()
-                                    .setPatentId(params.getPatentId())
+                                    .setPatentNo(params.getPatentNo())
                                     .setType(0)
                                     .setContent(strs[i])
                                     .setSort(i)
@@ -279,7 +279,7 @@ public class PatentRightUtils {
                                 builder.append(i).append(",");
                             }
                             RePatentClaim patentRight = new RePatentClaim()
-                                    .setPatentId(params.getPatentId())
+                                    .setPatentNo(params.getPatentNo())
                                     .setType(0)
                                     .setContent(strs[i])
                                     .setSort(i)
@@ -297,7 +297,7 @@ public class PatentRightUtils {
 
                     } else {
                         RePatentClaim patentRight = new RePatentClaim()
-                                .setPatentId(params.getPatentId())
+                                .setPatentNo(params.getPatentNo())
                                 .setType(1)
                                 .setContent(strs[i])
                                 .setSort(i)
@@ -319,7 +319,7 @@ public class PatentRightUtils {
         } catch (Exception e) {
             e.printStackTrace();
             ArrayList<RePatentClaim> patentRights = new ArrayList<>();
-            patentRights.add(new RePatentClaim().setPatentId(params.getPatentId()).setContent(params.getContent()).setContentOut(params.getContentOut()).setType(1).setSort(0).setParentSort("-1"));
+            patentRights.add(new RePatentClaim().setPatentNo(params.getPatentNo()).setContent(params.getContent()).setContentOut(params.getContentOut()).setType(1).setSort(0).setParentSort("-1"));
             return patentRights;
         }
     }

+ 2 - 10
src/main/java/cn/cslg/pas/common/PatentRightContent.java

@@ -1,18 +1,10 @@
-package cn.cslg.pas.common;
+package cn.cslg.pas.common.vo;
 
 import lombok.Data;
-import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.List;
 
-/**
- * 权要的文本树类
- *
- * @author chenyu
- * @date 2023/8/31
- */
-@Accessors(chain = true)
 @Data
 public class PatentRightContent implements Serializable {
     /**
@@ -36,4 +28,4 @@ public class PatentRightContent implements Serializable {
      */
     private Integer type;
 
-}
+}

+ 40 - 0
src/main/java/cn/cslg/pas/common/vo/PatentRightTree.java

@@ -0,0 +1,40 @@
+package cn.cslg.pas.common.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * 树结构类
+ *
+ * @author chenyu
+ * @date 2023/8/31
+ */
+@Accessors(chain = true)
+@Data
+public class PatentRightTree {
+    /**
+     * 节点ID(权要排序号)
+     */
+    private Integer sort;
+    /**
+     * 父节点ID:顶级节点为-1(父级权要排序号)
+     */
+    private List<Integer> parentSorts;
+    /**
+     * 节点名称(权要内容)
+     */
+    private String content;
+    /**
+     * 子节点(当前权要的所有子级权要)
+     */
+    private List<PatentRightTree> children;
+
+    public PatentRightTree(Integer sort, List<Integer> parentSorts, String content) {
+        this.sort = sort;
+        this.parentSorts = parentSorts;
+        this.content = content;
+    }
+
+}

+ 1 - 1
src/main/java/cn/cslg/pas/common/vo/PatentRightVo.java

@@ -32,7 +32,7 @@ public class PatentRightVo {
     /**
      * 专利ID
      */
-    private Integer patentId;
+    private String patentNo;
 
     /**
      * 内容

+ 11 - 0
src/main/java/cn/cslg/pas/common/vo/QuerySplitVO.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Accessors(chain = true)
+@Data
+public class QuerySplitVO {
+private Integer splitBy;
+private Integer splitType;
+}

+ 1 - 2
src/main/java/cn/cslg/pas/common/vo/RePatentClaim.java

@@ -18,7 +18,7 @@ public class RePatentClaim {
         /**
          * 专利ID
          */
-        private Integer patentId;
+        private String patentNo;
 
         /**
          * 内容
@@ -43,5 +43,4 @@ public class RePatentClaim {
          */
         private String parentSort;
 
-
 }

+ 37 - 6
src/main/java/cn/cslg/pas/controller/FeatureController.java

@@ -1,20 +1,20 @@
 package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.QuerySplitDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.common.vo.business.SplitVO;
 import cn.cslg.pas.service.business.FeatureService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 /**
  * 特征Controller层
+ *
  * @Author lrj
  * @Date 2023/12/5
  */
@@ -27,10 +27,41 @@ public class FeatureController {
 
     @Operation(summary = "查询特征")
     @PostMapping("/spiltFeature")
-    public Response queryCustomField(@RequestBody SplitVO splitVO) throws Exception {
+    public Response spiltFeature(@RequestBody SplitVO splitVO) throws Exception {
+        try {
+            Records records = new Records();
+            records.setData(featureService.splitPatentFeature(splitVO));
+            return Response.success(records);
 
-        return null;
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
     }
 
+    @Operation(summary = "查询拆分信息")
+    @PostMapping("/getSplitMessage")
+    public Response getSplitMessage(@RequestBody QuerySplitDTO splitDTO) throws Exception {
+        try {
+            Records records = new Records();
+            records.setData(featureService.getSplitMessage(splitDTO));
+            return Response.success(records);
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
 
+    }
+
+
+    @Operation(summary = "查询权要")
+    @GetMapping("/getPatentRight")
+    public Response queryCustomField(String patentNo) throws Exception {
+        try {
+            Records records = new Records();
+            records.setData(featureService.getPatentRight(patentNo));
+            return Response.success(records);
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
+
+    }
 }

+ 8 - 0
src/main/java/cn/cslg/pas/domain/business/Feature.java

@@ -69,4 +69,12 @@ public class Feature extends BaseEntity<Feature> {
      */
     @TableField(value = "create_time")
     private Date createTime;
+
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
+
+    @TableField(value="split_type")
+    private Integer splitType;
+    @TableField(value = "split_by")
+    private Integer splitBy;
 }

+ 143 - 24
src/main/java/cn/cslg/pas/service/business/FeatureService.java

@@ -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;
+    }
 }

+ 17 - 2
src/test/java/cn/cslg/pas/service/FeatureTests.java

@@ -1,11 +1,14 @@
 package cn.cslg.pas.service;
 
 import cn.cslg.pas.common.dto.business.ProductMarketDataDTO;
+import cn.cslg.pas.common.vo.PatentRightTree;
 import cn.cslg.pas.common.vo.PatentRightVo;
 import cn.cslg.pas.common.vo.business.SplitVO;
 import cn.cslg.pas.controller.ProductMarketDataController;
+import cn.cslg.pas.domain.business.Feature;
 import cn.cslg.pas.service.business.FeatureService;
 import cn.cslg.pas.service.business.ProductMarketDataService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,13 +32,25 @@ public class FeatureTests {
     @Test
     public void splitPantentFeature() throws Exception {
         SplitVO splitVO =new SplitVO();
-        splitVO.setSplitBy(0);
-        splitVO.setSplitType(0);
+        splitVO.setSplitBy(2);
+        splitVO.setSplitType(1);
         splitVO.setProjectId(51);
         splitVO.setPatentNo("CN102324864A");
   List<PatentRightVo> a = featureService.splitPatentFeature(splitVO);
      System.out.println(a);
     }
 
+    @Test
+    public  void test(){
+        LambdaQueryWrapper<Feature> featureLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        featureLambdaQueryWrapper.eq(Feature::getSplitBy, 2);
+        Feature feature = featureService.getOne(featureLambdaQueryWrapper,false);
+        System.out.println(feature);
+    }
 
+    @Test
+    public  void getTree(){
+   List<PatentRightTree> a= featureService.getPatentRightTree("CN102324864A");
+    System.out.println(a);
+    }
 }