From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 十一月 2019 18:30:01 +0800 Subject: [PATCH] 配置文件修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 127 +++++++++++++++++++++++++++++------------- 1 files changed, 87 insertions(+), 40 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 5fe344d..f31d9a8 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 @@ -16,6 +16,7 @@ import org.yeshi.utils.JsonUtil; import org.yeshi.utils.taobao.TbImgUtil; +import com.yeshi.fanli.dto.ConfigParamsDTO; import com.yeshi.fanli.dto.jd.JDCategoryInfo; import com.yeshi.fanli.dto.jd.JDCouponInfo; import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; @@ -72,6 +73,7 @@ import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil; @@ -182,10 +184,9 @@ @Resource private JumpDetailV2Service jumpDetailV2Service; - + @Resource private JDGoodsClassService jdGoodsClassService; - /** * 娣樺疂鍟嗗搧璇︽儏 @@ -266,7 +267,6 @@ taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); } }); - } } else { @@ -350,7 +350,17 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); + + if (TaoBaoUtil.isYUShou(goods)) { + if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { + if (goodsDetail.getLabels() == null) + goodsDetail.setLabels(new ArrayList<>()); + goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E")); + } + } + // 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭� // 搴楅摵淇℃伅 TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); @@ -545,13 +555,19 @@ } else {// 鏅�氳喘涔� OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("integralExchange")); - JSONObject params1=new JSONObject(); - params1.put("balanceMore", true); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + + rewardCoupon.setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil + .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE))); + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", configService.get("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney("楼" +TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add( MoneyBigDecimalUtil.mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), - Constant.MAX_REWARD_RATE))); - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); } @@ -632,18 +648,20 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); - + // 浜笢plus杩斿埄 String maxMoneyPlus = null; JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo(); if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) { Long cid3 = categoryInfo.getCid3(); JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString())); - if (threeClass != null && threeClass.getSelfComm() != null && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { + if (threeClass != null && threeClass.getSelfComm() != null + && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare(); // plus姣斾緥 灏忎簬姝e父姣斾緥 if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) { @@ -652,21 +670,35 @@ BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate); otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus); // 浣跨敤濂栧姳鍒告渶楂樿繑 - maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼"+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))+"锛�"; + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + maxMoneyPlus = "锛堜含涓減lus杩斅�" + + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + + "锛�"; + } else + maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼" + + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + + "锛�"; } } } - + // 濂栧姳鍒歌繑鍒� RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("integralExchange")); - JSONObject params1=new JSONObject(); - params1.put("balanceMore", true); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + + rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate) + .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", configService.get("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else { + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + } rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney( - "楼" +JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate).add( MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); @@ -803,18 +835,25 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("integralExchange")); - JSONObject params1=new JSONObject(); - params1.put("balanceMore", true); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + + rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil + .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", configService.get("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney("楼" +PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil.mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), - Constant.MAX_REWARD_RATE))); - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); @@ -961,10 +1000,11 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); for (JDGoods goods : list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); } // 鍙栧伓鏁颁釜鏁版嵁 @@ -1003,8 +1043,10 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, + Constant.MAX_REWARD_RATE); for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); } } } @@ -1020,7 +1062,7 @@ return; } - List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10); + List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10); // 鍒濆鍖� if (goodsList == null) { goodsList = new ArrayList<TaoBaoGoodsBrief>(); @@ -1047,6 +1089,7 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); goodsList.parallelStream().forEach(goods -> { if (goods != null) { @@ -1067,8 +1110,7 @@ } if (taoBaoGoodsBrief != null) { - listExtra.add( - GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate)); + listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO)); } } }); @@ -1103,12 +1145,13 @@ * @param acceptData * @param uid * @param id + * @param couponUrl + * -浼樻儬鍒搁摼鎺� * @param source - * @param request * @param out */ @RequestMapping(value = "getJDLink") - public void getJDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) { + public void getJDLink(AcceptData acceptData, Long uid, Long id, String couponUrl, String source, PrintWriter out) { if (uid == null || uid <= 0) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); return; @@ -1131,13 +1174,17 @@ return; } - String couponUrl = null; + String jumpLink = null; String materialId = "https://item.jd.com/" + id + ".html"; - JDCouponInfo couponInfo = goods.getCouponInfo(); - if (couponInfo != null) { - couponUrl = couponInfo.getLink(); + if (StringUtil.isNullOrEmpty(couponUrl)) { + JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); + if (couponInfo != null) { + couponUrl = couponInfo.getLink(); + } + jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); + } else { + jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); } - String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); JSONObject data = new JSONObject(); data.put("native", true); -- Gitblit v1.8.0