admin
2020-11-28 dc5be7d38446f70e6ff86df311119c32b41fe7f8
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -14,14 +14,11 @@
import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException;
import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager;
import com.yeshi.fanli.util.*;
import org.springframework.core.task.TaskExecutor;
import com.yeshi.fanli.util.StringUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.*;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
@@ -47,28 +44,22 @@
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoLink;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.common.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.goods.ShareGoodsTextTemplateException;
import com.yeshi.fanli.exception.share.ShareGoodsException;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
@@ -452,7 +443,7 @@
         shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),system));
         // 添加分享记录
         BigDecimal rate = hongBaoManageService.getShareRate();
         BigDecimal rate = hongBaoManageService.getShareRate(acceptData.getSystem());
         BigDecimal shareMoney = TaoBaoUtil.getShareGoodsHongBaoInfo(goods, rate);
         shareInfo.setShareMoney("¥" + shareMoney.toString());
         try {
@@ -512,7 +503,7 @@
         TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(uid, goodsId, relationId,null);
         if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) {
            ConfigParamsDTO dto = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version);
            ConfigParamsDTO dto = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,acceptData.getSystem());
            GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto);
            shareInfo.setGoodsInfo(goodsInfo);
         }
@@ -605,7 +596,7 @@
         shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),system));
         // 分享金额
         BigDecimal rate = hongBaoManageService.getShareRate();
         BigDecimal rate = hongBaoManageService.getShareRate(acceptData.getSystem());
         BigDecimal shareMoney = TaoBaoUtil.getShareGoodsHongBaoInfo(taoBaoLink.getGoods(), rate);
         shareInfo.setShareMoney("¥" + shareMoney.toString());
@@ -671,7 +662,7 @@
         // 设置评论文本选项
         shareInfo.setCommentTextChoiceList(
               getCommentChoiceList(shareInfo.getCommentText(), null, inviteCode, TaoBaoUtil.getGoodsHongBaoMoney(
                     taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP), false)));
                     taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()), false)));
         out.print(JsonUtil.loadTrueResult(
               JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -737,9 +728,9 @@
         couponUrl = couponInfo.getLink();
      }
      String materialId = "https://item.jd.com/" + goodsId + ".html";
      String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
      String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null,JDApiUtil.POSITION_SHARE + "", uid + "");
      if (StringUtil.isNullOrEmpty(jumpLink)) {
         jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_SHARE + "", uid + "");
         jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null,JDApiUtil.POSITION_SHARE + "", uid + "");
      }
      ShareInfoVO shareInfo = new ShareInfoVO();
@@ -751,7 +742,7 @@
      if (needGoods)
         shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, orderHongBaoMoneyComputeService
               .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())));
               .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion(),acceptData.getSystem())));
      boolean hasCoupon = false;
      if (couponInfo != null) {
@@ -782,7 +773,7 @@
      shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotifyJD.getKey(),SystemInfoUtil.getSystem(acceptData)));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate(acceptData.getSystem());
      BigDecimal shareMoney = JDUtil.getGoodsFanLiMoney(jdGoods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
      try {
@@ -840,7 +831,7 @@
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
            JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -916,9 +907,9 @@
      if (needGoods) {
         shareInfo
               .setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods,
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                           hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()),
                           hongBaoManageService.getShareRate(acceptData.getSystem()), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      }
      // 创建口令
@@ -953,7 +944,7 @@
      shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotifyPDD.getKey(),system));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate(acceptData.getSystem());
      BigDecimal shareMoney = PinDuoDuoUtil.getGoodsFanLiMoney(goods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
@@ -1015,7 +1006,7 @@
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
            PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -1084,9 +1075,9 @@
      if (needGoods) {
         shareInfo
               .setGoodsInfo(GoodsDetailVOFactory.convertVIPGoods(goods,
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                           hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()),
                           hongBaoManageService.getShareRate(acceptData.getSystem()), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      }
      String template = shareGoodsTextTemplateService.getTextTemplateByVIP(uid);
@@ -1108,7 +1099,7 @@
      shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotifyVIP.getKey(),system));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate(acceptData.getSystem());
      BigDecimal shareMoney = VipShopUtil.getGoodsFanLiMoney(goods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
@@ -1144,7 +1135,7 @@
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            VipShopUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
            VipShopUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -1219,9 +1210,9 @@
      if (needGoods) {
         shareInfo
               .setGoodsInfo(GoodsDetailVOFactory.convertSuningGoods(goods,
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                           hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()),
                           hongBaoManageService.getShareRate(acceptData.getSystem()), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      }
      String template = shareGoodsTextTemplateService.getTextTemplateBySuNing(uid);
@@ -1251,7 +1242,7 @@
      shareInfo.setNotifyDesc(configService.getValue(ConfigKeyEnum.goodsShareNotifySuning.getKey(),system));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate(acceptData.getSystem());
      BigDecimal shareMoney = SuningUtil.getGoodsFanLiMoney(goods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
@@ -1325,7 +1316,7 @@
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            SuningUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
            SuningUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -1460,7 +1451,7 @@
         app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
         app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
         app.setPid(TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT);
         TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
         TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app,null,null);
         if (goodsLink != null)
            token = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
                  StringUtil.isNullOrEmpty(goodsLink.getCouponLink()) ? goodsLink.getAuctionUrl()
@@ -1508,7 +1499,7 @@
         couponUrl = couponInfo.getLink();
      }
      String materialId = "https://item.jd.com/" + goodsId + ".html";
      String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
      String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null,JDApiUtil.POSITION_SHARE + "",
            uid + "");
      String content = shareGoodsTextTemplateService.createContentJD(template, goods, shortLink, hasCoupon);
@@ -1846,7 +1837,7 @@
      }
      ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
            acceptData.getVersion(),acceptData.getSystem());
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
            .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
@@ -1918,8 +1909,8 @@
      GoodsDetailVO goodsDetail = null;
      ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
            acceptData.getVersion(),acceptData.getSystem());
      paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem()));
      if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
         TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(Long.parseLong(goodsId));