zero 1 年間 前
コミット
6a35189d45

+ 4 - 4
src/main/java/cn/cslg/pas/controller/outApi/PatentStarController.java

@@ -99,10 +99,10 @@ public class PatentStarController {
         return patentStarApiService.getCitedNumByPubNoApi(patentNo);
     }
 
-    @Operation(summary = "根据专利号查询外部权利要求")
-    @PostMapping("/queryExternalClaim")
-    public Response queryExternalClaim(@RequestBody QueryExternalFamilyVO vo) throws Exception {
-        SelectClaimDTO dto = patentStarApiService.selectClaim(vo);
+    @Operation(summary = "根据原始申请号查询外部权利要求")
+    @GetMapping("/queryExternalClaim")
+    public Response queryExternalClaim(String appNo) throws Exception {
+        SelectClaimDTO dto = patentStarApiService.queryExternalClaim(appNo);
         return Response.success(dto);
     }
 

+ 26 - 17
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -70,6 +70,7 @@ public class EsCountService {
         if (countVOS.size() > 1) {
             EsCountVO countVO = countVOS.get(0);
             List<String> values = countVO.getValues();
+            values.removeIf(i -> i.equals("其他"));
             List<EsCountVO> esCountVOS = new ArrayList<>();
             esCountVOS.add(countVOS.get(1));
             if (StringUtils.isNotEmpty(countVO.getFieldId())) {
@@ -79,30 +80,38 @@ public class EsCountService {
                         valueDTO.setFieldId(countVO.getFieldId());
                         valueDTO.setFieldValue(Arrays.asList(value));
                         customFields.add(valueDTO);
-                        this.getReturnData(searchCondition, customFields, taskId, projectId, esCountVOS, detailDTOS, esCountDTO, value, map);
+                        this.getReturnData(searchCondition, "",customFields, taskId, projectId,
+                                esCountVOS, detailDTOS, esCountDTO, value, map);
                     }
                 }
             } else {
                 for (String value : values) {
                     String condition = countVO.getField() + " = " + value;
-                    if (searchCondition != null && !"".equals(searchCondition.trim())) {
-                        searchCondition = condition + " AND " + searchCondition;
-                    } else {
-                        searchCondition = condition;
-                    }
-                    this.getReturnData(searchCondition, customFields, taskId, projectId, esCountVOS, detailDTOS, esCountDTO, value, map);
+                    this.getReturnData(searchCondition, condition, customFields, taskId, projectId,
+                            esCountVOS, detailDTOS, esCountDTO, value, map);
                 }
             }
         } else {
-            this.getReturnData(searchCondition, customFields, taskId, projectId, countVOS, detailDTOS, esCountDTO, "", map);
+            this.getReturnData(searchCondition, "", customFields, taskId, projectId, countVOS,
+                    detailDTOS, esCountDTO, "", map);
         }
         esCountDTO.setDetailDTOS(detailDTOS);
         return esCountDTO;
     }
 
-    public void getReturnData(String searchCondition, List<EsCustomFieldValueDTO> customFields, Integer taskId,
+    public void getReturnData(String searchCondition,String condition, List<EsCustomFieldValueDTO> customFields, Integer taskId,
                               Integer projectId, List<EsCountVO> countVOS, List<EsCountDetailDTO> detailDTOS,
                               EsCountDTO esCountDTO, String firstName, Map<String, List<EsCountDetailDTO>> map) throws Exception {
+
+        if (StringUtils.isNotEmpty(condition)) {
+            if (searchCondition != null && !"".equals(searchCondition.trim())) {
+                searchCondition = condition + " AND " + searchCondition;
+            } else {
+                searchCondition = condition;
+            }
+        }
+
+
         if (!CollectionUtils.isEmpty(customFields)) {
             searchCondition = esService.parseCustomField(customFields);
         }
@@ -164,7 +173,7 @@ public class EsCountService {
                         } else {
                             filtersBuckets.forEach(filtersBucket -> {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
-                                this.getDateAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                                this.getDateAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                             });
                         }
                     } else if (nestedList.contains(field)) {
@@ -187,7 +196,7 @@ public class EsCountService {
                             filtersBuckets.forEach(filtersBucket -> {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
                                 this.getChildAnalysisDTOS(filtersAgg, field, finalFieldType1, topN,
-                                        detailDTOS, esCountDTO, firstName, map,values);
+                                        detailDTOS, esCountDTO, firstName, map, values);
                             });
                         }
                     } else if (numberList.contains(field)) {
@@ -196,13 +205,13 @@ public class EsCountService {
                         } else {
                             filtersBuckets.forEach(filtersBucket -> {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
-                                this.getNumberAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                                this.getNumberAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                             });
                         }
                     } else {
                         filtersBuckets.forEach(filtersBucket -> {
                             Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
-                            this.getTermCountDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                            this.getTermCountDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                         });
                     }
                 } else {
@@ -213,7 +222,7 @@ public class EsCountService {
                     if (CollectionUtils.isEmpty(values)) {
                         this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO);
                     } else {
-                        this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                        this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                     }
                 } else if (nestedList.contains(field)) {
                     this.getNestedCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
@@ -225,12 +234,12 @@ public class EsCountService {
                         this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO);
                     } else {
                         this.getChildAnalysisDTOS(agg, field, fieldType, topN,
-                                detailDTOS, esCountDTO, firstName, map,values);
+                                detailDTOS, esCountDTO, firstName, map, values);
                     }
                 } else if (numberList.contains(field)) {
-                    this.getNumberAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                    this.getNumberAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                 } else {
-                    this.getTermCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
+                    this.getTermCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                 }
             }
             esCountDTO.setCondition(searchCondition);

+ 49 - 20
src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java

@@ -500,6 +500,32 @@ public class PatentStarApiService {
         return "{}";
     }
 
+    //获取权利要求文本
+    public String getExternalClaim(String str) throws DocumentException {
+        SAXReader reader = new SAXReader();
+        reader.setEntityResolver(new IgnoreDTDEntityResolver());
+        Reader stringReader = new StringReader(str);
+        Document document = reader.read(stringReader);
+        XPath xpath = document.createXPath("//claim-text");
+        List<Element> element = (List<Element>) xpath.selectNodes(document);
+        if (element.size() == 0) {
+            xpath = document.createXPath("//business:ClaimText");
+            element = (List<Element>) xpath.selectNodes(document);
+        }
+        List<String> reClaims = new ArrayList<>();
+        element.forEach(item -> {
+            String claim = item.getText();
+            claim =   claim.replaceAll("\r\n|\r|\n| ", "");
+            reClaims.add(claim);
+
+        });
+        String reClaim = "";
+        if (reClaims.size() != 0) {
+            reClaim = cn.cslg.pas.common.utils.StringUtils.join(reClaims, "\r\n");
+        }
+        return reClaim;
+    }
+
     //获取说明书文本
     public String getFullText(String str) throws DocumentException {
         SAXReader reader = new SAXReader();
@@ -922,28 +948,31 @@ public class PatentStarApiService {
 
     /**
      * 根据专利号查询外部权利要求
-     * @param vo
+     * @param appNo
      * @return
      * @throws IOException
      */
-    public SelectClaimDTO selectClaim(QueryExternalFamilyVO vo) throws IOException {
-        PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
-        String condition = "AN=" + vo.getPatentNo();
-        patentStarListDTO.setCurrentQuery(condition);
-        patentStarListDTO.setDBType("CN");
-        patentStarListDTO.setOrderBy("AD");
-        patentStarListDTO.setOrderByType("DESC");
-        patentStarListDTO.setPageNum(1);
-        patentStarListDTO.setRowCount(10);
-        Records records = this.patentStarSearchLocal(patentStarListDTO);
-        Object data = records.getData();
-        String s = JSONArray.toJSONString(data);
-        List<PatentColumnDTO> list = JSONArray.parseArray(s, PatentColumnDTO.class);
+    public SelectClaimDTO queryExternalClaim(String appNo) throws IOException {
+        List<Text> claimList = new ArrayList<>();
+        //获取公开说明书
+        String cnFullXmlApi = null;
+        try {
+            cnFullXmlApi = this.getCnFullXmlApi(appNo);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        try {
+            String fullText = this.getExternalClaim(cnFullXmlApi);
+            Text pubText = new Text();
+            pubText.setTextContent(fullText);
+            pubText.setIfOrigin(true);
+            claimList.add(pubText);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        }
         SelectClaimDTO dto = new SelectClaimDTO();
-        if (!CollectionUtils.isEmpty(list)) {
-            for (PatentColumnDTO columnDTO : list) {
-                dto.setClaimContent(columnDTO.getClaim());
-            }
+        if (!CollectionUtils.isEmpty(claimList)) {
+            dto.setClaimContent(claimList);
         }
         return dto;
     }
@@ -1171,8 +1200,8 @@ public class PatentStarApiService {
                 for (ExternalLegalStatusDTO dto : statusDTOS) {
                     LegalEvent event = new LegalEvent();
                     event.setCode(dto.getLegalCode());
-                    event.setName(dto.getLegalStatusInfo());
-                    event.setDescription(dto.getJUANQI());
+                    event.setName(dto.getLegalStatus());
+                    event.setDescription(dto.getLegalStatusInfo());
                     if (StringUtils.isNotEmpty(dto.getLegalDate())) {
                         SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
                         Date date = format.parse(dto.getLegalDate());