|
@@ -4,22 +4,23 @@ import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
|
|
import cn.cslg.pas.common.dto.PatentStarListDTO;
|
|
import cn.cslg.pas.common.dto.PatentStarListDTO;
|
|
import cn.cslg.pas.common.dto.UploadPatentWebDTO;
|
|
import cn.cslg.pas.common.dto.UploadPatentWebDTO;
|
|
import cn.cslg.pas.common.dto.es.RefreshPatentDTO;
|
|
import cn.cslg.pas.common.dto.es.RefreshPatentDTO;
|
|
-import cn.cslg.pas.common.utils.DateUtils;
|
|
|
|
-import cn.cslg.pas.common.utils.FileUtils;
|
|
|
|
-import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
|
|
|
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
|
+import cn.cslg.pas.common.utils.*;
|
|
import cn.cslg.pas.common.utils.esDataForm.AddressSplitter;
|
|
import cn.cslg.pas.common.utils.esDataForm.AddressSplitter;
|
|
import cn.cslg.pas.common.utils.esDataForm.PatentClassifySplitter;
|
|
import cn.cslg.pas.common.utils.esDataForm.PatentClassifySplitter;
|
|
-import cn.cslg.pas.common.vo.ChinaPatentZhuLu;
|
|
|
|
-import cn.cslg.pas.common.vo.PatentWithIdVO;
|
|
|
|
-import cn.cslg.pas.common.vo.StarPatentVO;
|
|
|
|
-import cn.cslg.pas.common.vo.WorldPatentZhuLu;
|
|
|
|
|
|
+import cn.cslg.pas.common.vo.*;
|
|
|
|
+import cn.cslg.pas.domain.business.PatentClaim;
|
|
|
|
+import cn.cslg.pas.domain.business.ReportProject;
|
|
import cn.cslg.pas.domain.es.*;
|
|
import cn.cslg.pas.domain.es.*;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
|
+import cn.cslg.pas.service.business.ReportProjectService;
|
|
import cn.cslg.pas.service.business.es.EsService;
|
|
import cn.cslg.pas.service.business.es.EsService;
|
|
|
|
+import cn.cslg.pas.service.business.invalidReport.PatentClaimService;
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.experimental.Accessors;
|
|
import lombok.experimental.Accessors;
|
|
import org.dom4j.Document;
|
|
import org.dom4j.Document;
|
|
@@ -34,6 +35,7 @@ import java.io.File;
|
|
import java.io.Reader;
|
|
import java.io.Reader;
|
|
import java.io.StringReader;
|
|
import java.io.StringReader;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
@@ -46,6 +48,16 @@ public class ImportSinglePatentService {
|
|
@Autowired
|
|
@Autowired
|
|
private FileManagerService fileManagerService;
|
|
private FileManagerService fileManagerService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ReportProjectService reportProjectService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private PatentClaimService patentClaimService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CacheUtils cacheUtils;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LoginUtils loginUtils;
|
|
public StarPatentVO getPatentFromWeb(String patentNo) {
|
|
public StarPatentVO getPatentFromWeb(String patentNo) {
|
|
StarPatentVO starPatentVO = null;
|
|
StarPatentVO starPatentVO = null;
|
|
String dbType = "";
|
|
String dbType = "";
|
|
@@ -518,6 +530,7 @@ public class ImportSinglePatentService {
|
|
String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(starPatentVO.getRowApplicationNo());
|
|
String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(starPatentVO.getRowApplicationNo());
|
|
if (contents.contains(3)) {
|
|
if (contents.contains(3)) {
|
|
this.loadClaim(patent, cnFullXmlStr);
|
|
this.loadClaim(patent, cnFullXmlStr);
|
|
|
|
+
|
|
}
|
|
}
|
|
if (contents.contains(2)) {
|
|
if (contents.contains(2)) {
|
|
this.loadFullText(patent, cnFullXmlStr);
|
|
this.loadFullText(patent, cnFullXmlStr);
|
|
@@ -626,7 +639,7 @@ public class ImportSinglePatentService {
|
|
|
|
|
|
String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
|
|
String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
|
|
//先根据公开号判断国家,若没有公开号再根据申请号判断,调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
|
|
//先根据公开号判断国家,若没有公开号再根据申请号判断,调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
|
|
- if ((starPatentVO.getPublicNo() != null && starPatentVO.getPublicNo().contains("CN")) || (starPatentVO.getPublicNo() == null && starPatentVO.getPatentNo().contains("CN"))||(starPatentVO.getPublicAccreditNo() != null &&starPatentVO.getPublicAccreditNo().contains("CN")) ) {
|
|
|
|
|
|
+ if ((starPatentVO.getPublicNo() != null && starPatentVO.getPublicNo().contains("CN")) || (starPatentVO.getPublicNo() == null && starPatentVO.getPatentNo().contains("CN")) || (starPatentVO.getPublicAccreditNo() != null && starPatentVO.getPublicAccreditNo().contains("CN"))) {
|
|
|
|
|
|
String pdfUrlStr = patentStarApiService.getCnPdfApi(starPatentVO.getRowApplicationNo());
|
|
String pdfUrlStr = patentStarApiService.getCnPdfApi(starPatentVO.getRowApplicationNo());
|
|
|
|
|
|
@@ -658,10 +671,9 @@ public class ImportSinglePatentService {
|
|
fileManagerService.uploadFileWithGuid(file2, guid2);
|
|
fileManagerService.uploadFileWithGuid(file2, guid2);
|
|
}
|
|
}
|
|
} else { //若只有一个
|
|
} else { //若只有一个
|
|
- if(pdfUrlStr.contains("?")) {
|
|
|
|
|
|
+ if (pdfUrlStr.contains("?")) {
|
|
pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
|
|
pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"));
|
|
pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"));
|
|
}
|
|
}
|
|
if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
@@ -710,6 +722,7 @@ public class ImportSinglePatentService {
|
|
public Boolean refreshPatent(RefreshPatentDTO refreshPatentDTO) throws Exception {
|
|
public Boolean refreshPatent(RefreshPatentDTO refreshPatentDTO) throws Exception {
|
|
String patentNo = refreshPatentDTO.getPatentNo();
|
|
String patentNo = refreshPatentDTO.getPatentNo();
|
|
List<Integer> contents = refreshPatentDTO.getRefreshContent();
|
|
List<Integer> contents = refreshPatentDTO.getRefreshContent();
|
|
|
|
+ Integer projectId = refreshPatentDTO.getProjectId();
|
|
if (patentNo == null) {
|
|
if (patentNo == null) {
|
|
throw new XiaoShiException("请输入专利号");
|
|
throw new XiaoShiException("请输入专利号");
|
|
}
|
|
}
|
|
@@ -731,10 +744,8 @@ public class ImportSinglePatentService {
|
|
if (contents.contains(1)) {
|
|
if (contents.contains(1)) {
|
|
patent = this.getPatentCataloguingFromWeb(starPatentVO);
|
|
patent = this.getPatentCataloguingFromWeb(starPatentVO);
|
|
}
|
|
}
|
|
- //装载权利要求
|
|
|
|
- if (contents.contains(2) || contents.contains(3)) {
|
|
|
|
- this.getFullXmlStr(patent, starPatentVO, contents);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//装载图片
|
|
//装载图片
|
|
if (contents.contains(4)) {
|
|
if (contents.contains(4)) {
|
|
this.getPictureFromWeb(starPatentVO);
|
|
this.getPictureFromWeb(starPatentVO);
|
|
@@ -744,7 +755,7 @@ public class ImportSinglePatentService {
|
|
this.getPDFFromWeb(starPatentVO);
|
|
this.getPDFFromWeb(starPatentVO);
|
|
}
|
|
}
|
|
//添加法律事务
|
|
//添加法律事务
|
|
- if(contents.contains(6)){
|
|
|
|
|
|
+ if (contents.contains(6)) {
|
|
esService.addEsLegalEvent(patentNo);
|
|
esService.addEsLegalEvent(patentNo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -752,7 +763,83 @@ public class ImportSinglePatentService {
|
|
esService.updatePatentShouldWait(patent, patentWithIdVO.getId());
|
|
esService.updatePatentShouldWait(patent, patentWithIdVO.getId());
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ //装载权利要求
|
|
|
|
+ if (contents.contains(2) || contents.contains(3)) {
|
|
|
|
+ this.getFullXmlStr(patent, starPatentVO, contents);
|
|
|
|
+ if (contents.contains(3) && projectId != null) {
|
|
|
|
+ this.updateReportRight(patent,projectId,patentNo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void updateReportRight(Patent patent, Integer projectId,String patentNo) {
|
|
|
|
+ PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
+ //根据projectId 查询报告
|
|
|
|
+ LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(ReportProject::getProjectId, projectId);
|
|
|
|
+ ReportProject reportProject = reportProjectService.getOne(queryWrapper, false);
|
|
|
|
+ if (reportProject == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (reportProject.getReportType() == null || !reportProject.getReportType().equals(7)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据projectId查询
|
|
|
|
+ LambdaQueryWrapper<PatentClaim> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper1.eq(PatentClaim::getProjectId, projectId);
|
|
|
|
+ List<PatentClaim> patentClaims = patentClaimService.list(queryWrapper1);
|
|
|
|
+ if (patentClaims == null || patentClaims.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<Integer> ids =patentClaims.stream().map(PatentClaim::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<Text> claims = patent.getClaim();
|
|
|
|
+ if (claims == null || claims.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Text claim = patent.getClaim().stream().filter(item -> item.getIfOrigin().equals(true)).findFirst().orElse(null);
|
|
|
|
+ if (claim == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //拆分权要
|
|
|
|
+ PatentRightParams params = new PatentRightParams();
|
|
|
|
+ params.setPatentNo(patentNo);
|
|
|
|
+ params.setContent(claim.getTextContent());
|
|
|
|
+ List<RePatentClaim> rePatentClaims = PatentRightUtils.formatPatentRight(params);
|
|
|
|
+ if (rePatentClaims == null || rePatentClaims.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<PatentClaim> patentClaims1 = new ArrayList<>();
|
|
|
|
+ rePatentClaims.forEach(item->{
|
|
|
|
+ PatentClaim patentClaim =patentClaims.stream().filter(i->i.getSysOrder().equals(item.getSort())).findFirst().orElse(null);
|
|
|
|
+ if(patentClaim==null){
|
|
|
|
+ PatentClaim patentClaim1 =new PatentClaim();
|
|
|
|
+ patentClaim1.setProjectId(projectId);
|
|
|
|
+ patentClaim1.setContentType(0);
|
|
|
|
+ patentClaim1.setClaimType(item.getType());
|
|
|
|
+ patentClaim1.setContent(item.getContent());
|
|
|
|
+ patentClaim1.setParentOrder(item.getParentSort());
|
|
|
|
+ patentClaim1.setSysOrder(item.getSort());
|
|
|
|
+ patentClaim1.setCreateId(personnelVO.getId());
|
|
|
|
+ patentClaims1.add(patentClaim1);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ patentClaim.setClaimType(item.getType());
|
|
|
|
+ patentClaim.setContent(item.getContent());
|
|
|
|
+ patentClaim.setParentOrder(item.getParentSort());
|
|
|
|
+ ids.remove(patentClaim.getId());
|
|
|
|
+ patentClaims1.add(patentClaim);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ patentClaimService.saveOrUpdateBatch(patentClaims1);
|
|
|
|
+ if(ids!=null&&ids.size()>0){
|
|
|
|
+ patentClaimService.removeBatchByIds(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|