|
|
@@ -1,8 +1,11 @@
|
|
|
package com.uas.platform.b2c.common.search.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.platform.b2c.common.search.dao.SearchHistoryDao;
|
|
|
+import com.uas.platform.b2c.common.search.model.SearchHistory;
|
|
|
import com.uas.platform.b2c.common.search.rpc.service.SearchService;
|
|
|
import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentGoodsDao;
|
|
|
@@ -53,6 +56,9 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
@Autowired
|
|
|
private BrandDao brandDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SearchHistoryDao searchHistoryDao;
|
|
|
+
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
private final DeviceResolver deviceResolver = new LiteDeviceResolver();
|
|
|
|
|
|
@@ -142,7 +148,23 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public ModelMap searchComponentGoods(String keyword, PageParams page) {
|
|
|
+ public ModelMap searchComponentGoods(String keyword, PageParams page , HttpServletRequest request) {
|
|
|
+ if (this.deviceResolver.resolveDevice(request).isMobile()) {
|
|
|
+ if (null != SystemSession.getUser() && null!= SystemSession.getUser().getUserUU()){
|
|
|
+ SearchHistory searchHistory = null;
|
|
|
+ List<SearchHistory> searchHistories = searchHistoryDao.findByKeywordAndUserUUAndUserEnuu(keyword,SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
|
|
|
+ if (searchHistories.size()>0){
|
|
|
+ searchHistory = searchHistories.get(0);
|
|
|
+ }else {
|
|
|
+ searchHistory = new SearchHistory();
|
|
|
+ }
|
|
|
+ searchHistory.setKeyword(keyword);
|
|
|
+ searchHistory.setSearchTime(new Date(System.currentTimeMillis()));
|
|
|
+ searchHistory.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
+ searchHistory.setUserEnuu(SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
|
|
|
+ searchHistoryDao.save(searchHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
ModelMap map = new ModelMap();
|
|
|
Map<String,Object> results = null;
|
|
|
//Map<String, Object> results = new HashMap<>();
|