fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java
@@ -24,7 +24,6 @@ import com.yeshi.fanli.entity.bus.lable.QualityFactory; import com.yeshi.fanli.entity.bus.recommend.Honest; import com.yeshi.fanli.entity.bus.search.HotSearch; import com.yeshi.fanli.entity.bus.su.search.SuperHotSearch; import com.yeshi.fanli.entity.system.BusinessSystem; import com.yeshi.fanli.entity.taobao.PidUser; import com.yeshi.fanli.entity.taobao.SearchFilter; @@ -38,7 +37,7 @@ import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.config.SuperHotSearchService; import com.yeshi.fanli.service.inter.config.HotSearchService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.service.inter.lable.QualityGoodsService; import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService; @@ -71,7 +70,7 @@ private ConfigService configService; @Resource private SuperHotSearchService superHotSearchSerivce; private HotSearchService hotSearchService; @Resource private HistorySearchService historySearchService; @@ -97,39 +96,30 @@ @Resource private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService; /** * 热门搜索 * @param acceptData * @param goodsType * @param out */ @RequestMapping(value = "gethotsearch", method = RequestMethod.POST) public void getHotSearch(AcceptData acceptData, Integer goodsType, PrintWriter out) { BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages()); if (system == null) { out.print(JsonUtil.loadFalseResult("系统不存在")); return; } // 默认淘宝 if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } List<SuperHotSearch> superHotSearchList = superHotSearchSerivce .getSuperHotSearchBySystemIdCache(system.getId(), goodsType); if (superHotSearchList == null || superHotSearchList.size() == 0) { List<HotSearch> list = hotSearchService.getHotSearchCache(goodsType); if (list == null || list.size() == 0) { out.print(JsonUtil.loadFalseResult("没有数据")); return; } List<HotSearch> hotSearchList = new ArrayList<HotSearch>(); for (SuperHotSearch superHotSearch : superHotSearchList) { HotSearch hotSearch = superHotSearch.getHotSearch(); if (hotSearch != null) hotSearchList.add(hotSearch); } JSONObject data = new JSONObject(); data.put("count", hotSearchList.size()); data.put("hotSearchList", hotSearchList); String result = JsonUtil.loadTrueResult(data); out.print(result); return; data.put("count", list.size()); data.put("hotSearchList", list); out.print(JsonUtil.loadTrueResult(data)); } @RequestMapping("specialSearch") fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -743,6 +743,11 @@ String salesTip = pddGoods.getSalesTip(); if (!StringUtil.isNullOrEmpty(salesTip)) { int indexOf = salesTip.indexOf("+"); if (indexOf > 0) { salesTip = salesTip.substring(0, indexOf); } int totalSales = 0; if (salesTip.contains("万")) { salesTip = salesTip.substring(0, salesTip.indexOf("万")); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/HotSearchMapper.java
@@ -26,4 +26,11 @@ * @return */ int countQuery(@Param("key") String key, @Param("systemId")Long systemId, @Param("useType")Integer useType); /** * 查询热搜列表 * @param useType * @return */ List<HotSearch> getHotSearchList(@Param("useType")Integer useType); } fanli/src/main/java/com/yeshi/fanli/mapping/goods/HotSearchMapper.xml
@@ -63,4 +63,9 @@ <if test="useType != null">AND hc.`use_type` = #{useType}</if> </select> <select id="getHotSearchList" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_hot_search hc WHERE hc.use_type = #{useType} ORDER BY hc.`orderby` DESC </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/config/HotSearchServiceImpl.java
@@ -6,6 +6,7 @@ import javax.annotation.Resource; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.mybatis.goods.HotSearchMapper; @@ -124,4 +125,13 @@ return hotSearchMapper.countQuery(key, systemId, useType); } @Override @Cacheable(value = "crgCache", key = "'getHotSearchCache-' + #useType") public List<HotSearch> getHotSearchCache(Integer useType) { return hotSearchMapper.getHotSearchList(useType); } } fanli/src/main/java/com/yeshi/fanli/service/inter/config/HotSearchService.java
@@ -17,4 +17,12 @@ int countList(String key, Long systemId, Integer useType); /** * 查询各个平台热搜 * @param useType * @return */ public List<HotSearch> getHotSearchCache(Integer useType); } fanli/src/main/java/com/yeshi/fanli/util/factory/CommonGoodsFactory.java
@@ -161,6 +161,11 @@ String salesTip = goods.getSalesTip(); if (StringUtil.isNullOrEmpty(salesTip)) { salesTip = "0"; } else { int indexOf = salesTip.indexOf("+"); if (indexOf > 0) { salesTip = salesTip.substring(0, indexOf); } } int totalSales = 0;