Browse Source

fixed essearch

zero 1 year ago
parent
commit
70419b9c2e

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/controller/ProductCategoryController.java

@@ -43,6 +43,7 @@ public class ProductCategoryController {
     private final AssoPersonCategoryService assoPersonCategoryService;
     private final ImportProductCategoryService importProductCategoryService;
     private final ImportTaskService importTaskService;
+
     @Operation(summary = "查询产品类别列表")
     @PostMapping("/queryCategory")
     public Response queryProductCategory(@RequestBody ProductCategoryDTO productCategoryDTO) {

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

@@ -250,6 +250,15 @@ public class EsDenseVectorService {
         if (productId != null) {
             Product product = productMapper.selectById(productId);
             searchCondition = product.getSearchCondition();
+            String locNum = product.getLocNum();
+            if (StringUtils.isNotEmpty(locNum)) {
+                String s = this.appendStr(locNum);
+                if (StringUtils.isEmpty(searchCondition)) {
+                    searchCondition = "LOC = " + "(" + s + ")";
+                } else {
+                    searchCondition = searchCondition + " AND " + "LOC = " + "(" + s + ")";
+                }
+            }
 
 //            Date now = new Date();
 //            String nowFormat = format.format(now);

+ 16 - 0
src/test/java/com/example/xiaoshiweixinback/XiaoshiWeixinbackApplicationTests.java

@@ -1,6 +1,9 @@
 package com.example.xiaoshiweixinback;
 
 import com.example.xiaoshiweixinback.business.utils.RegexUtil;
+import com.example.xiaoshiweixinback.domain.Product;
+import com.example.xiaoshiweixinback.mapper.ProductMapper;
+import com.example.xiaoshiweixinback.service.ProductCategoryService;
 import com.example.xiaoshiweixinback.service.importPatent.EsDenseVectorService;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.jupiter.api.Test;
@@ -27,6 +30,12 @@ class XiaoshiWeixinbackApplicationTests {
     @Lazy
     private EsDenseVectorService denseVectorService;
 
+    @Autowired
+    private ProductCategoryService productCategoryService;
+
+    @Autowired
+    private ProductMapper productMapper;
+
     @Test
     void contextLoads() {
     }
@@ -141,4 +150,11 @@ class XiaoshiWeixinbackApplicationTests {
         }
     }
 
+    @Test
+    public void test5() {
+        Product product = productMapper.selectById(35);
+        String locNum = product.getLocNum();
+        List<String> delimiters = RegexUtil.splitByDelimiters(locNum);
+        delimiters.forEach(System.out::println);
+    }
 }