From 271ae63c20fcbe28d29c47f1881138ff6551a2a1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 10 六月 2020 19:26:26 +0800 Subject: [PATCH] 唯品会订单bug修复,APP端佣金比例展示错误bug修复 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 207 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java index 1bc82f3..c8fde66 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java @@ -24,6 +24,12 @@ import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.dto.pdd.PDDGoodsResult; import com.yeshi.fanli.dto.pdd.PDDSearchFilter; +import com.yeshi.fanli.dto.suning.SuningCommodityInfo; +import com.yeshi.fanli.dto.suning.SuningGoodsInfo; +import com.yeshi.fanli.dto.suning.SuningQueryModel; +import com.yeshi.fanli.dto.vip.VIPSearchFilter; +import com.yeshi.fanli.dto.vip.VIPSearchResult; +import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.jd.JDGoods; @@ -66,9 +72,11 @@ import com.yeshi.fanli.util.jd.JDUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; +import com.yeshi.fanli.util.suning.SuningApiUtil; import com.yeshi.fanli.util.taobao.SearchFilterUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; +import com.yeshi.fanli.util.vipshop.VipShopApiUtil; import com.yeshi.fanli.vo.brand.BrandInfoVO; import com.yeshi.fanli.vo.brand.TaoBaoShopVO; import com.yeshi.fanli.vo.common.JumpDetailContentVO; @@ -139,7 +147,7 @@ @Resource private JumpDetailV2Service jumpDetailV2Service; - + @Resource private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; @@ -192,15 +200,13 @@ Gson gson = JsonUtil.getApiCommonGson(); data.put("title", "鏅鸿兘鎼滅储"); - - int state = 0; if (result.getFirstGoods() != null && result.getFirstGoods().getGoodsId() != null) { state = 2; data.put("stateDesc", "閫夋嫨鎼滃埜鎴栬浆閾�"); JSONObject params = new JSONObject(); - params.put("id", result.getFirstGoods().getGoodsId()+""); + params.put("id", result.getFirstGoods().getGoodsId() + ""); params.put("from", "杞摼"); if (result.getFirstGoods().getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { view = new JumpDetailContentVO(); @@ -429,7 +435,7 @@ public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter, Integer order, Long uid, HttpSession session, PrintWriter out) { - if (goodsType == null || goodsType < 1 || goodsType > 3) { + if (goodsType == null || goodsType < 1 || goodsType > 5) { out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭钩鍙板弬鏁�")); return; } @@ -499,8 +505,21 @@ return; } + /*-------- 鍞搧浼氬晢鍝� ------*/ + if (goodsType.intValue() == Constant.SOURCE_TYPE_VIP) { + searchVIPGoods(acceptData, searchkey, page, filter, order, out); + return; + } + + /*-------- 鑻忓畞鍟嗗搧 ------*/ + if (goodsType.intValue() == Constant.SOURCE_TYPE_SUNING) { + searchSuningGoods(acceptData, searchkey, page, filter, order, out); + return; + } + /*-------- 娣樺疂鍟嗗搧 -------*/ searchTaoBaoGoods(acceptData, searchkey, page, filter, order, out); + } /** @@ -900,4 +919,187 @@ data.put("count", count); out.print(JsonUtil.loadTrueResult(data)); } + + /** + * 鎼滅储鍞搧浼氬晢鍝� + * @Title: searchVIPGoods + * @Description: + * @param acceptData + * @param key + * @param page + * @param filter + * @param order + * @param out + * void 杩斿洖绫诲瀷 + * @throws + */ + private void searchVIPGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, + PrintWriter out) { + VIPSearchFilter searchFilter = new VIPSearchFilter(); + searchFilter.setKeyword(key); + searchFilter.setPage(page); + searchFilter.setPageSize(Constant.PAGE_SIZE); + + if (order != null) { + int sort = order.intValue(); + switch (sort) { + case 2: // 浠锋牸鈥攄esc + searchFilter.setFieldName("price"); + searchFilter.setOrder(1); + break; + case 3: // 浠锋牸鈥攁sc + searchFilter.setFieldName("price"); + searchFilter.setOrder(0); + break; + case 5: // 鎶樻墸鈥攁ec + searchFilter.setFieldName("discount"); + searchFilter.setOrder(0); + break; + default: // 缁煎悎鎺掑簭 + break; + } + } + + if (!StringUtil.isNullOrEmpty(filter)) { + JSONObject jsonfilter = JSONObject.fromObject(filter); + String minPrice = jsonfilter.optString("minPrice"); + if (!StringUtil.isNullOrEmpty(minPrice)) { + searchFilter.setPriceStart(minPrice); + } + + String maxPrice = jsonfilter.optString("maxPrice"); + if (!StringUtil.isNullOrEmpty(maxPrice)) { + searchFilter.setPriceEnd(maxPrice); + } + } + + int count = 0; + JSONObject data = new JSONObject(); + JSONArray array = new JSONArray(); + + VIPSearchResult result = VipShopApiUtil.search(searchFilter); + if (result != null) { + count = result.getTotal(); + Gson gson = JsonUtil.getApiCommonGson(); + List<VIPGoodsInfo> goodsList = result.getGoodsList(); + if (goodsList != null && goodsList.size() > 0) { + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); + + for (VIPGoodsInfo goods : goodsList) { + GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertVIPGoods(goods, paramsDTO); + array.add(gson.toJson(goodsDetailVO)); + } + } + } + + data.put("result", array); + data.put("count", count); + out.print(JsonUtil.loadTrueResult(data)); + } + + /** + * 鎼滅储鍞搧浼氬晢鍝� + * @Title: searchVIPGoods + * @Description: + * @param acceptData + * @param key + * @param page + * @param filter + * @param order + * @param out + * void 杩斿洖绫诲瀷 + * @throws + */ + private void searchSuningGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, + PrintWriter out) { + SuningQueryModel searchFilter = new SuningQueryModel(); + searchFilter.setKeyword(key); + searchFilter.setPageIndex(page); + searchFilter.setSize(10); + + if (order != null) { + if (order == 1) { // 閿�閲忛珮鍒颁綆 + searchFilter.setSortType(2); + } else if (order == 2) { // 浠锋牸楂樺埌浣� + searchFilter.setSortType(3); + } else if (order == 3) { // 浠锋牸浣庡埌楂� + searchFilter.setSortType(4); + } else if (order == 4) { // 杩斿埄姣旈珮鍒颁綆 + searchFilter.setSortType(5); + } + } + + if (!StringUtil.isNullOrEmpty(filter)) { + JSONObject jsonfilter = JSONObject.fromObject(filter); + Boolean coupon = jsonfilter.optBoolean("coupon"); + if (coupon != null && coupon) { + searchFilter.setCoupon(1); // 鏈夊埜 + } + + Boolean snfwservice = jsonfilter.optBoolean("snfwservice");// 鑻忓畞鏈嶅姟 + if (snfwservice != null && snfwservice) { + searchFilter.setSnfwservice(1); + } + + Boolean snhwg = jsonfilter.optBoolean("snhwg");// 鑻忓畞鍥介檯 + if (snhwg != null && snhwg) { + searchFilter.setSnhwg(1); + } + + Boolean suningService = jsonfilter.optBoolean("suningService");// 鑻忓畞鑷惀 + if (suningService != null && suningService) { + searchFilter.setSuningService(1); + } + + Boolean pgSearch = jsonfilter.optBoolean("pgSearch");// 鎷艰喘 + if (pgSearch != null && pgSearch) { + searchFilter.setPgSearch(1); + } + + String minPrice = jsonfilter.optString("minPrice"); + if (!StringUtil.isNullOrEmpty(minPrice)) { + searchFilter.setStartPrice(minPrice); + } + + String maxPrice = jsonfilter.optString("maxPrice"); + if (!StringUtil.isNullOrEmpty(maxPrice)) { + searchFilter.setEndPrice(maxPrice); + } + } + + JSONObject data = new JSONObject(); + JSONArray array = new JSONArray(); + + List<SuningGoodsInfo> resultList = null; + List<SuningGoodsInfo> list = SuningApiUtil.searchGoodsOld(searchFilter); + if (list != null && list.size() > 0) { + List<String> listId = new ArrayList<>(); + for (SuningGoodsInfo goodsInfo: list) { + SuningCommodityInfo info = goodsInfo.getCommodityInfo(); + if (info != null) { + listId.add(info.getCommodityCode() + "-" + info.getSupplierCode()); + } + } + resultList = SuningApiUtil.getGoodsDetailList(listId); + } + + if (resultList != null) { + Gson gson = JsonUtil.getApiCommonGson(); + if (resultList != null && resultList.size() > 0) { + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); + + for (SuningGoodsInfo goods : resultList) { + GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); + array.add(gson.toJson(goodsDetailVO)); + } + } + } + + data.put("result", array); + data.put("count", 1000); + out.print(JsonUtil.loadTrueResult(data)); + } + } -- Gitblit v1.8.0