admin
2019-12-24 8dc8133fb93405c6fc34c9c3c6c6bbce09ebe7f0
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -240,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();
@@ -309,7 +309,6 @@
      }
      if (goods != null) {
         goodsList.add(goods);
         final TaoBaoGoodsBrief newGoods = goods;
         ThreadUtil.run(new Runnable() {
            public void run() {
@@ -324,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, "商品不存在"));
@@ -338,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 {
@@ -354,10 +367,9 @@
         LogHelper.errorDetailInfo(e);
      }
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
            hongBaoManageService.getVIPFanLiRate());
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
      if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
         goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
@@ -524,8 +536,7 @@
            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()));
         rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
         if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
            rewardCoupon.setDesc("返");
            params1.put("url", configService.get("vip_link"));
@@ -611,10 +622,8 @@
      // 保存缓存
      jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
            hongBaoManageService.getVIPFanLiRate());
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
      if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
         goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
@@ -638,12 +647,14 @@
            if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
               jdGoods.setCommissionPlus(threeClass.getSelfComm());
               // plus返利
               BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate);
               BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
                     hongBaoManageService.getFanLiRate());
               otherInfo.setFanliMoneyPlus("京东plus返¥" + fanliMoneyPlus);
               // 使用奖励券最高返
               if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
                  maxMoneyPlus = "(京东plus返¥"
                        + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
                        + JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
                              hongBaoManageService.getVIPFanLiRate())
                        + ")";
               } else
                  maxMoneyPlus = "(京东plus最高返¥"
@@ -663,7 +674,7 @@
      else
         params1.put("url", configService.get("vip_link"));
      rewardCoupon.setMaxMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPFanLiRate()));
      rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         rewardCoupon.setDesc("返");
         params1.put("url", configService.get("vip_link"));
@@ -807,10 +818,8 @@
         return;
      }
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
            hongBaoManageService.getVIPFanLiRate());
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
      if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
         goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
@@ -828,8 +837,7 @@
      else
         params1.put("url", configService.get("vip_link"));
      rewardCoupon
            .setMaxMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPFanLiRate()));
      rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         rewardCoupon.setDesc("返");
         params1.put("url", configService.get("vip_link"));
@@ -981,10 +989,8 @@
               list = list.subList(0, 10);
            }
            BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
            BigDecimal shareRate = hongBaoManageService.getShareRate();
            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
                  hongBaoManageService.getVIPFanLiRate());
            ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                  acceptData.getVersion());
            List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
            for (JDGoods goods : list) {
@@ -1025,10 +1031,8 @@
                        goodsList = goodsList.subList(0, 10);
                     }
                     BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
                     BigDecimal shareRate = hongBaoManageService.getShareRate();
                     ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate,
                           Constant.MAX_REWARD_RATE, hongBaoManageService.getVIPFanLiRate());
                     ConfigParamsDTO paramsDTO = hongBaoManageService
                           .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
                     for (PDDGoodsDetail goods : goodsList) {
                        listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
                     }
@@ -1071,10 +1075,8 @@
         if (goodsList != null && goodsList.size() > 0) {
            BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
            BigDecimal shareRate = hongBaoManageService.getShareRate();
            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
                  hongBaoManageService.getVIPFanLiRate());
            ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                  acceptData.getVersion());
            goodsList.parallelStream().forEach(goods -> {
               if (goods != null) {
@@ -1352,6 +1354,7 @@
      ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
            hongBaoManageService.getShareRate(), new BigDecimal(80), hongBaoManageService.getVIPFanLiRate());
      hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
      if (tbGoodsList.size() > 0) {
         List<TaoBaoGoodsBrief> goodsList = null;