admin
2020-07-14 eec7e789a87863c25d92c10ad5dfc22ad80c448d
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsTextTemplateServiceImpl.java
@@ -5,6 +5,8 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.BigDecimalUtil;
@@ -47,6 +49,9 @@
   @Resource
   private ConfigTaoLiJinService configTaoLiJinService;
   @Resource
   private UserInfoService userInfoService;
   @Override
   public void saveCommonTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
@@ -234,8 +239,9 @@
            template = ""; // 老板分享
         }
      }
      SystemEnum system=userInfoService.getUserSystem(uid);
      if (StringUtil.isNullOrEmpty(template)) {
         template = configService.get(ConfigKeyEnum.shareCommentTextTB.getKey());
         template = configService.getValue(ConfigKeyEnum.shareCommentTextTB.getKey(),system);
      }
      return template;
@@ -252,7 +258,8 @@
         }
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = configService.get(ConfigKeyEnum.shareCommentTextJD.getKey());
         SystemEnum system=userInfoService.getUserSystem(uid);
         template = configService.getValue(ConfigKeyEnum.shareCommentTextJD.getKey(),system);
      }
      return template;
   }
@@ -268,7 +275,8 @@
         }
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = configService.get(ConfigKeyEnum.shareCommentTextPDD.getKey());
         SystemEnum system=userInfoService.getUserSystem(uid);
         template = configService.getValue(ConfigKeyEnum.shareCommentTextPDD.getKey(),system);
      }
      return template;
@@ -282,7 +290,8 @@
         template = objct.getShareVIPTextTemplate();
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = configService.get(ConfigKeyEnum.shareCommentTextVIP.getKey());
         SystemEnum system=userInfoService.getUserSystem(uid);
         template = configService.getValue(ConfigKeyEnum.shareCommentTextVIP.getKey(),system);
      }
      return template;
@@ -296,7 +305,8 @@
         template = objct.getShareSuNingTextTemplate();
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = configService.get(ConfigKeyEnum.shareCommentTextSuNing.getKey());
         SystemEnum system=userInfoService.getUserSystem(uid);
         template = configService.getValue(ConfigKeyEnum.shareCommentTextSuNing.getKey(),system);
      }
      return template;
@@ -837,8 +847,8 @@
   }
   @Override
   public String getRecommendText(boolean coupon, String title, String sales, String couponAmount, String description) {
      String template = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey());
   public String getRecommendText(boolean coupon, String title, String sales, String couponAmount, String description, SystemEnum system) {
      String template = configService.getValue(ConfigKeyEnum.quickShareGoodsText.getKey(),system);
      String recommendText = template.replace("[商品标题]", title);
      if (!coupon) {
         recommendText = recommendText.replace("推荐理由:[推荐语]", "");
@@ -862,8 +872,8 @@
   
   @Override
   public String getCommentTextByTaoToken(boolean coupon, String taoToken, String zkPrice, String quanPrice) {
      String quickCommentText = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
   public String getCommentTextByTaoToken(boolean coupon, String taoToken, String zkPrice, String quanPrice, SystemEnum system) {
      String quickCommentText = configService.getValue(ConfigKeyEnum.quickShareTBCommentText.getKey(),system);
      String commentText = quickCommentText.replace("[原价]", zkPrice);
      commentText = commentText.replace("[淘口令]", TaoBaoUtil.filterTaoToken(taoToken));
      if (!coupon) {
@@ -876,8 +886,8 @@
   }
   
   @Override
   public String getCommentTextByLink(boolean coupon, String link, String zkPrice, String quanPrice, ConfigKeyEnum keyEnum) {
      String quickCommentText = configService.get(keyEnum.getKey());
   public String getCommentTextByLink(boolean coupon, String link, String zkPrice, String quanPrice, ConfigKeyEnum keyEnum, SystemEnum system) {
      String quickCommentText = configService.getValue(keyEnum.getKey(),system);
      String commentText = quickCommentText.replace("[原价]", zkPrice);
      commentText = commentText.replace("[链接]", link);
      if (!coupon) {
@@ -905,12 +915,12 @@
         BigDecimal amount = new BigDecimal(goods.getCouponInfo().getCouponValue());
         BigDecimal startFee = new BigDecimal(goods.getCouponInfo().getBounsLimit());
         BigDecimal zkPrice = new BigDecimal(commodityPrice);
         BigDecimal couponPrice  = zkPrice;
         if (zkPrice.compareTo(startFee) >= 0) {
            couponPrice = zkPrice.subtract(amount);
            BigDecimal couponPrice = zkPrice.subtract(amount);
            commentText = commentText.replace("[券后价]",BigDecimalUtil.getWithNoZera(couponPrice).toString());
         } else {
            commentText = commentText.replace("【券后价】[券后价]元", "");
            commentText = commentText.replace("[券后价]", BigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice)).toString());
         }
      } else {
         commentText = commentText.replace("领券抢购", "抢购");