chendayu 2 anos atrás
pai
commit
59684f2d12

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java

@@ -121,7 +121,7 @@ public class UploadParamsVO {
     }
 
     /**
-     * 专利摘要附图
+     * 专利摘要附图(用于Excel导入存放附图)
      */
     private PictureData pictureData;
     /**

+ 0 - 7
PAS/src/main/java/cn/cslg/pas/controller/TaskController.java

@@ -61,13 +61,6 @@ public class TaskController {
         return Response.success("添加任务完成");
     }
 
-//    @PostMapping("/addPatentNoTask")
-//    @Operation(summary = "根据专利号导入专利任务")
-//    public String addPatentNoTask(@RequestBody TaskAddNewDTO taskAddNewDTO) throws IOException {
-//        uploadTaskService.addPatentNoTask(taskAddNewDTO);
-//        return Response.success();
-//    }
-
     @PostMapping("/queryTasks")
     @Operation(summary = "查询任务列表")
     public String queryTasks(@RequestBody QueryTaskDTO queryTaskDTO) throws IOException {

+ 22 - 3
PAS/src/main/java/cn/cslg/pas/domain/PatentSimpleFamilyLink.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.domain;
 
 import cn.cslg.pas.common.model.BaseEntity;
+import com.alibaba.fastjson.annotation.JSONField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -30,13 +31,31 @@ public class PatentSimpleFamilyLink extends BaseEntity<PatentSimpleFamilyLink> {
 
     @TableField(exist = false)
     private String name;
-
     @TableField(exist = false)
     private List<PatentApplicant> applicant;
-
     @TableField(exist = false)
     private String abstractPath;
-
     @TableField(exist = false)
     private Integer patentId;
+    /**
+     * 公开号
+     */
+    @TableField(exist = false)
+    private String publicNo;
+    /**
+     * 申请号
+     */
+    @TableField(exist = false)
+    private String applicationNo;
+    /**
+     * 公开日
+     */
+    @TableField(exist = false)
+    private String publicDate;
+    /**
+     * 公告日
+     */
+    @TableField(exist = false)
+    private String publicAccreditDate;
+
 }

+ 6 - 1
PAS/src/main/java/cn/cslg/pas/domain/QuestionRecord.java

@@ -35,9 +35,14 @@ public class QuestionRecord implements Serializable {
     @TableField(value = "task_id")
     private Integer taskId;
     /**
-     * 失败字段
+     * 失败字段(1著录 2权要 3说明书文本 4说明书pdf 5摘要附图)
      */
     @TableField(value = "cell")
     private Integer cell;
+    /**
+     * 备注
+     */
+    @TableField(value = "remark")
+    private String remark;
 
 }

+ 96 - 67
PAS/src/main/java/cn/cslg/pas/service/getPatentStarPart/GetPatentStarPartService.java

@@ -11,7 +11,9 @@ import cn.cslg.pas.common.utils.ThrowException;
 import cn.cslg.pas.domain.*;
 import cn.cslg.pas.service.outApi.PatentStarApiService;
 import cn.cslg.pas.service.upLoadPatent.ExcutePatentDataStar;
+import cn.cslg.pas.service.upLoadPatent.QuestionRecordService;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 获取专利之星专利某部分(如权要、说明书等一项)业务层
@@ -112,6 +115,7 @@ public class GetPatentStarPartService {
      * @return 返回装载着说明书pdf的对象
      */
     public PatentDTO getInstructionPDF(String appNo, String patentNo) throws IOException {
+        String applicationNo = appNo + "";
         if (appNo.contains(".")) {
             appNo = appNo.substring(0, appNo.lastIndexOf("."));
         }
@@ -121,35 +125,34 @@ public class GetPatentStarPartService {
 
         String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
         if (patentNo.contains("CN")) {
-            //根据申请号调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
+            //调用"获得中国专利pdf"接口,获得公开和授权中的1个或2个url
             String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
+
+            //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
             if (pdfUrlStr.equals("")) {
+                excutePatentDataStar.recordQuestionPatent(applicationNo, 4);
                 return new PatentDTO();
             }
-            if (pdfUrlStr.contains("|http")) {  //若包含公开和授权两个pdf
+
+            if (pdfUrlStr.contains("|http")) {  //若两个都有
                 String[] pdfUrlArr = pdfUrlStr.split("\\|http");
                 pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
                 pdfUrlArr[1] = "http" + pdfUrlArr[1];
                 pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
+
+                PatentInstruction patentInstruction = new PatentInstruction();
+                PatentInstruction patentInstruction2 = new PatentInstruction();
+                patentInstruction.setUrl(pdfUrl1);
+                patentInstruction2.setUrl(pdfUrl2);
                 if (pdfUrl1.contains("0A_CN_0.pdf")) {
-                    PatentInstruction patentInstruction = new PatentInstruction();
-                    patentInstruction.setUrl(pdfUrl1);
                     patentInstruction.setType(1);
-                    patentInstructions.add(patentInstruction);
-                    PatentInstruction patentInstruction2 = new PatentInstruction();
-                    patentInstruction2.setUrl(pdfUrl2);
                     patentInstruction2.setType(2);
-                    patentInstructions.add(patentInstruction2);
                 } else {
-                    PatentInstruction patentInstruction = new PatentInstruction();
-                    patentInstruction.setUrl(pdfUrl2);
-                    patentInstruction.setType(1);
-                    patentInstructions.add(patentInstruction);
-                    PatentInstruction patentInstruction2 = new PatentInstruction();
-                    patentInstruction2.setUrl(pdfUrl1);
-                    patentInstruction2.setType(2);
-                    patentInstructions.add(patentInstruction2);
+                    patentInstruction.setType(2);
+                    patentInstruction2.setType(1);
                 }
+                patentInstructions.add(patentInstruction);
+                patentInstructions.add(patentInstruction2);
             } else {  //若只有一个
                 pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
                 PatentInstruction patentInstruction = new PatentInstruction();
@@ -160,19 +163,18 @@ public class GetPatentStarPartService {
                     patentInstruction.setType(2);
                 }
                 patentInstructions.add(patentInstruction);
-
             }
 
         } else {
             //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
             pdfUrl = patentStarApiService.getEnPdfApi(patentNo);
-            if (pdfUrl.equals("")) {
+
+            //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
+            if (pdfUrl.equals("") || pdfUrl.equals("{}")) {
+                excutePatentDataStar.recordQuestionPatent(patentNo, 4);
                 return new PatentDTO();
             }
-            if (pdfUrl.contains("?Expire")) {
-                //pdfUrl = pdfUrl.substring(pdfUrl.indexOf("http"), pdfUrl.indexOf("?Expire"));
-                return patentDTO;
-            }
+
             PatentInstruction patentInstruction = new PatentInstruction();
             patentInstruction.setUrl(pdfUrl);
             patentInstruction.setType(1);
@@ -195,6 +197,7 @@ public class GetPatentStarPartService {
         if (appNo.contains(".")) {
             appNo = appNo.substring(0, appNo.lastIndexOf("."));
         }
+
         String pictureUrl = patentStarApiService.getPictureApi(appNo);
 
         PatentDTO patentDTO = new PatentDTO();
@@ -221,13 +224,13 @@ public class GetPatentStarPartService {
 
         PatentDTO patentDTO = new PatentDTO();
         PageVO pageVO = new PageVO()
-                .setCurrent(current)
-                .setSize(size);
+                .setCurrent(current)  //装载当前页
+                .setSize(size);  //装载每页条数
 
         try {
-            //以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
+            //1.从同族接口获取同族号单
             String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(patentNo);
-            //若没有同族号,则返回空集合(表示该公开号暂无同族)
+            //若接口返回"no data"即没有同族号,则返回空集合同族信息
             if (familyPatentNoStr.equals("no data")) {
                 pageVO.setRecords(new ArrayList<>())
                         .setTotal(0);
@@ -236,69 +239,96 @@ public class GetPatentStarPartService {
             }
 
             FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
-            //familyPNStr:以分号;拼接的多个同族公开号字符串
-            String familyPNStr = familyPatentNo.getFamilyinfo();
-            List<String> familyPatentNos = Arrays.asList(familyPNStr.split(";"));
-
-            //集合转成字符串
-            String conditions = "PN=(" + StringUtils.join(familyPatentNos, " OR ") + ")";
-
-            //调用一般接口返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
-            PatentStarListDto patentStarListDto = new PatentStarListDto()
-                    .setCurrentQuery(conditions)
-                    .setOrderBy("ID")
-                    .setOrderByType("DESC")
-                    .setPageNum(current)
-                    .setRowCount(size)
-                    .setDBType("CN");
-            Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
-            if (resultMap == null || (Integer) resultMap.get("total") == 0) {
-                patentStarListDto.setDBType("WD");
-                resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
+            List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
+            //装载总条数
+            pageVO.setTotal(familyPatentNos.size());
+
+            //2.根据分页条件截取需要位置的条数
+            List<String> needShowFamilyPatentNos = pageBySubList(familyPatentNos, current, size);
+
+            //3.拼接成检索式
+            List<String> cNfamilyPatentNos = needShowFamilyPatentNos.stream().filter(item -> item.contains("CN")).collect(Collectors.toList());
+            List<String> wDfamilyPatentNos = needShowFamilyPatentNos.stream().filter(item -> !item.contains("CN")).collect(Collectors.toList());
+
+            String cNconditions = "", wDconditions = "";
+            if (cNfamilyPatentNos.size() > 0) {
+                cNconditions = "PN=(" + StringUtils.join(cNfamilyPatentNos, " OR ") + ")";
+            }
+            if (wDfamilyPatentNos.size() > 0) {
+                wDconditions = "PN=(" + StringUtils.join(wDfamilyPatentNos, " OR ") + ")";
+            }
+
+            //根据专利的国家类型调用并使用对应的库(中国/世界库),返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
+            List<StarPatentVO> cNpatents = new ArrayList<>();
+            List<StarPatentVO> wDpatents = new ArrayList<>();
+            if (!cNconditions.equals("")) {
+                PatentStarListDto patentStarListDto = new PatentStarListDto()
+                        .setCurrentQuery(cNconditions)
+                        .setOrderBy("ID")
+                        .setOrderByType("DESC")
+                        .setPageNum(1)
+                        .setRowCount(size)
+                        .setDBType("CN");
+                Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
                 if (resultMap == null || (Integer) resultMap.get("total") == 0) {
-                    ThrowException.throwXiaoShiException("发生未知错误,一般接口未检索出专利");
+                    for (String cNfamilyPatentNo : cNfamilyPatentNos) {
+                        cNpatents.add(new StarPatentVO().setPatentNo(cNfamilyPatentNo));
+                    }
+                } else {
+                    cNpatents = (List<StarPatentVO>) resultMap.get("records");
                 }
             }
-
-            List<StarPatentVO> patents = (List<StarPatentVO>) resultMap.get("records");
-            int total = patents.size();
-
-            //防止下标越界的判断(即判断所需当前页是否有数据)
-            if ((current - 1) * size >= total) {
-                pageVO.setRecords(new ArrayList<>())
-                        .setTotal(familyPatentNos.size());
-                patentDTO.setFamilyPatentResult(pageVO);
-                return patentDTO;
+            if (!wDconditions.equals("")) {
+                PatentStarListDto patentStarListDto = new PatentStarListDto()
+                        .setCurrentQuery(wDconditions)
+                        .setOrderBy("ID")
+                        .setOrderByType("DESC")
+                        .setPageNum(1)
+                        .setRowCount(size)
+                        .setDBType("WD");
+                Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
+                if (resultMap == null || (Integer) resultMap.get("total") == 0) {
+                    for (String wDfamilyPatentNo : wDfamilyPatentNos) {
+                        wDpatents.add(new StarPatentVO().setPatentNo(wDfamilyPatentNo));
+                    }
+                } else {
+                    wDpatents = (List<StarPatentVO>) resultMap.get("records");
+                }
             }
 
-            //根据分页信息,取分页区间内的同族号
-            //familyPatentNos = pageBySubList(familyPatentNos, current, size);
+            //将中国和外国专利数据合并
+            ArrayList<StarPatentVO> patents = new ArrayList<>();
+            patents.addAll(cNpatents);
+            patents.addAll(wDpatents);
 
             List<PatentSimpleFamilyLink> records = new ArrayList<>();
             for (StarPatentVO starPatent : patents) {
                 PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
-                patentSimpleFamilyLink.setAbstractPath(starPatent.getAbstractPath());  //装载摘要附图
-                patentSimpleFamilyLink.setPatentNo(starPatent.getPatentNo());  //装载公开号
+                patentSimpleFamilyLink.setPatentNo(starPatent.getPatentNo());  //装载专利号
+                patentSimpleFamilyLink.setPublicNo(starPatent.getPublicNo());  //装载公开号
+                patentSimpleFamilyLink.setApplicationNo(starPatent.getApplicationNo());  //装载申请号
+                patentSimpleFamilyLink.setPublicDate(starPatent.getPublicDate());  //装载公开日
+                patentSimpleFamilyLink.setPublicAccreditDate(starPatent.getPublicAccreditDate());  //装载公告日
                 patentSimpleFamilyLink.setName(starPatent.getName());  //装载标题
                 //装载申请人和权利人
                 ArrayList<PatentApplicant> patentApplicants = new ArrayList<>();
                 //装载申请人
                 if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
-                    List<String> patentApplicantOriginalNames = Arrays.asList(starPatent.getApplicantStr().split(";"));
+                    String[] patentApplicantOriginalNames = starPatent.getApplicantStr().split(";");
                     for (String patentApplicantOriginalName : patentApplicantOriginalNames) {
                         PatentApplicant patentApplicant = new PatentApplicant();
                         patentApplicant.setName(patentApplicantOriginalName);
-                        patentApplicant.setDataType(1);
+                        patentApplicant.setDataType(2);
                         patentApplicants.add(patentApplicant);  //装载申请人
                     }
                 }
                 //装载权利人
                 if (starPatent.getCurrentApplicantStr() != null && !starPatent.getCurrentApplicantStr().equals("")) {
-                    List<String> patentApplicantCurrentNames = (Arrays.asList(starPatent.getCurrentApplicantStr().split(";")));
+                    String[] patentApplicantCurrentNames = (starPatent.getCurrentApplicantStr().split(";"));
                     for (String patentApplicantCurrentName : patentApplicantCurrentNames) {
                         PatentApplicant patentApplicant = new PatentApplicant();
                         patentApplicant.setName(patentApplicantCurrentName);
-                        patentApplicant.setDataType(2);
+                        patentApplicant.setDataType(1);
                         patentApplicants.add(patentApplicant);  //装载权利人
                     }
                 }
@@ -306,9 +336,9 @@ public class GetPatentStarPartService {
                 records.add(patentSimpleFamilyLink);
             }
 
-            pageVO.setRecords(records)
-                    .setTotal(total);
+            pageVO.setRecords(records);  //装载结果集
             patentDTO.setFamilyPatentResult(pageVO);
+
         } catch (Exception e) {
             pageVO.setRecords(new ArrayList<>())
                     .setTotal(0);
@@ -368,7 +398,6 @@ public class GetPatentStarPartService {
         return patentDTO;
     }
 
-
     /**
      * 根据分页信息,取同族号集合中分页区间内的同族号
      *

+ 7 - 5
PAS/src/main/java/cn/cslg/pas/service/outApi/PatentStarApiService.java

@@ -248,12 +248,14 @@ public class PatentStarApiService {
                         }
                 );
             }
+            //TODO 此处不调用取附图接口,(遍历调接口效率太低)  提出者:罗总
             //附图
-            if (item.getApplicationNo() != null && item.getApplicationNo() != "") {
-                String apN = item.getApplicationNo().replace(".", "");
-                String path = this.getPictureApi(apN.substring(2));
-                item.setAbstractPath(path);
-            }
+//            if (item.getApplicationNo() != null && item.getApplicationNo() != "") {
+//                String apN = item.getApplicationNo().replace(".", "");
+//
+//                //String path = this.getPictureApi(apN.substring(2));
+//                //item.setAbstractPath(path);
+//            }
             if (item.getLG() != null) {
                 switch (item.getLG()) {
                     case 1:

+ 204 - 201
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataStar.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.service.upLoadPatent;
 
+import cn.cslg.pas.common.model.dto.PatentDTO;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import cn.cslg.pas.common.model.outApi.PatentStarListDto;
 import cn.cslg.pas.common.model.vo.KeyValueVO;
@@ -13,9 +14,11 @@ import cn.cslg.pas.domain.asso.TaskCondition;
 import cn.cslg.pas.service.TaskService;
 import cn.cslg.pas.service.UploadPatentBatchService;
 import cn.cslg.pas.service.asso.TaskConditionService;
+import cn.cslg.pas.service.getPatentStarPart.GetPatentStarPartService;
 import cn.cslg.pas.service.outApi.PatentStarApiService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.fileupload.FileItem;
@@ -51,6 +54,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
     private final UploadPatentBatchService uploadPatentBatchService;
     private final TaskService taskService;
     private final TaskConditionService taskConditionService;
+    private final QuestionRecordService questionRecordService;
     private Integer pTaskId = 0;
     private Integer pTaskStatus = 0;
 
@@ -470,10 +474,6 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
             uploadParamsVO.setSimpleStatus(starPatent.getSimpleStatus());
         }
-        //装载受理局
-        if (starPatent.getBureau() != null && !starPatent.getBureau().equals("")) {
-            uploadParamsVO.getPatent().setBureau(starPatent.getBureau());
-        }
         //装载优先权
         if (starPatent.getPriorityNo() != null && !starPatent.getPriorityNo().equals("")) {
             uploadParamsVO.getPatent().setPriorityNo(starPatent.getPriorityNo());
@@ -483,6 +483,10 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             int timeStamp = stringDateToTimeStamp(starPatent.getPriorityDate());
             uploadParamsVO.getPatent().setPriorityDate(timeStamp);
         }
+        //装载受理局
+        if (starPatent.getBureau() != null && !starPatent.getBureau().equals("")) {
+            uploadParamsVO.getPatent().setBureau(starPatent.getBureau());
+        }
 
 
         String appNo;
@@ -588,8 +592,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                     uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
                 }
                 //装载CPC分类号
-                String[] cpcArr = worldPatentZhuLu.getCpc().split(";");
-                uploadParamsVO.setCpcList(Arrays.asList(cpcArr));
+                if (uploadParamsVO.getCpcList() == null || uploadParamsVO.getCpcList().size() == 0) {
+                    if (worldPatentZhuLu.getCpc() != null && !worldPatentZhuLu.getCpc().equals("")) {
+                        String[] cpcArr = worldPatentZhuLu.getCpc().split(";");
+                        uploadParamsVO.setCpcList(Arrays.asList(cpcArr));
+                    }
+                }
                 //装载申请人
                 if (uploadParamsVO.getPatentApplicantOriginalName() == null || uploadParamsVO.getPatentApplicantOriginalName().size() == 0) {
                     uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(worldPatentZhuLu.getPa().split(";")));
@@ -624,7 +632,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             }
 
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
 
         //以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
@@ -633,41 +641,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
                 if (!familyPatentNoStr.equals("no data")) {
                     FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
-                    //装载同族号
-                    if (familyPatentNo.getFamilyinfo() != null && !familyPatentNo.getFamilyinfo().equals("")) {
-                        List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
-                        //集合转成字符串
-                        String conditions = "PN=(" + StringUtils.join(familyPatentNos, " OR ") + ")";
-
-                        //调用一般接口返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
-                        PatentStarListDto patentStarListDto = new PatentStarListDto()
-                                .setCurrentQuery(conditions)
-                                .setOrderBy("ID")
-                                .setOrderByType("DESC")
-                                .setPageNum(1)
-                                .setRowCount(50)
-                                .setDBType("CN");
-                        Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
-                        List<StarPatentVO> patents = new ArrayList<>();
-                        if (resultMap == null || (Integer) resultMap.get("total") == 0) {
-                            patentStarListDto.setDBType("WD");
-                            resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
-                            if (resultMap != null && (Integer) resultMap.get("total") != 0) {
-                                patents = (List<StarPatentVO>) resultMap.get("records");
-                            }
-                        } else {
-                            patents = (List<StarPatentVO>) resultMap.get("records");
-                        }
-                        if (patents != null && patents.size() > 0) {
-                            List<String> simpleFamilys = patents.stream().map(StarPatentVO::getPatentNo).collect(Collectors.toList());
-                            uploadParamsVO.setSimpleFamily(simpleFamilys);
-                        }
-                    }
+                    List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
+                    uploadParamsVO.setSimpleFamily(familyPatentNos);
                 }
             }
-
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
 
         //以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
@@ -711,7 +690,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             }
 
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
 
     }
@@ -723,39 +702,48 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param uploadParamsVO 专利实体类对象
      */
     public void setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
-        String appNo;
-        if (starPatent.getApplicationNo().contains(".")) {
-            appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
-        } else {
-            appNo = starPatent.getApplicationNo();
-        }
-        //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
-        String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
-
-        //使用正则表达式拼接出权要原文
-        String regex = "(?<=<claim id=.{1,110}>)[\\w\\W]+?(?=</claim>)";
-        Pattern compile = Pattern.compile(regex);
-        Matcher matcher = compile.matcher(cnFullXmlStr);
-        StringBuilder builder = new StringBuilder();
-        while (matcher.find()) {
-            String macherGroup = matcher.group();
-            String right = macherGroup.replaceAll("<!--.*?-->", "").trim();
-            right = right.replaceAll("<.*?>", "").trim();
-            builder.append(right).append("\r\n");
-        }
+        try {
+            String applicationNo = starPatent.getApplicationNo() + "";
+            String appNo;
+            if (starPatent.getApplicationNo().contains(".")) {
+                appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
+            } else {
+                appNo = starPatent.getApplicationNo();
+            }
+            //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
+            String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
 
-//        <!-- SIPO <DP n="1"> -->
+            //若没有取到全文文本,即取不到权要,则将当前申请号或专利号和备注信息记录到问题记录表
+            if (cnFullXmlStr.equals("")) {
+                recordQuestionPatent(applicationNo, 2);
+                return;
+            }
 
-        String patentRightText = builder + "";
+            //使用正则表达式拼接出权要原文
+            String regex = "(?<=<claim id=.{1,110}>)[\\w\\W]+?(?=</claim>)";
+            Pattern compile = Pattern.compile(regex);
+            Matcher matcher = compile.matcher(cnFullXmlStr);
+            StringBuilder builder = new StringBuilder();
+            while (matcher.find()) {
+                String macherGroup = matcher.group();
+                String right = macherGroup.replaceAll("<!--.*?-->", "").trim();
+                right = right.replaceAll("<.*?>", "").trim();
+                builder.append(right).append("\r\n");
+            }
 
-        //使用工具类去除字符串文本中的所有HTML格式标签
-        patentRightText = RemoveHtmlTagsUtils.removeHtmlTags(patentRightText);
-        patentRightText = patentRightText.trim();
+            String patentRightText = builder + "";
 
-        //装载权利要求原文
-        PatentRight patentRight = new PatentRight();
-        patentRight.setContent(patentRightText);
-        uploadParamsVO.setPatentRight(patentRight);
+            //使用工具类去除字符串文本中的所有HTML格式标签
+            patentRightText = RemoveHtmlTagsUtils.removeHtmlTags(patentRightText);
+            patentRightText = patentRightText.trim();
+
+            //装载权利要求原文
+            PatentRight patentRight = new PatentRight();
+            patentRight.setContent(patentRightText);
+            uploadParamsVO.setPatentRight(patentRight);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
     }
 
@@ -766,68 +754,42 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param uploadParamsVO 专利实体类对象
      */
     public void setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
-        String appNo;
-        if (starPatent.getApplicationNo().contains(".")) {
-            appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
-        } else {
-            appNo = starPatent.getApplicationNo();
-        }
-        //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
-        String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
-
-        //使用正则表达式拼接出说明书文本全文
-        String regex = "(?<=<description>)[\\w\\W]+?(?=</description>)";
-        Pattern compile = Pattern.compile(regex);
-        Matcher matcher = compile.matcher(cnFullXmlStr);
-//        StringBuilder builder = new StringBuilder();
-//        String regexTable = "(?<=<tables[^>]{1,50}>)[\\w\\W]+?(?=</tables>)";
-//        Pattern compileTable = Pattern.compile(regexTable);
-        String text = "";
-        while (matcher.find()) {
-            text = matcher.group();
-            text = text.replaceAll("<invention-title[^>]*>.*?(\\n{0,}|\\s{0,}?)</invention-title>", "");
-            text = text.replaceAll("<br/>", "");
-            text = text.replaceAll("\\s", "");
+        try {
+            String applicationNo = starPatent.getApplicationNo() + "";
+            String appNo;
+            if (starPatent.getApplicationNo().contains(".")) {
+                appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
+            } else {
+                appNo = starPatent.getApplicationNo();
+            }
+            //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
+            String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
+
+            //若没有取到全文文本,即取不到说明书文本,则将当前申请号或专利号和备注信息记录到问题记录表
+            if (cnFullXmlStr.equals("")) {
+                recordQuestionPatent(applicationNo, 3);
+                return;
+            }
+
+            //使用正则表达式拼接出说明书文本全文
+            String regex = "(?<=<description>)[\\w\\W]+?(?=</description>)";
+            Pattern compile = Pattern.compile(regex);
+            Matcher matcher = compile.matcher(cnFullXmlStr);
+            String text = "";
+            while (matcher.find()) {
+                text = matcher.group();
+                text = text.replaceAll("<invention-title[^>]*>.*?(\\n{0,}|\\s{0,}?)</invention-title>", "");
+                text = text.replaceAll("<br/>", "");
+                text = text.replaceAll("\\s", "");
+            }
+
+            //装载说明书文本全文
+            PatentInstructionText patentInstructionText = new PatentInstructionText();
+            patentInstructionText.setManual(text.trim());
+            uploadParamsVO.setPatentInstructionText(patentInstructionText);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-//        String oldRow = matcher.group();
-//        oldRow = oldRow.replaceAll("\\s", "");
-//        if (oldRow.contains("num=\"n")) {
-//            oldRow = oldRow.substring(oldRow.indexOf("num=\"n") + 6);
-//            oldRow = "[" + oldRow;
-//            oldRow = oldRow.replace("\">", "]");
-//        } else if (oldRow.contains("num=")) {
-//            oldRow = oldRow.substring(oldRow.indexOf("num=") + 5);
-//            oldRow = "[" + oldRow;
-//            oldRow = oldRow.replace("\">", "]");
-//        } else {
-//            oldRow = oldRow.substring(oldRow.indexOf("\">") + 2);
-//        }
-//            Matcher matcherTable = compileTable.matcher(oldRow);
-//            StringBuilder builder1 = new StringBuilder();
-//            while (matcherTable.find()) {
-//                String tableGroup = matcherTable.group();
-//                tableGroup = tableGroup.replaceAll("<tgroup[^>]*>", "").replaceAll("</tgroup >", "").replaceAll("<colspec[^>]*>", "").
-//                        replaceAll("</colspec>", "").replaceAll("<colspec", "<td").replaceAll("row", "tr").
-//                        replaceAll("entry", "td");
-//                builder1.append(tableGroup);
-//            }
-//            if ((builder1 + "").length() > 0) {
-//                oldRow = builder1 + "";
-//            }
-
-//            builder.append(oldRow).append("\r\n");
-//        }
-
-//        String instructionText = builder + "";
-
-        //使用工具类去除字符串文本中的所有HTML格式标签
-//        instructionText = RemoveHtmlTagsUtils.removeHtmlTags(instructionText);
-//        instructionText = instructionText.trim();
-
-        //装载说明书文本全文
-        PatentInstructionText patentInstructionText = new PatentInstructionText();
-        patentInstructionText.setManual(text.trim());
-        uploadParamsVO.setPatentInstructionText(patentInstructionText);
 
     }
 
@@ -838,53 +800,66 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param uploadParamsVO 专利实体类对象
      */
     public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
-        String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
-        if ((starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) || (starPatent.getApplicationNo() != null && !starPatent.getApplicationNo().equals(""))) {
-            //根据申请号调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
-            if (starPatent.getPatentNo().contains("CN")) {
-                String appNo = starPatent.getApplicationNo();
-                if (appNo.contains(".")) {
-                    appNo = appNo.substring(0, appNo.lastIndexOf("."));
-                }
-                String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
-                if (pdfUrlStr.equals("")) {
-                    return;
-                }
-                if (pdfUrlStr.contains("|http")) {  //若包含公开和授权两个pdf
-                    String[] pdfUrlArr = pdfUrlStr.split("\\|http");
-                    pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
-                    pdfUrlArr[1] = "http" + pdfUrlArr[1];
-                    pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
-                    UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
-                    UploadFileDTO fileDTO2 = downLoadPdf(pdfUrl2);
-                    if (pdfUrl1.contains("0A_CN_0.pdf")) {
-                        uploadParamsVO.setPdf1FileDTO(fileDTO);
-                        uploadParamsVO.setPdf2FileDTO(fileDTO2);
-                    } else {
-                        uploadParamsVO.setPdf1FileDTO(fileDTO2);
-                        uploadParamsVO.setPdf2FileDTO(fileDTO);
+        try {
+            String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
+            if ((starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) || (starPatent.getApplicationNo() != null && !starPatent.getApplicationNo().equals(""))) {
+                //根据申请号调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
+                if (starPatent.getPatentNo().contains("CN")) {
+                    String appNo = starPatent.getApplicationNo();
+                    if (appNo.contains(".")) {
+                        appNo = appNo.substring(0, appNo.lastIndexOf("."));
                     }
-                } else {  //若只有一个
-                    pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
-                    UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
-                    if (pdfUrl1.contains("0A_CN_0.pdf")) {
-                        uploadParamsVO.setPdf1FileDTO(fileDTO);
-                    } else {
-                        uploadParamsVO.setPdf2FileDTO(fileDTO);
+                    String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
+
+                    //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
+                    if (pdfUrlStr.equals("")) {
+                        recordQuestionPatent(starPatent.getPatentNo(), 4);
+                        return;
                     }
-                }
 
-                //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
-            } else {
-                pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
-                if (pdfUrl.equals("")) {
-                    return;
+                    if (pdfUrlStr.contains("|http")) {  //若包含公开和授权两个pdf
+                        String[] pdfUrlArr = pdfUrlStr.split("\\|http");
+                        pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
+                        pdfUrlArr[1] = "http" + pdfUrlArr[1];
+                        pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
+                        UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
+                        UploadFileDTO fileDTO2 = downLoadPdf(pdfUrl2);
+                        if (pdfUrl1.contains("0A_CN_0.pdf")) {
+                            uploadParamsVO.setPdf1FileDTO(fileDTO);
+                            uploadParamsVO.setPdf2FileDTO(fileDTO2);
+                        } else {
+                            uploadParamsVO.setPdf1FileDTO(fileDTO2);
+                            uploadParamsVO.setPdf2FileDTO(fileDTO);
+                        }
+                    } else {  //若只有一个
+                        pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
+                        UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
+                        if (pdfUrl1.contains("0A_CN_0.pdf")) {
+                            uploadParamsVO.setPdf1FileDTO(fileDTO);
+                        } else {
+                            uploadParamsVO.setPdf2FileDTO(fileDTO);
+                        }
+                    }
+
+                    //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
+                } else {
+                    pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
+
+                    //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
+                    if (pdfUrl.equals("") || pdfUrl.equals("{}")) {
+                        recordQuestionPatent(starPatent.getPatentNo(), 4);
+                        return;
+                    }
+
+                    UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
+                    uploadParamsVO.setPdf1FileDTO(fileDTO);
                 }
-                UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
-                uploadParamsVO.setPdf1FileDTO(fileDTO);
-            }
 
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
         }
+
     }
 
     /**
@@ -894,37 +869,47 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param uploadParamsVO 专利实体类对象
      */
     public void setPatentPicture(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
-        //取出一般接口返回的摘要附图路径
-        String pictureUrl = starPatent.getAbstractPath();
-        URL url = new URL(pictureUrl);  //想要读取的url地址
-        InputStream in = url.openStream();
-        File file = File.createTempFile("new_url", ".jpg");  //创建文件
-        OutputStream os = new FileOutputStream(file);  //创建文件输出流
-        int bytesRead;
-        byte[] buffer = new byte[8192];
-        int len = 8192;
-        while ((bytesRead = in.read(buffer, 0, len)) != -1) {
-            os.write(buffer, 0, bytesRead);
-        }
-        //关闭释放流
-        os.close();
-        in.close();
-
-        DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
-        FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
-        buffer = new byte[8192];
-        FileInputStream fis = new FileInputStream(file);
-        OutputStream fos = item.getOutputStream();
-        len = 8192;
-        while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
-            fos.write(buffer, 0, bytesRead);
+        try {
+            //调用"获取中国专利摘要附图"接口
+            String appNo = starPatent.getApplicationNo();
+            if (appNo.contains(".")) {
+                appNo = appNo.substring(0, appNo.lastIndexOf("."));
+            }
+            if (appNo.contains("CN")) {
+                String pictureUrl = patentStarApiService.getPictureApi(appNo);
+                URL url = new URL(pictureUrl);  //想要读取的url地址
+                InputStream in = url.openStream();
+                File file = File.createTempFile("new_url", ".jpg");  //创建文件
+                OutputStream os = new FileOutputStream(file);  //创建文件输出流
+                int bytesRead;
+                byte[] buffer = new byte[8192];
+                int len = 8192;
+                while ((bytesRead = in.read(buffer, 0, len)) != -1) {
+                    os.write(buffer, 0, bytesRead);
+                }
+                //关闭释放流
+                os.close();
+                in.close();
+
+                DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
+                FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
+                buffer = new byte[8192];
+                FileInputStream fis = new FileInputStream(file);
+                OutputStream fos = item.getOutputStream();
+                len = 8192;
+                while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
+                    fos.write(buffer, 0, bytesRead);
+                }
+                //关闭释放流
+                fos.close();
+                fis.close();
+                MultipartFile multipartFile = new CommonsMultipartFile(item);
+                UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
+                uploadParamsVO.setPictureFileDTO(fileDTO);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-        //关闭释放流
-        fos.close();
-        fis.close();
-        MultipartFile multipartFile = new CommonsMultipartFile(item);
-        UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
-        uploadParamsVO.setPictureFileDTO(fileDTO);
 
     }
 
@@ -1089,6 +1074,24 @@ public class ExcutePatentDataStar implements IExcutePatentData {
         return calculate;
     }
 
+    /**
+     * 记录没有数据的专利信息
+     *
+     * @param applicationNoOrPatentNo 公开号/申请号
+     * @param cell                    失败字段(1著录 2权要 3说明书文本 4说明书pdf 5摘要附图)
+     */
+    public void recordQuestionPatent(String applicationNoOrPatentNo, int cell) {
+        QuestionRecord questionRecord = new QuestionRecord()
+                .setPatentNo(applicationNoOrPatentNo)
+                .setCell(cell)
+                .setTaskId(-1)
+                .setRemark("该公开号或申请号的该字段接口检索返回原始数据为空");
+        List<QuestionRecord> questionRecords = questionRecordService.list(new LambdaQueryWrapper<QuestionRecord>().eq(QuestionRecord::getPatentNo, applicationNoOrPatentNo).eq(QuestionRecord::getCell, cell).eq(QuestionRecord::getTaskId, -1));
+        if (questionRecords == null || questionRecords.size() == 0) {
+            questionRecordService.save(questionRecord);
+        }
+    }
+
     public void setTaskStatus(Integer taskId, Integer taskStatus) {
         this.pTaskId = taskId;
         this.pTaskStatus = taskStatus;