yujian
2020-04-02 0ec22dcf4fd9c4496e6f681e7fab89f56c6e4e8a
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -33,6 +33,7 @@
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.jd.JDGoodsClass;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemClientParams;
import com.yeshi.fanli.entity.taobao.ClientTBPid;
import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
@@ -41,6 +42,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
@@ -49,6 +51,7 @@
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
@@ -194,10 +197,12 @@
   @Resource
   private UserVIPInfoService userVIPInfoService;
   @Resource
   private UserVipConfigService userVipConfigService;
   @Resource
   private GoodsEvaluateService goodsEvaluateService;
   /**
    * 淘宝商品详情
@@ -261,6 +266,7 @@
               app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID);
               app.setAdzoneId(TaoBaoConstant.TAOBAO_COMMON_PID.split("_")[3]);
               goods = TaoKeApiUtil.searchGoodsDetail(id, app);
               final TaoBaoGoodsBrief finalGoods = goods;
               if (goods != null) {
                  ThreadUtil.run(new Runnable() {
@@ -367,13 +373,15 @@
      // 大淘客商品过滤
      try {
         goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
         goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods, acceptData.getPlatform(),
               acceptData.getVersion());
      } catch (Exception e) {
         LogHelper.errorDetailInfo(e);
      }
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
      GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
      if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
@@ -381,8 +389,10 @@
         goodsDetail.getMoneyInfo().setShareMoney(
               "¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate()));
         goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
         goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
      }
      goodsDetail.getMoneyInfo().setRateInfoHelpUrl(configService.get("goods_detail_fanli_rate_help_url"));
      goodsDetail.getMoneyInfo()
            .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
      if (TaoBaoUtil.isYUShou(goods)) {
         if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {
@@ -415,7 +425,7 @@
      }
      extraVO.setTbPidInfo(clientTBPid);
      extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
      extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img.html?id=" + id);
      // 分享赚人提示
      MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
@@ -480,7 +490,7 @@
         moneyType = 2;
         fanliValid = true;
         shareValid = false;
         helpLink = configService.get("zigoulijian_nofanli_help");
         helpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
         BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
@@ -540,7 +550,7 @@
         rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
         JSONObject params1 = new JSONObject();
         if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
            params1.put("url", configService.get("special_guide_reward_coupon_link"));
            params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
         else
            params1.put("url", userVipConfigService.getValueByKey("vip_link"));
         rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
@@ -551,7 +561,12 @@
         } else
            rewardCoupon.setDesc("用返利奖励券最高返");
         rewardCoupon.setParams(params1.toString());
         otherInfo.setRewardCoupon(rewardCoupon);
         if ("ios".equalsIgnoreCase(acceptData.getPlatform())
               && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
            otherInfo.setRewardCoupon(null);
         goodsDetail.setOtherInfo(otherInfo);
      }
      extraVO.setFanliValid(fanliValid);
@@ -564,7 +579,7 @@
      // 分享路径
      if (StringUtil.isNullOrEmpty(helpLink)) {
         helpLink = configService.get("no_rebate_help_link");
         helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
      }
      // 分享路径
@@ -599,8 +614,9 @@
    * @param from
    * @param out
    */
   @RequestMapping(value = "getDetailJD", method = RequestMethod.POST)
   @RequestMapping(value = "getDetailJD")
   public void getDetialJD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
      // uid=2255993L;
      // 系统验证
      BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
            acceptData.getPackages());
@@ -631,14 +647,17 @@
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
      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("goods_detail_fanli_rate_help_url"));
      goodsDetail.getMoneyInfo()
            .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
      // 附加信息
      OtherInfo otherInfo = new OtherInfo();
@@ -677,7 +696,7 @@
      rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
      JSONObject params1 = new JSONObject();
      if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
         params1.put("url", configService.get("special_guide_reward_coupon_link"));
         params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
      else
         params1.put("url", userVipConfigService.getValueByKey("vip_link"));
@@ -690,7 +709,12 @@
         rewardCoupon.setDesc("用返利奖励券最高返");
      }
      rewardCoupon.setParams(params1.toString());
      otherInfo.setRewardCoupon(rewardCoupon);
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())
            && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
         otherInfo.setRewardCoupon(null);
      goodsDetail.setOtherInfo(otherInfo);
      CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
@@ -722,7 +746,7 @@
      List<ShamUser> listShareUser = new ArrayList<ShamUser>();
      // 京东开启分享
      String open = configService.get("share_jd_open");
      String open = configService.get(ConfigKeyEnum.shareOpenJD.getKey());
      if ("1".equals(open.trim())) {
         extraVO.setShareValid(true);
         MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
@@ -775,7 +799,7 @@
      extraVO.setFanliValid(true);
      if (StringUtil.isNullOrEmpty(helpLink)) {
         helpLink = configService.get("no_rebate_help_link");
         helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
      }
      ShareVO shareInfoVO = new ShareVO();
@@ -788,11 +812,18 @@
      out.print(JsonUtil.loadTrueResult(object.toString()));
      final JDGoods goods = jdGoods;
      final Long fuid = uid;
      ThreadUtil.run(new Runnable() {
         public void run() {
            // 添加浏览记录
            try {
               scanHistoryV2Service.addJDScanHistory(uid, acceptData.getDevice(), goods);
               scanHistoryV2Service.addJDScanHistory(fuid, acceptData.getDevice(), goods);
            } catch (Exception e) {
               e.printStackTrace();
            }
            try {
               goodsEvaluateService.updateJDGoods(goods);
            } catch (Exception e) {
               e.printStackTrace();
            }
@@ -827,14 +858,18 @@
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
      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()));
         goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
         goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
      }
      goodsDetail.getMoneyInfo().setRateInfoHelpUrl(configService.get("goods_detail_fanli_rate_help_url"));
      goodsDetail.getMoneyInfo()
            .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
      // 附加信息
      OtherInfo otherInfo = new OtherInfo();
@@ -842,7 +877,7 @@
      rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
      JSONObject params1 = new JSONObject();
      if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
         params1.put("url", configService.get("special_guide_reward_coupon_link"));
         params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
      else
         params1.put("url", userVipConfigService.getValueByKey("vip_link"));
@@ -855,6 +890,9 @@
         rewardCoupon.setDesc("用返利奖励券最高返");
      rewardCoupon.setParams(params1.toString());
      otherInfo.setRewardCoupon(rewardCoupon);
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())
            && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
         otherInfo.setRewardCoupon(null);
      goodsDetail.setOtherInfo(otherInfo);
      CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
@@ -882,7 +920,7 @@
      }
      // 图文详情
      extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
      extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id);
      String salesTip = pddGoods.getSalesTip();
      if (!StringUtil.isNullOrEmpty(salesTip)) {
@@ -942,7 +980,7 @@
      extraVO.setShareValid(true);
      if (StringUtil.isNullOrEmpty(helpLink)) {
         helpLink = configService.get("no_rebate_help_link");
         helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
      }
      ShareVO shareInfoVO = new ShareVO();
@@ -967,6 +1005,12 @@
            } catch (Exception e) {
               e.printStackTrace();
            }
            try {
               goodsEvaluateService.updatePDDGoods(pddGoods);
            } catch (Exception e) {
               e.printStackTrace();
            }
         }
      });
   }