|
|
@@ -1,16 +1,17 @@
|
|
|
package com.uas.platform.b2c.common.search.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentGoodsDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentInfoDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.ComponentGoods;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.ComponentInfo;
|
|
|
-import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
-import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.core.exception.SystemException;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
import com.uas.search.exception.SearchException;
|
|
|
+import com.uas.search.model.CollectField;
|
|
|
import com.uas.search.model.PageParams.FilterField;
|
|
|
import com.uas.search.model.SPage;
|
|
|
import com.uas.search.model.Sort;
|
|
|
@@ -27,11 +28,9 @@ import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
|
-import com.uas.search.model.CollectField;
|
|
|
-
|
|
|
/**
|
|
|
* 搜索索引
|
|
|
- *
|
|
|
+ *
|
|
|
* @author sunyj
|
|
|
* @since 2016年7月8日 下午5:14:44
|
|
|
*/
|
|
|
@@ -51,7 +50,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 智能搜索类目
|
|
|
- *
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @param field
|
|
|
* @return
|
|
|
@@ -74,7 +73,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 智能搜索品牌
|
|
|
- *
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @param field
|
|
|
* @return
|
|
|
@@ -97,7 +96,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 智能搜索器件
|
|
|
- *
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @return
|
|
|
* @throws InterruptedException
|
|
|
@@ -180,35 +179,35 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
- /**
|
|
|
- * 批次搜索数量统计
|
|
|
- *
|
|
|
- * @param keyword
|
|
|
- * @param page
|
|
|
- * @return
|
|
|
- * @throws InterruptedException
|
|
|
- * @throws IOException
|
|
|
- */
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
- @Override
|
|
|
- public ModelMap searchComponentGoodsNums(String keyword, PageParams page) {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- Map<String, Object> results = null;
|
|
|
- //Map<String, Object> results = new HashMap<>();
|
|
|
- try {
|
|
|
- results = searchService.getGoodsIds(keyword, convertPageParams(page));
|
|
|
- } catch (SearchException e) {
|
|
|
- throwSystemException(e);
|
|
|
- }
|
|
|
- map.put("total", results.get("total"));// 搜索结果总数
|
|
|
- return map;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 批次搜索数量统计
|
|
|
+ *
|
|
|
+ * @param keyword
|
|
|
+ * @param page
|
|
|
+ * @return
|
|
|
+ * @throws InterruptedException
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public ModelMap searchComponentGoodsNums(String keyword, PageParams page) {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ Map<String, Object> results = null;
|
|
|
+ //Map<String, Object> results = new HashMap<>();
|
|
|
+ try {
|
|
|
+ results = searchService.getGoodsIds(keyword, convertPageParams(page));
|
|
|
+ } catch (SearchException e) {
|
|
|
+ throwSystemException(e);
|
|
|
+ }
|
|
|
+ map.put("total", results.get("total"));// 搜索结果总数
|
|
|
+ return map;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取器件搜索的类目统计
|
|
|
- *
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -225,7 +224,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 获取器件搜索的品牌统计列表
|
|
|
- *
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -254,7 +253,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
for (Entry<String, Object> entry : paramEntry) {
|
|
|
param.put(FilterField.valueOf(entry.getKey().toUpperCase()), entry.getValue());
|
|
|
}
|
|
|
- try {
|
|
|
+ try {
|
|
|
collectResult = searchService.collectBySearchGoods(keyword, CollectField.valueOf(collectList.toUpperCase()),param);
|
|
|
} catch (SearchException e) {
|
|
|
throwSystemException(e);
|
|
|
@@ -271,8 +270,8 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
throwSystemException(e);
|
|
|
}
|
|
|
if (result.size() > 8) {
|
|
|
- result = result.subList(0,8);
|
|
|
- }
|
|
|
+ result = result.subList(0,8);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -289,7 +288,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 把平台中PageParams对象转化为搜索API封装的PageParams对象
|
|
|
- *
|
|
|
+ *
|
|
|
* @param params
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -352,7 +351,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
/**
|
|
|
* 捕获SearchException抛出SystemException
|
|
|
- *
|
|
|
+ *
|
|
|
* @param e
|
|
|
* @return
|
|
|
*/
|