浏览代码

fixed 同族

zero 1 年之前
父节点
当前提交
d2834ab43a

+ 2 - 2
src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -128,8 +128,8 @@ public class PatentController {
     @Operation(summary = "根据专利号查询同族")
     @PostMapping("/selectKinByPatentNo")
     public Response selectKinByPatentNo(@RequestBody PatentKinVO vo) throws Exception {
-        List<PatentKinDTO> dto = patentService.selectKinByPatentNo(vo);
-        return Response.success(dto);
+        Records records = patentService.selectKinByPatentNo(vo);
+        return Response.success(records);
     }
 
     @Operation(summary = "查询分页信息")

+ 10 - 5
src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java

@@ -173,7 +173,7 @@ public class EsPatentService {
     public List<String> loadName(List<PatentPerson> list) {
         List<String> collect = new ArrayList<>();
         if (!CollectionUtils.isEmpty(list)) {
-            collect = list.stream().map(PatentPerson::getName).collect(Collectors.toList());
+            collect = list.stream().filter(i -> StringUtils.isNotEmpty(i.getName())).map(PatentPerson::getName).collect(Collectors.toList());
         }
         return collect;
     }
@@ -339,7 +339,7 @@ public class EsPatentService {
      * @return
      * @throws IOException
      */
-    public List<PatentKinDTO> selectKinByPatentNo(PatentKinVO vo) throws IOException {
+    public Records selectKinByPatentNo(PatentKinVO vo) throws IOException {
         //1.根据专利号查询出同族
         String no = vo.getNo();
         Integer pageNum = vo.getPageNum();
@@ -395,7 +395,12 @@ public class EsPatentService {
                 }
             }
         }
-        return kinDTOS;
+        Records records = new Records();
+        records.setCurrent(vo.getPageNum().longValue());
+        records.setSize(vo.getPageSize().longValue());
+        records.setData(kinDTOS);
+        records.setTotal(Long.valueOf(String.valueOf(kinDTOS.size())));
+        return records;
     }
 
     public List<PatentKinDTO> selectPatentKindDetail(PatentKinDetailVO vo, String patentNo) throws IOException {
@@ -406,9 +411,9 @@ public class EsPatentService {
         //设置查询索引
         builder.index("patent");
         //申请号
-        Query q1 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getAppNo()));
+        Query q1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(vo.getAppNo()));
         //公开号
-        Query q2 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getPublicNo()));
+        Query q2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(vo.getPublicNo()));
         //授权号
 //        Query q3 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getGrantNo()));
         Query bool = null;

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

@@ -1032,34 +1032,36 @@ public class PatentStarApiService {
         QueryExternalFamilyDTO familyDTO = JSONObject.parseObject(family, QueryExternalFamilyDTO.class);
         String familyInfos = familyDTO.getFamilyinfo();
         List<String> publicNos = new ArrayList<>();
-        if (StringUtils.isNotEmpty(familyInfos) && familyInfos.equals("{}")) {
+        if (StringUtils.isNotEmpty(familyInfos) && !familyInfos.equals("{}")) {
             publicNos = Arrays.asList(familyInfos.split(";"));
         }
 
-        String pubNo = "";
+        List<PatentColumnDTO> list = new ArrayList<>();
         if (!CollectionUtils.isEmpty(publicNos)) {
-            int count = publicNos.size() - 1;
-            for (int i = 0; i < publicNos.size(); i++) {
-                String s = publicNos.get(i);
-                if (i == count) {
-                    pubNo = pubNo + s;
+            for (String publicNo : publicNos) {
+                PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
+                String condition = "PN=" + publicNo;
+                patentStarListDTO.setCurrentQuery(condition);
+                String index = publicNo.substring(0, 2);
+                if (index.equals("CN")) {
+                    patentStarListDTO.setDBType("CN");
                 } else {
-                    pubNo = pubNo + s + " " + "OR" + " ";
+                    patentStarListDTO.setDBType("WD");
                 }
+                patentStarListDTO.setOrderBy("AD");
+                patentStarListDTO.setOrderByType("DESC");
+                patentStarListDTO.setPageNum(vo.getPageNum());
+                patentStarListDTO.setRowCount(vo.getPageSize());
+                records = this.patentStarSearchLocal(patentStarListDTO);
+                list.addAll((Collection<? extends PatentColumnDTO>) records.getData());
             }
         }
-        if (StringUtils.isNotEmpty(pubNo)) {
-            PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
-            String condition = "PN=" + "(" + pubNo + ")";
-            patentStarListDTO.setCurrentQuery(condition);
-            patentStarListDTO.setDBType("CN");
-            patentStarListDTO.setOrderBy("AD");
-            patentStarListDTO.setOrderByType("DESC");
-            patentStarListDTO.setPageNum(vo.getPageNum());
-            patentStarListDTO.setRowCount(vo.getPageSize());
-            records = this.patentStarSearchLocal(patentStarListDTO);
-        }
-        return records;
+        Records record = new Records();
+        record.setCurrent(vo.getPageNum().longValue());
+        record.setSize(vo.getPageSize().longValue());
+        record.setData(list);
+        record.setTotal(Long.valueOf(String.valueOf(list.size())));
+        return record;
     }
 
     /**

+ 11 - 4
src/test/java/cn/cslg/pas/service/EventServiceTests.java

@@ -27,6 +27,7 @@ import cn.cslg.pas.service.business.es.EsCountService;
 import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.business.es.EsService;
 import cn.cslg.pas.service.business.es.EsPatentService;
+import cn.cslg.pas.service.common.FileManagerService;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.http.entity.ContentType;
 import org.junit.jupiter.api.Test;
@@ -67,8 +68,8 @@ public class EventServiceTests {
     private EsCustomFieldService esCustomFieldService;
     @Autowired
     private MergePersonService mergePersonService;
-
-
+    @Autowired
+    private FileManagerService fileManagerService;
     @Autowired
     private ProductMarketDataService productMarketDataService;
     @Autowired
@@ -277,8 +278,8 @@ public class EventServiceTests {
         vo.setPageNum(1);
         vo.setPageSize(10);
         vo.setType("inpadoc");
-        List<PatentKinDTO> kinDTOS = patentService.selectKinByPatentNo(vo);
-        System.out.println(kinDTOS);
+        Records records = patentService.selectKinByPatentNo(vo);
+        System.out.println(records);
     }
 
     @Test
@@ -500,4 +501,10 @@ public class EventServiceTests {
         System.out.println(collect);
     }
 
+    @Test
+    public void test103() throws IOException {
+        List<String> fms = Arrays.asList("CN200880110903.8_p");
+        String systemFileFromFMS = fileManagerService.getSystemFileFromFMS(fms);
+        System.out.println(systemFileFromFMS);
+    }
 }