From 207dc8655711cddac2653e18b51e58a88dba2084 Mon Sep 17 00:00:00 2001
From: yj <Administrator@192>
Date: 星期五, 06 三月 2020 18:14:36 +0800
Subject: [PATCH] 发圈处理

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
index 0f63cda..0a92bff 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -24,6 +24,7 @@
 import com.google.gson.GsonBuilder;
 import com.yeshi.fanli.dto.ConfigParamsDTO;
 import com.yeshi.fanli.dto.jd.JDCouponInfo;
+import com.yeshi.fanli.dto.jd.JDPingouInfo;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.dto.share.ShareGoodsRecordDTO;
 import com.yeshi.fanli.entity.accept.AcceptData;
@@ -35,7 +36,6 @@
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
 import com.yeshi.fanli.entity.goods.CommonGoods;
-import com.yeshi.fanli.entity.goods.ShareGoodsTextTemplate;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -244,14 +244,11 @@
 		}
 	}
 
-	public static String getERCodeContent(String template, TaoBaoGoodsBrief goods, String token) {
-		 return template.replace("[娣樺彛浠", token);
-	}
 
 	
 	public static String getERCodeContentNew(String template, TaoBaoGoodsBrief goods, String token) {
 		String commentText = template.replace("[鍘熶环]", goods.getZkPrice().toString());
-		commentText = commentText.replace("[鍙d护]", token);
+		commentText = commentText.replace("[娣樺彛浠", token);
 		if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
 			commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
 			commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
@@ -559,7 +556,7 @@
 				shareInfo.setClickUrl(getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()),
 						taoBaoLink.getGoods(), shareInfo.getToken()));
 			} else if (!VersionUtil.greaterThan_2_0_2(platform, version)) {
-				shareInfo.setClickUrl(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
+				shareInfo.setClickUrl(getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
 						taoBaoLink.getGoods(), shareInfo.getToken()));
 			}
 
@@ -567,7 +564,7 @@
 				shareInfo.setWxErCode(getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()),
 					taoBaoLink.getGoods(), shareInfo.getToken()));
 			} else {
-				shareInfo.setWxErCode(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
+				shareInfo.setWxErCode(getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
 						taoBaoLink.getGoods(), shareInfo.getToken()));
 			}
 			
@@ -624,7 +621,7 @@
 
 				String quickCommentText = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
 				commentText = quickCommentText.replace("[鍘熶环]", goods.getZkPrice().toString());
-				commentText = commentText.replace("[鍙d护]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
+				commentText = commentText.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
 				if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
 					commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
 					commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
@@ -782,15 +779,31 @@
 		if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
 			String template2 = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey());
 			recommendText = template2.replace("[鍟嗗搧鏍囬]", jdGoods.getSkuName());
-			// 鏃犳帹鑽愯
 			recommendText = recommendText.replace("鎺ㄨ崘鐞嗙敱:[鎺ㄨ崘璇璢", "");
-
 			String sales = JDUtil.getSaleCount(jdGoods.getInOrderCount30Days());
 			if (sales.equals("0")) {
 				recommendText = recommendText.replace("閿�閲�:[閿�閲廬", "");
 			} else {
 				recommendText = recommendText.replace("[閿�閲廬", sales.replace("涓�", "w"));
 			}
+			
+			BigDecimal price = jdGoods.getPrice();
+			JDPingouInfo pinGouInfo = jdGoods.getPinGouInfo();
+			if (pinGouInfo != null) {
+				price = pinGouInfo.getPingouPrice();
+			}
+			
+			String template3 = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey());
+			commentText = template3.replace("[鍘熶环]", BigDecimalUtil.getWithNoZera(price).toString());
+			if (!hasCoupon) {
+				recommendText = recommendText.replace("浼樻儬鍒�:[鍒搁潰棰漖鍏�", "");
+				commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
+				commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
+			} else {
+				recommendText = recommendText.replace("[鍒搁潰棰漖", BigDecimalUtil.getWithNoZera(couponInfo.getDiscount()).toString());
+				commentText = commentText.replace("[鍒稿悗浠穄", BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(jdGoods)).toString());
+			}
+			commentText = commentText.replace("[閾炬帴]", jumpLink);
 		} else {
 			commentText = shareInfo.getShareText();
 			recommendText = shareInfo.getDescText();

--
Gitblit v1.8.0