admin
2019-11-12 0cf8c0bf5649b0b7269f78f6eae7c09cffea75cd
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());
@@ -545,12 +554,12 @@
      } 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.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比例 小于正常比例
            if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
@@ -652,20 +663,22 @@
               BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate);
               otherInfo.setFanliMoneyPlus("京东plus会员返¥" + fanliMoneyPlus);
               // 使用奖励券最高返
               maxMoneyPlus = "(京东plus会员最高返¥"+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))+")";
               maxMoneyPlus = "(京东plus会员最高返¥"
                     + 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.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("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.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,9 @@
                     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));
                     }
                  }
               }
@@ -1047,7 +1063,8 @@
            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) {
                  // 获取详情
@@ -1068,7 +1085,7 @@
                  if (taoBaoGoodsBrief != null) {
                     listExtra.add(
                           GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
                           GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
                  }
               }
            });