|
@@ -7,12 +7,15 @@ import com.aliyun.opensearch.sdk.generated.commons.OpenSearchClientException;
|
|
|
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchException;
|
|
|
import com.aliyun.opensearch.sdk.generated.search.SearchParams;
|
|
|
import com.caimei365.commodity.components.SearchOpenService;
|
|
|
+import com.caimei365.commodity.mapper.PageMapper;
|
|
|
import com.caimei365.commodity.mapper.SearchMapper;
|
|
|
import com.caimei365.commodity.model.ResponseJson;
|
|
|
import com.caimei365.commodity.model.po.SearchHistoryPo;
|
|
|
+import com.caimei365.commodity.model.vo.HotSearchVo;
|
|
|
import com.caimei365.commodity.model.vo.PaginationVo;
|
|
|
import com.caimei365.commodity.model.search.ProductListVo;
|
|
|
import com.caimei365.commodity.service.SearchProductService;
|
|
|
+import com.caimei365.commodity.utils.AppletsLinkUtil;
|
|
|
import com.caimei365.commodity.utils.Json2PojoUtil;
|
|
|
import com.caimei365.commodity.components.PriceUtilService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -22,8 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -41,6 +43,8 @@ public class SearchProductServiceImpl implements SearchProductService {
|
|
|
@Resource
|
|
|
private SearchMapper searchMapper;
|
|
|
@Resource
|
|
|
+ private PageMapper pageMapper;
|
|
|
+ @Resource
|
|
|
private SearchOpenService searchOpenService;
|
|
|
@Resource
|
|
|
private PriceUtilService priceUtilService;
|
|
@@ -367,4 +371,33 @@ public class SearchProductServiceImpl implements SearchProductService {
|
|
|
searchMapper.deleteAllSearchHistory(userId);
|
|
|
return ResponseJson.success(null);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品仪器热搜词
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> getHotSearchTerms() {
|
|
|
+ //产品
|
|
|
+ List<HotSearchVo> productHotSearch = getHotSearch(1, 2);
|
|
|
+ //仪器
|
|
|
+ List<HotSearchVo> instrumentHotSearch = getHotSearch(2, 2);
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
+ map.put("productHotSearch", productHotSearch);
|
|
|
+ map.put("instrumentHotSearch", instrumentHotSearch);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<HotSearchVo> getHotSearch(Integer typeSort, Integer source) {
|
|
|
+ List<Integer> pageIds = pageMapper.getPageIdByTypeSort(typeSort);
|
|
|
+ List<HotSearchVo> productHotSearch = new ArrayList<>();
|
|
|
+ if (pageIds != null) {
|
|
|
+ productHotSearch = pageMapper.getHotSearchByPageIds(pageIds, source);
|
|
|
+ }
|
|
|
+ productHotSearch.forEach(h -> {
|
|
|
+ String link = h.getLink();
|
|
|
+ h.setLinkType(AppletsLinkUtil.getLinkType(link));
|
|
|
+ h.setLinkParam(AppletsLinkUtil.getLinkParam(h.getLinkType(), link));
|
|
|
+ });
|
|
|
+ return productHotSearch;
|
|
|
+ }
|
|
|
}
|