Преглед изворни кода

Merge branch 'dev2' into test

lwhhszx пре 2 година
родитељ
комит
1c977dd834
31 измењених фајлова са 780 додато и 461 уклоњено
  1. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/dto/TaskAddNewDTO.java
  2. 16 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/QueryTaskVO.java
  3. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java
  4. 8 9
      PAS/src/main/java/cn/cslg/pas/common/utils/PatentRightUtils.java
  5. 7 0
      PAS/src/main/java/cn/cslg/pas/controller/CommonController.java
  6. 2 1
      PAS/src/main/java/cn/cslg/pas/controller/GetPatentStarPartController.java
  7. 6 7
      PAS/src/main/java/cn/cslg/pas/controller/TaskController.java
  8. 4 0
      PAS/src/main/java/cn/cslg/pas/domain/PQueueData.java
  9. 11 1
      PAS/src/main/java/cn/cslg/pas/domain/PatentInstruction.java
  10. 22 3
      PAS/src/main/java/cn/cslg/pas/domain/PatentSimpleFamilyLink.java
  11. 6 1
      PAS/src/main/java/cn/cslg/pas/domain/QuestionRecord.java
  12. 1 1
      PAS/src/main/java/cn/cslg/pas/domain/Task.java
  13. 15 0
      PAS/src/main/java/cn/cslg/pas/service/OutInterfaceService.java
  14. 2 0
      PAS/src/main/java/cn/cslg/pas/service/PatentFieldService.java
  15. 1 1
      PAS/src/main/java/cn/cslg/pas/service/PatentInstructionService.java
  16. 35 7
      PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java
  17. 17 3
      PAS/src/main/java/cn/cslg/pas/service/PatentService.java
  18. 1 0
      PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java
  19. 64 20
      PAS/src/main/java/cn/cslg/pas/service/TaskService.java
  20. 136 75
      PAS/src/main/java/cn/cslg/pas/service/getPatentStarPart/GetPatentStarPartService.java
  21. 1 1
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java
  22. 22 23
      PAS/src/main/java/cn/cslg/pas/service/outApi/PatentStarApiService.java
  23. 4 0
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataExcel.java
  24. 301 255
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataStar.java
  25. 48 25
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/PantentQueueService.java
  26. 19 19
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java
  27. 6 0
      PAS/src/main/resources/application-prodNetIn.yml
  28. 7 1
      PAS/src/main/resources/application-prodNetOut.yml
  29. 1 1
      PAS/src/main/resources/application.yml
  30. 1 1
      PAS/src/main/resources/mapper/PatentMapper.xml
  31. 14 4
      PAS/src/main/resources/mapper/TaskMapper.xml

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/dto/TaskAddNewDTO.java

@@ -62,7 +62,7 @@ public class TaskAddNewDTO {
      */
     private Integer reportId;
     /**
-     * 任务类型2(3.欧专局 4.专利之星)
+     * 任务类型2(3.欧专局导入 4.专利之星导入 5.专利号导入
      */
     private Integer taskType2;
     /**

+ 16 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/QueryTaskVO.java

@@ -92,6 +92,10 @@ public class QueryTaskVO implements Serializable {
      * 最近更新时间(即上面的结束时间endTime)
      */
     private Integer modifiedTime;
+    /**
+     * Excel文件地址
+     */
+    private String url;
 
     //以上若是网站导入的任务,则以下为关联任务条件表数据;以上若是Excel导入的任务,则以下都是null
     /**
@@ -138,6 +142,18 @@ public class QueryTaskVO implements Serializable {
      * 创建人名称
      */
     private String createName;
+    /**
+     * isAddPatentNos中的多个专利或申请号的下载任务类型(1.检索页面手动勾选的专利下载任务 2.多个专利号导入的下载任务)
+     */
+    private Integer isAddType;
+    /**
+     * 专题库名称
+     */
+    private String projectName;
+    /**
+     * 报告名称
+     */
+    private String reportName;
 
     //以下属性是两张表都没有的(值为:任务表使用的oldName、任务条件表由手动装载生成)
     /**

+ 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;
     /**

+ 8 - 9
PAS/src/main/java/cn/cslg/pas/common/utils/PatentRightUtils.java

@@ -21,7 +21,6 @@ public class PatentRightUtils {
 
     public static List<PatentRight> formatPatentRight(PatentRightParams params) {
         try {
-
             //国家
             String country = params.getPatentNo().substring(0, 2);
             //原文
@@ -29,19 +28,19 @@ public class PatentRightUtils {
             //译文
             String contentOut = params.getContentOut();
 
-            //创建一个权要集合
+            //创建一个权要集合用于返回结果
             ArrayList<PatentRight> patentRights = new ArrayList<>();
 
-            //若原文为null或空串,则直接结束并返回空集合;若译文为null,则置为空串
+            //若原文为null或空串,则直接结束并返回空集合;
             if (content == null || content.equals("")) {
                 return patentRights;
             }
-
+            //若译文为null,则置为空串
             if (contentOut == null) {
                 contentOut = "";
             }
 
-            //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@",这样首先可以使得全文连在一起,其次再根据特殊符号@拆分权要
+            //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@"(先使得全文连在一起,再根据特殊符号@拆分权要)
             if (content.contains("\r\n")) {
                 content = content.replaceAll("\r\n", "@");
             }
@@ -63,13 +62,13 @@ public class PatentRightUtils {
             if (country.equals("CN") || country.equals("JP") || country.equals("KR") || content.contains("权利要求")) {
                 String regex;
                 if (content.contains("@2")) {
-                    regex = "@[0-9]+";
+                    regex = "@[1-9]+";
                 } else if (content.contains("@[00")) {
                     regex = "@\\[[0-9]+]";
                 } else if (content.contains("@請求項")) {
-                    regex = "@【請求項[0-9]+】";
+                    regex = "@【請求項[1-9]+】";
                 } else if (content.contains("@청구항")) {
-                    regex = "@청구항 [0-9]+";
+                    regex = "@청구항 [1-9]+";
                 } else {
                     regex = "";
                 }
@@ -185,7 +184,7 @@ public class PatentRightUtils {
 
                 String regex;
                 if (content.contains("@")) {
-                    regex = "@[0-9]+";
+                    regex = "@[1-9]+";
                 } else if (content.contains("[001]")) {
                     regex = "\\[[0-9]+]";
                 } else {

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

@@ -178,6 +178,13 @@ public class CommonController {
         return new ResponseEntity<>(new FileSystemResource(file), headers, status);
     }
 
+    @PostMapping("downloadPartUrlFile")
+    @Operation(summary = "由报告系统下载接口调用获得本分析系统的文件夹层级路径")
+    public String downloadPartUrlFile(@RequestBody String url) {
+        String filePath = fileUtils.getSystemPath() + url;
+        return Response.success(filePath);
+    }
+
     @PostMapping("/upload/chunks")
     @Operation(summary = "上传分片")
     public String uploadChunks(MultipartFile file, String md5, Integer index) throws IOException {

+ 2 - 1
PAS/src/main/java/cn/cslg/pas/controller/GetPatentStarPartController.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
+import java.sql.SQLException;
 
 /**
  * 获取专利之星专利某部分(如权要、说明书等一项)控制层
@@ -30,7 +31,7 @@ public class GetPatentStarPartController {
 
     @Operation(summary = "根据专利号或申请号获取专利指定部分项")
     @PostMapping("/getPatentPart")
-    public String getPatentPart(@RequestBody GetPatentStarPartDTO getPatentStarPartDTO) throws IOException {
+    public String getPatentPart(@RequestBody GetPatentStarPartDTO getPatentStarPartDTO) throws IOException, SQLException {
         log.info("开始处理【根据专利号或申请号获取专利指定部分项】的请求,请求参数为:{}", getPatentStarPartDTO);
 
         PatentDTO patentPart = getPatentStarPartService.getPatentPart(getPatentStarPartDTO);

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

@@ -61,19 +61,18 @@ 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 {
         return Response.success(taskService.queryTasks(queryTaskDTO));
     }
 
+    @GetMapping("/queryTaskById")
+    @Operation(summary = "根据id查询任务")
+    public String queryTaskByTaskId(Integer taskId) {
+        return Response.success(taskService.getById(taskId));
+    }
+
     @PostMapping("/queryQrtzTaskLogs")
     @Operation(summary = "查询定时任务执行日志")
     public String queryQrtzTaskLogs(@RequestBody QueryQrtzTaskLogsDTO queryQrtzTaskLogsDTO) {

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/domain/PQueueData.java

@@ -28,5 +28,9 @@ public class PQueueData implements Serializable {
      * 专利之星调用一般接口返回专利数据
      */
     private StarPatentVO starPatent;
+    /**
+     * 该专利检索专利之星接口次数(如权要或说明书第一次调用中国专利全文文本接口返回空,则num++,直到num为3)
+     */
+    private int callNum;
 
 }

+ 11 - 1
PAS/src/main/java/cn/cslg/pas/domain/PatentInstruction.java

@@ -1,9 +1,12 @@
 package cn.cslg.pas.domain;
 
 import cn.cslg.pas.common.model.SuperEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import javax.sql.rowset.serial.SerialBlob;
+
 /**
  * <p>
  * 专利说明书
@@ -25,7 +28,6 @@ public class PatentInstruction extends SuperEntity<PatentInstruction> {
      * 附件上传地址
      */
     private String url;
-
     /**
      * 专利ID
      */
@@ -56,4 +58,12 @@ public class PatentInstruction extends SuperEntity<PatentInstruction> {
      */
     private String fileName;
 
+    /**
+     * 文件流
+     */
+    //private byte[] buffer;
+    //private SerialBlob blob;
+    @TableField(exist = false)
+    private String pictureStringData;
+
 }

+ 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;
 
 }

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

@@ -23,7 +23,7 @@ import java.util.List;
 public class Task extends BaseEntity<Task> {
 
     /**
-     * 任务类型 1.Excel导入 2.导出 3.EPO欧专局导入 4.专利之星导入
+     * 任务类型 1.Excel导入 2.导出 3.EPO欧专局导入 4.专利之星导入 5.专利号导入
      */
     @TableField("type")
     private Integer type;

+ 15 - 0
PAS/src/main/java/cn/cslg/pas/service/OutInterfaceService.java

@@ -212,4 +212,19 @@ public class OutInterfaceService {
         return Objects.requireNonNull(httpClient.newCall(request).execute().body()).string();
     }
 
+    public String getReportsFromRMS(List<Integer> reportIds) throws IOException {
+        String param = new Gson().toJson(reportIds);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        OkHttpClient httpClient = new OkHttpClient.Builder()
+                .pingInterval(400, TimeUnit.SECONDS) // 设置 PING 帧发送间隔
+                .connectTimeout(300, TimeUnit.SECONDS)//设置连接超时时间
+                .readTimeout(300, TimeUnit.SECONDS)//设置读取超时时间
+                .build();
+        Request request = new Request.Builder()
+                .url(RMSUrl + "/api/report/api/report/getReportsByIds")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(httpClient.newCall(request).execute().body()).string();
+    }
+
 }

+ 2 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentFieldService.java

@@ -230,6 +230,8 @@ public class PatentFieldService {
             add(new PatentField("quotedNum", "被引用数量", Constants.SYSTEM_FIELD_PATENT_LIST, 25));
             add(new PatentField("agency", "代理机构", Constants.SYSTEM_FIELD_PATENT_LIST, 26));
             add(new PatentField("agent", "代理人", Constants.SYSTEM_FIELD_PATENT_LIST, 27));
+            add(new PatentField("publicAccreditNo", "授权号", Constants.SYSTEM_FIELD_PATENT_LIST, 28));
+            add(new PatentField("publicNo", "公开号", Constants.SYSTEM_FIELD_PATENT_LIST, 29));
             add(new PatentField("clientName", "委托方", Constants.SYSTEM_FIELD_PROJECT, 1));
             add(new PatentField("scenarioid", "应用场景", Constants.SYSTEM_FIELD_PROJECT, 1));
             add(new PatentField("typeid", "调查类型", Constants.SYSTEM_FIELD_PROJECT, 1));

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/PatentInstructionService.java

@@ -84,7 +84,7 @@ public class PatentInstructionService extends ServiceImpl<PatentInstructionMappe
     public PatentInstruction getPatentInstructionByPatentNoAndType(String patentNo, Integer type) {
         LambdaQueryWrapper<PatentInstruction> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentInstruction::getType, type);
-        queryWrapper.eq(PatentInstruction::getPatentNo, patentNo);
+        queryWrapper.eq(PatentInstruction::getPatentNo, patentNo).last("Limit 1");
         return this.getOne(queryWrapper);
     }
 

+ 35 - 7
PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java

@@ -32,6 +32,9 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
 
     public List<PatentRight> getPatentRightByPatentNo(String patentNo) {
         Patent patent = patentService.getByPatentNo(patentNo);
+        if(patent==null){
+            patent =new Patent();
+        }
         LambdaQueryWrapper<PatentRight> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentRight::getPatentId, patent.getId());
         queryWrapper.orderByAsc(PatentRight::getSort);
@@ -42,6 +45,18 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
         LambdaQueryWrapper<PatentRight> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentRight::getPatentId, patentId);
         queryWrapper.orderByAsc(PatentRight::getSort);
+        List<PatentRight> patentRights = this.list(queryWrapper);
+        if (patentRights != null && patentRights.size() > 0) {
+            PatentRight patentRight = patentRights.get(0);
+            //创建PatentRightParams对象保存权要基本信息
+            PatentRightParams patentRightParams = new PatentRightParams();
+            patentRightParams.setPatentId(patentId);  //装载专利id
+            patentRightParams.setPatentNo(patentService.getById(patentId).getPatentNo());
+            patentRightParams.setContent(patentRight.getContent());  //装载权利要求原文
+            patentRightParams.setContentOut(patentRight.getContentOut());  //装载权利要求译文
+            patentRights = PatentRightUtils.formatPatentRight(patentRightParams);
+            return patentRights;
+        }
         return this.list(queryWrapper);
     }
 
@@ -435,13 +450,26 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
     public void updatePatentRight(PatentRightParams params) {
         try {
             //调用拆分权要工具类
-            List<PatentRight> patentRights = PatentRightUtils.formatPatentRight(params);
-
-            if (patentRights.size() > 0) {
-                //删除库表中原有该权要
-                this.deleteByPatentId(params.getPatentId());
-                //权要数据入表"os_patent_right"
-                this.saveOrUpdateBatch(patentRights);
+//            List<PatentRight> patentRights = PatentRightUtils.formatPatentRight(params);
+//
+//            if (patentRights.size() > 0) {
+//                //删除库表中原有该权要
+//                this.deleteByPatentId(params.getPatentId());
+//                //权要数据入表"os_patent_right"
+//                this.saveOrUpdateBatch(patentRights);
+//            }
+
+            //不进行拆分,原文直接保存入库
+            PatentRight patentRight = new PatentRight()
+                    .setPatentId(params.getPatentId())
+                    .setContent(params.getContent())
+                    .setContentOut(params.getContentOut());
+            //.setType(1)
+            //.setSort(0)
+            //.setParentSort("-1");
+            if (patentRight.getContent() != null && !patentRight.getContent().equals("")) {
+                this.deleteByPatentId(patentRight.getPatentId());
+                this.saveOrUpdate(patentRight);
             }
 
         } catch (Exception e) {

+ 17 - 3
PAS/src/main/java/cn/cslg/pas/service/PatentService.java

@@ -108,7 +108,17 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
     public Patent getByPatentNo(String patentNo) {
         LambdaQueryWrapper<Patent> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(Patent::getPatentNo, patentNo);
-        return this.getOne(queryWrapper);
+        if(patentNo.contains("CN")){
+            queryWrapper.or().eq(Patent::getPublicNo,patentNo)
+                    .or().eq(Patent::getPublicAccreditNo,patentNo);
+        }
+        queryWrapper.orderByDesc(Patent::getId);
+      List<Patent> patents = this.list(queryWrapper);
+        Patent patent =new Patent();
+        if(patents.size()>0){
+            patent =patents.get(0);
+        }
+        return patent;
     }
 
     public List<Patent> getPublicDateAndPatentNoByPatentNo(List<String> patentNo) {
@@ -460,6 +470,7 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
             patentDTO.setPriorityDate(DateUtils.formatDate(item.getPriorityDate(), DateUtils.YYYY_MM_DD));
             patentDTO.setPublicDate(DateUtils.formatDate(item.getPublicDate(), DateUtils.YYYY_MM_DD));
             patentDTO.setPublicAccreditDate(DateUtils.formatDate(item.getPublicAccreditDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPublicAccreditNo(item.getPublicAccreditNo());
             patentDTO.setFirstPublicDate(DateUtils.formatDate(item.getFirstPublicDate(), DateUtils.YYYY_MM_DD));
             patentDTO.setSimpleStatus(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getValue().equals(String.valueOf(item.getSimpleStatus()))).findFirst().orElse(new SystemDict()).getLabel());
             patentDTO.setType(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_TYPE) && systemDict.getValue().equals(String.valueOf(item.getType()))).findFirst().orElse(new SystemDict()).getLabel());
@@ -759,6 +770,10 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
     public PatentDTO getPatentDTOById(String patentNo, Integer projectId) {
         LambdaQueryWrapper<Patent> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(Patent::getPatentNo, patentNo);
+        if(patentNo.contains("CN")){
+            wrapper.or().eq(Patent::getPublicNo,patentNo)
+                    .or().eq(Patent::getPublicAccreditNo,patentNo);
+        }
         List<Patent> patents = this.list(wrapper);
         PatentDTO patentDTO = new PatentDTO();
         //如果未查出专利则返回为空
@@ -767,11 +782,9 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
         }
         Patent patent = patents.get(0);
 
-
         BeanUtils.copyProperties(patent, patentDTO);
         List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.PATENT_TYPE, Constants.PATENT_SIMPLE_STATUS, Constants.COUNTRIES));
         List<PatentClassNumberLink> patentClassNumberLinkList = patentClassNumberLinkService.getPatentClassNumberLinkByPatentIds(Collections.singletonList(patent.getId()));
-
         if (patent.getPriorityNo() != null) {
             patentDTO.setPriorityNo(patent.getPriorityNo());
         } else {
@@ -826,6 +839,7 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
         patentDTO.setPriorityDate(DateUtils.formatDate(patent.getPriorityDate(), DateUtils.YYYY_MM_DD));
         patentDTO.setPublicDate(DateUtils.formatDate(patent.getPublicDate(), DateUtils.YYYY_MM_DD));
         patentDTO.setPublicAccreditDate(DateUtils.formatDate(patent.getPublicAccreditDate(), DateUtils.YYYY_MM_DD));
+        patentDTO.setPublicAccreditNo(patent.getPublicAccreditNo());
         patentDTO.setFirstPublicDate(DateUtils.formatDate(patent.getFirstPublicDate(), DateUtils.YYYY_MM_DD));
         patentDTO.setSimpleStatus(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getValue().equals(String.valueOf(patent.getSimpleStatus()))).findFirst().orElse(new SystemDict()).getLabel());
         patentDTO.setSimpleStatusInt(patent.getSimpleStatus());

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java

@@ -104,6 +104,7 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
     }
 
     public void updateData(List<String> familyNo, String patentNo, Integer patentId, Integer type) {
+        familyNo = new ArrayList<>(familyNo);
         //0.合并专利号
         if (!familyNo.contains(patentNo)) {
             familyNo.add(patentNo);

+ 64 - 20
PAS/src/main/java/cn/cslg/pas/service/TaskService.java

@@ -11,6 +11,8 @@ import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 
 import cn.cslg.pas.domain.Personnel;
+import cn.cslg.pas.domain.Project;
+import cn.cslg.pas.domain.Report;
 import cn.cslg.pas.domain.Task;
 import cn.cslg.pas.domain.asso.TaskCondition;
 import cn.cslg.pas.mapper.TaskMapper;
@@ -61,6 +63,8 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
     private final ExcutePatentDataEpo excutePatentDataEpo;
     private final ExcutePatentDataStar excutePatentDataStar;
     private final TaskConditionService taskConditionService;
+    private final ProjectService projectService;
+    private final ReportService reportService;
     private final JobService jobService;
     private final TaskMapper taskMapper;
 
@@ -187,7 +191,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
         }
         //专利总数量
         task.setTotal(total);
-        //任务类型 (1Excel导入 2导出 3欧专局导入 4专利之星导入)
+        //任务类型 (1Excel导入 2导出 3欧专局导入 4专利之星导入 5专利号导入
         task.setType(taskAddNewDTO.getTaskType2());
         //导入导出字段数量
         task.setFieldNum(0);
@@ -278,10 +282,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
     public PageVO queryTasks(QueryTaskDTO queryTaskDTO) throws IOException {
         log.info("开始处理【查询任务】的业务,参数为:{}", queryTaskDTO);
 
-        //专题库id和报告id都没有时,根据当前登陆人id查询
-        if (queryTaskDTO.getProjectId() == null && queryTaskDTO.getReportId() == null) {
-            queryTaskDTO.setCreateId(loginUtils.getId());
-        }
+        //装载创建人id
+        queryTaskDTO.setCreateId(loginUtils.getId());
+
         //根据创建人名称模糊查询
         if (queryTaskDTO.getCreateName() != null && !queryTaskDTO.getCreateName().equals("")) {
             String res = outInterfaceService.getPersonIdByNamePCS(queryTaskDTO.getCreateName());
@@ -304,11 +307,11 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
 
         //装载创建人名称、装载任务名称
         if (tasks.size() > 0) {
+            //装载创建人名称
             List<Integer> createPersonIds = tasks.stream().map(QueryTaskVO::getCreateBy).collect(Collectors.toList());
             String res = outInterfaceService.getPersonnelByIdsFromPCS(createPersonIds);
             com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
             List<Personnel> personnels = com.alibaba.fastjson.JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
-            //遍历装载创建人名称
             for (QueryTaskVO task : tasks) {
                 for (Personnel personnel : personnels) {
                     if (personnel.getId().equals(task.getCreateBy())) {
@@ -317,12 +320,54 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                     }
                 }
             }
-            //遍历装载任务名称(检索式+创建时间+创建人名称)
+
+            //装载任务名称(专利号/检索式 导入到 某某 专题库/报告中)
+            if (queryTaskDTO.getProjectId() != null) {  //若当前查询是查询所有导入专题库的任务,则装载专题库名称
+                List<Integer> projectIds = tasks.stream().map(QueryTaskVO::getProjectId).collect(Collectors.toList());
+                List<Project> projects = projectService.list(new LambdaQueryWrapper<Project>().in(Project::getId, projectIds));
+                tasks.forEach(task -> {
+                    projects.forEach(project -> {
+                        if (task.getProjectId().equals(project.getId())) {
+                            task.setProjectName(project.getName());
+                        }
+                    });
+                });
+            } else if (queryTaskDTO.getReportId() != null) {  //若当前查询是查询所有导入报告的任务,则装载报告名称
+                List<Integer> reportIds = tasks.stream().map(QueryTaskVO::getReportId).collect(Collectors.toList());
+                String res2 = outInterfaceService.getReportsFromRMS(reportIds);
+                JSONObject jsonObject2 = JSONObject.parseObject(res2);
+                List<Report> reports = JSON.parseArray(jsonObject2.getString("data"), Report.class);
+                tasks.forEach(task -> {
+                    reports.forEach(report -> {
+                        if (task.getReportId().equals(report.getId())) {
+                            task.setReportName(report.getName());
+                        }
+                    });
+                });
+            }
+
             for (QueryTaskVO task : tasks) {
-                if (task.getType().equals(3) || task.getType().equals(4)) {
-                    String conditions = task.getConditions();
-                    String createTime = new SimpleDateFormat("yyyyMMdd").format(task.getCreateTime());
-                    String taskName = createTime + " - 检索式:" + conditions + " - " + task.getCreateName();
+                String taskName = "";
+                if (task.getType().equals(5)) {  //若是专利号导入任务
+                    if (task.getProjectName() != null) {
+                        taskName = "专利号导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
+                    } else if (task.getReportName() != null) {
+                        taskName = "专利号导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
+                    }
+                    task.setTaskName(taskName);
+                } else if (task.getType().equals(3) || task.getType().equals(4)) {  //若是检索式导入(欧专局或专利之星)
+                    if (task.getProjectName() != null) {
+                        taskName = "检索式导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
+                    } else if (task.getReportName() != null) {
+                        taskName = "检索式导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
+                    }
+                    task.setTaskName(taskName);
+                } else if (task.getType().equals(2)) {  //若是导出
+                    if (task.getProjectName() != null) {
+                        taskName = "从专题库【" + task.getProjectName() + "】导出 - " + task.getCreateName();
+                    } else if (task.getReportName() != null) {
+                        taskName = "从报告【" + task.getReportName() + "】导出 - " + task.getCreateName();
+                    }
                     task.setTaskName(taskName);
                 }
             }
@@ -487,7 +532,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
      * 暂停任务
      *
      * @param taskId 任务id
-     * @return
+     * @return 返回任务状态4,已暂停
      */
     @Override
     public Integer pauseTask(Integer taskId) throws InterruptedException {
@@ -503,7 +548,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
 
         //检查任务是否处于进行中状态,若不是则提示用户 "暂停失败,当前任务不处于进行中状态,请尝试刷新页面"
         if (!task.getStatus().equals(1)) {
-            ThrowException.throwXiaoShiException("暂停失败,当前任务未进行,请尝试刷新页面");
+            ThrowException.throwXiaoShiException("暂停失败,当前任务不在进行中,请尝试刷新页面");
         }
 
         //任务表将任务状态修改为4暂停
@@ -516,24 +561,23 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
             ThrowException.throwXiaoShiException("暂停失败,服务器忙请稍后再试");
         }
 
-        //将生产者生产专利中的公共任务状态改为暂停
-        if (task.getType() == 1) {
+        //将检索生产专利时的公共任务状态改为暂停(若还在检索生产,则会结束)
+        if (task.getType() == 1) {  //Excel导入
             excutePatentDataExcel.setTaskStatus(taskId, 4);
-        } else if (task.getType() == 3) {
+        } else if (task.getType() == 3) {  //欧专局
             excutePatentDataEpo.setTaskStatus(taskId, 4);
-        } else if (task.getType() == 4) {
+        } else if (task.getType() == 4) {  //专利之星
             excutePatentDataStar.setTaskStatus(taskId, 4);
         }
 
-        //若是网站导入任务,则还要将专利各部分装载线程队列中该任务的专利清空
+        //若是网站导入任务,则还要将专利各部分装载线程队列中该任务元素清空
         if (task.getType().equals(3) || task.getType().equals(4)) {
             //等上半秒(上述代码虽然使得生产暂停,但是生产暂停前正在存入生产队列的过程中,等2秒使得这些放入消费者队列后再清空消费者)
-            Thread.sleep(500);
             pantentQueueService.setQueueRemoveTasks(taskId);
         }
 
         //等上一秒(上述代码虽然使得生产暂停,但是生产暂停前已生产的专利正在存入消费者队列的过程中,等2秒使得这些放入消费者队列后再清空消费者)
-        Thread.sleep(1000);
+        Thread.sleep(1500);
         //将消费者的专利队列中所有该任务的专利剔除
         pantentQueueService.consumerQueueRemoveTasks(taskId);
 

+ 136 - 75
PAS/src/main/java/cn/cslg/pas/service/getPatentStarPart/GetPatentStarPartService.java

@@ -7,18 +7,23 @@ import cn.cslg.pas.common.model.vo.KeyValueVO;
 import cn.cslg.pas.common.model.vo.PageVO;
 import cn.cslg.pas.common.model.vo.UploadParamsVO;
 import cn.cslg.pas.common.model.vo.outApi.StarPatentVO;
-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 com.alibaba.fastjson.JSON;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.sql.SQLException;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 获取专利之星专利某部分(如权要、说明书等一项)业务层
@@ -39,7 +44,7 @@ public class GetPatentStarPartService {
      * @param getPatentStarPartDTO 前端传输DTO对象
      * @return 返回装载着指定专利项的对象
      */
-    public PatentDTO getPatentPart(GetPatentStarPartDTO getPatentStarPartDTO) throws IOException {
+    public PatentDTO getPatentPart(GetPatentStarPartDTO getPatentStarPartDTO) throws IOException, SQLException {
         log.info("开始处理【根据专利号或申请号获取专利指定部分项】的业务,参数为:{}", getPatentStarPartDTO);
 
         Integer patentCell = getPatentStarPartDTO.getPatentCell();
@@ -47,9 +52,9 @@ public class GetPatentStarPartService {
         String patentNo = getPatentStarPartDTO.getPatentNo();
         PatentDTO patentDTO;
         if (patentCell == 1) {
-            patentDTO = getParentRight(appNo);  //拿权要
+            patentDTO = getParentRight(appNo, patentNo);  //拿权要
         } else if (patentCell == 2) {
-            patentDTO = getInstructionText(appNo);  //拿说明书文本
+            patentDTO = getInstructionText(appNo, patentNo);  //拿说明书文本
         } else if (patentCell == 3) {
             patentDTO = getInstructionPDF(appNo, patentNo);  //拿说明书pdf
         } else if (patentCell == 4) {
@@ -71,12 +76,13 @@ public class GetPatentStarPartService {
      * @param appNo 申请号
      * @return 返回装载着权要的对象
      */
-    public PatentDTO getParentRight(String appNo) throws IOException {
+    public PatentDTO getParentRight(String appNo, String patentNo) throws IOException {
         StarPatentVO starPatentVO = new StarPatentVO()
+                .setPublicNo(patentNo)
                 .setApplicationNo(appNo);
         UploadParamsVO uploadParamsVO = new UploadParamsVO();
         //调用"获得中国专利全文文本"接口,处理xml格式权要
-        excutePatentDataStar.setPatentClaim(starPatentVO, uploadParamsVO);
+        excutePatentDataStar.setPatentClaim(starPatentVO, uploadParamsVO, null);
 
         PatentDTO patentDTO = new PatentDTO();
         ArrayList<PatentRight> patentRights = new ArrayList<>();
@@ -92,12 +98,13 @@ public class GetPatentStarPartService {
      * @param appNo 申请号
      * @return 返回装载着说明书文本的对象
      */
-    public PatentDTO getInstructionText(String appNo) throws IOException {
+    public PatentDTO getInstructionText(String appNo, String patentNo) throws IOException {
         StarPatentVO starPatentVO = new StarPatentVO()
+                .setPublicNo(patentNo)
                 .setApplicationNo(appNo);
         UploadParamsVO uploadParamsVO = new UploadParamsVO();
         //调用"获得中国专利全文文本"接口,处理xml格式说明书文本
-        excutePatentDataStar.setPatentInstructionText(starPatentVO, uploadParamsVO);
+        excutePatentDataStar.setPatentInstructionText(starPatentVO, uploadParamsVO, null);
 
         PatentDTO patentDTO = new PatentDTO();
         patentDTO.setInstruction(uploadParamsVO.getPatentInstructionText());
@@ -111,7 +118,8 @@ public class GetPatentStarPartService {
      * @param patentNo 专利号(公开号)
      * @return 返回装载着说明书pdf的对象
      */
-    public PatentDTO getInstructionPDF(String appNo, String patentNo) throws IOException {
+    public PatentDTO getInstructionPDF(String appNo, String patentNo) throws IOException, SQLException {
+        String applicationNo = appNo + "";
         if (appNo.contains(".")) {
             appNo = appNo.substring(0, appNo.lastIndexOf("."));
         }
@@ -121,66 +129,70 @@ 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, null, 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);
+                patentInstruction.setPictureStringData(urlToBytes(pdfUrl1));
+                patentInstruction2.setPictureStringData(urlToBytes(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();
                 patentInstruction.setUrl(pdfUrl1);
+                patentInstruction.setPictureStringData(urlToBytes(pdfUrl1));
                 if (pdfUrl1.contains("0A_CN_0.pdf")) {
                     patentInstruction.setType(1);
                 } else {
                     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(applicationNo, null, 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.setPictureStringData(urlToBytes(pdfUrl));
             patentInstruction.setType(1);
             patentInstructions.add(patentInstruction);
 
         }
 
         patentDTO.setPdf(patentInstructions);
+
         return patentDTO;
     }
 
@@ -195,6 +207,7 @@ public class GetPatentStarPartService {
         if (appNo.contains(".")) {
             appNo = appNo.substring(0, appNo.lastIndexOf("."));
         }
+
         String pictureUrl = patentStarApiService.getPictureApi(appNo);
 
         PatentDTO patentDTO = new PatentDTO();
@@ -221,13 +234,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 +249,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 +346,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,6 +408,27 @@ public class GetPatentStarPartService {
         return patentDTO;
     }
 
+    public String urlToBytes(String pdfUrl) throws IOException {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        URL url = new URL(pdfUrl);  //想要读取的url地址
+        InputStream in = url.openStream();
+        int bytesRead;
+        byte[] buffer = new byte[8192];
+
+        //读取url地址文件
+        while ((bytesRead = in.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, bytesRead);
+        }
+
+        //关闭释放流
+        in.close();
+
+        byte[] bytes = outputStream.toByteArray();
+        //BASE64Encoder encoder = new BASE64Encoder();
+        //String data = encoder.encode(bytes);
+        String data = Base64.encodeBase64String(bytes);
+        return data;
+    }
 
     /**
      * 根据分页信息,取同族号集合中分页区间内的同族号

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java

@@ -234,7 +234,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         Integer size = productQueryPageDTO.getSize();
         String groupBy = productQueryPageDTO.getGroupBy();
         String orderBy = productQueryPageDTO.getOrderBy();
-        if (orderBy != null) {
+        if (orderBy != null && !orderBy.equals("")) {
             String regex = "[A-Z]+";
             Pattern pattern = Pattern.compile(regex);
             Matcher matcher = pattern.matcher(orderBy);

+ 22 - 23
PAS/src/main/java/cn/cslg/pas/service/outApi/PatentStarApiService.java

@@ -158,16 +158,23 @@ public class PatentStarApiService {
     public void loadStarPatentVOS(List<StarPatentVO> starPatentVOS, JSONObject Data) {
         String aa = Data.toString();
         starPatentVOS.forEach(item -> {
-
             //如果有公开号,则将公开号作为专利号
-            if (item.getPublicNo() != null && !item.getPublicNo().equals("")) {
-                item.setPatentNo(item.getPublicNo());
-
+            if (item.getApplicationNo() != null && !item.getApplicationNo().equals("") && item.getApplicationNo().contains("CN")) {
+                item.setPatentNo(item.getApplicationNo());
+            }
+            else if (item.getPublicNo() != null && !item.getPublicNo().equals("")) {
+                    item.setPatentNo(item.getPublicNo());
                 //如果没有公开号,但是有公告号,则将公告号作为公开号和专利号
-            } else if (item.getPublicAccreditNo() != null && !item.getPublicAccreditNo().equals("")) {
-                item.setPublicNo(item.getPublicAccreditNo());
-                item.setPatentNo(item.getPublicAccreditNo());
-            } else {
+            }
+            if (item.getPublicAccreditNo() != null && !item.getPublicAccreditNo().equals("")) {
+                if(item.getPublicNo()==null||item.getPublicNo().equals("")){
+                    item.setPublicNo(item.getPublicAccreditNo());
+                }
+                if(item.getPatentNo() ==null) {
+                    item.setPatentNo(item.getPublicAccreditNo());
+                }
+            }
+            else {
                 System.out.println("");
 
             }
@@ -248,12 +255,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:
@@ -460,7 +469,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -504,7 +512,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -549,7 +556,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -592,7 +598,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -635,7 +640,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -679,7 +683,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -724,7 +727,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -767,7 +769,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -810,7 +811,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }
@@ -853,7 +853,6 @@ public class PatentStarApiService {
             Response response = okHttpClient.newCall(request).execute();
             // 判断请求是否成功
             if (response.isSuccessful()) {
-                response.body().toString();
                 // 打印服务端返回结果
                 return Objects.requireNonNull(response.body()).string();
             }

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataExcel.java

@@ -61,6 +61,10 @@ public class ExcutePatentDataExcel implements IExcutePatentData {
                 PatentData patentData = ReadExcelUtils.readExcelOneRow(filePath, sheet, i + 1);
                 //调用装载数据类(根据数据源配置文件对象和专利源数据生成专利数据)
                 UploadParamsVO uploadParamsVO = excuteDataToVOService.fileToPatentVO(patentData, jsonData);
+                //如果是中国专利,就将申请号作为专利号
+                if (uploadParamsVO.getPatent().getPatentNo().contains("CN")) {
+                    uploadParamsVO.getPatent().setPatentNo(uploadParamsVO.getPatent().getApplicationNo());  //将申请号设为专利号patentNo
+                }
 
                 //专利丢入消费者队列,并唤醒消费者线程
                 pantentQueueService.patentToQueue(task, uploadParamsVO);

+ 301 - 255
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;
 
@@ -223,6 +227,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
 
             //如果完成数量大于0,则当前下载任务为暂停后的继续下载,则开始位置更新
             if (successNum > 0) {
+                if (startNumber == null) {  //多个专利号导入任务没有startNumber这些值
+                    startNumber = 0;
+                }
                 startNumber += successNum;
             }
 
@@ -306,22 +313,13 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                 }
             }
 
-            //若是暂停后继续的任务,若 successNum > startToEndNum,即已经下载完了起止条数中的专利
-            int fromIndex = 0;
-            if (successNum > 0 && successNum > startToEndNum) {
-                fromIndex = successNum - startToEndNum;
-            }
             //下载isAdd中的专利 / 下载多个专利号导入接口的专利 ↓
             if (isAddPatentNos != null && isAddPatentNos.size() > 0) {
-                if (fromIndex > 0 && fromIndex < isAddPatentNos.size() - 1) {
-                    isAddPatentNos = isAddPatentNos.subList(fromIndex, isAddPatentNos.size());
-                } else if (fromIndex == isAddPatentNos.size() - 1) {
-                    isAddPatentNos = Arrays.asList(isAddPatentNos.get(isAddPatentNos.size() - 1));
-                }
-
                 //判断isAdd中的多个专利号或申请号,即判断是检索页面手动勾选的多个专利下载/还是多个专利号导入的下载任务
                 if (task.getIsAddType() != null && task.getIsAddType().equals(2)) {
                     //若是多个专利号导入的下载
+                    String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
+                    conditions = "AN=(" + patentNoCondition + ") OR PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";
                     downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
                 } else {
                     //若是检索页面手动勾选的多个专利的下载
@@ -347,6 +345,13 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param uploadParamsVO 专利实体类对象
      */
     public void setPatentZhuLu(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
+        String usedPatentNo;
+        if (starPatent.getPublicNo() != null && !starPatent.getPublicNo().equals("")) {
+            usedPatentNo = starPatent.getPublicNo();
+        } else {
+            usedPatentNo = starPatent.getPatentNo();
+        }
+
         //以下 ↓装载的是调用"一般检索"接口返回的专利相关数据
         //装载专利类型
         Integer patentType = starPatent.getPatentType();
@@ -470,10 +475,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 +484,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;
@@ -494,9 +499,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
 
         try {
             //以下 ↓装载的是调用"获得中国专利著录"接口返回的专利相关数据
-            if (starPatent.getPatentNo().contains("CN")) {
+            if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
                 String chinaPatentZhuLuStr = patentStarApiService.getCnBibApi(appNo);
-                if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}")) {
+                if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}") && !chinaPatentZhuLuStr.contains("请求不合法")) {
                     List<ChinaPatentZhuLu> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, ChinaPatentZhuLu.class);
                     ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
                     //装载申请人地址
@@ -555,7 +560,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                     }
                 }
             } else {  //以下 ↓装载的是调用"获得世界专利著录"接口返回的专利相关数据
-                String worldPatentZhuLuStr = patentStarApiService.getENBibApi(starPatent.getPatentNo());
+                String worldPatentZhuLuStr = patentStarApiService.getENBibApi(usedPatentNo);
                 List<WorldPatentZhuLu> worldPatentZhuLus = JSON.parseArray(worldPatentZhuLuStr, WorldPatentZhuLu.class);
                 WorldPatentZhuLu worldPatentZhuLu = worldPatentZhuLus.get(0);
 
@@ -588,8 +593,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(";")));
@@ -612,11 +621,11 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                     uploadParamsVO.getPatent().setPriorityNo(worldPatentZhuLu.getPr());
                 }
                 //装载标题
-                if (uploadParamsVO.getPatent().getName() == null && uploadParamsVO.getPatent().getName().equals("")) {
+                if (uploadParamsVO.getPatent().getName() == null || uploadParamsVO.getPatent().getName().equals("")) {
                     uploadParamsVO.getPatent().setName(worldPatentZhuLu.getTitle());
                 }
                 //装载摘要
-                if (uploadParamsVO.getPatent().getAbstractStr() == null && uploadParamsVO.getPatent().getAbstractStr().equals("")) {
+                if (uploadParamsVO.getPatent().getAbstractStr() == null || uploadParamsVO.getPatent().getAbstractStr().equals("")) {
                     uploadParamsVO.getPatent().setAbstractStr(worldPatentZhuLu.getAbstract());
                 }
 
@@ -624,94 +633,67 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             }
 
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
 
         //以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
         try {
             if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
-                String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
-                if (!familyPatentNoStr.equals("no data")) {
+                String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(usedPatentNo);
+                if (!familyPatentNoStr.equals("no data") && !familyPatentNoStr.equals("{}")) {
                     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();
         }
 
         //以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
         try {
-            PatentAffair patentAffair = new PatentAffair();
-            String cnLegalApiStr = patentStarApiService.getCnLegalApi(appNo);
-            if (!cnLegalApiStr.equals("")) {
-                List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
-                if (chinaLeagalStatuses != null && chinaLeagalStatuses.size() > 0) {
-                    ArrayList<KeyValueVO> lst = new ArrayList<>();
-                    HashMap<Integer, String> nameMap = new HashMap<>();
-                    HashMap<Integer, String> contentMap = new HashMap<>();
-                    nameMap.put(0, "发生日期");
-                    nameMap.put(1, "法律状态");
-                    nameMap.put(2, "详细法律状态");
-                    nameMap.put(3, "详细信息");
-                    for (int i = 0; i < chinaLeagalStatuses.size(); i++) {
-                        if (i == 0) {
-                            patentAffair.setStatus(chinaLeagalStatuses.get(i).getLegalStatus());
-                        }
-                        contentMap.put(0, chinaLeagalStatuses.get(i).getLegalDate());
-                        contentMap.put(1, chinaLeagalStatuses.get(i).getLegalStatus());
-                        contentMap.put(2, chinaLeagalStatuses.get(i).getLegalStatusInfo());
-                        contentMap.put(3, chinaLeagalStatuses.get(i).getDETAIL());
-                        ArrayList<KeyValueVO.InpadocData> inpadocDatas = new ArrayList<>();
-                        for (int j = 0; j < 4; j++) {
-                            KeyValueVO.InpadocData inpadocData = new KeyValueVO.InpadocData();
-                            inpadocData.setName(nameMap.get(j));
-                            inpadocData.setContent(contentMap.get(j));
-                            inpadocDatas.add(inpadocData);
+            if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
+                PatentAffair patentAffair = new PatentAffair();
+                String cnLegalApiStr = patentStarApiService.getCnLegalApi(appNo);
+                if (!cnLegalApiStr.equals("")) {
+                    List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
+                    if (chinaLeagalStatuses != null && chinaLeagalStatuses.size() > 0) {
+                        ArrayList<KeyValueVO> lst = new ArrayList<>();
+                        HashMap<Integer, String> nameMap = new HashMap<>();
+                        HashMap<Integer, String> contentMap = new HashMap<>();
+                        nameMap.put(0, "发生日期");
+                        nameMap.put(1, "法律状态");
+                        nameMap.put(2, "详细法律状态");
+                        nameMap.put(3, "详细信息");
+                        for (int i = 0; i < chinaLeagalStatuses.size(); i++) {
+                            if (i == 0) {
+                                patentAffair.setStatus(chinaLeagalStatuses.get(i).getLegalStatus());
+                            }
+                            contentMap.put(0, chinaLeagalStatuses.get(i).getLegalDate());
+                            contentMap.put(1, chinaLeagalStatuses.get(i).getLegalStatus());
+                            contentMap.put(2, chinaLeagalStatuses.get(i).getLegalStatusInfo());
+                            contentMap.put(3, chinaLeagalStatuses.get(i).getDETAIL());
+                            ArrayList<KeyValueVO.InpadocData> inpadocDatas = new ArrayList<>();
+                            for (int j = 0; j < 4; j++) {
+                                KeyValueVO.InpadocData inpadocData = new KeyValueVO.InpadocData();
+                                inpadocData.setName(nameMap.get(j));
+                                inpadocData.setContent(contentMap.get(j));
+                                inpadocDatas.add(inpadocData);
+                            }
+                            KeyValueVO keyValueVO = new KeyValueVO();
+                            keyValueVO.setInpadocData(inpadocDatas);
+                            lst.add(keyValueVO);
                         }
-                        KeyValueVO keyValueVO = new KeyValueVO();
-                        keyValueVO.setInpadocData(inpadocDatas);
-                        lst.add(keyValueVO);
+                        //装载事务表的status(公开|授权|驳回|权力转移。。。)
+                        String content = JSONObject.toJSONString(lst);
+                        patentAffair.setContent(content);
+                        uploadParamsVO.setPatentAffair(patentAffair);
                     }
-                    //装载事务表的status(公开|授权|驳回|权力转移。。。)
-                    String content = JSONObject.toJSONString(lst);
-                    patentAffair.setContent(content);
-                    uploadParamsVO.setPatentAffair(patentAffair);
                 }
             }
 
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
 
     }
@@ -722,40 +704,64 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param starPatent     专利之星著录对象
      * @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");
-        }
+    public Boolean setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, PQueueData pQueueData) throws IOException {
+        try {
+            if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
+                String applicationNo = starPatent.getApplicationNo() + "";
+                String appNo;
+                if (starPatent.getApplicationNo().contains(".")) {
+                    appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
+                } else {
+                    appNo = starPatent.getApplicationNo();
+                }
 
-//        <!-- SIPO <DP n="1"> -->
+                //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
+                String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
 
-        String patentRightText = builder + "";
+                //若没有取到全文文本即取不到权要,则将该专利检索专利之星接口次数+1,重新丢入权要生产队列,将当前申请号或专利号和备注信息记录到问题记录表,返回false
+                if (cnFullXmlStr.equals("")) {
+                    if (pQueueData != null && pQueueData.getCallNum() < 2) {
+                        pQueueData.setCallNum(pQueueData.getCallNum() + 1);
+                        pantentQueueService.rightToPQueue(pQueueData);
+                        recordQuestionPatent(applicationNo, pQueueData.getTask().getId(), 2);
+                        return false;
+                    }
+                    recordQuestionPatent(applicationNo, null, 2);
+                    return true;
+                }
+
+                //使用正则表达式拼接出权要原文
+                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();
+                    right = right.replaceAll(" +", "");
+                    right = right.replace("\r\n", "").replace("\n", "");
+                    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();
+            return true;
+        }
+
+        return true;
 
     }
 
@@ -765,69 +771,56 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param starPatent     专利之星著录对象
      * @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", "");
+    public Boolean setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, PQueueData pQueueData) throws IOException {
+        try {
+            if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
+                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("")) {
+                    if (pQueueData != null && pQueueData.getCallNum() < 2) {
+                        pQueueData.setCallNum(pQueueData.getCallNum() + 1);
+                        pantentQueueService.rightToPQueue(pQueueData);
+                        recordQuestionPatent(applicationNo, pQueueData.getTask().getId(), 3);
+                        return false;
+                    }
+                    recordQuestionPatent(applicationNo, null, 3);
+                    return true;
+                }
+
+                //使用正则表达式拼接出说明书文本全文
+                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();
+            return true;
         }
-//        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);
+
+        return true;
 
     }
 
@@ -837,54 +830,75 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param starPatent     专利之星著录对象
      * @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);
+    public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, Task task) throws IOException {
+        String usedPatentNo;
+        if (starPatent.getPublicNo() != null && !starPatent.getPublicNo().equals("")) {
+            usedPatentNo = starPatent.getPublicNo();
+        } else {
+            usedPatentNo = starPatent.getPatentNo();
+        }
+        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.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && 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.getApplicationNo(), task.getId(), 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(usedPatentNo);
+
+                    //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
+                    if (pdfUrl.equals("") || pdfUrl.equals("{}")) {
+                        recordQuestionPatent(starPatent.getApplicationNo(), task.getId(), 4);
+                        return;
+                    }
+
+                    UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
+                    uploadParamsVO.setPdf1FileDTO(fileDTO);
                 }
-                UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
-                uploadParamsVO.setPdf1FileDTO(fileDTO);
-            }
 
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
         }
+
     }
 
     /**
@@ -894,37 +908,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 ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().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);
 
     }
 
@@ -953,12 +977,14 @@ public class ExcutePatentDataStar implements IExcutePatentData {
             }
 
             List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
+
             //遍历这一页的专利
             for (StarPatentVO starPatent : starPatents) {
                 //判断若任务状态为已暂停,则结束生产
                 if (pTaskId.equals(task.getId()) && pTaskStatus == 4) {
                     return;
                 }
+
                 try {
                     UploadParamsVO uploadParamsVO = new UploadParamsVO();
                     Patent patent = new Patent();
@@ -996,6 +1022,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                 }
 
             }
+
         }
 
     }
@@ -1089,6 +1116,25 @@ public class ExcutePatentDataStar implements IExcutePatentData {
         return calculate;
     }
 
+    /**
+     * 记录没有数据的专利信息
+     *
+     * @param applicationNoOrPatentNo 公开号/申请号
+     * @param taskId                  任务id
+     * @param cell                    失败字段(1著录 2权要 3说明书文本 4说明书pdf 5摘要附图)
+     */
+    public void recordQuestionPatent(String applicationNoOrPatentNo, Integer taskId, int cell) {
+        QuestionRecord questionRecord = new QuestionRecord()
+                .setPatentNo(applicationNoOrPatentNo)
+                .setCell(cell)
+                .setTaskId(taskId)
+                .setRemark("该申请号的该字段(2权要 3说明书文本 4说明书pdf)接口检索返回原始数据为空");
+        List<QuestionRecord> questionRecords = questionRecordService.list(new LambdaQueryWrapper<QuestionRecord>().eq(QuestionRecord::getPatentNo, applicationNoOrPatentNo).eq(QuestionRecord::getCell, cell));
+        if (questionRecords == null || questionRecords.size() == 0) {
+            questionRecordService.save(questionRecord);
+        }
+    }
+
     public void setTaskStatus(Integer taskId, Integer taskStatus) {
         this.pTaskId = taskId;
         this.pTaskStatus = taskStatus;

+ 48 - 25
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/PantentQueueService.java

@@ -4,6 +4,7 @@ import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
 import cn.cslg.pas.common.model.vo.UploadParamsVO;
 import cn.cslg.pas.common.utils.DateUtils;
 import cn.cslg.pas.common.utils.JsonUtils;
+import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.domain.PQueueData;
 import cn.cslg.pas.domain.QuestionRecord;
 import cn.cslg.pas.domain.QueueData;
@@ -105,7 +106,7 @@ public class PantentQueueService {
                     }
 
                     //若是网站导入任务,则将网站导入相关信息存入task对象中(方便生产与消费时使用)
-                    if (task.getType().equals(3) || task.getType().equals(4)) {
+                    if (task.getType().equals(3) || task.getType().equals(4) || task.getType().equals(5)) {
                         TaskCondition taskCondition = taskConditionService.getById(task.getTaskConditionId());
                         List<String> configCells = Arrays.asList(taskCondition.getConfigCells().split(","));
                         task.setConfigCellsNum(configCells.size());
@@ -161,7 +162,7 @@ public class PantentQueueService {
                             .setUploadParamsVO(pQueueData.getUploadParamsVO());
 
                     //专利之星
-                    if (task.getType() == 4) {
+                    if (task.getType() == 4 || task.getType().equals(5)) {
                         excutePatentDataStar.setPatentZhuLu(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO());
                     }
 
@@ -205,18 +206,21 @@ public class PantentQueueService {
                             .setUploadParamsVO(pQueueData.getUploadParamsVO());
 
                     //专利之星
-                    if (task.getType() == 4) {
-                        excutePatentDataStar.setPatentClaim(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO());
+                    Boolean canSendMessage = true;
+                    if (task.getType() == 4 || task.getType().equals(5)) {
+                        canSendMessage = excutePatentDataStar.setPatentClaim(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO(), pQueueData);
                     }
 
                     queueData.setUploadParamsVO(pQueueData.getUploadParamsVO());
 
-                    //装载完成,将其丢入权要消费者队列,并唤醒权要消费者线程
-                    patentRightQueueList.add(queueData);
-                    if (patentRightLock.tryLock()) {
-                        //patentRightLock.lock();
-                        patentRightCondition.signalAll();
-                        patentRightLock.unlock();
+                    if (canSendMessage) {
+                        //装载完成,将其丢入权要消费者队列,并唤醒权要消费者线程
+                        patentRightQueueList.add(queueData);
+                        if (patentRightLock.tryLock()) {
+                            //patentRightLock.lock();
+                            patentRightCondition.signalAll();
+                            patentRightLock.unlock();
+                        }
                     }
 
                 } else {
@@ -250,8 +254,8 @@ public class PantentQueueService {
                             .setUploadParamsVO(pQueueData.getUploadParamsVO());
 
                     //专利之星
-                    if (task.getType() == 4) {
-                        excutePatentDataStar.setPatentInstructionText(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO());
+                    if (task.getType() == 4 || task.getType().equals(5)) {
+                        excutePatentDataStar.setPatentInstructionText(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO(), pQueueData);
                     }
 
                     queueData.setUploadParamsVO(pQueueData.getUploadParamsVO());
@@ -295,8 +299,8 @@ public class PantentQueueService {
                             .setUploadParamsVO(pQueueData.getUploadParamsVO());
 
                     //专利之星
-                    if (task.getType() == 4) {
-                        excutePatentDataStar.setPatentInstructionPDF(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO());
+                    if (task.getType() == 4 || task.getType().equals(5)) {
+                        excutePatentDataStar.setPatentInstructionPDF(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO(), task);
                     }
 
                     queueData.setUploadParamsVO(pQueueData.getUploadParamsVO());
@@ -340,7 +344,7 @@ public class PantentQueueService {
                             .setUploadParamsVO(pQueueData.getUploadParamsVO());
 
                     //专利之星
-                    if (task.getType() == 4) {
+                    if (task.getType() == 4 || task.getType().equals(5)) {
                         excutePatentDataStar.setPatentPicture(pQueueData.getStarPatent(), pQueueData.getUploadParamsVO());
                     }
 
@@ -590,6 +594,22 @@ public class PantentQueueService {
                 updateTask.setDefaultNum(task.getDefaultNum());
                 updateTask.setTrueSuccessNum(task.getSuccessNum() - updateTask.getDefaultNum());
                 taskService.updateById(updateTask);
+
+                //任务条件表更新isAddPatentNos
+                if (task.getIsAddPatentNos() != null && task.getIsAddPatentNos().size() > 0) {
+                    ArrayList<String> updateIsAddPatentNos = new ArrayList<>(task.getIsAddPatentNos());
+                    updateIsAddPatentNos.removeIf(item -> item.equals(queueData.getUploadParamsVO().getPatent().getPatentNo()));
+                    updateIsAddPatentNos.removeIf(item -> item.equals(queueData.getUploadParamsVO().getPatent().getApplicationNo()));
+
+                    TaskCondition taskCondition = new TaskCondition()
+                            .setId(task.getTaskConditionId())
+                            .setIsAddPatentNos(StringUtils.join(updateIsAddPatentNos, ","));
+                    taskConditionService.updateById(taskCondition);
+
+                    task.setIsAddPatentNos(updateIsAddPatentNos);
+
+                }
+
                 long percentage = (long) Math.floor((task.getSuccessNum() + 0D) / total * 100D);
                 //当全部完成时
                 if (task.getSuccessNum().equals(total)) {
@@ -749,7 +769,7 @@ public class PantentQueueService {
      * @param taskId 任务id
      */
     public void setQueueRemoveTasks(Integer taskId) {
-        //任务暂停时清除生产者队列中已有的该任务的所有专利
+        //任务暂停时清除生产者队列中该任务元素
         this.setPatentZhuluQueueList.removeIf(pQueueData -> pQueueData.getTask().getId().equals(taskId));
         this.setPatentRightQueueList.removeIf(pQueueData -> pQueueData.getTask().getId().equals(taskId));
         this.setPatentInstructionTextQueueList.removeIf(pQueueData -> pQueueData.getTask().getId().equals(taskId));
@@ -770,14 +790,15 @@ public class PantentQueueService {
         this.patentInstructionPDFQueueList.removeIf(queueData -> queueData.getTask().getId().equals(taskId));
         this.patentImageQueueList.removeIf(queueData -> queueData.getTask().getId().equals(taskId));
         //任务暂停时清除 patentIdMap(任务id + "|" + 专利id,拼接而成的专利的数量标识(作为辨别某一任务的某一专利消费完成的消费者数量))中该任务的专利数量标识
-        Iterator<String> iterator = this.patentIdMap.keySet().iterator();
-        while (iterator.hasNext()) {
-            String key = iterator.next();
-            if (key.contains(taskId + "")) {
-                iterator.remove();
-                this.patentIdMap.remove(key);
-            }
-        }
+//        Iterator<String> iterator = this.patentIdMap.keySet().iterator();
+        this.patentIdMap.keySet().removeIf(item -> item.contains(taskId + "|"));
+//        while (iterator.hasNext()) {
+//            String key = iterator.next();
+//            if (key.contains(taskId + "|")) {
+//                iterator.remove();
+//                this.patentIdMap.remove(key);
+//            }
+//        }
 
     }
 
@@ -807,6 +828,8 @@ public class PantentQueueService {
                 return excutePatentDataEpo;
             case 4:  //专利之星网站导入
                 return excutePatentDataStar;
+            case 5:  //专利号导入(也是专利之星方式)
+                return excutePatentDataStar;
             default:
                 return null;
         }
@@ -821,7 +844,7 @@ public class PantentQueueService {
      */
     public void saveQuestionRecord(QueueData queueData, Integer cell) {
         QuestionRecord questionRecord = new QuestionRecord()
-                .setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo())
+                .setPatentNo(queueData.getUploadParamsVO().getPatent().getApplicationNo())
                 .setTaskId(queueData.getTask().getId())
                 .setCell(cell);
         questionRecordService.save(questionRecord);

+ 19 - 19
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java

@@ -74,7 +74,13 @@ public class UploadTaskService {
     public TaskCondition addPatentStarTask(TaskAddNewDTO taskAddNewDTO) throws IOException {
         log.info("开始处理【新增专利之星下载接口导入专利】的业务,参数为:{}", taskAddNewDTO);
 
-        //检查任务合法性1(检查要导入的专题库或报告是否存在)
+        //检查任务合法性1(检查是否有下载字段)
+        List<String> cells = taskAddNewDTO.getConfigCells();
+        if (cells == null || cells.size() == 0) {
+            ThrowException.throwXiaoShiException("请选择至少一个需要下载的字段");
+        }
+
+        //检查任务合法性2(检查专题库是否存在)
         if (taskAddNewDTO.getProjectId() != null) {
             Project project = projectService.getById(taskAddNewDTO.getProjectId());
             if (project == null) {
@@ -82,7 +88,7 @@ public class UploadTaskService {
             }
         }
 
-        //检查任务合法性2(根据检索式信息调用一般检索接口,看是否能检索出专利)
+        //检查任务合法性3(根据检索式进行一次检索看是否能检索出专利)
         PatentStarListDto patentStarListDto = new PatentStarListDto()
                 .setCurrentQuery(taskAddNewDTO.getConditions())
                 .setOrderBy(taskAddNewDTO.getOrderBy())
@@ -92,11 +98,10 @@ public class UploadTaskService {
                 .setDBType(taskAddNewDTO.getDBType());
         Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
         if (resultMap == null || (Integer) resultMap.get("total") == 0) {
-            ThrowException.throwXiaoShiException("未检索到相关专利");
+            ThrowException.throwXiaoShiException("该检索信息未检索出相关专利");
         }
 
-
-        //获取专利总数量
+        //计算要下载的专利总数量
         Integer total;
         if (taskAddNewDTO.getEndNumber() > 0) {
             total = taskAddNewDTO.getEndNumber() - taskAddNewDTO.getStartNumber() + 1;
@@ -110,7 +115,7 @@ public class UploadTaskService {
             total = taskAddNewDTO.getIsAddPatentNos().size();
         }
 
-        //新增任务与任务条件关联表("asso_osTask_qrtzTask")数据
+        //任务条件表("task_condition")新增数据
         TaskCondition taskCondition = new TaskCondition();
         taskCondition
                 .setTaskType(taskAddNewDTO.getTaskType())
@@ -125,26 +130,21 @@ public class UploadTaskService {
                 .setDBType(taskAddNewDTO.getDBType())
                 .setStartNumber(taskAddNewDTO.getStartNumber())
                 .setEndNumber(taskAddNewDTO.getEndNumber())
-                .setIsAddType(taskAddNewDTO.getIsAddType());
+                .setIsAddType(taskAddNewDTO.getIsAddType())
+                .setConfigCells(String.join(",", cells));
         if (taskAddNewDTO.getIsAddPatentNos() != null && taskAddNewDTO.getIsAddPatentNos().size() > 0) {
             taskCondition.setIsAddPatentNos(StringUtils.join(taskAddNewDTO.getIsAddPatentNos(), ","));
         }
         if (taskAddNewDTO.getIsDeletePatentNos() != null && taskAddNewDTO.getIsDeletePatentNos().size() > 0) {
             taskCondition.setIsDeletePatentNos(StringUtils.join(taskAddNewDTO.getIsDeletePatentNos(), ","));
         }
-        List<String> cells = taskAddNewDTO.getConfigCells();
-        if (cells == null) {
-            taskCondition.setConfigCells("");
-        } else {
-            taskCondition.setConfigCells(String.join(",", cells));
-        }
-        log.info("任务与任务条件关联表(asso_osTask_qrtzTask)新增数据");
+        log.info("任务条件表新增数据");
         taskConditionService.save(taskCondition);
 
         //任务表新增任务
         Integer taskId = taskService.addTask3(taskAddNewDTO, total, taskCondition);
 
-        //任务与任务条件关联表(asso_osTask_qrtzTask)更新数据(普通任务)
+        //任务条件表(task_condition)更新数据(普通任务)
         if (taskAddNewDTO.getTaskType().equals(0)) {
             taskCondition.setTaskId(taskId);
             taskConditionService.updateById(taskCondition);
@@ -231,19 +231,19 @@ public class UploadTaskService {
                 .setEndNumber(0)
                 .setIsAddPatentNos(Arrays.asList(isAddPatentNosStr.split("[,|,]")))
                 .setDBType("CN")
-                .setOrderBy("ID")
+                .setOrderBy("AD")
                 .setOrderByType("DESC")
                 .setConfigCells(Arrays.asList("1", "2", "3", "4", "6"))
                 .setConfigId(2)
                 .setTaskName("多个专利号导入方式任务")
                 .setTaskType(0)
-                .setTaskType2(4)
+                .setTaskType2(5)
                 .setIsAddType(2);
 
         //根据下载的网站类型新增任务
         if (taskAddNewDTO.getTaskType2().equals(3)) {
             this.addEpoTask(taskAddNewDTO);
-        } else if (taskAddNewDTO.getTaskType2().equals(4)) {
+        } else if (taskAddNewDTO.getTaskType2().equals(4) || taskAddNewDTO.getTaskType2().equals(5)) {
             this.addPatentStarTask(taskAddNewDTO);
         }
 
@@ -269,7 +269,7 @@ public class UploadTaskService {
         }
         //将本系统不包含的专利拼接成条件
         String patentNoCondition = StringUtils.join(patentNos, " OR ");
-        String conditions = "PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";
+        String conditions = "AN=(" + patentNoCondition + ") OR PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";
         return conditions;
     }
 

+ 6 - 0
PAS/src/main/resources/application-prodNetIn.yml

@@ -24,3 +24,9 @@ spring:
       web-stat-filter:
         exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
 authorUrl: http://localhost:8871
+
+PCSUrl: http://localhost:8871
+#OPSUrl: http://192.168.1.24:5001
+OPSUrl: http://139.224.24.90:5001
+PASUrl: http://localhost:8877
+RMSUrl: http://localhost:8872

+ 7 - 1
PAS/src/main/resources/application-prodNetOut.yml

@@ -23,4 +23,10 @@ spring:
         login-password: Cslg2022+
       web-stat-filter:
         exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
-authorUrl: http://localhost:8871
+authorUrl: http://localhost:8871
+
+PCSUrl: http://localhost:8871
+#OPSUrl: http://192.168.1.24:5001
+OPSUrl: http://139.224.24.90:5001
+PASUrl: http://localhost:8877
+RMSUrl: http://localhost:8872

+ 1 - 1
PAS/src/main/resources/application.yml

@@ -20,7 +20,7 @@ spring:
       max-file-size: 1000MB
       max-request-size: 1000MB
   profiles:
-    active: dev
+    active: prodNetOut
   jackson:
     default-property-inclusion: non_null
     serialization:

+ 1 - 1
PAS/src/main/resources/mapper/PatentMapper.xml

@@ -51,7 +51,7 @@
         a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
         application_no, a.appdate as application_date,
         a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
-        a.prioritydate as priority_date,
+        a.prioritydate as priority_date, a.publictono as public_accredit_no,
         b.look as `read`, a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as
         quoted_num,
         a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum

+ 14 - 4
PAS/src/main/resources/mapper/TaskMapper.xml

@@ -45,24 +45,30 @@
         tas.success_num tas_success_num,
         tas.true_success_num tas_true_success_num, tas.default_num tas_default_num, tas.pram_json tas_pram_json,
         tas.task_condition_id tas_task_condition_id, tas.create_time tas_create_time,
-        tas.task_type tas_task_type,
+        tas.task_type tas_task_type, tas.downexcel tas_downexcel,
         con.id, con.task_id, con.task_type, con.task_type2, con.conditions,
         con.crons, con.config_cells, con.config_id, con.task_name, con.total,
         con.orderby, con.orderby_type, con.db_type, con.start_number, con.end_number,
-        con.isadd_patentnos, con.isdelete_patentnos
+        con.isadd_patentnos, con.isdelete_patentnos, con.isadd_type
         from os_task tas
         left join os_task tas2 on tas.task_condition_id = tas2.task_condition_id and tas.ctime &lt; tas2.ctime
         left join task_condition con on tas.task_condition_id = con.id
         <where>
-            <if test="projectId != null">
+            <if test="projectId != null and projectId != 0">
                 and tas.tid = #{projectId}
             </if>
-            <if test="reportId != null">
+            <if test="reportId != null and reportId != 0">
                 and tas.report_id = #{reportId}
             </if>
             <if test="projectId == null and reportId == null">
                 and tas.uid = #{createId}
             </if>
+            <if test="projectId == 0 and reportId == null">
+                and tas.tid != 0
+            </if>
+            <if test="reportId == 0 and projectId == null">
+                and tas.report_id is not null
+            </if>
             <if test="personIds != null and personIds.size > 0">
                 and tas.uid in
                 <foreach collection="personIds" item="n" separator="," open="(" close=")">
@@ -117,6 +123,7 @@
         <result column="tas_old_name" property="taskName"/>
         <result column="tas_task_type" property="taskType"/>
         <result column="tas_endtime" property="modifiedTime"/>
+        <result column="tas_downexcel" property="url"/>
         <result column="conditions" property="conditions"/>
         <result column="crons" property="crons"/>
         <result column="config_cells" property="configCells"/>
@@ -127,7 +134,10 @@
         <result column="end_number" property="endNumber"/>
         <result column="isadd_patentnos" property="isAddPatentNos"/>
         <result column="isdelete_patentnos" property="isDeletePatentNos"/>
+        <result column="isadd_type" property="isAddType"/>
     </resultMap>
+
+
     <select id="queryTask" resultMap="queryTasksMap">
         select tas.*
         from os_task tas