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/GoodsControllerV2.java | 240 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 165 insertions(+), 75 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index e61d625..bf824c5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java @@ -13,7 +13,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.yeshi.utils.HttpUtil; import org.yeshi.utils.JsonUtil; import org.yeshi.utils.taobao.TbImgUtil; @@ -26,6 +25,7 @@ import com.yeshi.fanli.dto.pdd.PDDPromotionUrl; import com.yeshi.fanli.dto.pdd.PDDSearchFilter; import com.yeshi.fanli.dto.suning.SuningGoodsInfo; +import com.yeshi.fanli.dto.suning.SuningGoodsInfoRecommend; import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult; import com.yeshi.fanli.dto.vip.VIPConvertResultDTO; import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; @@ -33,6 +33,10 @@ import com.yeshi.fanli.entity.bus.user.ShamUser; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; +import com.yeshi.fanli.entity.dynamic.CommentInfo; +import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; +import com.yeshi.fanli.entity.dynamic.ImgInfo; +import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; import com.yeshi.fanli.entity.goods.CollectionGoodsV2; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.jd.JDGoods; @@ -450,7 +454,7 @@ if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); goodsDetail.getMoneyInfo().setShareMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, - hongBaoManageService.getShareRate(UserLevelEnum.superVIP),true)); + hongBaoManageService.getShareRate(UserLevelEnum.superVIP), true)); goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); } @@ -552,7 +556,8 @@ shareValid = false; helpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey()); - BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,false); + BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE, + false); ReduceHongBao reduceHongBao = new ReduceHongBao(); reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount()); @@ -653,6 +658,12 @@ couponInfoList.add(goodsDetail.getCouponInfo()); goodsDetail.setCouponInfoList(couponInfoList); } + + + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } + JSONObject object = new JSONObject(); object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); @@ -854,11 +865,11 @@ // 鍟嗗搧閾炬帴 String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + ""); - try { - extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); - } catch (Exception e) { - extraVO.setH5Url(h5Url); - } + // try { + // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); + // } catch (Exception e) { + extraVO.setH5Url(h5Url); + // } String helpLink = null; extraVO.setFanliValid(true); @@ -870,6 +881,10 @@ ShareVO shareInfoVO = new ShareVO(); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); + + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } JSONObject object = new JSONObject(); object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); @@ -1033,11 +1048,11 @@ // 鍒嗕韩璺緞 String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); - try { - extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); - } catch (Exception e) { - extraVO.setH5Url(h5Url); - } + // try { + // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); + // } catch (Exception e) { + extraVO.setH5Url(h5Url); + // } String helpLink = null; extraVO.setFanliValid(true); @@ -1054,6 +1069,10 @@ if (convertUrl != null) { extraVO.setCouponJumpLink(convertUrl.getUrl()); extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); + } + + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� } JSONObject object = new JSONObject(); @@ -1173,11 +1192,11 @@ // 鍒嗕韩璺緞 String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); - try { - extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); - } catch (Exception e) { - extraVO.setH5Url(h5Url); - } + // try { + // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); + // } catch (Exception e) { + extraVO.setH5Url(h5Url); + // } String helpLink = null; extraVO.setFanliValid(true); @@ -1190,6 +1209,9 @@ ShareVO shareInfoVO = new ShareVO(); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); + + // 浜戝彂鍗曟枃妗堜俊鎭� + getCloudInfo(acceptData, goodsDetail, extraVO); JSONObject object = new JSONObject(); object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); @@ -1304,11 +1326,11 @@ // 鍒嗕韩璺緞 String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); - try { - extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); - } catch (Exception e) { - extraVO.setH5Url(h5Url); - } + // try { + // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); + // } catch (Exception e) { + extraVO.setH5Url(h5Url); + // } String helpLink = null; extraVO.setFanliValid(true); @@ -1322,6 +1344,9 @@ shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); + // 浜戝彂鍗曟枃妗堜俊鎭� + getCloudInfo(acceptData, goodsDetail, extraVO); + JSONObject object = new JSONObject(); object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); @@ -1344,6 +1369,49 @@ } }); } + + /** + * // 浜戝彂鍗曟枃妗堜俊鎭� + * @param goodsDetail + */ + private void getCloudInfo(AcceptData acceptData, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) { + // 浜戝彂鍗曟槸鍚﹀紑鍚� + String cloudState = configService.getByVersion(ConfigKeyEnum.robotCloudOpen.getKey(), acceptData.getPlatform(), + Integer.parseInt(acceptData.getVersion())); + if (!StringUtil.isNullOrEmpty(cloudState) && "1".equals(cloudState)) { + extraVO.setCloudOpen(true); + } + + + if (!goodsDetail.isHasCoupon()) { + return; + } + + GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() +"", goodsDetail.getGoodsType()); + if (evaluate != null) { + String cloudText = null; + List<CommentInfo> comments = evaluate.getComments(); + if (comments != null && comments.size() > 0) { + cloudText = comments.get(0).getContent(); + } + + String cloudPic = null; + List<ImgInfo> imgList = evaluate.getImgList(); + if (imgList != null && imgList.size() > 0) { + for (ImgInfo imgInfo: imgList) { + ImgEnum type = imgInfo.getType(); + if (type == ImgEnum.goods) { + cloudPic = imgInfo.getUrl(); + } + } + } + + if (!StringUtil.isNullOrEmpty(cloudText) && !StringUtil.isNullOrEmpty(cloudPic)) { + extraVO.setCloudPic(cloudPic); + extraVO.setCloudText(cloudText); + } + } + } /** * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛� @@ -1359,7 +1427,6 @@ } try { - // 浜笢 if (goodsType == Constant.SOURCE_TYPE_JD) { JSONObject data = new JSONObject(); @@ -1431,12 +1498,51 @@ out.print(JsonUtil.loadTrueResult(data)); return; } - - if (goodsType == Constant.SOURCE_TYPE_SUNING) { - //鐚滀綘鍠滄 - - } + // 鍞搧浼� + if (goodsType == Constant.SOURCE_TYPE_VIP) { + JSONObject data = new JSONObject(); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + out.print(JsonUtil.loadTrueResult(data)); + return; + } + + // 鑻忓畞 + if (goodsType == Constant.SOURCE_TYPE_SUNING) { + List<SuningGoodsInfo> resultList = null; + String[] ids = SuningUtil.getGoodsIdDetail(id); + List<SuningGoodsInfoRecommend> list = SuningApiUtil.getRecommendGoods(ids[1], ids[0]); + if (list != null && list.size() > 0) { + List<String> listId = new ArrayList<>(); + for (SuningGoodsInfoRecommend goodsInfo: list) { + if (goodsInfo != null) { + listId.add(goodsInfo.getCommodityCode() + "-" + goodsInfo.getSupplierCode()); + } + } + resultList = SuningApiUtil.getGoodsDetailList(listId); + } + + List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); + if (resultList != null) { + if (resultList != null && resultList.size() > 0) { + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); + + for (SuningGoodsInfo goods : resultList) { + GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); + listDetailVO.add(goodsDetailVO); + } + } + } + + JSONObject data = new JSONObject(); + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + out.print(JsonUtil.loadTrueResult(data)); + return; + } + List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10); // 鍒濆鍖� if (goodsList == null) { @@ -1444,50 +1550,12 @@ } List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); - TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); - app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); - app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT); - - List<Long> ids = new ArrayList<>(); - for (TaoBaoGoodsBrief goods : goodsList) - ids.add(goods.getAuctionId()); - - try { - goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids); - } catch (TaoKeApiException e1) { - } catch (TaobaoGoodsDownException e1) { - } - - if (goodsList != null && goodsList.size() > 0) { - - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); - - goodsList.parallelStream().forEach(goods -> { - if (goods != null) { - // 鑾峰彇璇︽儏 - TaoBaoGoodsBrief taoBaoGoodsBrief = null; - try { - taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId()); - } catch (Exception e) { - e.printStackTrace(); - } - - if (taoBaoGoodsBrief == null) { - TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app); - goods.setCouponInfo(newGoods.getCouponInfo()); - goods.setCouponLink(newGoods.getCouponLink()); - goods.setTkRate(newGoods.getTkRate()); - taoBaoGoodsBrief = goods; - } - - if (taoBaoGoodsBrief != null) { - listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO)); - } - } - }); - } + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); + goodsList.parallelStream().forEach(goods -> { + if (goods != null) { + listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO)); + } + }); List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); // 鍙栧伓鏁颁釜鏁版嵁 @@ -1563,6 +1631,9 @@ } else { jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); + if (StringUtil.isNullOrEmpty(jumpLink)) { + jumpLink = couponUrl; + } } JSONObject data = new JSONObject(); @@ -1589,6 +1660,9 @@ String materialId = "https://item.jd.com/" + id + ".html"; jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null); + if (StringUtil.isNullOrEmpty(jumpLink)) { + jumpLink = couponUrl; + } JSONObject data = new JSONObject(); data.put("native", true); @@ -1718,8 +1792,8 @@ String quanUrl = null; if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) quanUrl = goods.getCouponInfo().getCouponUrl(); - String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), - quanUrl, SuningApiUtil.PID_BUY, uid + ""); + String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl, + SuningApiUtil.PID_BUY, uid + ""); JSONObject data = new JSONObject(); data.put("native", false); data.put("jumpLink", link); @@ -1782,6 +1856,22 @@ } else { data.put("extend", true); } + } else if (goodsType == Constant.SOURCE_TYPE_VIP) { + VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId); + if (goods == null) { + data.put("extend", false); + data.put("url",""); + } else { + data.put("extend", true); + } + } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { + SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsId.split("-")[1], goodsId.split("-")[0]); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://m.suning.com/product/%s/%s.html", goodsId.split("-")[0],goodsId.split("-")[1])); + } else { + data.put("extend", true); + } } out.print(JsonUtil.loadTrueResult(data)); } -- Gitblit v1.8.0