From 8a54915d3c39d9d8d7e90c0971d1e19d0eb76622 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期五, 12 六月 2020 14:37:04 +0800
Subject: [PATCH] 券统计

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 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 f5ce570..b0e9f89 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
@@ -71,6 +71,7 @@
 import com.yeshi.fanli.service.inter.user.QrCodeService;
 import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.cloud.UserCloudService;
 import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
 import com.yeshi.fanli.util.Constant;
@@ -158,6 +159,9 @@
 
 	@Resource
 	private CommonShareInfoService commonShareInfoService;
+
+	@Resource
+	private UserCloudService userCloudService;
 
 	@Resource(name = "taskExecutor")
 	private TaskExecutor executor;
@@ -637,12 +641,16 @@
 			if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
 				listNew.addAll(list);
 			} else if (list.size() > 0) { // 娲诲姩鍥剧墖涓嶅厑璁歌烦杞�
+				
+				// 浜戝彂鍗曟槸鍚﹀紑鍚�
+				String cloudState = configService.getByVersion(ConfigKeyEnum.robotCloudOpen.getKey(), acceptData.getPlatform(),
+						Integer.parseInt(acceptData.getVersion()));
+				boolean cloudOpen = false;
+				if (!StringUtil.isNullOrEmpty(cloudState) && "1".equals(cloudState)) {
+					cloudOpen = true;
+				}
+				
 				for (GoodsEvaluate goodsEvaluate : list) {
-					if (goodsEvaluate.getType() != EvaluateEnum.activity) {
-						listNew.add(goodsEvaluate);
-						continue;
-					}
-
 					GoodsEvaluate evaluateNew = new GoodsEvaluate();
 					try {
 						PropertyUtils.copyProperties(evaluateNew, goodsEvaluate);
@@ -650,6 +658,19 @@
 						e.printStackTrace();
 						continue;
 					}
+					
+					EvaluateEnum evaluateEnum = evaluateNew.getType();
+					// 鍗曞搧 娲诲姩鍙互涓�閿簯鍙戝崟
+					if (evaluateEnum == EvaluateEnum.activity || evaluateEnum == EvaluateEnum.single) {
+						evaluateNew.setCloud(cloudOpen);
+					}
+					
+					if (evaluateEnum != EvaluateEnum.activity) {
+						listNew.add(evaluateNew);
+						continue;
+					}
+
+					
 					// 璺宠浆杩囨浮椤�
 					// String jumpLink =
 					// configService.get(ConfigKeyEnum.activityDetailLink.getKey())
@@ -813,8 +834,8 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "evaluateShare", method = RequestMethod.POST)
-	public void evaluateShare(AcceptData acceptData, Long uid, String id, Integer type, Long goodsId, Integer goodsType,
-			PrintWriter out) {
+	public void evaluateShare(AcceptData acceptData, Long uid, String id, Integer type, String goodsId,
+			Integer goodsType, PrintWriter out) {
 		try {
 			if (uid == null) {
 				out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
@@ -826,7 +847,7 @@
 				return;
 			}
 
-			if (type == 1 && (goodsId == null || goodsType == null)) {
+			if (type == 1 && (StringUtil.isNullOrEmpty(goodsId) || goodsType == null)) {
 				out.print(JsonUtil.loadFalseResult("鍟嗗搧鍙傛暟涓嶈兘涓虹┖"));
 				return;
 			}
@@ -908,7 +929,7 @@
 					if (type == 1) {
 						for (ImgInfo imgInfo : imgs) {
 							if (imgInfo.getGoodsVO() != null)
-								if (imgInfo.getGoodsVO().getGoodsId().longValue() == goodsId.longValue()
+								if (imgInfo.getGoodsVO().getGoodsId().equalsIgnoreCase(goodsId)
 										&& imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) {
 									String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode,
 											imgInfo.getUrl());
@@ -985,7 +1006,8 @@
 		if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
 			TaoBaoLink taoBaoLink = null;
 			try {
-				taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), goodsVO.getGoodsId(), relationId);
+				taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()),
+						relationId);
 			} catch (ShareGoodsException e) {
 				e.printStackTrace();
 			}
@@ -993,7 +1015,7 @@
 					configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), taoBaoLink.getGoods(),
 					TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
 		} else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
-			JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsVO.getGoodsId());
+			JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsVO.getGoodsId()));
 			if (jdGoods == null) {
 				return null;
 			}
@@ -1007,8 +1029,8 @@
 			jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
 					user.getId() + "");
 		} else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
-			jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsVO.getGoodsId(), PinDuoDuoApiUtil.PID_SHARE + "",
-					user.getId() + "");
+			jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsVO.getGoodsId()),
+					PinDuoDuoApiUtil.PID_SHARE + "", user.getId() + "");
 		}
 
 		FileUploadResult uploadResult = qrCodeService.drawDynamicGoodsPoster(jumpLink, user.getPortrait(), inviteCode,
@@ -1102,7 +1124,7 @@
 			} 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");
+			newText = 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();
@@ -1611,4 +1633,5 @@
 			}
 		});
 	}
+	
 }

--
Gitblit v1.8.0