Bläddra i källkod

fixed essearch

zero 1 år sedan
förälder
incheckning
75ce20a719

+ 2 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/esPicture/EsPatentVectorVo.java

@@ -28,4 +28,6 @@ public class EsPatentVectorVo {
     private String guid;
 
     private List<PatentClassify> loc;
+
+    private String patentNo;
 }

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/service/exportPatent/PatentExportService.java

@@ -94,7 +94,7 @@ public class PatentExportService {
             for (int i = 0; i < patentNos.size(); i++) {
                 Map<String, Object> map = new LinkedHashMap<>();
                 //获取专利信息
-                PatentColumnDTO patent = esPatentService.selectPatentByAppNo(patentNos.get(i));
+                PatentColumnDTO patent = esPatentService.selectPatentInfoByPatentNo(patentNos.get(i));
                 if (patent != null) {
                     //遍历字段 配置map集合
                     for (int j = 0; j < columns.size(); j++) {

+ 9 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java

@@ -22,6 +22,7 @@ import com.example.xiaoshiweixinback.domain.Product;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPatentVectorDTO;
+import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
 import com.example.xiaoshiweixinback.entity.dto.searchRecord.AddSearchRecordDTO;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
@@ -66,6 +67,10 @@ public class EsDenseVectorService {
     @Autowired
     private FileManagerService fileManagerService;
 
+    @Lazy
+    @Autowired
+    private EsPatentService esPatentService;
+
     /**
      * 根据图片排序获取列表
      *
@@ -146,12 +151,16 @@ public class EsDenseVectorService {
                     PatentVector vector = hit.source();
                     EsPatentVectorVo vectorVo = new EsPatentVectorVo();
                     BeanUtil.copy(vector, vectorVo);
+                    PatentColumnDTO columnDTO = esPatentService.selectPatentByAppNo(vector.getAppNo());
+                    vectorVo.setPatentNo(columnDTO.getPatentNo());
                     vectorVos.add(vectorVo);
                 }
             } else {
                 PatentVector vector = hit.source();
                 EsPatentVectorVo vectorVo = new EsPatentVectorVo();
                 BeanUtil.copy(vector, vectorVo);
+                PatentColumnDTO columnDTO = esPatentService.selectPatentByAppNo(vector.getAppNo());
+                vectorVo.setPatentNo(columnDTO.getPatentNo());
                 vectorVos.add(vectorVo);
             }
         }

+ 25 - 1
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsPatentService.java

@@ -276,6 +276,30 @@ public class EsPatentService {
     }
 
     /**
+     * 根据专利号获取专利id
+     *
+     * @param patentNo
+     * @return
+     * @throws IOException
+     */
+    public PatentColumnDTO selectPatentInfoByPatentNo(String patentNo) throws IOException {
+        PatentColumnDTO columnDTO = new PatentColumnDTO();
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("wxpatent");
+        Query q = QueryBuilders.term(i -> i.field("patent_no.keyword").value(patentNo));
+        builder.query(q);
+        builder.size(10);
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        List<Hit<Patent>> hits = response.hits().hits();
+        for (Hit<Patent> hit : hits) {
+            Patent patent = hit.source();
+            columnDTO = this.getPatentColumnDTO(patent, null, null);
+        }
+        return columnDTO;
+    }
+
+    /**
      * 判断该专利是否已经被收藏
      *
      * @param personProductId
@@ -437,7 +461,7 @@ public class EsPatentService {
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("wxpatent");
-        Query q = QueryBuilders.term(i -> i.field("patent_no.keyword").value(appNo));
+        Query q = QueryBuilders.term(i -> i.field("app_no.keyword").value(appNo));
         builder.query(q);
         builder.size(10);
         SearchResponse<Patent> response = client.search(builder.build(), Patent.class);