|
@@ -23,6 +23,7 @@ import cn.cslg.pas.service.WebLoginConfigService;
|
|
|
import cn.cslg.pas.service.importPatent.WebVOTransformService;
|
|
|
import cn.cslg.pas.service.novelty.AssoRetrieveRecordProjectService;
|
|
|
import cn.cslg.pas.service.query.FormatQueryService;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sun.istack.NotNull;
|
|
@@ -31,6 +32,7 @@ import lombok.experimental.Accessors;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.*;
|
|
|
import okhttp3.Response;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.dom4j.Document;
|
|
|
import org.dom4j.DocumentException;
|
|
|
import org.dom4j.Element;
|
|
@@ -45,6 +47,7 @@ import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
@@ -86,6 +89,8 @@ public class PatentStarApiService {
|
|
|
private AssoRetrieveRecordProjectService assoRetrieveRecordProjectService;
|
|
|
@Autowired
|
|
|
private NOSCacheService cacheService;
|
|
|
+ @Autowired
|
|
|
+ private FileManagerService fileManagerService;
|
|
|
|
|
|
public Records patentStarSearchLocal(PatentStarListDTO patentStarListDTO) throws IOException {
|
|
|
RetrieveRecord retrieveRecord = retrieveRecordService.setRetrieveRecord(patentStarListDTO);
|
|
@@ -1141,6 +1146,98 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 根据专利号查询外部权利要求
|
|
|
+ *
|
|
|
+ * @param patentNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ public PatentInfoDTO queryPatentDetailByPatentNo(String patentNo) throws IOException {
|
|
|
+ PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
|
+ String condition = "AN=" + patentNo + " OR " + "PN=" + patentNo + " OR " + "GN=" + patentNo;
|
|
|
+ patentStarListDTO.setCurrentQuery(condition);
|
|
|
+ String index = patentNo.substring(0, 2);
|
|
|
+ if (index.equals("CN") || index.equals("ZL")) {
|
|
|
+ patentStarListDTO.setDBType("CN");
|
|
|
+ } else {
|
|
|
+ patentStarListDTO.setDBType("WD");
|
|
|
+ }
|
|
|
+ patentStarListDTO.setOrderBy("AD");
|
|
|
+ patentStarListDTO.setOrderByType("DESC");
|
|
|
+ patentStarListDTO.setPageNum(1);
|
|
|
+ patentStarListDTO.setRowCount(10);
|
|
|
+ Records records = this.patentStarSearchLocal(patentStarListDTO);
|
|
|
+ Object data = records.getData();
|
|
|
+ String s = JSON.toJSONString(data);
|
|
|
+ List<PatentColumnDTO> list = JSON.parseArray(s, PatentColumnDTO.class);
|
|
|
+ PatentInfoDTO dto = new PatentInfoDTO();
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
+ for (PatentColumnDTO columnDTO : list) {
|
|
|
+ BeanUtils.copyProperties(columnDTO, dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(dto.getRowApplicationNo())) {
|
|
|
+ String txtGuid = this.getTxtGuid(dto.getRowApplicationNo(), patentNo);
|
|
|
+ dto.setTxtGuid(txtGuid);
|
|
|
+ }
|
|
|
+ List<InnerPatentPdfDTO> pdfList = this.getExternalTextPdf(dto.getAppNo(), dto.getRowApplicationNo(), dto.getPublicNo(), dto.getGrantNo());
|
|
|
+ if (!CollectionUtils.isEmpty(pdfList)) {
|
|
|
+ List<InnerPatentPdfDTO> pdfDTOS = new ArrayList<>();
|
|
|
+ for (InnerPatentPdfDTO innerPatentPdfDTO : pdfList) {
|
|
|
+ File file = FileUtils.getFileByUrl(innerPatentPdfDTO.getPdfGuid());
|
|
|
+ List<String> guidList = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
|
|
|
+ if (!CollectionUtils.isEmpty(guidList)) {
|
|
|
+ InnerPatentPdfDTO pdfDTO = new InnerPatentPdfDTO();
|
|
|
+ pdfDTO.setPdfGuid(guidList.get(0));
|
|
|
+ pdfDTO.setType(innerPatentPdfDTO.getType());
|
|
|
+ pdfDTOS.add(pdfDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setPdfDTOS(pdfDTOS);
|
|
|
+ }
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getTxtGuid(String rowApplicationNo,String patentNo) throws IOException {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ SelectClaimDTO externalClaim = this.queryExternalClaim(rowApplicationNo);
|
|
|
+ if (ObjectUtils.isNotEmpty(externalClaim)) {
|
|
|
+ List<Text> claimContent = externalClaim.getClaimContent();
|
|
|
+ if (!CollectionUtils.isEmpty(claimContent)) {
|
|
|
+ Text text = claimContent.stream().filter(i -> i.getIfOrigin().equals(true)).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotEmpty(text)) {
|
|
|
+ String claim = text.getTextContent();
|
|
|
+ String claimStr = claim.replaceAll("\t", "\n");
|
|
|
+ builder.append(" 权利要求");
|
|
|
+ builder.append("\n");
|
|
|
+ builder.append(claimStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Text> fullText = this.getCnFullText(rowApplicationNo);
|
|
|
+ if (!CollectionUtils.isEmpty(fullText)) {
|
|
|
+ Text text = fullText.stream().filter(i -> i.getIfOrigin().equals(true)).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotEmpty(text)) {
|
|
|
+ String specification = text.getTextContent();
|
|
|
+ builder.append("\n");
|
|
|
+ builder.append("\n");
|
|
|
+ builder.append("\n");
|
|
|
+ builder.append(" 说明书");
|
|
|
+ builder.append("\n");
|
|
|
+ builder.append(specification);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String result = builder.toString();
|
|
|
+ byte[] bytes = result.getBytes();
|
|
|
+ MultipartFile multipartFile = FileUtils.convertBytesToMultipartFile(bytes, patentNo + "-" + "文本文档.txt");
|
|
|
+ List<String> list = fileManagerService.uploadFileGetGuid(Collections.singletonList(multipartFile));
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
+ return list.get(0);
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 查询外部专利同族专利
|
|
|
*
|
|
|
* @param vo
|