yujian
2019-12-19 626d711cb15896055c13fe344eb7fcc824589715
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;
   /**
    * 淘宝商品详情
@@ -352,8 +356,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 +443,7 @@
      } catch (Exception e) {
         extraVO.setH5Url(h5Url);
      }
      String helpLink = null;
      boolean fanliValid = true;
      boolean shareValid = true;
@@ -475,7 +485,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 +495,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,16 +508,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"));
@@ -594,8 +613,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();
@@ -633,10 +658,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"));
@@ -782,18 +809,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"));
@@ -947,7 +983,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) {
@@ -991,7 +1028,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));
                     }
@@ -1036,7 +1073,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) {
@@ -1313,7 +1351,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;
@@ -1334,14 +1372,14 @@
      if (jdGoodsList.size() > 0) {
         List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
         for (JDGoods goods : goodsList) {
            tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
            tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD,
                  GoodsDetailVOFactory.convertJDGoods(goods, params));
         }
      }
      if (pddGoodsList.size() > 0) {
         List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
         for (PDDGoodsDetail goods : goodsList) {
            tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
            tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD,
                  GoodsDetailVOFactory.convertPDDGoods(goods, params));
         }
      }