|
@@ -1,16 +1,23 @@
|
|
package cn.cslg.pas.service.importPatent;
|
|
package cn.cslg.pas.service.importPatent;
|
|
|
|
|
|
import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
|
|
import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
|
|
|
|
+import cn.cslg.pas.common.dto.OPS.GetFuTuParamsDTO;
|
|
|
|
+import cn.cslg.pas.common.dto.OPS.PubNo;
|
|
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.model.cronModel.Personnel;
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
|
+import cn.cslg.pas.common.model.cronModel.SystemFile;
|
|
import cn.cslg.pas.common.utils.*;
|
|
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.*;
|
|
import cn.cslg.pas.common.vo.*;
|
|
import cn.cslg.pas.common.dto.OPS.GetClaimsInfoParamsDTO;
|
|
import cn.cslg.pas.common.dto.OPS.GetClaimsInfoParamsDTO;
|
|
import cn.cslg.pas.common.dto.OPS.GetDescriptionInfoParamsDTO;
|
|
import cn.cslg.pas.common.dto.OPS.GetDescriptionInfoParamsDTO;
|
|
|
|
+import cn.cslg.pas.common.vo.OPS.GetImagesInfoVO;
|
|
|
|
+import cn.cslg.pas.common.vo.OPS.ImagesInfoVO;
|
|
|
|
+import cn.cslg.pas.common.vo.OPS.PatentNoDetailVO;
|
|
import cn.cslg.pas.domain.business.PatentClaim;
|
|
import cn.cslg.pas.domain.business.PatentClaim;
|
|
import cn.cslg.pas.domain.business.ReportProject;
|
|
import cn.cslg.pas.domain.business.ReportProject;
|
|
import cn.cslg.pas.domain.es.*;
|
|
import cn.cslg.pas.domain.es.*;
|
|
@@ -22,17 +29,20 @@ import cn.cslg.pas.service.common.FileManagerService;
|
|
import cn.cslg.pas.service.common.OPSService;
|
|
import cn.cslg.pas.service.common.OPSService;
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.dom4j.Document;
|
|
import org.dom4j.Document;
|
|
import org.dom4j.Element;
|
|
import org.dom4j.Element;
|
|
import org.dom4j.XPath;
|
|
import org.dom4j.XPath;
|
|
import org.dom4j.io.SAXReader;
|
|
import org.dom4j.io.SAXReader;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.io.Reader;
|
|
import java.io.Reader;
|
|
import java.io.StringReader;
|
|
import java.io.StringReader;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -61,6 +71,8 @@ public class ImportSinglePatentService {
|
|
private LoginUtils loginUtils;
|
|
private LoginUtils loginUtils;
|
|
@Autowired
|
|
@Autowired
|
|
private OPSService opsService;
|
|
private OPSService opsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PatentNoUtil patentNoUtil;
|
|
|
|
|
|
public StarPatentVO getPatentFromWeb(String patentNo) {
|
|
public StarPatentVO getPatentFromWeb(String patentNo) {
|
|
StarPatentVO starPatentVO = null;
|
|
StarPatentVO starPatentVO = null;
|
|
@@ -870,17 +882,76 @@ public class ImportSinglePatentService {
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public void loadClaimFromOPS(UploadPatentWebDTO uploadPatentWebDTO) throws Exception {
|
|
public void loadClaimFromOPS(UploadPatentWebDTO uploadPatentWebDTO) throws Exception {
|
|
|
|
+ Patent patent = uploadPatentWebDTO.getPatent();
|
|
//从ops获取权利要求
|
|
//从ops获取权利要求
|
|
GetClaimsInfoParamsDTO getClaimsInfoParamsDTO = new GetClaimsInfoParamsDTO();
|
|
GetClaimsInfoParamsDTO getClaimsInfoParamsDTO = new GetClaimsInfoParamsDTO();
|
|
- opsService.getClaimsInfo(getClaimsInfoParamsDTO);
|
|
|
|
|
|
+ PatentNoDetailVO patentNoDetailVO = patentNoUtil.getPatentNoDetail(patent.getPatentNo());
|
|
|
|
+ BeanUtils.copyProperties(patentNoDetailVO, getClaimsInfoParamsDTO);
|
|
|
|
+ String res = opsService.getClaimsInfo(getClaimsInfoParamsDTO);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
|
+ Text text = new Text();
|
|
|
|
+ text.setLanguage(getClaimsInfoParamsDTO.getCc());
|
|
|
|
+ text.setTextContent(jsonObject.getString("data"));
|
|
|
|
+ text.setIfOrigin(true);
|
|
|
|
+ patent.setClaim(Arrays.asList(text));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 从OPS装载说明书
|
|
* 从OPS装载说明书
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- private void loadFullTextFromOPS(UploadPatentWebDTO uploadPatentWebDTO) throws Exception{
|
|
|
|
- GetDescriptionInfoParamsDTO getDescriptionInfoParamsDTO =new GetDescriptionInfoParamsDTO();
|
|
|
|
- opsService.getDescriptionInfo(getDescriptionInfoParamsDTO);
|
|
|
|
|
|
+ private void loadFullTextFromOPS(UploadPatentWebDTO uploadPatentWebDTO) throws Exception{
|
|
|
|
+ Patent patent = uploadPatentWebDTO.getPatent();
|
|
|
|
+ GetDescriptionInfoParamsDTO getDescriptionInfoParamsDTO = new GetDescriptionInfoParamsDTO();
|
|
|
|
+ PatentNoDetailVO patentNoDetailVO = patentNoUtil.getPatentNoDetail(patent.getPatentNo());
|
|
|
|
+ BeanUtils.copyProperties(patentNoDetailVO, getDescriptionInfoParamsDTO);
|
|
|
|
+ String res = opsService.getDescriptionInfo(getDescriptionInfoParamsDTO);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
|
+ Text text = new Text();
|
|
|
|
+ text.setIfOrigin(true);
|
|
|
|
+ text.setTextContent(jsonObject.getString("data"));
|
|
|
|
+ text.setLanguage(getDescriptionInfoParamsDTO.getCc());
|
|
|
|
+ patent.setPublicFullText(Arrays.asList(text));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public byte[] getImages(String publicNo) throws IOException {
|
|
|
|
+ PatentNoDetailVO patentNoDetailVO = patentNoUtil.getPatentNoDetail(publicNo);
|
|
|
|
+ PubNo pubNo = new PubNo();
|
|
|
|
+ pubNo.setCountry(patentNoDetailVO.getCc());
|
|
|
|
+ pubNo.setNumber(patentNoDetailVO.getNumber());
|
|
|
|
+ pubNo.setKind(patentNoDetailVO.getKind());
|
|
|
|
+ String res = opsService.getImagesInfo(pubNo);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
|
+ String imageInfo = jsonObject.getString("data");
|
|
|
|
+ // 删除第一个 `[`
|
|
|
|
+ if (imageInfo.startsWith("[")) {
|
|
|
|
+ imageInfo = imageInfo.substring(1);
|
|
|
|
+ }
|
|
|
|
+ // 删除最后一个 `]`
|
|
|
|
+ if (imageInfo.endsWith("]")) {
|
|
|
|
+ imageInfo = imageInfo.substring(0, imageInfo.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ GetImagesInfoVO getImagesInfoVO = JSONObject.parseObject(imageInfo, GetImagesInfoVO.class);
|
|
|
|
+ List<ImagesInfoVO> images = getImagesInfoVO.getImages();
|
|
|
|
+ if (!images.isEmpty()) {
|
|
|
|
+ ImagesInfoVO infoVO = images.stream().filter(item -> item.getImageType().equals("FirstPageClipping")).findFirst().orElse(null);
|
|
|
|
+ if (infoVO != null) {
|
|
|
|
+ GetFuTuParamsDTO getFuTuParamsDTO = new GetFuTuParamsDTO();
|
|
|
|
+ getFuTuParamsDTO.setPage(1);
|
|
|
|
+ getFuTuParamsDTO.setType("image/png");
|
|
|
|
+ getFuTuParamsDTO.setLink(infoVO.getUrlLink());
|
|
|
|
+ byte[] buffer = opsService.getPatentFile(getFuTuParamsDTO);
|
|
|
|
+ if (buffer != null) {
|
|
|
|
+ return buffer;
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|