|
|
@@ -1,28 +1,41 @@
|
|
|
package com.uas.search.console.controller;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import com.uas.search.console.dao.BrandSimpleInfoDao;
|
|
|
+import com.uas.search.console.dao.ComponentSimpleInfoDao;
|
|
|
+import com.uas.search.console.dao.KindSimpleInfoDao;
|
|
|
+import com.uas.search.console.dcn.DCNRegistrationManager;
|
|
|
import com.uas.search.console.jms.AQListener;
|
|
|
+import com.uas.search.console.model.BrandSimpleInfo;
|
|
|
+import com.uas.search.console.model.ComponentSimpleInfo;
|
|
|
+import com.uas.search.console.model.KindSimpleInfo;
|
|
|
import com.uas.search.console.service.IndexService;
|
|
|
|
|
|
/**
|
|
|
* 索引创建相关请求
|
|
|
+ *
|
|
|
* @author sunyj
|
|
|
* @since 2016年8月5日 上午11:42:54
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping("/index")
|
|
|
public class IndexController {
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private IndexService indexService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private AQListener aqListener;
|
|
|
-
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DCNRegistrationManager dcnRegistrationManager;
|
|
|
+
|
|
|
/**
|
|
|
* 初始化创建索引文件
|
|
|
*
|
|
|
@@ -33,19 +46,77 @@ public class IndexController {
|
|
|
public String initIndexes() {
|
|
|
return "Indexes created success in " + indexService.createIndexs() + " ms.";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 实时更新索引
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/listen")
|
|
|
@ResponseBody
|
|
|
- public String listen(){
|
|
|
- new Thread(){
|
|
|
+ public String listen() {
|
|
|
+ new Thread() {
|
|
|
public void run() {
|
|
|
aqListener.execute();
|
|
|
};
|
|
|
}.start();
|
|
|
return "Listen...";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 开启实时更新索引的程序
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/realTimeUpdate")
|
|
|
+ @ResponseBody
|
|
|
+ public String registerDatabaseChangeNotification() {
|
|
|
+ dcnRegistrationManager.registerDataChangeNotification();
|
|
|
+ return "Started real-time updating for lucene index...";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ComponentSimpleInfoDao componentDao;
|
|
|
+ @RequestMapping("/rowTest/component")
|
|
|
+ @ResponseBody
|
|
|
+ public String testROWIDComponent(){
|
|
|
+ System.out.println(componentDao.findByRowid("AACu7GAAEAAOZvTAAA"));
|
|
|
+ return "created";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BrandSimpleInfoDao brandDao;
|
|
|
+ @RequestMapping("/rowTest/brand")
|
|
|
+ @ResponseBody
|
|
|
+ public String testROWIDBrand(){
|
|
|
+ System.out.println(brandDao.findByRowid("AACoH2AAEAANmqSAAB"));
|
|
|
+ return "created";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KindSimpleInfoDao kindDao;
|
|
|
+ @RequestMapping("/rowTest/kind")
|
|
|
+ @ResponseBody
|
|
|
+ public String testROWIDKind(){
|
|
|
+ System.out.println(kindDao.findByRowid("AACmtMAAEAAFmG8AAY"));
|
|
|
+ return "created";
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/findAll/kind")
|
|
|
+ @ResponseBody
|
|
|
+ public List<KindSimpleInfo> findAllKinds(){
|
|
|
+ return kindDao.findAll();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/findAll/brand")
|
|
|
+ @ResponseBody
|
|
|
+ public List<BrandSimpleInfo> findAllBrands(){
|
|
|
+ return brandDao.findAll();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/findAll/component")
|
|
|
+ @ResponseBody
|
|
|
+ public List<ComponentSimpleInfo> findAllComponents(){
|
|
|
+ return componentDao.findAll();
|
|
|
+ }
|
|
|
}
|