From 0ebe28172283b3c3e1dfdcd5b1d283148bda97c3 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 22 六月 2020 10:16:43 +0800
Subject: [PATCH] 好单库商品口令生成

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
index ec7abe5..18cec44 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -45,12 +45,14 @@
 import com.yeshi.fanli.entity.dynamic.SimpleGoods;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.entity.taobao.PidUser;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoLink;
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
 import com.yeshi.fanli.exception.dynamic.ActivityUserException;
 import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException;
 import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException;
+import com.yeshi.fanli.exception.share.ShareGoodsException;
 import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.activity.ActivityUserService;
@@ -2009,6 +2011,7 @@
 			commentInfo.setContent(comment);
 			commentInfo.setType("");
 		} else {
+			goodsBrief.setCouponLink(null);
 			String token = shareGoodsService.createTaoBaoToken(Constant.LINK_TOKEN_VERIFY_UID, goodsBrief);
 			String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
 			String commentText = template.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(token));
@@ -2122,27 +2125,33 @@
 			i++;
 		}
 
+		
+		// 鐢熸垚鍙d护
+		String token = null;
+		try {
+			TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(Constant.LINK_TOKEN_VERIFY_UID, goodsBrief.getAuctionId(), "1");
+			token = taoBaoLink.getTaoToken();
+		} catch (ShareGoodsException e) {
+			e.printStackTrace();
+			throw new GoodsEvaluateException(1, "杞摼澶辫触");
+		}
+		 
+		 
+		String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
+		String commentText = template.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(token));
+		if (!goodsVO.isHasCoupon()) {
+			commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
+			commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
+			commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n",
+					"\r\n");
+		}
 		// 璇勮鍐呭
 		CommentInfo commentInfo = new CommentInfo();
 		commentInfo.setNeedSpin(true);
 		commentInfo.setId(UUID.randomUUID().toString().replace("-", ""));
 		commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon);
-		if (!StringUtil.isNullOrEmpty(comment)) {
-			commentInfo.setContent(comment);
-			commentInfo.setType("");
-		} else {
-			String token = shareGoodsService.createTaoBaoToken(Constant.LINK_TOKEN_VERIFY_UID, goodsBrief);
-			String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
-			String commentText = template.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(token));
-			if (!goodsVO.isHasCoupon()) {
-				commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
-				commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
-				commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n",
-						"\r\n");
-			}
-			commentInfo.setContent(commentText);
-			commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc());
-		}
+		commentInfo.setContent(commentText);
+		commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc());
 
 		List<CommentInfo> commentsNew = new ArrayList<>();
 		commentsNew.add(commentInfo);

--
Gitblit v1.8.0