Sfoglia il codice sorgente

fix(index):增加测试接口

wangyc 7 anni fa
parent
commit
5af1ec1462

+ 11 - 0
mall-search/src/main/java/com/uas/search/controller/IndexController.java

@@ -9,6 +9,7 @@ import com.uas.search.jms.LuceneMessageService;
 import com.uas.search.service.IndexService;
 import com.uas.search.support.DownloadHelper;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Controller;
 import com.uas.search.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -42,6 +43,9 @@ public class IndexController {
     @Autowired
     private JmsListener jmsListener;
 
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+
     @RequestMapping("/create")
     @ResponseBody
     public String initIndexes(String tableNames, HttpServletRequest request) {
@@ -49,6 +53,13 @@ public class IndexController {
                 indexService.createIndexes(toList(tableNames), true) / 1000.0);
     }
 
+    @RequestMapping("/test")
+    @ResponseBody
+    public String testController(){
+        Integer count = jdbcTemplate.queryForObject("select count(1) from lucene$message", Integer.class);
+        return String.format("Indexes test success , %s", count);
+    }
+
     /**
      * 根据逗号进行分隔,将字符串转为 List
      *

+ 0 - 1
mall-search/src/main/java/com/uas/search/controller/SearchController.java

@@ -72,7 +72,6 @@ public class SearchController {
 	 * @return idPage
 	 * @throws IOException 输入异常
 	 */
-	@Deprecated
 	@RequestMapping("/productIds/b2b")
 	@ResponseBody
 	public SPage<Long> searchProductIdsB2B(String keyword, String tableName, Integer page, Integer size,

+ 4 - 1
mall-search/src/main/resources/application.yml

@@ -14,6 +14,8 @@ spring:
    max-request-size: 512MB
   encoding:
     charset: UTF-8
+ profiles:
+  active: test
 
 security:
  basic:
@@ -27,4 +29,5 @@ security:
   
 schedule:
  auto-start: false
-
+server:
+ port: 20000