From d0f12da013131cd291cec6e81a12d661c02c4bf4 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 17 三月 2020 12:14:27 +0800
Subject: [PATCH] 2.1

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
index 79913cc..c859a73 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -2,6 +2,7 @@
 
 import java.io.PrintWriter;
 import java.lang.reflect.Type;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -61,6 +62,7 @@
 import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
@@ -620,6 +622,16 @@
 						return new JsonPrimitive(value.getVlaue());
 					}
 				}
+			}).registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
+				@Override
+				public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
+					if (value == null) {
+						return new JsonPrimitive("");
+					} else {
+						// 淇濈暀2浣嶅皬鏁�
+						return new JsonPrimitive(MoneyBigDecimalUtil.getWithNoZera(value)+"");
+					}
+				}
 			}).registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
 				@Override
 				public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
@@ -809,7 +821,7 @@
 							continue;
 						}
 
-						String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode);
+						String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl());
 						if (!StringUtil.isNullOrEmpty(jumpLink)) {
 							list.add(jumpLink);
 						}
@@ -821,7 +833,7 @@
 							if (imgInfo.getGoodsVO() != null)
 								if (imgInfo.getGoodsVO().getGoodsId().longValue() == goodsId.longValue()
 										&& imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) {
-									String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode);
+									String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl());
 									if (!StringUtil.isNullOrEmpty(jumpLink)) {
 										list.add(jumpLink);
 									}
@@ -831,7 +843,7 @@
 					} else if (type == 2 || type == 3) {
 						for (ImgInfo imgInfo : imgs) {
 							if (imgInfo.getGoodsVO() != null) {
-								String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode);
+								String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl() );
 								if (!StringUtil.isNullOrEmpty(jumpLink)) {
 									list.add(jumpLink);
 								}
@@ -879,7 +891,7 @@
 		}
 	}
 
-	private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode) {
+	private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode, String mainPic) {
 		String jumpLink = null;
 		if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
 			TaoBaoLink taoBaoLink = null;
@@ -911,7 +923,7 @@
 		}
 
 		FileUploadResult uploadResult = qrCodeService.drawDynamicGoodsPoster(jumpLink, user.getPortrait(), inviteCode,
-				goodsVO);
+				mainPic, goodsVO);
 		if (uploadResult != null) {
 			return uploadResult.getUrl();
 		}
@@ -986,6 +998,20 @@
 			return;
 		}
 
+		// 鏇挎崲浠锋牸
+		if (goodsEvaluate.getType() == EvaluateEnum.single) {
+			GoodsDetailVO goods = goodsEvaluate.getGoods();
+			newText = newText.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) +"");
+			if (!goods.isHasCoupon()) {
+				newText = newText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
+				newText = newText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
+			} else {
+				newText = newText.replace("[鍒稿悗浠穄", MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+"");
+			}
+			newText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
+		}
+		
+		
 		JSONObject data = new JSONObject();
 		data.put("text", newText);
 		out.print(JsonUtil.loadTrueResult(data));

--
Gitblit v1.8.0