yj
2020-03-06 207dc8655711cddac2653e18b51e58a88dba2084
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java
@@ -61,7 +61,6 @@
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.JumpDetailUtil;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.VersionUtil;
@@ -73,6 +72,7 @@
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.goods.CouponInfoVO;
import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
@@ -263,7 +263,7 @@
    *            页面来源
    * @param out
    */
   @RequestMapping(value = "getGoodsDetial", method = RequestMethod.POST)
   @RequestMapping(value = "getGoodsDetial")
   public void getGoodsDetial(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Long uid,
         PrintWriter out) {
      if (goodsType == null || goodsType < 2 || goodsType > 3) {
@@ -316,12 +316,18 @@
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setMaxRewardRate(null);
      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()));
         goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
         goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
      }
      goodsDetail.getMoneyInfo()
            .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
      // 附加信息
      OtherInfo otherInfo = new OtherInfo();
@@ -343,13 +349,10 @@
                     hongBaoManageService.getFanLiRate());
               otherInfo.setFanliMoneyPlus("京东plus返¥" + fanliMoneyPlus);
               // 使用奖励券最高返
               if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
                  maxMoneyPlus = "(京东plus返¥"
                        + JDUtil.getGoodsFanLiMoneyPlus(jdGoods, hongBaoManageService.getVIPFanLiRate()) + ")";
               } else
                  maxMoneyPlus = "(京东plus最高返¥"
                        + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
                        + ")";
               maxMoneyPlus = "(京东plus返¥"
                     + JDUtil.getGoodsFanLiMoneyPlus(jdGoods, hongBaoManageService.getVIPFanLiRate()) + ")";
            }
         }
      }
@@ -357,7 +360,10 @@
      // 奖励券返利
      RewardCouponVO rewardCoupon = new RewardCouponVO();
      rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
      rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
      rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
      rewardCoupon.setDesc("返");
      otherInfo.setRewardCoupon(rewardCoupon);
      goodsDetail.setOtherInfo(otherInfo);
      CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
@@ -440,6 +446,10 @@
      shareInfoVO.setHelpLink(helpLink);
      extraVO.setShare(shareInfoVO);
      // 判断vip
      if (uid != null) {
         extraVO.setVip(userVIPInfoService.isVIP(uid));
      }
      JSONObject object = new JSONObject();
      object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
      object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
@@ -468,7 +478,7 @@
    * @param out
    */
   private void getDetialPDD(WXMPAcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
      PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id);
      PDDGoodsDetail pddGoods =null; //PinDuoDuoApiUtil.getGoodsDetail(id);
      if (pddGoods == null) {
         out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
         return;
@@ -476,12 +486,29 @@
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setMaxRewardRate(null);
      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()));
      }
      if (goodsDetail.getCouponInfo() != null) {
         List<CouponInfoVO> list = new ArrayList<>();
         list.add(goodsDetail.getCouponInfo());
         goodsDetail.setCouponInfoList(list);
      }
      // 奖励券返利
      RewardCouponVO rewardCoupon = new RewardCouponVO();
      rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
      rewardCoupon.setDesc("返");
      OtherInfo otherInfo = new OtherInfo();
      otherInfo.setRewardCoupon(rewardCoupon);
      goodsDetail.setOtherInfo(otherInfo);
      CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
      PDDPromotionUrl convertUrl = null;
@@ -563,6 +590,11 @@
      shareInfoVO.setHelpLink(helpLink);
      extraVO.setShare(shareInfoVO);
      // 判断vip
      if (uid != null) {
         extraVO.setVip(userVIPInfoService.isVIP(uid));
      }
      if (convertUrl != null) {
         extraVO.setCouponJumpLink(convertUrl.getUrl());
         extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));