Ver código fonte

Merge remote-tracking branch 'origin/master'

xiexiang 1 ano atrás
pai
commit
f650f207ec
27 arquivos alterados com 389 adições e 162 exclusões
  1. 1 1
      src/main/java/cn/cslg/pas/common/dto/business/ReportProjectDTO.java
  2. 18 5
      src/main/java/cn/cslg/pas/common/utils/DateUtils.java
  3. 4 0
      src/main/java/cn/cslg/pas/common/utils/esDataForm/PatentClassifySplitter.java
  4. 4 4
      src/main/java/cn/cslg/pas/common/utils/handler/PatentTypeHandler.java
  5. 17 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java
  6. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildNestedAnalyseBuilder.java
  7. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/DateCountAnalyssBuilder.java
  8. 5 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/IEsCountAnalysisBuilder.java
  9. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/NestedCountAnalysisBuilder.java
  10. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/PrioritiesCountAnalysisBuilder.java
  11. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/RangeCountAnalysisBuilder.java
  12. 11 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/TermsCountAnalysisBuilder.java
  13. 1 2
      src/main/java/cn/cslg/pas/service/business/CustomFieldService.java
  14. 2 4
      src/main/java/cn/cslg/pas/service/business/CustomOptionService.java
  15. 1 1
      src/main/java/cn/cslg/pas/service/business/ImportTaskService.java
  16. 1 1
      src/main/java/cn/cslg/pas/service/business/PatentProjectService.java
  17. 40 9
      src/main/java/cn/cslg/pas/service/business/es/EsCountService.java
  18. 42 33
      src/main/java/cn/cslg/pas/service/business/es/EsService.java
  19. 1 2
      src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java
  20. 17 17
      src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java
  21. 59 6
      src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java
  22. 2 1
      src/main/java/cn/cslg/pas/service/importPatent/GetPatentPictureFromWebThread.java
  23. 54 45
      src/main/java/cn/cslg/pas/service/importPatent/GetRightAndFullTextFromWebThread.java
  24. 12 7
      src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java
  25. 4 0
      src/main/java/cn/cslg/pas/service/importPatent/SavePatentToEsThread.java
  26. 24 16
      src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java
  27. 14 8
      src/main/resources/jsons/uploadSetting.json

+ 1 - 1
src/main/java/cn/cslg/pas/common/dto/business/ReportProjectDTO.java

@@ -67,7 +67,7 @@ public class ReportProjectDTO {
     @Schema(description = "产品或技术")
     private String productOrTech;
     @Schema(description = "关联报告")
-    private Integer AssoReportId;
+    private Integer assoReportId;
     @Schema(description = "是否直接完成")
     private Boolean ifFinish;
     @Schema(description = "是否有第二次无效理由")

+ 18 - 5
src/main/java/cn/cslg/pas/common/utils/DateUtils.java

@@ -115,12 +115,22 @@ public class DateUtils {
         return (int) (new Date().getTime() / 1000);
     }
 
-    public static Integer getDateTime(String date) {
-        int dateTime = 0;
+//    public static Integer getDateTime(String date) {
+//        int dateTime = 0;
+//        if (date.contains("/")) {
+//            dateTime = Math.toIntExact(strToDateTime(date, parsePatterns[4]).getTime() / 1000);
+//        } else if (date.contains("-")) {
+//            dateTime = Math.toIntExact(strToDateTime(date, YYYY_MM_DD).getTime() / 1000);
+//        }
+//        return dateTime;
+//    }
+
+        public static Date getDateTime(String date) {
+        Date dateTime = null;
         if (date.contains("/")) {
-            dateTime = Math.toIntExact(strToDateTime(date, parsePatterns[4]).getTime() / 1000);
+            dateTime = strToDateTime(date, parsePatterns[4]);
         } else if (date.contains("-")) {
-            dateTime = Math.toIntExact(strToDateTime(date, YYYY_MM_DD).getTime() / 1000);
+            dateTime = strToDateTime(date, YYYY_MM_DD);
         }
         return dateTime;
     }
@@ -679,7 +689,7 @@ public class DateUtils {
         int endPage;  //检索结束页数
         int endNum;  //检索结束页数的结束专利位置
         if (startNumber % pageSize != 0) {
-            startPage = startNumber / pageSize + 1;
+            startPage = startNumber / pageSize;
             startNum = startNumber % pageSize;
         } else {
             startPage = startNumber / pageSize;
@@ -721,4 +731,7 @@ public class DateUtils {
         return (int) timeStamp;
     }
 
+    public static void main(String[] args) {
+        System.out.println(12%50);
+    }
 }

+ 4 - 0
src/main/java/cn/cslg/pas/common/utils/esDataForm/PatentClassifySplitter.java

@@ -14,6 +14,10 @@ public class PatentClassifySplitter {
     }
 
     public static PatentClassify split(String classify) {
+        if(classify==null||classify.trim().equals(""))
+        {
+            return null;
+        }
         PatentClassify patentClassify = new PatentClassify();
         Integer length = classify.length();
         String level1 = "";

+ 4 - 4
src/main/java/cn/cslg/pas/common/utils/handler/PatentTypeHandler.java

@@ -11,13 +11,13 @@ public class PatentTypeHandler implements IProcessData {
     @Override
     public Object processData(Object data, Object ob) {
         if (data.toString().contains("实用新型")) {
-            return 1;
+            return "2";
         } else if (data.toString().contains("发明申请") || data.toString().contains("发明公布")) {
-            return 2;
+            return "1";
         } else if (data.toString().contains("外观设计")) {
-            return 3;
+            return "3";
         } else if (data.toString().contains("授权")) {
-            return 4;
+            return "4";
         }
         return null;
     }

+ 17 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java

@@ -26,12 +26,21 @@ public class ChildCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
 
     @Override
     public Aggregation createCountAnalyseAgg() throws Exception {
         Aggregation aggregation = null;
         List<Query> queryList = new ArrayList<>();
         Query q1 = QueryBuilders.term(i -> i.field("custom_field.field").value(fieldId));
+        if (projectId != null) {
+            Query q2 = QueryBuilders.term(i -> i.field("custom_field.project_id").value(projectId));
+            queryList.add(q2);
+        }
+        if (taskId != null) {
+            Query q3 = QueryBuilders.term(i -> i.field("custom_field.task_id").value(taskId));
+            queryList.add(q3);
+        }
         queryList.add(q1);
         Aggregation termAgg = null;
         if (ifHaveChild) {
@@ -203,4 +212,12 @@ public class ChildCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildNestedAnalyseBuilder.java

@@ -24,6 +24,7 @@ public class ChildNestedAnalyseBuilder implements IEsCountAnalysisBuilder{
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
 
     public Aggregation createCountAnalyseAgg() throws Exception {
         Aggregation terms = null;
@@ -186,4 +187,14 @@ public class ChildNestedAnalyseBuilder implements IEsCountAnalysisBuilder{
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/DateCountAnalyssBuilder.java

@@ -25,6 +25,7 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
     public static final int YEAR = 4;
     public static final int MONTH = 7;
     public static final int DAY = 10;
@@ -296,4 +297,14 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 5 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/IEsCountAnalysisBuilder.java

@@ -17,6 +17,7 @@ public interface IEsCountAnalysisBuilder {
     public List<String> values = new ArrayList<>();
     public String format = null;
     public Integer projectId = null;
+    public Integer taskId = null;
 
     public Aggregation createCountAnalyseAgg() throws Exception;
 
@@ -62,4 +63,8 @@ public interface IEsCountAnalysisBuilder {
     public Integer getProjectId();
 
     public void setProjectId(Integer projectId);
+
+    public Integer getTaskId();
+
+    public void setTaskId(Integer taskId);
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/NestedCountAnalysisBuilder.java

@@ -27,6 +27,7 @@ public class NestedCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
 
     @Override
     public Aggregation createCountAnalyseAgg() throws Exception {
@@ -144,4 +145,14 @@ public class NestedCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/PrioritiesCountAnalysisBuilder.java

@@ -23,6 +23,7 @@ public class PrioritiesCountAnalysisBuilder implements IEsCountAnalysisBuilder{
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
     public static final int YEAR = 4;
     public static final int MONTH = 7;
     public static final int DAY = 10;
@@ -280,4 +281,14 @@ public class PrioritiesCountAnalysisBuilder implements IEsCountAnalysisBuilder{
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/RangeCountAnalysisBuilder.java

@@ -22,6 +22,7 @@ public class RangeCountAnalysisBuilder implements IEsCountAnalysisBuilder{
     private String format;
     public List<String> values = new ArrayList<>();
     public Integer projectId = null;
+    public Integer taskId = null;
 
     @Override
     public Aggregation createCountAnalyseAgg() throws Exception {
@@ -160,4 +161,14 @@ public class RangeCountAnalysisBuilder implements IEsCountAnalysisBuilder{
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 11 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/TermsCountAnalysisBuilder.java

@@ -26,6 +26,7 @@ public class TermsCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     public List<String> values = new ArrayList<>();
     private String format;
     public Integer projectId = null;
+    public Integer taskId = null;
 
     @Override
     public Aggregation createCountAnalyseAgg() throws Exception {
@@ -139,4 +140,14 @@ public class TermsCountAnalysisBuilder implements IEsCountAnalysisBuilder {
     public void setProjectId(Integer projectId) {
         this.projectId = projectId;
     }
+
+    @Override
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    @Override
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
 }

+ 1 - 2
src/main/java/cn/cslg/pas/service/business/CustomFieldService.java

@@ -571,7 +571,6 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
                         break;
                     case 4:
 
-
                     case 5:
                         fieldId = this.GetIdByName(name, projectId, type);
                         value = customOptionService.getIdsByNames(value, fieldId);
@@ -580,7 +579,7 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
                         //TODO 根据名称和类型查询
                         fieldId = this.GetIdByName(name, projectId, type);
                         value = treeNodeService.getIdByNames(value, fieldId, type);
-                        ;
+                        break;
                 }
 
                 EsCustomFieldDTO esCustomFieldDTO = new EsCustomFieldDTO();

+ 2 - 4
src/main/java/cn/cslg/pas/service/business/CustomOptionService.java

@@ -190,10 +190,8 @@ public class CustomOptionService extends ServiceImpl<CustomOptionMapper, CustomO
                         Personnel personnel = personnels.stream().filter(item -> item.getId().equals(customOptionVO.getCreateId())).findFirst().orElse(null);
                         if (personnel != null) {
                             customOptionVO.setCreateName(personnel.getPersonnelName());
-                            customOptionVOS.add(customOptionVO);
-                        } else {
-                            throw new XiaoShiException("未获取到创建人信息");
                         }
+                        customOptionVOS.add(customOptionVO);
                     }
                 }
             } else {
@@ -243,7 +241,7 @@ public class CustomOptionService extends ServiceImpl<CustomOptionMapper, CustomO
                 customOption.setName(item);
                 customOption.insert();
             }
-            ids.add(item);
+            ids.add(customOption.getId().toString());
         });
         return  ids;
     }

+ 1 - 1
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -382,7 +382,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         ImportTask importTask = this.getById(taskId);
         importTask.setState(state);
         importTask.updateById();
-        if (state.equals(4)) {
+        if (state.equals(4)||state.equals(5)) {
             schedulingTaskService.pauseTask(taskId, state);
         }
         if (state.equals(0)) {

+ 1 - 1
src/main/java/cn/cslg/pas/service/business/PatentProjectService.java

@@ -910,7 +910,7 @@ public class PatentProjectService extends ServiceImpl<PatentProjectMapper, Paten
         }
         else if(roleType.equals(2))
         {
-            rootSql="p.tenant_id="+tenantId;
+            rootSql="(p.tenant_id="+tenantId+" or p.id in (select project_id from asso_project_person where person_id ="+id+"))";
         }
 
         if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {

+ 40 - 9
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -21,6 +21,7 @@ import co.elastic.clients.elasticsearch._types.aggregations.*;
 import co.elastic.clients.elasticsearch._types.query_dsl.Query;
 import co.elastic.clients.elasticsearch.core.SearchRequest;
 import co.elastic.clients.elasticsearch.core.SearchResponse;
+import co.elastic.clients.elasticsearch.core.search.Hit;
 import com.alibaba.fastjson.JSON;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
@@ -184,7 +185,7 @@ public class EsCountService {
             }
             String format = countVO.getFormat();
             List<String> values = countVO.getValues();
-            Aggregation aggregation = this.getAggregation(countVO,projectId);
+            Aggregation aggregation = this.getAggregation(countVO, projectId, taskId);
             if (query != null) {
                 Query finalQuery = query;
                 Aggregation finalAggregation = aggregation;
@@ -415,7 +416,7 @@ public class EsCountService {
      * @return
      * @throws Exception
      */
-    public Aggregation getAggregation(EsCountVO countVO,Integer projectId) throws Exception {
+    public Aggregation getAggregation(EsCountVO countVO, Integer projectId, Integer taskId) throws Exception {
         String field = countVO.getField();
         Integer topN = countVO.getTopN();
         Boolean ifHaveChild = countVO.getIfHaveChild();
@@ -448,6 +449,7 @@ public class EsCountService {
             iEsCountAnalysisBuilder.setTopN(topN);
             iEsCountAnalysisBuilder.setFormat(format);
             iEsCountAnalysisBuilder.setProjectId(projectId);
+            iEsCountAnalysisBuilder.setTaskId(taskId);
             iEsCountAnalysisBuilder.setIfHaveChild(ifHaveChild);
             if (iEsCountAnalysisBuilder.getField().contains(".")) {
                 String path = iEsCountAnalysisBuilder.getField()
@@ -620,6 +622,32 @@ public class EsCountService {
         });
     }
 
+    public Integer getUnselectedCustomNum(Integer projectId,Integer taskId) throws Exception {
+        String condition = "";
+        if (taskId != null) {
+            condition = "taskId = " + taskId;
+        } else {
+            condition = "projectId = " + projectId;
+        }
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("patent");
+        treeNode tree = expressManager.getInstance().Parse(condition, false);
+        //格式化检索式
+        //3. 从es中检索数据
+        Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent");
+        builder.query(q);
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        List<Hit<Patent>> hits = response.hits().hits();
+        Long total = response.hits().total().value();
+        List<String> list = new ArrayList<>();
+        for (Hit<Patent> hit : hits) {
+            String id = hit.id();
+            list.add(id);
+        }
+        return null;
+    }
+
     /**
      * 获取children分析后数据
      *
@@ -987,14 +1015,17 @@ public class EsCountService {
             EsCountDetailDTO dto = new EsCountDetailDTO();
             dto.setField(field);
             Aggregate aggregate = bucket.aggregations().get("filter_agg");
-            dto.setName(bucket.key().stringValue());
-            dto.setNumber(bucket.docCount());
-            dto.setTopN(topN);
-            dto.setFirstName(firstName);
-            if (aggregate != null) {
-                dto.setNumber(aggregate.filter().docCount());
+            String value = bucket.key().stringValue();
+            if (StringUtils.isNotEmpty(value)) {
+                dto.setName(value);
+                dto.setNumber(bucket.docCount());
+                dto.setTopN(topN);
+                dto.setFirstName(firstName);
+                if (aggregate != null) {
+                    dto.setNumber(aggregate.filter().docCount());
+                }
+                countDetailDTOS.add(dto);
             }
-            countDetailDTOS.add(dto);
 //            if (dto.getNumber() > 0) {
 //                detailDTOS.add(dto);
 //            }

+ 42 - 33
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -259,8 +259,7 @@ public class EsService {
         //分页
         if (current != null && size != null && current > 0 && size > 0) {
             builder.from((current.intValue() - 1) * size.intValue()).size(size.intValue());
-        }
-        else {
+        } else {
             builder.from(0).size(99999);
 
         }
@@ -988,13 +987,12 @@ public class EsService {
                     quotePatent1 = quotePatents.stream()
                             .filter(item -> patentNo.equals(item.getAppNo()) || patentNo.equals(item.getPublicNo()) || patentNo.equals(item.getGrantNo())).findFirst().orElse(null);
                 }
-              Patent patent=  patents.stream().filter(item -> patentNo.equals(item.getAppNo())).findFirst().orElse(null);
+                Patent patent = patents.stream().filter(item -> patentNo.equals(item.getAppNo())).findFirst().orElse(null);
                 if (quotePatent1 == null) {
-                    quotePatent1 = this.reQuotePatent(patent,patentNo);
+                    quotePatent1 = this.reQuotePatent(patent, patentNo);
                     quotePatents.add(quotePatent1);
-                }
-                else {
-                    quotePatent1 = this.reQuotePatent(patent,patentNo);
+                } else {
+                    quotePatent1 = this.reQuotePatent(patent, patentNo);
                 }
             }
 
@@ -1090,10 +1088,21 @@ public class EsService {
             //设置查询索引
             builder.index("legal_event");
             //申请号
-            Query q1 = QueryBuilders.term(t -> t.field("app_no").value(starPatentVO.getApplicationNo()));
-            Query q2 = QueryBuilders.term((t -> t.field("grant_no").value(starPatentVO.getPublicAccreditNo())));
-            Query q3 = QueryBuilders.term((t -> t.field("public_no").value(starPatentVO.getPublicNo())));
-            Query bool = QueryBuilders.bool(i -> i.should(q1, q2, q3));
+            List<Query> queries = new ArrayList<>();
+            if (starPatentVO.getApplicationNo() != null) {
+                Query q1 = QueryBuilders.term(t -> t.field("app_no").value(starPatentVO.getApplicationNo()));
+                queries.add(q1);
+            }
+            if (starPatentVO.getPublicAccreditNo() != null) {
+                Query q2 = QueryBuilders.term((t -> t.field("grant_no").value(starPatentVO.getPublicAccreditNo())));
+                queries.add(q2);
+            }
+            if (starPatentVO.getPublicNo() != null) {
+                Query q3 = QueryBuilders.term((t -> t.field("public_no").value(starPatentVO.getPublicNo())));
+                queries.add(q3);
+            }
+
+            Query bool = QueryBuilders.bool(i -> i.should(queries));
             builder.query(bool);
             SearchResponse<LegalEvent> response = null;
             try {
@@ -1107,28 +1116,28 @@ public class EsService {
                     legalEvents.add(item.source());
                 });
             }
-
-            List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
-            chinaLeagalStatuses.forEach(item -> {
-                LegalEvent tem = legalEvents.stream().filter(em -> em.getEventDate() != null && em.getEventDate().compareTo(item.getLegalDate()) == 0).findFirst().orElse(null);
-                if (tem == null) {
-                    LegalEvent legalEvent1 = new LegalEvent();
-                    legalEvent1.setEventDate(item.getLegalDate());
-                    legalEvent1.setCode(item.getLegalCode());
-                    legalEvent1.setAppNo(starPatentVO.getApplicationNo());
-                    legalEvent1.setGrantNo(starPatentVO.getPublicAccreditNo());
-                    legalEvent1.setPublicNo(starPatentVO.getPublicNo());
-                    legalEvent1.setDescription(item.getLegalStatusInfo());
-                    legalEvent1.setName(item.getLegalStatus());
-                    try {
-                        String reId = this.addLegalEvent(legalEvent1);
-                    } catch (Exception e) {
-                        throw new XiaoShiException(e.getMessage());
-                    }
-                }
-
-            });
-
+               if(!cnLegalApiStr.contains("408")) {
+                   List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
+                   chinaLeagalStatuses.forEach(item -> {
+                       LegalEvent tem = legalEvents.stream().filter(em -> em.getEventDate() != null && em.getEventDate().compareTo(item.getLegalDate()) == 0).findFirst().orElse(null);
+                       if (tem == null) {
+                           LegalEvent legalEvent1 = new LegalEvent();
+                           legalEvent1.setEventDate(item.getLegalDate());
+                           legalEvent1.setCode(item.getLegalCode());
+                           legalEvent1.setAppNo(starPatentVO.getApplicationNo());
+                           legalEvent1.setGrantNo(starPatentVO.getPublicAccreditNo());
+                           legalEvent1.setPublicNo(starPatentVO.getPublicNo());
+                           legalEvent1.setDescription(item.getLegalStatusInfo());
+                           legalEvent1.setName(item.getLegalStatus());
+                           try {
+                               String reId = this.addLegalEvent(legalEvent1);
+                           } catch (Exception e) {
+                               throw new XiaoShiException(e.getMessage());
+                           }
+                       }
+
+                   });
+               }
 
         }
         return "";

+ 1 - 2
src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java

@@ -429,8 +429,7 @@ public class AssoGroupFeatureService extends ServiceImpl<AssoGroupFeatureMapper,
         Integer featureId = feature.getId();
         //根据权要id 查询 无效法条
         LambdaQueryWrapper<InvalidStatutes> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(InvalidStatutes::getClaimId, claimId)
-                .and(wrapper -> wrapper.eq(InvalidStatutes::getStatutesId, 2).or().eq(InvalidStatutes::getStatutesId, 3));
+        queryWrapper.eq(InvalidStatutes::getClaimId, claimId);
         List<InvalidStatutes> invalidStatutes = invalidStatutesService.list(queryWrapper);
         if (invalidStatutes != null && invalidStatutes.size() != 0) {
             List<Integer> statutesIds = invalidStatutes.stream().map(InvalidStatutes::getId).collect(Collectors.toList());

+ 17 - 17
src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java

@@ -98,31 +98,31 @@ public class GetCataloguingFromWebThread extends Thread {
 
                 EsService esService = applicationContext.getBean(EsService.class);
 
-            // 添加同族专利
+                // 添加同族专利
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(uploadPatentWebDTO.getPatent().getPublicNo());
                 List<String> familyPatentNos = new ArrayList<>();
-                if (!familyPatentNoStr.equals("no data")&&!familyPatentNoStr.trim().equals("")) {
+                if (!familyPatentNoStr.equals("no data") && !familyPatentNoStr.trim().equals("")) {
                     FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
-                    if (familyPatentNo != null &&!familyPatentNo.getFamilyinfo().trim().equals("")&& familyPatentNo.getFamilyinfo() != null) {
-                   String[] nos =     familyPatentNo.getFamilyinfo().split(";");
-                   if(nos!=null&&nos.length>0){
-                       for (String no : nos) {
-                           familyPatentNos.add(no);
-                       }
-                   }
+                    if (familyPatentNo != null &&familyPatentNo.getFamilyinfo() != null&& !familyPatentNo.getFamilyinfo().trim().equals("")) {
+                        String[] nos = familyPatentNo.getFamilyinfo().split(";");
+                        if (nos != null && nos.length > 0) {
+                            for (String no : nos) {
+                                familyPatentNos.add(no);
+                            }
+                        }
                     }
                 }
                 familyPatentNos.add(uploadPatentWebDTO.getPatent().getAppNo());
 
                 if (familyPatentNos.size() != 0) {
-                    EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(uploadPatentWebDTO.getPatent(),familyPatentNos, "inpadoc");
+                    EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(uploadPatentWebDTO.getPatent(), familyPatentNos, "inpadoc");
                     uploadPatentWebDTO.getPatent().setInpadocFamilyNum(esPatentFamilyDTO.getFamilyNum());
                     uploadPatentWebDTO.getPatent().setInpadocFamilyId(esPatentFamilyDTO.getPatentFamilyId());
                 }
-
-                //添加法律事务
-                esService.addEsLegalEvent(uploadPatentWebDTO.getStarPatentVO());
-
+                if (uploadPatentWebDTO.getStarPatentVO().getApplicationNo().contains("CN")) {
+                    //添加法律事务
+                    esService.addEsLegalEvent(uploadPatentWebDTO.getStarPatentVO());
+                }
                 //添加引用专利
                 String nos = starPatentVO.getQuoteNos();
                 if (nos != null) {
@@ -137,7 +137,7 @@ public class GetCataloguingFromWebThread extends Thread {
                 e.printStackTrace();
             }
         }
-        importFromWebToEsService.setPatentToEsProductAll();
+        importFromWebToEsService.setPatentToEsProductAll("catalogDone");
     }
 
 
@@ -173,9 +173,9 @@ public class GetCataloguingFromWebThread extends Thread {
         Integer patentType = starPatentVO.getPatentType();
         if (patentType != null) {
             if (patentType.equals(2) || patentType.equals(9)) {
-                patent.setPatentType("1");  //实用新型
+                patent.setPatentType("2");  //实用新型
             } else if (patentType.equals(1) || patentType.equals(8)) {
-                patent.setPatentType("2");  //发明
+                patent.setPatentType("1");  //发明
             } else if (patentType.equals(3)) {
                 patent.setPatentType("3");  //外观设计
             }

+ 59 - 6
src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java

@@ -6,11 +6,14 @@ import cn.cslg.pas.common.dto.business.EsPatentFamilyDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
 import cn.cslg.pas.common.utils.ReadExcelUtils;
+import cn.cslg.pas.common.utils.esDataForm.PatentClassifySplitter;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
 import cn.cslg.pas.common.vo.PatentData;
 import cn.cslg.pas.common.vo.UploadParamsVO;
 import cn.cslg.pas.common.vo.UploadSettingVO;
 import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentClassify;
+import cn.cslg.pas.domain.es.PatentPerson;
 import cn.cslg.pas.domain.es.Text;
 import cn.cslg.pas.service.business.CustomFieldService;
 import cn.cslg.pas.service.business.es.EsService;
@@ -80,9 +83,9 @@ public class GetPatentFromExcelThread extends Thread {
                 uploadPatentWebDTO.setTotalCounter(importTaskAMVO.getThreadCounter());
                 uploadPatentWebDTO.setPictureData(uploadParamsVO.getPictureData());
                 uploadPatentWebDTO.setPatent(uploadParamsVO.getPatent());
-                if(uploadParamsVO.getCustomerFieldList()!=null&&uploadParamsVO.getCustomerFieldList().size()!=0){
-                    CustomFieldService customFieldService =applicationContext.getBean(CustomFieldService.class);
-                    List<EsCustomFieldDTO> esCustomFieldDTOList =customFieldService.getFieldDTOByStrings(uploadParamsVO.getCustomerFieldList(),importTaskAMVO.getProjectId());
+                if (uploadParamsVO.getCustomerFieldList() != null && uploadParamsVO.getCustomerFieldList().size() != 0) {
+                    CustomFieldService customFieldService = applicationContext.getBean(CustomFieldService.class);
+                    List<EsCustomFieldDTO> esCustomFieldDTOList = customFieldService.getFieldDTOByStrings(uploadParamsVO.getCustomerFieldList(), importTaskAMVO.getProjectId());
                     uploadPatentWebDTO.setEsCustomFieldDTOList(esCustomFieldDTOList);
                 }
                 //专利丢入消费者队列,并唤醒消费者线程
@@ -182,7 +185,7 @@ public class GetPatentFromExcelThread extends Thread {
         if (uploadParamsVO.getSimpleFamily() != null) {
             EsService esService = applicationContext.getBean(EsService.class);
             try {
-                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent,uploadParamsVO.getSimpleFamily(), FamilyType.SIMPLE);
+                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent, uploadParamsVO.getSimpleFamily(), FamilyType.SIMPLE);
                 if (esPatentFamilyDTO != null) {
                     patent.setSimpleFamilyId(esPatentFamilyDTO.getPatentFamilyId());
                     patent.setSimpleFamilyNum(esPatentFamilyDTO.getFamilyNum());
@@ -195,7 +198,7 @@ public class GetPatentFromExcelThread extends Thread {
         if (uploadParamsVO.getInpadocFamily() != null) {
             EsService esService = applicationContext.getBean(EsService.class);
             try {
-                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent,uploadParamsVO.getSimpleFamily(), FamilyType.INPADOC);
+                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent, uploadParamsVO.getSimpleFamily(), FamilyType.INPADOC);
                 if (esPatentFamilyDTO != null) {
                     patent.setInpadocFamilyId(esPatentFamilyDTO.getPatentFamilyId());
                     patent.setInpadocFamilyNum(esPatentFamilyDTO.getFamilyNum());
@@ -208,7 +211,7 @@ public class GetPatentFromExcelThread extends Thread {
         if (uploadParamsVO.getPatSnapFamily() != null) {
             EsService esService = applicationContext.getBean(EsService.class);
             try {
-                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent,uploadParamsVO.getSimpleFamily(), FamilyType.PATSNAP);
+                EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(patent, uploadParamsVO.getSimpleFamily(), FamilyType.PATSNAP);
                 if (esPatentFamilyDTO != null) {
                     patent.setPatsnapFamilyId(esPatentFamilyDTO.getPatentFamilyId());
                     patent.setPatsnapFamilyNum(esPatentFamilyDTO.getFamilyNum());
@@ -217,6 +220,56 @@ public class GetPatentFromExcelThread extends Thread {
             }
         }
 
+        List<String> applicantNames = uploadParamsVO.getPatentApplicantOriginalName();
+        //申请人
+        if (applicantNames != null && applicantNames.size() != 0) {
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < applicantNames.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(i + 1);
+                patentPerson.setType("1");
+                patentPerson.setName(applicantNames.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setApplicant(patentPeople);
+
+        }
+
+        List<String> ipcList = uploadParamsVO.getIpcList();
+        String mainIpc = uploadParamsVO.getMainIpc();
+        //装载IPC分类号
+        if (ipcList == null && mainIpc!= null) {
+            ipcList=new ArrayList<>();
+            ipcList.add(uploadParamsVO.getMainIpc());
+        }
+
+        if (ipcList != null && uploadParamsVO.getIpcList().size() > 0) {
+            List<PatentClassify> patentClassifies = new ArrayList<>();
+            for (int i = 0; i < uploadParamsVO.getIpcList().size(); i++) {
+                PatentClassify patentClassify = PatentClassifySplitter.split(uploadParamsVO.getIpcList().get(i));
+                if(patentClassify!=null) {
+                    patentClassifies.add(patentClassify);
+                    if (i == 0) {
+                        patent.setMipc(patentClassify);
+                    }
+                }
+            }
+            patent.setIpc(patentClassifies);
+        }
+
+
+        //装载CPC分类号
+        List<String> cpcList = uploadParamsVO.getCpcList();
+        if (cpcList != null && cpcList.size() > 0) {
+            List<PatentClassify> patentClassifies = new ArrayList<>();
+            for (int i = 0; i < cpcList.size(); i++) {
+                PatentClassify patentClassify = PatentClassifySplitter.split(cpcList.get(i));
+                patentClassifies.add(patentClassify);
+            }
+            patent.setCpc(patentClassifies);
+        }
+
+
 
     }
 

+ 2 - 1
src/main/java/cn/cslg/pas/service/importPatent/GetPatentPictureFromWebThread.java

@@ -60,7 +60,8 @@ public class GetPatentPictureFromWebThread extends Thread {
 
                 PatentStarApiService patentStarApiService = applicationContext.getBean(PatentStarApiService.class);
                 String pictureUrl = patentStarApiService.getPictureApi(uploadPatentWebDTO.getStarPatentVO().getRowApplicationNo());
-                if (pictureUrl != null && pictureUrl != "{}") {
+
+                if (pictureUrl != null && !pictureUrl.contains("408")) {
                     File file = FileUtils.getPictureFileByUrl(pictureUrl);
                     FileManagerService fileManagerService = applicationContext.getBean(FileManagerService.class);
                     String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getStarPatentVO().getApplicationNo());

+ 54 - 45
src/main/java/cn/cslg/pas/service/importPatent/GetRightAndFullTextFromWebThread.java

@@ -35,43 +35,47 @@ public class GetRightAndFullTextFromWebThread extends Thread {
     private ApplicationContext applicationContext;
     private ImportFromWebToEsService importFromWebToEsService;
     private PatentStarApiService patentStarApiService;
-    private List<UploadPatentWebDTO> uploadPatentWebDTOs =new ArrayList<>();
+    private List<UploadPatentWebDTO> uploadPatentWebDTOs = new ArrayList<>();
     private final Lock taskLock = new ReentrantLock();
     private final Condition taskCondition = taskLock.newCondition();
     private Boolean ifProductAll = false;
     private TaskThread taskThread;
+
     @Override
     public void run() {
 
-            while ((!ifProductAll || uploadPatentWebDTOs.size() > 0) && importTaskAMVO.getState().equals(1)) {
-
-                try {
-                    if (uploadPatentWebDTOs.size() == 0) {
-                        taskLock.lock();
-                        taskCondition.await();
-                    }
-                }catch (Exception e){
+        while ((!ifProductAll || uploadPatentWebDTOs.size() > 0) && importTaskAMVO.getState().equals(1)) {
 
+            try {
+                if (uploadPatentWebDTOs.size() == 0) {
+                    taskLock.lock();
+                    taskCondition.await();
                 }
-                UploadPatentWebDTO uploadPatentWebDTO = uploadPatentWebDTOs.remove(0);
-                try {
-                StarPatentVO starPatentVO =uploadPatentWebDTO.getStarPatentVO();
+            } catch (Exception e) {
+
+            }
+            if(uploadPatentWebDTOs.size()==0){
+                break;
+            }
+            UploadPatentWebDTO uploadPatentWebDTO = uploadPatentWebDTOs.remove(0);
+            try {
+                StarPatentVO starPatentVO = uploadPatentWebDTO.getStarPatentVO();
 
                 if ((starPatentVO.getPublicNo() != null && starPatentVO.getPublicNo().contains("CN")) || (starPatentVO.getPublicNo() == null && starPatentVO.getPublicNo().contains("CN"))) {
-                   patentStarApiService =applicationContext.getBean(PatentStarApiService.class);
+                    patentStarApiService = applicationContext.getBean(PatentStarApiService.class);
                     String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(starPatentVO.getRowApplicationNo());
-                       this.loadClaim(uploadPatentWebDTO,cnFullXmlStr);
-                       this.loadFullText(uploadPatentWebDTO,cnFullXmlStr);
+                    this.loadClaim(uploadPatentWebDTO, cnFullXmlStr);
+                    this.loadFullText(uploadPatentWebDTO, cnFullXmlStr);
                 }
                 //加入es保存队列
-                    importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
+                importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
+            } catch (Exception e) {
+                importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
+                e.printStackTrace();
             }
-                catch (Exception e) {
-                    importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
-                    e.printStackTrace();
-                }
+            System.out.println("rightDone" + ifProductAll);
         }
-        importFromWebToEsService.setPatentToEsProductAll();
+        importFromWebToEsService.setPatentToEsProductAll("rightDone");
     }
 
 
@@ -79,25 +83,27 @@ public class GetRightAndFullTextFromWebThread extends Thread {
         this.importTaskAMVO = taskThread.getImportTaskAMVO();
         this.importFromWebToEsService = importFromWebToEsService;
         this.applicationContext = taskThread.getApplicationContext();
-        this.taskThread=taskThread;
+        this.taskThread = taskThread;
     }
 
     public void awakeTask(UploadPatentWebDTO uploadPatentWebDTO) {
-        UploadPatentWebDTO uploadPatentWebDTO1=new UploadPatentWebDTO();
-        BeanUtils.copyProperties(uploadPatentWebDTO,uploadPatentWebDTO1);
-        uploadPatentWebDTOs.add(uploadPatentWebDTO1);
-        if (taskLock.tryLock()) {
-            taskCondition.signalAll();
-            taskLock.unlock();
+        synchronized ("装载专利信息") {
+            UploadPatentWebDTO uploadPatentWebDTO1 = new UploadPatentWebDTO();
+            BeanUtils.copyProperties(uploadPatentWebDTO, uploadPatentWebDTO1);
+            uploadPatentWebDTOs.add(uploadPatentWebDTO1);
+            if (taskLock.tryLock()) {
+                taskCondition.signalAll();
+                taskLock.unlock();
+            }
         }
     }
 
 
     //装载权利要求
-    private void loadClaim(UploadPatentWebDTO uploadPatentWebDTO,String cnFullXmlStr) {
+    private void loadClaim(UploadPatentWebDTO uploadPatentWebDTO, String cnFullXmlStr) {
         Patent patent = uploadPatentWebDTO.getPatent();
         try {
-            if(cnFullXmlStr!=null&&cnFullXmlStr!="") {
+            if (cnFullXmlStr != null && cnFullXmlStr != "") {
                 SAXReader reader = new SAXReader();
                 reader.setEntityResolver(new IgnoreDTDEntityResolver());
                 Reader stringReader = new StringReader(cnFullXmlStr);
@@ -111,7 +117,7 @@ public class GetRightAndFullTextFromWebThread extends Thread {
                 List<String> reClaims = new ArrayList<>();
                 element.forEach(item -> {
                     String claim = item.getText();
-                    claim =   claim.replaceAll("\r\n|\r|\n|\t| ", "");
+                    claim = claim.replaceAll("\r\n|\r|\n|\t| ", "");
                     reClaims.add(claim);
 
                 });
@@ -133,13 +139,13 @@ public class GetRightAndFullTextFromWebThread extends Thread {
 
     }
 
-     //装载说明书文档
-    private void loadFullText(UploadPatentWebDTO uploadPatentWebDTO,String cnFullXmlStr) {
+    //装载说明书文档
+    private void loadFullText(UploadPatentWebDTO uploadPatentWebDTO, String cnFullXmlStr) {
         Patent patent = uploadPatentWebDTO.getPatent();
         try {
             //若没有取到全文文本,即取不到说明书文本,则将当前申请号或专利号和备注信息记录到问题记录表
             if (cnFullXmlStr.equals("")) {
-                return ;
+                return;
             }
 
             SAXReader reader = new SAXReader();
@@ -153,41 +159,44 @@ public class GetRightAndFullTextFromWebThread extends Thread {
                 elements = (List<Element>) xpath.selectNodes(document);
             }
             List<String> fullTexts = new ArrayList<>();
-            Integer count=1;
-            for (Element item:elements){
+            Integer count = 1;
+            for (Element item : elements) {
                 String fullText = item.getText().replaceAll("<br/>", "");
                 if (!fullText.trim().equals("技术领域")
                         && !fullText.trim().equals("发明内容")
                         && !fullText.trim().equals("附图说明")
                         && !fullText.trim().equals("具体实施方式")
-                        &&!fullText.trim().equals("背景技术")
-                        &&!fullText.trim().equals("实用新型内容"))
-
-                {String formattedNum = String.format("%04d", count);
-                    fullText ="["+formattedNum+"]"+fullText;
+                        && !fullText.trim().equals("背景技术")
+                        && !fullText.trim().equals("实用新型内容")) {
+                    String formattedNum = String.format("%04d", count);
+                    fullText = "[" + formattedNum + "]" + fullText;
                     count++;
                 }
-                fullText =  fullText.replaceAll("\r\n|\r|\n| ", "");
+                fullText = fullText.replaceAll("\r\n|\r|\n| ", "");
                 fullTexts.add(fullText);
             }
             String fullText = "";
             if (fullTexts.size() != 0) {
                 fullText = cn.cslg.pas.common.utils.StringUtils.join(fullTexts, "\r");
             }
-            Text text =new Text();
+            Text text = new Text();
             text.setIfOrigin(true);
             text.setTextContent(fullText);
             text.setLanguage(patent.getAppCountry());
             patent.setPublicFullText(Arrays.asList(text));
 
-    } catch (Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
 
 
     }
-    public void setIfProductAll(Boolean ifProductAll) {
 
+    public void setIfProductAll(Boolean ifProductAll) {
+        if (taskLock.tryLock()) {
+            taskCondition.signalAll();
+            taskLock.unlock();
+        }
         this.ifProductAll = ifProductAll;
 
     }

+ 12 - 7
src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java

@@ -202,10 +202,10 @@ public class ImportFromWebToEsService implements PatentImportImp {
                 Integer startPage = calculate.getStartPage();
                 Integer endPage = calculate.getEndPage();
 
-                for (int i = startPage; i < endPage; i++) {
+                for (int i = startPage; i <endPage; i++) {
                     PatentStarListDTO patentStarListDTOTemp = new PatentStarListDTO();
                     BeanUtils.copyProperties(patentStarListDto, patentStarListDTOTemp);
-                    patentStarListDTOTemp.setPageNum(i + 1);
+                    patentStarListDTOTemp.setPageNum(i+1);
                     patentStarListDTOTemp.setRowCount(50);
                     //调用一般接口返回一批专利著录相关数据
 
@@ -222,10 +222,13 @@ public class ImportFromWebToEsService implements PatentImportImp {
                     //遍历这一页的专利
                     for (int j = pageStartNum; j < pageEndNum; j++) {
                         StarPatentVO starPatentVO =starPatents.get(j);
-                      nos.removeIf(item->item.equals(starPatentVO.getApplicationNo())
-                              ||item.equals(starPatentVO.getPublicNo())
-                              ||item.equals(starPatentVO.getPublicAccreditNo())
-                               ||item.equals(starPatentVO.getRowApplicationNo()));
+
+                        if(nos!=null) {
+                            nos.removeIf(item -> item.equals(starPatentVO.getApplicationNo())
+                                    || item.equals(starPatentVO.getPublicNo())
+                                    || item.equals(starPatentVO.getPublicAccreditNo())
+                                    || item.equals(starPatentVO.getRowApplicationNo()));
+                        }
                         UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
                         Patent patent = new Patent();
                         //装载start
@@ -279,6 +282,7 @@ public class ImportFromWebToEsService implements PatentImportImp {
             }
             if (ifAddFullText == '1') {
                 getRightAndFullTextFromWebThread.setIfProductAll(true);
+                System.out.println("fullTextawake");
             }
             if (ifPdf == '1') {
                 getPatentPDFFromWebThread.setIfProductAll(true);
@@ -322,8 +326,9 @@ public class ImportFromWebToEsService implements PatentImportImp {
     }
 
 
-    public void setPatentToEsProductAll() {
+    public void setPatentToEsProductAll(String message) {
         synchronized ("装载专利信息") {
+            System.out.println(message);
             importTaskAMVO.setMessageThreadDoneCounter(importTaskAMVO.getMessageThreadDoneCounter() + 1);
             if (importTaskAMVO.getMessageThreadCounter().equals(importTaskAMVO.getMessageThreadDoneCounter())) {
                 savePatentToEsThread.setIfProductAll(true);

+ 4 - 0
src/main/java/cn/cslg/pas/service/importPatent/SavePatentToEsThread.java

@@ -50,6 +50,9 @@ public class SavePatentToEsThread extends Thread {
                 }
             } catch (Exception e) {
             }
+            if(uploadPatentWebDTOS.size()==0){
+                break;
+            }
             UploadPatentWebDTO uploadPatentWebDTO = uploadPatentWebDTOS.remove(0);
             Patent patent = uploadPatentWebDTO.getPatent();
             try {
@@ -132,6 +135,7 @@ public class SavePatentToEsThread extends Thread {
                     ) {
                         esCustomFieldDTO.setPatentId(patentId);
                         esCustomFieldDTO.setOptionType(2);
+                        esCustomFieldDTO.setPatentNo(patent.getPatentNo());
                         EsCustomFieldService esCustomFieldService = applicationContext.getBean(EsCustomFieldService.class);
                         esCustomFieldService.addCustomField(esCustomFieldDTO);
                     }

+ 24 - 16
src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java

@@ -43,16 +43,20 @@ public class SchedulingTaskService {
 
     public void startTask() {
         Integer freeCount = Constants.MAX_IMPORT_TASK_COUNT - threadPoolTaskExecutor.getActiveCount();
-       if(importTaskAMVOS==null){
-           importTaskAMVOS=new ArrayList<>();
-       }
+        if (importTaskAMVOS == null) {
+            importTaskAMVOS = new ArrayList<>();
+        }
         // 当正在活跃的线程数小于最大线程数时
+        List<Integer> ids = importTaskAMVOS.stream().map(ImportTaskAMVO::getId).collect(Collectors.toList());
         if (freeCount > 0) {
             //查找任务
             LambdaQueryWrapper<ImportTask> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.in(ImportTask::getState, new ArrayList<>(Arrays.asList(0)))
-                    .in((ImportTask::getType),new ArrayList<>(Arrays.asList(1,2,3,4,5)))
+                    .in((ImportTask::getType), new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5)))
                     .orderByDesc(ImportTask::getState);
+            if (ids.size() > 0) {
+                queryWrapper.notIn(ImportTask::getId, ids);
+            }
             List<ImportTask> importTaskList = importTaskService.list(queryWrapper);
             if (importTaskList.size() > freeCount) {
                 importTaskList = importTaskList.subList(0, freeCount - 1);
@@ -60,7 +64,7 @@ public class SchedulingTaskService {
 
             if (importTaskList.size() > 0) {
                 // 装载任务信息
-             List<ImportTaskAMVO>   importTaskAMVOFromDbs = this.loadTaskAMVOS(importTaskList);
+                List<ImportTaskAMVO> importTaskAMVOFromDbs = this.loadTaskAMVOS(importTaskList);
 
                 for (int i = 0; i < importTaskAMVOFromDbs.size(); i++) {
                     importTaskList.get(i).setState(1);
@@ -96,7 +100,7 @@ public class SchedulingTaskService {
 
             ImportTaskCondition importTaskCondition = importTaskConditions.stream().filter(item -> item.getId().equals(importTask.getImportTaskConditionId())).findFirst().orElse(null);
             ImportTaskAMVO importTaskAMVO = new ImportTaskAMVO();
-            BeanUtils.copyProperties(importTask,importTaskAMVO);
+            BeanUtils.copyProperties(importTask, importTaskAMVO);
             if (importTaskCondition != null) {
                 importTaskAMVO.setFileGuid(importTaskCondition.getFileGuid());
                 importTaskAMVO.setSourceId(importTaskCondition.getSourceId());
@@ -108,8 +112,10 @@ public class SchedulingTaskService {
                 importTaskAMVO.setOrderByType(importTaskCondition.getOrderByType());
                 importTaskAMVO.setProjectType(importTaskCondition.getProjectType());
                 importTaskAMVO.setPatentNoStr(importTaskCondition.getPatentNos());
-                if(importTaskCondition.getCustomFields()!=null) {
-                    List<EsCustomFieldDTO> dtos = JSONArray.parseArray(importTaskCondition.getCustomFields());
+                if (importTaskCondition.getCustomFields() != null) {
+
+                    JSONArray jsonArray = JSONArray.parseArray(importTaskCondition.getCustomFields());
+                    List<EsCustomFieldDTO> dtos=  jsonArray.toJavaList(EsCustomFieldDTO.class);
                     importTaskAMVO.setFieldDTOS(dtos);
                 }
                 LambdaQueryWrapper<ReportProject> rQueryWrapper = new LambdaQueryWrapper<>();
@@ -132,19 +138,21 @@ public class SchedulingTaskService {
 
     public void pauseTask(Integer taskId, Integer state) {
         //根据id获得
-        ImportTaskAMVO importTaskAMVO = importTaskAMVOS.stream().filter(item -> item.getId().equals(taskId)).findFirst().orElse(null);
-      if(importTaskAMVO!=null) {
-          importTaskAMVO.setState(state);
-      }
-
+        if (importTaskAMVOS != null) {
+            ImportTaskAMVO importTaskAMVO = importTaskAMVOS.stream().filter(item -> item.getId().equals(taskId)).findFirst().orElse(null);
+            if (importTaskAMVO != null) {
+                importTaskAMVO.setState(state);
+            }
+        }
     }
 
     public List<ImportTaskAMVO> getImportTaskAMVOs() {
         return this.importTaskAMVOS;
     }
-    public void removeTaskAMVO(Integer taskId){
-        if(importTaskAMVOS!=null&&importTaskAMVOS.size()>0){
-            importTaskAMVOS.removeIf(i->i.getId().equals(taskId));
+
+    public void removeTaskAMVO(Integer taskId) {
+        if (importTaskAMVOS != null && importTaskAMVOS.size() > 0) {
+            importTaskAMVOS.removeIf(i -> i.getId().equals(taskId));
         }
 
 

+ 14 - 8
src/main/resources/jsons/uploadSetting.json

@@ -556,40 +556,46 @@
 			},
 			{
 				"setName": "标题",
-				"column": "patent.name",
+				"column": "title.name",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.StringHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
 			{
 				"setName": "标题(翻译)",
-				"column": "patent.nameOut",
+				"column": "title.nameOut",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.StringHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
 			{
 				"setName": "摘要",
-				"column": "patent.abstractStr",
+				"column": "abstractStr.name",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.StringHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
 			{
 				"setName": "摘要(翻译)",
-				"column": "patent.abstractOut",
+				"column": "abstractStr.nameOut",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.StringHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
 			{
 				"setName": "申请日",
-				"column": "patent.applicationDate",
+				"column": "patent.appDate",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.TimeHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
-
+			{
+				"setName": "申请号",
+				"column": "patent.appNo",
+				"splitSymbol": "",
+				"handler": "cn.cslg.pas.common.utils.handler.StringHandler",
+				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
+			},
 			{
 				"setName": "文献种类代码",
 				"column": "patent.code",
@@ -613,14 +619,14 @@
 			},
 			{
 				"setName": "授权公告日",
-				"column": "patent.publicAccreditDate",
+				"column": "patent.grantDate",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.TimeHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"
 			},
 			{
 				"setName": "专利类型",
-				"column": "patent.type",
+				"column": "patent.patentType",
 				"splitSymbol": "",
 				"handler": "cn.cslg.pas.common.utils.handler.PatentTypeHandler",
 				"jarOrClassPath": "./Wispro-CodeWarehouse-BackEnd.jar"