From eec7e789a87863c25d92c10ad5dfc22ad80c448d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 14 七月 2020 12:36:48 +0800 Subject: [PATCH] 系统区分BUG修复 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java | 81 +++++++++++++++++++--------------------- 1 files changed, 39 insertions(+), 42 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java index 4f393ac..af5625f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java @@ -10,6 +10,7 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,6 +26,7 @@ import com.yeshi.fanli.entity.bus.recommend.Honest; import com.yeshi.fanli.entity.bus.search.HotSearch; import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.entity.taobao.PidUser; import com.yeshi.fanli.entity.taobao.SearchFilter; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; @@ -33,17 +35,16 @@ import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav; import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult; import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig; -import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail; 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.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; +import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; -import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service; import com.yeshi.fanli.service.inter.user.HistorySearchService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.EhcacheUtil; @@ -82,9 +83,6 @@ private TaoBaoUnionConfigService taoBaoUnionConfigService; @Resource - private TaoKeGoodsService taoKeGoodsService; - - @Resource private QualityGoodsService qualityGoodsService; @Resource @@ -94,7 +92,7 @@ private TaoBaoShopService taoBaoShopService; @Resource - private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService; + private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; /** @@ -110,7 +108,7 @@ goodsType = Constant.SOURCE_TYPE_TAOBAO; } - List<HotSearch> list = hotSearchService.getHotSearchCache(goodsType); + List<HotSearch> list = hotSearchService.getHotSearchCache(goodsType,acceptData.getSystem()); if (list == null || list.size() == 0) { out.print(JsonUtil.loadFalseResult("娌℃湁鏁版嵁")); return; @@ -151,7 +149,7 @@ data.put("nav", gson.toJson(navList)); List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>(); List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); - BigDecimal proportion = manageService.getFanLiRate(); + BigDecimal proportion = manageService.getFanLiRate(acceptData.getSystem()); for (TaoBaoGoodsBrief bf : taoBaoGoodsBriefs) { re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); } @@ -176,7 +174,7 @@ String bid = getHistorySearchBid(acceptData); historySearchService.addHistorySearch(kw, bid); BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); + acceptData.getPackages(),acceptData.getSystem()); if (system == null) { out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�")); return; @@ -197,7 +195,7 @@ filter = fastFilter; } } - JSONObject data = search(kw, page, filter, order, startprice, endprice); + JSONObject data = search(acceptData, kw, page, filter, order, startprice, endprice); out.print(JsonUtil.loadTrueResult(data)); } @@ -205,11 +203,11 @@ public JSONObject searchClass(AcceptData acceptData, String kw, int page, String filter, String order, String startprice, String endprice, String md5) { java.lang.System.out.println("searchClass"); - JSONObject data = search(kw, page, filter, order, startprice, endprice); + JSONObject data = search(acceptData, kw, page, filter, order, startprice, endprice); return data; } - private JSONObject search(String kw, int page, String filter, String order, String startprice, String endprice) { + private JSONObject search(AcceptData acceptData, String kw, int page, String filter, String order, String startprice, String endprice) { page = page + 1; SearchFilter sf = new SearchFilter(); @@ -325,7 +323,7 @@ int fq = sf.getQuan(); int fh = sf.getHongbao(); boolean ft = sf.isTmall(); - BigDecimal proportion = manageService.getFanLiRate(); + BigDecimal proportion = manageService.getFanLiRate(acceptData.getSystem()); if (fq == 0 && fh == 0 && !ft) { if (result != null && result.getTaoBaoGoodsBriefs() != null) for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { @@ -458,14 +456,13 @@ JSONObject data = null; if (!recommend) { - // 娣樺疂鎺ュ彛璇锋眰 - data = searchGoods(kw, page, filter, order, startprice, endprice); + data = searchGoods(acceptData, kw, page, filter, order, startprice, endprice,acceptData.getSystem()); } else { // 鎺ㄨ崘锛氱簿閫夊簱 // data = searchQualityGoods(kw, page, filter, order, startprice, // endprice); - data = searchDaTaoKeGoods(kw, page, filter, order, startprice, endprice); + data = searchDaTaoKeGoods(acceptData, kw, page, filter, order, startprice, endprice); } // 鑾峰彇鎺ㄨ崘璇� @@ -477,7 +474,7 @@ listRecommendWords = new ArrayList<String>(); } - List<TaoBaoShopVO> listShop =taoBaoShopService.getShopByKey(kw); + List<TaoBaoShopVO> listShop =taoBaoShopService.getShopByKey(kw,acceptData.getSystem()); if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoods() != null && listShop.get(0).getListGoods().size() > 2) { data.put("shop", JsonUtil.getApiCommonGson().toJson(listShop.get(0))); @@ -502,8 +499,8 @@ * @param endprice * @return */ - private JSONObject searchGoods(String kw, int page, String filter, String order, String startprice, - String endprice) { + private JSONObject searchGoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice, + String endprice,SystemEnum system) { page = page + 1; SearchFilter sf = new SearchFilter(); @@ -606,24 +603,24 @@ int id = array.optJSONObject(i).optInt("id"); sf.setProvinceId(id); } else if ("tkRate1".equalsIgnoreCase(ty)) { - setSearchTkRate(0, sf); + setSearchTkRate(0, sf,system); } else if ("tkRate2".equalsIgnoreCase(ty)) { - setSearchTkRate(1, sf); + setSearchTkRate(1, sf,system); } else if ("tkRate3".equalsIgnoreCase(ty)) { - setSearchTkRate(2, sf); + setSearchTkRate(2, sf,system); } else if ("tkRate4".equalsIgnoreCase(ty)) { - setSearchTkRate(3, sf); + setSearchTkRate(3, sf,system); } else if ("tkRate5".equalsIgnoreCase(ty)) { - setSearchTkRate(4, sf); + setSearchTkRate(4, sf,system); } } sf.setParams(params); } // 鎼滅储澶ф窐瀹� - List<DaTaoKeDetail> daTaoKeList = null; + List<DaTaoKeDetailV2> daTaoKeList = null; if (page == 1) - daTaoKeList = daTaoKeGoodsDetailService.listByDtitle(kw); + daTaoKeList = daTaoKeGoodsDetailV2Service.listByDtitle(kw); TaoBaoSearchResult result = TaoBaoUtil.search(sf); if (result == null) { @@ -675,7 +672,7 @@ try { if (daTaoKeList != null && daTaoKeList.size() > 0) { Collections.reverse(daTaoKeList); - for (DaTaoKeDetail detail : daTaoKeList) { + for (DaTaoKeDetailV2 detail : daTaoKeList) { taoBaoGoodsBriefs.add(0, TaoBaoUtil.convert(detail)); } } @@ -685,7 +682,7 @@ int fq = sf.getQuan(); int fh = sf.getHongbao(); boolean ft = sf.isTmall(); - BigDecimal proportion = manageService.getFanLiRate(); + BigDecimal proportion = manageService.getFanLiRate(acceptData.getSystem()); if (fq == 0 && fh == 0 && !ft) { if (result != null && taoBaoGoodsBriefs != null) for (TaoBaoGoodsBrief bf : taoBaoGoodsBriefs) { @@ -730,7 +727,7 @@ /** * 鎵ц鎼滅储绮鹃�夊簱 * - * @param kw + * @param key * @param page * @param filter * @param order @@ -738,8 +735,8 @@ * @param endprice * @return */ - private JSONObject searchQualityGoods(String key, int page, String filter, String order, String startprice, - String endprice) { + private JSONObject searchQualityGoods(AcceptData acceptData, String key, int page, String filter, String order, String startprice, + String endprice, SystemEnum system) { Integer hasQuan = null; Integer userType = null; @@ -788,7 +785,7 @@ provinceId = array.optJSONObject(i).optInt("id"); } else if ("tkRate1".equalsIgnoreCase(ty)) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { JSONArray tkRatearray = JSONArray.fromObject(value); if (tkRatearray != null) { @@ -804,7 +801,7 @@ } } else if ("tkRate2".equalsIgnoreCase(ty)) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { JSONArray tkRatearray = JSONArray.fromObject(value); if (tkRatearray != null) { @@ -820,7 +817,7 @@ } } else if ("tkRate3".equalsIgnoreCase(ty)) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { JSONArray tkRatearray = JSONArray.fromObject(value); if (tkRatearray != null) { @@ -836,7 +833,7 @@ } } else if ("tkRate4".equalsIgnoreCase(ty)) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { JSONArray tkRatearray = JSONArray.fromObject(value); if (tkRatearray != null) { @@ -852,7 +849,7 @@ } } else if ("tkRate5".equalsIgnoreCase(ty)) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { JSONArray tkRatearray = JSONArray.fromObject(value); if (tkRatearray != null) { @@ -876,7 +873,7 @@ userType, start_Price, end_Price, startTkRate, endTkRate, sort); List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>(); - BigDecimal proportion = manageService.getFanLiRate(); + BigDecimal proportion = manageService.getFanLiRate(acceptData.getSystem()); /* 閬嶅巻鍒楄〃鏁版嵁 */ if (listQuery != null && listQuery.size() > 0) { for (QualityFactory selectionGoods : listQuery) { @@ -945,7 +942,7 @@ return data; } - private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice, + private JSONObject searchDaTaoKeGoods(AcceptData acceptData, String key, int page, String filter, String order, String startprice, String endprice) { page = page + 1; int sort = DaTaoKeApiUtil.SORT_DEFAULT; @@ -960,7 +957,7 @@ } List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>(); - BigDecimal proportion = manageService.getFanLiRate(); + BigDecimal proportion = manageService.getFanLiRate(acceptData.getSystem()); DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, null, null, page, 20, sort); if (result != null && result.getGoodsList() != null) @@ -988,9 +985,9 @@ * @param i * @param sf */ - public void setSearchTkRate(int i, SearchFilter sf) { + public void setSearchTkRate(int i, SearchFilter sf,SystemEnum system) { // 鑾峰彇瀵瑰簲鍙傛暟 - String value = configService.get("tkRate_range"); + String value = configService.getValue(ConfigKeyEnum.tkRateRange.getKey(),system); if (!StringUtil.isNullOrEmpty(value)) { -- Gitblit v1.8.0