From 8b2191df2f7d94aa299bd43dcbe97c94e5a61bbd Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 20 十一月 2019 14:53:34 +0800 Subject: [PATCH] RocketMQ的消息整改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 65 ++++++++++++++++++++------------ 1 files changed, 41 insertions(+), 24 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 2164966..292536b 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; @@ -182,10 +183,9 @@ @Resource private JumpDetailV2Service jumpDetailV2Service; - + @Resource private JDGoodsClassService jdGoodsClassService; - /** * 娣樺疂鍟嗗搧璇︽儏 @@ -266,7 +266,6 @@ taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); } }); - } } else { @@ -350,7 +349,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()); @@ -546,11 +555,11 @@ OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - JSONObject params1=new JSONObject(); + JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney("楼" +TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add( MoneyBigDecimalUtil.mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), - Constant.MAX_REWARD_RATE))); + 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 +641,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,20 +663,22 @@ BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate); otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus); // 浣跨敤濂栧姳鍒告渶楂樿繑 - maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼"+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))+"锛�"; + maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼" + + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + + "锛�"; } } } - + // 濂栧姳鍒歌繑鍒� RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - JSONObject params1=new JSONObject(); + JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney( - "楼" +JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate).add( MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + 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,17 +816,18 @@ 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("web")); - JSONObject params1=new JSONObject(); + JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); - rewardCoupon.setMaxMoney("楼" +PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil.mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), - Constant.MAX_REWARD_RATE))); + 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 +975,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 +1018,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 +1037,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 +1064,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 +1085,7 @@ } if (taoBaoGoodsBrief != null) { - listExtra.add( - GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate)); + listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO)); } } }); -- Gitblit v1.8.0