From 28cf328a098334b51a3e9d2d56f983fb8c862211 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 23 五月 2020 09:54:38 +0800
Subject: [PATCH] 足迹、收藏订单兼容新需求

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java |   64 +++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 22 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 89ad2ca..d264993 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
@@ -35,6 +35,7 @@
 import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
+import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
 import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
@@ -55,6 +56,7 @@
 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;
@@ -104,6 +106,9 @@
 
 	@Resource
 	private HongBaoManageService hongBaoManageService;
+
+	@Resource
+	private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
 
 	@Resource
 	private MonitorService monitorService;
@@ -254,6 +259,13 @@
 			commentText = commentText.replace("[鍒稿悗浠穄", TaoBaoUtil.getAfterUseCouplePrice(goods) + "");
 		}
 
+		commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
+		return commentText;
+	}
+
+	// 娣樺疂鍒嗕韩娲诲姩
+	public static String getTaoBaoActiivtyERCodeContentNew(String template, String token) {
+		String commentText = template.replace("[娣樺彛浠", token);
 		commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
 		return commentText;
 	}
@@ -492,7 +504,7 @@
 			TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
 
 			if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) {
-				ConfigParamsDTO dto = hongBaoManageService.getShowComputeRate(platform, version);
+				ConfigParamsDTO dto = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version);
 				GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto);
 				shareInfo.setGoodsInfo(goodsInfo);
 			}
@@ -561,15 +573,14 @@
 								taoBaoLink.getGoods(), shareInfo.getToken()));
 			}
 
-			if (VersionUtil.greaterThan_2_0_7(platform, version)) {
-				shareInfo.setWxErCode(
-						getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()),
-								taoBaoLink.getGoods(), shareInfo.getToken()));
-			} else {
-				shareInfo.setWxErCode(
-						getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
-								taoBaoLink.getGoods(), shareInfo.getToken()));
-			}
+			// if (VersionUtil.greaterThan_2_0_7(platform, version)) {
+			// shareInfo.setWxErCode(
+			// getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()),
+			// taoBaoLink.getGoods(), shareInfo.getToken()));
+			// } else {
+			shareInfo.setWxErCode(getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()),
+					taoBaoLink.getGoods(), shareInfo.getToken()));
+			// }
 
 			// 鎻愮ず鍥炬枃鍐呭
 			String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), platform,
@@ -611,7 +622,11 @@
 				if (!coupon) {
 					recommendText = recommendText.replace("鎺ㄨ崘鐞嗙敱:[鎺ㄨ崘璇璢", "");
 				} else {
-					recommendText = recommendText.replace("[鎺ㄨ崘璇璢", goods.getDescription());
+					if (!StringUtil.isNullOrEmpty(goods.getDescription())) {
+						recommendText = recommendText.replace("[鎺ㄨ崘璇璢", goods.getDescription());
+					} else {
+						recommendText = recommendText.replace("鎺ㄨ崘鐞嗙敱:[鎺ㄨ崘璇璢", "");
+					}
 				}
 
 				String sales = TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day());
@@ -646,8 +661,9 @@
 			shareInfo.setRecommendText(deleteBlankLine(recommendText));
 
 			// 璁剧疆璇勮鏂囨湰閫夐」
-			shareInfo.setCommentTextChoiceList(getCommentChoiceList(shareInfo.getCommentText(), null, inviteCode,
-					TaoBaoUtil.getGoodsHongBaoMoney(taoBaoLink.getGoods(), hongBaoManageService.getVIPFanLiRate())));
+			shareInfo.setCommentTextChoiceList(
+					getCommentChoiceList(shareInfo.getCommentText(), null, inviteCode, TaoBaoUtil.getGoodsHongBaoMoney(
+							taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
 
 			out.print(JsonUtil.loadTrueResult(
 					JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -726,8 +742,8 @@
 		shareInfo.setCommentTexts(new ArrayList<>());
 
 		if (needGoods)
-			shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods,
-					hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())));
+			shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, orderHongBaoMoneyComputeService
+					.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())));
 
 		boolean hasCoupon = false;
 		if (couponInfo != null) {
@@ -816,7 +832,7 @@
 
 		// 璁剧疆璇勮鏂囨湰閫夐」
 		shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
-				JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPFanLiRate())));
+				JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
 
 		out.print(JsonUtil.loadTrueResult(
 				JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -889,7 +905,7 @@
 					.setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods,
 							new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
 									hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
-									hongBaoManageService.getVIPFanLiRate())));
+									hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
 		}
 
 		// 鍒涘缓鍙d护
@@ -986,7 +1002,7 @@
 
 		// 璁剧疆璇勮鏂囨湰閫夐」
 		shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
-				PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getVIPFanLiRate())));
+				PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
 
 		out.print(JsonUtil.loadTrueResult(
 				JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -1390,8 +1406,12 @@
 
 		JSONArray array = new JSONArray();
 		JSONObject data = new JSONObject();
+		
+		boolean notBackSuVip = false;
+		if (!VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion()))
+			notBackSuVip = true;
 
-		List<UserShareGoodsGroup> list = userShareGoodsGroupService.listByRecordId(recordId);
+		List<UserShareGoodsGroup> list = userShareGoodsGroupService.listByRecordId(recordId, notBackSuVip);
 		if (list == null || list.size() == 0) {
 			data.put("title", "鍒嗕韩鍟嗗搧");
 			data.put("count", 0);
@@ -1424,7 +1444,7 @@
 			}
 		}
 
-		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+		ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
 				acceptData.getVersion());
 
 		Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
@@ -1496,7 +1516,7 @@
 		}
 
 		GoodsDetailVO goodsDetail = null;
-		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+		ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
 				acceptData.getVersion());
 		paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
 
@@ -1531,7 +1551,7 @@
 
 		String template = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey());
 		template = template.replace("[鍟嗗搧鏍囬]", goodsDetail.getTitle()).replace("[閿�閲廬", goodsDetail.getSalesCount());
-		if (StringUtil.isNullOrEmpty(goodsDetail.getDescription())) {
+		if (!StringUtil.isNullOrEmpty(goodsDetail.getDescription())) {
 			template = template.replace("[鎺ㄨ崘璇璢", goodsDetail.getDescription());
 		} else {
 			template = template.replace("鎺ㄨ崘璇�:[鎺ㄨ崘璇璢", "");

--
Gitblit v1.8.0