From eda5d0e998204c7a49ab84d8528569b765bec2f9 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 20 十二月 2019 10:05:10 +0800 Subject: [PATCH] 品牌日志 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 109 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 77 insertions(+), 32 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 70d6918..b92e409 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 @@ -69,6 +69,7 @@ import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.RedisManager; @@ -183,12 +184,15 @@ @Resource private JDGoodsClassService jdGoodsClassService; - + @Resource private TLJFreeBuyGoodsService tljFreeBuyGoodsService; - + @Resource private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; + + @Resource + private UserVIPInfoService userVIPInfoService; /** * 娣樺疂鍟嗗搧璇︽儏 @@ -236,7 +240,7 @@ LogHelper.test("鑾峰彇PID鑰楁椂锛�" + (java.lang.System.currentTimeMillis() - startTime)); - final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); + // final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); // 鏄惁鍦ㄦ湇鍔$杩涜杞摼 boolean convertInServer = configService.isConvertTaoBaoLinkInServer(); @@ -305,7 +309,6 @@ } if (goods != null) { - goodsList.add(goods); final TaoBaoGoodsBrief newGoods = goods; ThreadUtil.run(new Runnable() { public void run() { @@ -320,10 +323,7 @@ }); } - TaoBaoGoodsBrief tb = null; - if (goodsList.size() > 0) { - tb = goodsList.get(0); - } + TaoBaoGoodsBrief tb = goods; if (tb == null) { out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); @@ -334,14 +334,31 @@ tb.setImgList(new ArrayList<>()); } - tb.getImgList().add(0, tb.getPictUrl()); + // tb.getImgList().add(0, tb.getPictUrl()); List<String> finalImgList = new ArrayList<>(); for (String img : tb.getImgList()) { finalImgList.add(TbImgUtil.getTBSizeImg(img, 600)); } + + if (finalImgList.size() == 0) { + finalImgList.add(tb.getPictUrl()); + } + if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) finalImgList.add(0, tb.getPictUrlWhite()); + + // 绉婚櫎鐩稿悓鍥剧墖 + if (finalImgList.size() > 0) + for (int i = 0; i < finalImgList.size(); i++) { + if (i < finalImgList.size() - 1) + if (TbImgUtil.getTBSizeImg(finalImgList.get(i), 600) + .equalsIgnoreCase(TbImgUtil.getTBSizeImg(finalImgList.get(i + 1), 600))) { + finalImgList.remove(i--); + } + } + + tb.setImgList(finalImgList); // 澶ф窐瀹㈠晢鍝佽繃婊� try { @@ -352,8 +369,14 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney( + "楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate())); + } if (TaoBaoUtil.isYUShou(goods)) { if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { @@ -433,7 +456,7 @@ } catch (Exception e) { extraVO.setH5Url(h5Url); } - + String helpLink = null; boolean fanliValid = true; boolean shareValid = true; @@ -475,7 +498,8 @@ goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao)); } } else if (from != null && from.equals("taolijin_free_buy")) { - TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); + TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); if (freeGoods == null) { out.print(JsonUtil.loadFalseResult(2, "鍏嶅崟鍟嗗搧宸蹭笅鏋�")); return; @@ -484,9 +508,9 @@ fanliValid = true; shareValid = false; BigDecimal couponPrice = goodsDetail.getCouponPrice(); - if (couponPrice == null) + if (couponPrice == null) couponPrice = goodsDetail.getZkPrice(); - + NewUserHongBao newUserHongBao = new NewUserHongBao(); newUserHongBao.setMoney(couponPrice.setScale(2).toString()); newUserHongBao.setName("鏂颁汉绾㈠寘 "); @@ -497,22 +521,24 @@ OtherInfo otherInfo = new OtherInfo(); otherInfo.setReduceHongBao(newUserHongBao); goodsDetail.setOtherInfo(otherInfo); - + // 涓撳睘鏍囩 List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>(); labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014")); labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600")); goodsDetail.setLabels(labels); - + } else {// 鏅�氳喘涔� OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); 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())) + params1.put("url", configService.get("special_guide_reward_coupon_link")); + else + params1.put("url", configService.get("vip_link")); + rewardCoupon + .setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -600,8 +626,14 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo() + .setShareMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate())); + } // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); @@ -639,10 +671,12 @@ rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1 = new JSONObject(); - params1.put("url", configService.get("special_guide_reward_coupon_link")); + if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) + params1.put("url", configService.get("special_guide_reward_coupon_link")); + else + params1.put("url", configService.get("vip_link")); - rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate) - .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -788,18 +822,27 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney( + "楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate())); + } // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1 = new JSONObject(); - params1.put("url", configService.get("special_guide_reward_coupon_link")); + if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) + params1.put("url", configService.get("special_guide_reward_coupon_link")); + else + params1.put("url", configService.get("vip_link")); - rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil - .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon + .setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -953,7 +996,8 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); for (JDGoods goods : list) { @@ -997,7 +1041,7 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, - Constant.MAX_REWARD_RATE); + Constant.MAX_REWARD_RATE, hongBaoManageService.getVIPFanLiRate()); for (PDDGoodsDetail goods : goodsList) { listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); } @@ -1042,7 +1086,8 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); goodsList.parallelStream().forEach(goods -> { if (goods != null) { @@ -1319,7 +1364,7 @@ Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>(); ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), - hongBaoManageService.getShareRate(), new BigDecimal(80)); + hongBaoManageService.getShareRate(), new BigDecimal(80), hongBaoManageService.getVIPFanLiRate()); if (tbGoodsList.size() > 0) { List<TaoBaoGoodsBrief> goodsList = null; -- Gitblit v1.8.0