|
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -545,6 +546,52 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 给原始权要进行拆分
|
|
|
+ *
|
|
|
+ * @param patentNo 专利号
|
|
|
+ * @return 返回拆分后的权要
|
|
|
+ */
|
|
|
+ public List<PatentRight> formatPatentRights(String patentNo) {
|
|
|
+ Patent patent = patentService.getByPatentNo(patentNo);
|
|
|
+ if (patent == null) {
|
|
|
+ patent = new Patent();
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatentRight> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(PatentRight::getPatentId, patent.getId());
|
|
|
+ queryWrapper.orderByAsc(PatentRight::getSort);
|
|
|
+ List<PatentRight> patentRights = this.list(queryWrapper);
|
|
|
+
|
|
|
+ //装载权要原文
|
|
|
+ PatentRightParams params = new PatentRightParams();
|
|
|
+ params.setPatentId(patent.getId());
|
|
|
+ params.setPatentNo(patentNo);
|
|
|
+ //对获得的权利要求集合,判断集合元素个数若为1则为原文文本;若大于1则为已经拆分了的多个权要文本,此时就将其合并回原文文本
|
|
|
+ if (patentRights.size() == 1) {
|
|
|
+ params.setContent(patentRights.get(0).getContent());
|
|
|
+ } else if (patentRights.size() > 1) {
|
|
|
+ StringBuilder contentBuilder = new StringBuilder();
|
|
|
+ patentRights.forEach(patentRight -> {
|
|
|
+ contentBuilder.append(patentRight.getContent()).append("\n");
|
|
|
+ });
|
|
|
+ params.setContent(contentBuilder + "");
|
|
|
+ }
|
|
|
+
|
|
|
+ //调用拆分权要工厂类方法,返回对应该国家专利的拆分权要方法的对象
|
|
|
+ PatentRightSplitService obj = getPatentRightSplitServiceObj(patent.getPatentNo());
|
|
|
+ //对象调用拆分权要方法,返回处理过的(经过拆分、理出主附权要、理出层级关系的)权要集合
|
|
|
+ List<PatentRightContent> patentRightContents = obj.formatPatentRight(params);
|
|
|
+
|
|
|
+ List<PatentRight> finalPatentRights = new ArrayList<>();
|
|
|
+ patentRightContents.forEach(patentRightContent -> {
|
|
|
+ PatentRight patentRight = new PatentRight();
|
|
|
+ BeanUtils.copyProperties(patentRightContent, patentRight);
|
|
|
+ finalPatentRights.add(patentRight);
|
|
|
+ });
|
|
|
+
|
|
|
+ return finalPatentRights;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public PatentRightSplitService getPatentRightSplitServiceObj(String patentNo) {
|
|
|
String country = patentNo.substring(0, 2);
|