|
@@ -1,15 +1,20 @@
|
|
|
package com.example.demo.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.example.demo.base.Constants;
|
|
|
-import com.example.demo.domain.dto.UploadFileDTO;
|
|
|
+import com.example.demo.domain.dto.*;
|
|
|
import com.example.demo.domain.entity.*;
|
|
|
+import com.example.demo.exception.XiaoShiException;
|
|
|
import com.example.demo.model.dto.TaskWebSocketDTO;
|
|
|
import com.example.demo.model.dto.WebQueryDTO;
|
|
|
import com.example.demo.util.*;
|
|
|
+import com.spire.pdf.FileFormat;
|
|
|
+import com.spire.pdf.PdfDocument;
|
|
|
+import com.spire.pdf.PdfDocumentBase;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.fileupload.FileItem;
|
|
|
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|
|
import org.openqa.selenium.By;
|
|
|
import org.openqa.selenium.WebDriver;
|
|
|
import org.openqa.selenium.WebElement;
|
|
@@ -18,13 +23,14 @@ import org.openqa.selenium.chrome.ChromeOptions;
|
|
|
import org.openqa.selenium.interactions.Actions;
|
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.DecimalFormat;
|
|
|
+import java.io.*;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Matcher;
|
|
@@ -66,8 +72,6 @@ public class UploadFromWebService {
|
|
|
//conditions = this.formatConditions(conditions);
|
|
|
//根据id 获得网站配置
|
|
|
WebConfig webConfig = webConfigService.getConfigById(id);
|
|
|
- //根据网站id和用户的租户获得登录信息
|
|
|
- WebLoginConfig webLoginConfig = webLoginConfigService.getLoginConfig(webConfig.getId());
|
|
|
if (webConfig == null) {
|
|
|
qrtzTaskDetail.setTaskDetailState(3);
|
|
|
qrtzTaskDetail.setSuccessNum(successNum);
|
|
@@ -85,7 +89,10 @@ public class UploadFromWebService {
|
|
|
.setFileName("")
|
|
|
.setUrl("")
|
|
|
.setTotal(successNum), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), "null");
|
|
|
+ return null;
|
|
|
}
|
|
|
+ //根据网站id和用户的租户获得登录信息
|
|
|
+ WebLoginConfig webLoginConfig = webLoginConfigService.getLoginConfig(webConfig.getId());
|
|
|
//1.获得驱动
|
|
|
// System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
|
|
|
System.setProperty("webdriver.chrome.driver", url);
|
|
@@ -331,7 +338,7 @@ public class UploadFromWebService {
|
|
|
stringBuilder.append("\r\n");
|
|
|
for (int t = 1; t < textP1.size(); t++) {
|
|
|
String tem = String.format("%04d", flag);
|
|
|
- stringBuilder.append("[" + tem + "]" + textP1.get(t).getText());
|
|
|
+ stringBuilder.append("[").append(tem).append("]").append(textP1.get(t).getText());
|
|
|
stringBuilder.append("\r\n");
|
|
|
flag += 1;
|
|
|
}
|
|
@@ -497,6 +504,442 @@ public class UploadFromWebService {
|
|
|
return patentCells;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 下载欧专局专利数据
|
|
|
+ *
|
|
|
+ * @param webQueryDTO 前台传来的下载条件等数据
|
|
|
+ * @return 返回
|
|
|
+ * @throws IOException 抛出IO异常
|
|
|
+ */
|
|
|
+ public List<PatentCell> getEPO(WebQueryDTO webQueryDTO) throws Exception {
|
|
|
+ log.info("开始处理【下载欧专局专利数据】的业务,参数为:{}", webQueryDTO);
|
|
|
+ List<PatentCell> patentCells = new ArrayList<>();
|
|
|
+
|
|
|
+ //1.从DTO中取出网站id、检索信息条件、下载字段、专题库id、报告id
|
|
|
+ Integer webId = webQueryDTO.getWebConfigId();
|
|
|
+ List<String> cells = webQueryDTO.getConCells();
|
|
|
+ String conditions = webQueryDTO.getConditions();
|
|
|
+ Integer projectId = webQueryDTO.getProjectId();
|
|
|
+ Integer reportId = webQueryDTO.getReportId();
|
|
|
+
|
|
|
+ //定义每次检索的专利数量(每次检索50件)
|
|
|
+ int size = 50;
|
|
|
+
|
|
|
+ //2.根据检索式conditions先检索一件专利著录信息【此操作主要是为了获得专利总数量count】
|
|
|
+ SerachBiblioData serachBiblioData = getSerachBiblioData(conditions, 1, 1);
|
|
|
+ if (serachBiblioData == null || serachBiblioData.getTotals() == 0) {
|
|
|
+ //conditions没有检索到任何相关专利(杰哥处理)
|
|
|
+ ThrowException.throwXiaoShiException("检索失败,未检索出任何相关专利信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得专利总数量
|
|
|
+ Integer count = serachBiblioData.getTotals();
|
|
|
+
|
|
|
+ //3.根据专利总数量count计算检索次数,来循环检索
|
|
|
+ for (int i = 1; i <= count; i += size) {
|
|
|
+ //3.1根据检索式conditions、专利开始数i、专利最后数i + size - 1检索专利著录信息
|
|
|
+ serachBiblioData = getSerachBiblioData(conditions, i, i + size - 1);
|
|
|
+ //获取检索结果中的所有专利著录信息
|
|
|
+ if (serachBiblioData == null || serachBiblioData.getTotals() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<PatentZhuLu> patents = serachBiblioData.getPatents();
|
|
|
+
|
|
|
+ //3.2遍历专利
|
|
|
+ for (PatentZhuLu patent : patents) {
|
|
|
+ PatentCell patentCell = new PatentCell();
|
|
|
+ PubNo pubNO = new PubNo();
|
|
|
+ //装载专利著录
|
|
|
+ if (cells.contains("1")) {
|
|
|
+ setPatentZhuLu(patentCell, patent, pubNO);
|
|
|
+ }
|
|
|
+ //装载权要
|
|
|
+ if (cells.contains("2")) {
|
|
|
+ try {
|
|
|
+ setPatentClaim(patentCell, pubNO);
|
|
|
+ } catch (XiaoShiException e) {
|
|
|
+ //权要接口不支持检索该国家类型专利则跳过该专利,继续下一个专利
|
|
|
+ //continue;
|
|
|
+ //虽然拿不到权要,但是可以拿其他的,能拿到啥都返回
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载说明书文本
|
|
|
+ if (cells.contains("3")) {
|
|
|
+ try {
|
|
|
+ setPatentInstructionText(patentCell, pubNO);
|
|
|
+ } catch (XiaoShiException e) {
|
|
|
+ //说明书接口不支持检索该国家类型专利则跳过该专利,继续下一个专利
|
|
|
+ //continue;
|
|
|
+ //虽然拿不到说明书,但是可以拿其他的,能拿到啥都返回
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //以下代码是在准备一会要调用拿取各种附图的接口所需的参数(FullDocument->说明书pdf、Drawing->其他附图、FirstPageClipping->摘要附图)
|
|
|
+ String fullDocumentLink = "", fullDocumentType = "", drawingLink = "", drawingType = "", firstPageClippingLink = "", firstPageClippingType = "";
|
|
|
+ Integer fullDocumentPage = 0, drawingPage = 0, firstPageClippingPage = 0;
|
|
|
+ //根据当前专利号调用接口获取一会调用拿取各种附图的接口的参数
|
|
|
+ try {
|
|
|
+ ImageInfo imageInfo = getImage(pubNO);
|
|
|
+ for (Image image : imageInfo.getImages()) {
|
|
|
+ //如果附件类型是说明书
|
|
|
+ if (image.getImageType().equals("FullDocument")) {
|
|
|
+ fullDocumentLink = image.getUrlLink();
|
|
|
+ fullDocumentPage = image.getNumberOfPages();
|
|
|
+ for (String formatOption : image.getFormatOptions()) {
|
|
|
+ if (formatOption.contains("pdf")) {
|
|
|
+ fullDocumentType = formatOption;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果附件类型是其他附件
|
|
|
+ if (image.getImageType().equals("Drawing")) {
|
|
|
+ drawingLink = image.getUrlLink();
|
|
|
+ drawingPage = image.getNumberOfPages();
|
|
|
+ for (String formatOption : image.getFormatOptions()) {
|
|
|
+ if (formatOption.contains("tiff")) {
|
|
|
+ drawingType = formatOption;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果附件类型是摘要附图
|
|
|
+ if (image.getImageType().equals("FirstPageClipping")) {
|
|
|
+ firstPageClippingLink = image.getUrlLink();
|
|
|
+ firstPageClippingPage = image.getNumberOfPages();
|
|
|
+ for (String formatOption : image.getFormatOptions()) {
|
|
|
+ if (formatOption.contains("jpeg")) {
|
|
|
+ firstPageClippingType = formatOption;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载说明书pdf
|
|
|
+ if (cells.contains("4")) {
|
|
|
+ setFuJian(fullDocumentLink, fullDocumentPage, fullDocumentType, patentCell, ".pdf");
|
|
|
+ }
|
|
|
+ //装载摘要附图
|
|
|
+ if (cells.contains("6")) {
|
|
|
+ setFuJian(firstPageClippingLink, firstPageClippingPage, firstPageClippingType, patentCell, ".jpeg");
|
|
|
+ }
|
|
|
+ //装载其他附图
|
|
|
+ if (cells.contains("7")) {
|
|
|
+ setFuJian(drawingLink, drawingPage, drawingType, patentCell, ".tiff");
|
|
|
+ }
|
|
|
+ } catch (XiaoShiException e) {
|
|
|
+ //虽然拿不到所有附图,但是可以拿其他的,能拿到啥是啥
|
|
|
+ log.info(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ //4.保存专利信息(发送给专题库)
|
|
|
+ patentCells.add(patentCell);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return patentCells;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载其他附件方法
|
|
|
+ *
|
|
|
+ * @param link 附件链接
|
|
|
+ * @param page 附件页数
|
|
|
+ * @param type 附件类型
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ */
|
|
|
+// private void setOtherImage(String link, Integer page, String type, PatentCell patentCell) throws IOException {
|
|
|
+// GetFuTuParamsDTO getFuTuParamsDTO = new GetFuTuParamsDTO()
|
|
|
+// .setLink(link)
|
|
|
+// .setPage(page)
|
|
|
+// .setType(type);
|
|
|
+// outInterfaceService.getPatentFile(getFuTuParamsDTO);
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载摘要附图方法
|
|
|
+ *
|
|
|
+ * @param link 附件链接
|
|
|
+ * @param page 附件页数
|
|
|
+ * @param type 附件类型
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ */
|
|
|
+// private void setAbstractImage(String link, Integer page, String type, PatentCell patentCell) throws IOException {
|
|
|
+// GetFuTuParamsDTO getFuTuParamsDTO = new GetFuTuParamsDTO()
|
|
|
+// .setLink(link)
|
|
|
+// .setPage(page)
|
|
|
+// .setType(type);
|
|
|
+// outInterfaceService.getPatentFile(getFuTuParamsDTO);
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载说明书附件pdf方法
|
|
|
+ *
|
|
|
+ * @param link 附件链接
|
|
|
+ * @param page 附件页数
|
|
|
+ * @param type 附件类型
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ */
|
|
|
+ private void setFuJian(String link, Integer page, String type, PatentCell patentCell, String FuJianSuffix) throws Exception {
|
|
|
+ //合并说明书pdf文档时所需的读取流数组
|
|
|
+ InputStream[] streams = new InputStream[page];
|
|
|
+ //其他附图url数组
|
|
|
+ ArrayList<String> otherUrls = new ArrayList<>();
|
|
|
+ //遍历附件页数
|
|
|
+ for (int i = 1; i <= page; i++) {
|
|
|
+ GetFuTuParamsDTO getFuTuParamsDTO = new GetFuTuParamsDTO()
|
|
|
+ .setLink(link)
|
|
|
+ .setPage(i)
|
|
|
+ .setType(type);
|
|
|
+ byte[] buffer = outInterfaceService.getPatentFile(getFuTuParamsDTO);
|
|
|
+ InputStream inputStream = new ByteArrayInputStream(buffer);
|
|
|
+ streams[i - 1] = inputStream;
|
|
|
+// File file = File.createTempFile("new_url", FuJianSuffix);
|
|
|
+// FileOutputStream out = new FileOutputStream(file);
|
|
|
+// out.write(buffer);
|
|
|
+// out.close();
|
|
|
+// streams[i - 1] = new FileInputStream(file);
|
|
|
+// DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
|
|
|
+// FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
|
|
|
+// int bytesRead = 0;
|
|
|
+// buffer = new byte[8192];
|
|
|
+// try {
|
|
|
+// FileInputStream fis = new FileInputStream(file);
|
|
|
+// OutputStream os = item.getOutputStream();
|
|
|
+// int len = 8192;
|
|
|
+// while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
|
|
|
+// os.write(buffer, 0, bytesRead);
|
|
|
+// }
|
|
|
+// os.close();
|
|
|
+// fis.close();
|
|
|
+// } catch (IOException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
+// UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
+// switch (FuJianSuffix) {
|
|
|
+// case ".pdf":
|
|
|
+// streams[i - 1] = new FileInputStream(fileDTO.getPath());
|
|
|
+// break;
|
|
|
+// case ".jpeg":
|
|
|
+// patentCell.setPicUrl(fileDTO.getPath());
|
|
|
+// break;
|
|
|
+// case ".tiff":
|
|
|
+// otherUrls.add(fileDTO.getPath());
|
|
|
+// break;
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (FuJianSuffix.equals(".pdf")) {
|
|
|
+ //合并说明书多个pdf文件
|
|
|
+ PdfDocumentBase doc = PdfDocument.mergeFiles(streams);
|
|
|
+ //保存结果文件
|
|
|
+ doc.save("merge.pdf", FileFormat.PDF);
|
|
|
+ doc.close();
|
|
|
+ } else if (FuJianSuffix.equals(".tiff")) {
|
|
|
+ patentCell.setOtherUrls(otherUrls);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取Image信息方法(从信息中获取三种附图的检索参数)
|
|
|
+ *
|
|
|
+ * @param pubNo 公开号对象
|
|
|
+ */
|
|
|
+ private ImageInfo getImage(PubNo pubNo) throws IOException {
|
|
|
+ String res = outInterfaceService.getImagesInfo(pubNo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ if (!jsonObject.get("status").toString().equals("200")) {
|
|
|
+ //若发生类似400、500等异常(杰哥处理)
|
|
|
+ ThrowException.throwXiaoShiException("Image信息接口无法检索该国家专利");
|
|
|
+ }
|
|
|
+ //拿到检索结果(未格式化的含有页面等标签的说明书)
|
|
|
+ String unFormatData = jsonObject.get("data").toString();
|
|
|
+ String data = unFormatData.substring(unFormatData.indexOf("[") + 1, unFormatData.lastIndexOf("]"));
|
|
|
+ ImageInfo imageInfo = JSONObject.parseObject(data, ImageInfo.class);
|
|
|
+ return imageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载说明书方法
|
|
|
+ *
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ * @param pubNo 公开号对象
|
|
|
+ */
|
|
|
+ private void setPatentInstructionText(PatentCell patentCell, PubNo pubNo) throws IOException {
|
|
|
+ GetDescriptionInfoParamsDTO getDescriptionInfoParamsDTO = new GetDescriptionInfoParamsDTO()
|
|
|
+ .setCc(pubNo.getCountry())
|
|
|
+ .setNumber(pubNo.getNumber())
|
|
|
+ .setKind(pubNo.getKind());
|
|
|
+ String res = outInterfaceService.getDescriptionInfo(getDescriptionInfoParamsDTO);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ if (!jsonObject.get("status").toString().equals("200")) {
|
|
|
+ //若发生类似400、500等异常(杰哥处理)
|
|
|
+ ThrowException.throwXiaoShiException("说明书接口无法检索该国家专利");
|
|
|
+ }
|
|
|
+ //拿到检索结果(未格式化的含有页面等标签的说明书)
|
|
|
+ //String unformatInstructionText = JSONObject.parseObject(jsonObject.get("data").toString(), String.class);
|
|
|
+ List<String> unformatInstructionText = JSONObject.parseObject(jsonObject.get("data").toString(), List.class);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (String n : unformatInstructionText) {
|
|
|
+ builder.append(n);
|
|
|
+ }
|
|
|
+// String regex = "<p>(.+?)</p>";
|
|
|
+// Matcher matcher = Pattern.compile(regex).matcher(unformatInstructionText);
|
|
|
+// if (matcher.find()) {
|
|
|
+// patentCell.setPatentInstructionText(matcher.group());
|
|
|
+// }
|
|
|
+ patentCell.setPatentInstructionText(builder + "");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载权要方法
|
|
|
+ *
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ * @param pubNo 公开号对象
|
|
|
+ */
|
|
|
+ private void setPatentClaim(PatentCell patentCell, PubNo pubNo) throws IOException {
|
|
|
+ GetClaimsInfoParamsDTO getClaimsInfoParamsDTO = new GetClaimsInfoParamsDTO()
|
|
|
+ .setCc(pubNo.getCountry())
|
|
|
+ .setNumber(pubNo.getNumber())
|
|
|
+ .setKind(pubNo.getKind());
|
|
|
+ String res = outInterfaceService.getClaimsInfo(getClaimsInfoParamsDTO);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ if (!jsonObject.get("status").toString().equals("200")) {
|
|
|
+ //若发生类似400、500等异常(杰哥处理)
|
|
|
+ ThrowException.throwXiaoShiException("权要接口无法检索该国家专利");
|
|
|
+ }
|
|
|
+ //拿到检索结果(未格式化的含有页面等标签的权要)并格式化权要
|
|
|
+ //String unformatRight = JSONObject.parseObject(jsonObject.get("data").toString(), String.class);
|
|
|
+ ArrayList<String> unformatRights = JSONObject.parseObject(jsonObject.get("data").toString(), ArrayList.class);
|
|
|
+ //String[] rightArr = unformatRight.split("\n");
|
|
|
+ //ArrayList<String> rights = new ArrayList<>(Arrays.asList(rightArr));
|
|
|
+ patentCell.setRights(unformatRights);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载著录方法
|
|
|
+ *
|
|
|
+ * @param patentCell 实体类对象
|
|
|
+ * @param patent 专利对象
|
|
|
+ * @param pubNo 公开号对象
|
|
|
+ */
|
|
|
+ private void setPatentZhuLu(PatentCell patentCell, PatentZhuLu patent, PubNo pubNo) {
|
|
|
+ //装载申请号
|
|
|
+ for (AppNo appNo : patent.getAppNos()) {
|
|
|
+ if (appNo.getType().equals("docdb")) {
|
|
|
+ patentCell.setApplicationNo(appNo.getCountry() + appNo.getNumber() + appNo.getKind());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载申请日
|
|
|
+ patentCell.setApplicationDate(patent.getAppDate());
|
|
|
+ //装载国家/省市
|
|
|
+ patentCell.setCountry(patent.getAppCountry());
|
|
|
+ //装载公开号
|
|
|
+ for (PubNo n : patent.getPubNos()) {
|
|
|
+ if (n.getType().equals("docdb")) {
|
|
|
+ BeanUtils.copyProperties(n, pubNo);
|
|
|
+ patentCell.setPublicNo(n.getCountry() + n.getNumber() + n.getKind());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载专利号
|
|
|
+ patentCell.setPatentNo(patentCell.getPublicNo());
|
|
|
+ //装载公开日
|
|
|
+ patentCell.setPubilcDate(patent.getPubDate());
|
|
|
+ //装载授权公告号(未找到)
|
|
|
+ //装载授权公告日(未找到)
|
|
|
+ //装载主分类号
|
|
|
+ List<String> ipCs = patent.getIpCs();
|
|
|
+ List<String> cpCs = patent.getCpCs();
|
|
|
+ ipCs.addAll(cpCs);
|
|
|
+ patentCell.setMainIpc(ipCs.get(0));
|
|
|
+ //装载分类号
|
|
|
+ patentCell.setIpc(ipCs);
|
|
|
+ //装载申请人
|
|
|
+ ArrayList<String> applicationPersons = new ArrayList<>();
|
|
|
+ for (Application application : patent.getApplications()) {
|
|
|
+ applicationPersons.add(application.getOriginalName());
|
|
|
+ }
|
|
|
+ patentCell.setApplicationPersons(applicationPersons);
|
|
|
+ //装载申请人地址(未找到)
|
|
|
+ //装载发明人
|
|
|
+ ArrayList<String> inventors = new ArrayList<>();
|
|
|
+ for (Inventor inventor : patent.getInventors()) {
|
|
|
+ inventors.add(inventor.getOriginalName());
|
|
|
+ }
|
|
|
+ patentCell.setInventors(inventors);
|
|
|
+ //装载当前权利人(未找到)
|
|
|
+ //装载代理人(未找到)
|
|
|
+ //装载代理机构(未找到)
|
|
|
+ //装载范畴分类(未找到)
|
|
|
+ //装载当前状态(未找到)
|
|
|
+ //装载同族号
|
|
|
+ patentCell.setFamilyId(patent.getFamilyId());
|
|
|
+ //装载著录标题
|
|
|
+ String olTitle = patent.getOlTitle();
|
|
|
+ String enTitle = patent.getEnTitle();
|
|
|
+ if (olTitle == null) {
|
|
|
+ patentCell.setTitle(enTitle);
|
|
|
+ } else {
|
|
|
+ patentCell.setTitle(olTitle);
|
|
|
+ }
|
|
|
+ //装载摘要
|
|
|
+ String olAbstract = patent.getOlAbstract();
|
|
|
+ String enAbstract = patent.getEnAbstract();
|
|
|
+ if (olAbstract == null) {
|
|
|
+ patentCell.setAbstrText(enAbstract);
|
|
|
+ } else {
|
|
|
+ patentCell.setAbstrText(olAbstract);
|
|
|
+ }
|
|
|
+ //装载优先权号、优先权国家、优先权日
|
|
|
+ ArrayList<Priority> priorities = new ArrayList<>();
|
|
|
+ List<Priorityy> priorties = patent.getPriorties();
|
|
|
+ for (Priorityy priorty : priorties) {
|
|
|
+ for (PriorityNumber number : priorty.getNumbers()) {
|
|
|
+ if (number.getType().equals("epodoc")) {
|
|
|
+ Priority priority = new Priority()
|
|
|
+ .setPriorityNo(number.getNumber().substring(2))
|
|
|
+ .setPriorityCountry(number.getNumber().substring(0, 2))
|
|
|
+ .setPriorityDate(priorty.getDate());
|
|
|
+ priorities.add(priority);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ patentCell.setPriorities(priorities);
|
|
|
+ }
|
|
|
+
|
|
|
+ //调用接口获取一批专利著录信息
|
|
|
+ private SerachBiblioData getSerachBiblioData(String conditions, Integer start, Integer size) throws IOException {
|
|
|
+ GetSearchBiblioParamsDTO getSearchBiblioParamsDTO = new GetSearchBiblioParamsDTO()
|
|
|
+ .setQuery(conditions)
|
|
|
+ .setStart(start)
|
|
|
+ .setEnd(size);
|
|
|
+ String res = outInterfaceService.getSearchBiblio(getSearchBiblioParamsDTO);
|
|
|
+ if (res == null || res.equals("")) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ if (!jsonObject.get("status").toString().equals("200")) {
|
|
|
+ //若发生类似400、500等异常(杰哥处理)
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //返回检索结果data
|
|
|
+ return JSONObject.parseObject(jsonObject.get("data").toString(), SerachBiblioData.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载爬取智慧芽专利数据
|
|
|
+ *
|
|
|
+ * @param patentVO
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @throws InterruptedException
|
|
|
+ */
|
|
|
public List<PatentCell> getPatentya(String patentVO) throws IOException, InterruptedException {
|
|
|
//1.获得驱动
|
|
|
System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
|