From 8ebf78f9d9a2663f53f09346abdd14c5964fdfeb Mon Sep 17 00:00:00 2001
From: yj <Administrator@192>
Date: 星期二, 03 三月 2020 19:11:00 +0800
Subject: [PATCH] 发圈修改

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java |   57 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 38 insertions(+), 19 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 6b89a94..0592d5a 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
@@ -33,7 +33,6 @@
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.common.JumpDetailV2;
 import com.yeshi.fanli.entity.dynamic.CommentInfo;
-import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum;
 import com.yeshi.fanli.entity.dynamic.DynamicInfo;
 import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
 import com.yeshi.fanli.entity.dynamic.GoodsEvaluate.EvaluateEnum;
@@ -71,6 +70,7 @@
 import com.yeshi.fanli.vo.goods.GoodsDetailVO;
 import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
 
+import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 
 /**
@@ -123,7 +123,7 @@
 
 	@Resource
 	private QrCodeService qrCodeService;
-	
+
 	@Resource
 	private ConvertLinkManager convertLinkManager;
 
@@ -240,7 +240,7 @@
 			// 2.0.7杩斿洖鍙戝湀+娲诲姩+瀛﹂櫌+绱犳潗
 			list.add(map.get(TYPE_FAQUAN));
 			list.add(map.get(TYPE_HUODONG));
-			// list.add(map.get(TYPE_XUEYUAN));
+//			list.add(map.get(TYPE_XUEYUAN));
 			list.add(map.get(TYPE_SUCAI));
 
 		} else if (VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) {
@@ -590,6 +590,7 @@
 	 */
 	@RequestMapping(value = "getDynamicList", method = RequestMethod.POST)
 	public void getDynamicListNew(AcceptData acceptData, Integer page, Long cid, String subId, PrintWriter out) {
+
 		try {
 			int type = 1;
 			if (cid == TYPE_FAQUAN){
@@ -669,12 +670,31 @@
 			});
 			Gson gson = gsonBuilder.create();
 			long count = goodsEvaluateService.countValidMaterials(type);
-
+			
+			String listStr = gson.toJson(list);
+			JSONArray array = JSONArray.fromObject(listStr);
+			for (int i = 0; i< array.size() ; i++) {
+				Object object = array.get(i);
+				JSONObject json = JSONObject.fromObject(object);
+				Object shareNum = json.get("shareNum");
+				if (shareNum != null) {
+					int num = Integer.parseInt(shareNum.toString());
+					if (num >= 10000) {
+						double sales = num;
+						String salesCountMidea = String.format("%.1f", sales / 10000);
+						json.put("shareNum", salesCountMidea + "涓�");
+					} 
+				}
+//				array.add(json);
+			}
+			
+			
 			JSONObject data = new JSONObject();
 			data.put("count", count);
-			data.put("list", gson.toJson(list));
+			data.put("list", array);
 			out.print(JsonUtil.loadTrueResult(data));
 		} catch (Exception e) {
+			e.printStackTrace();
 			out.print(JsonUtil.loadFalseResult(1, "鏌ヨ淇℃伅澶辫触"));
 			LogHelper.errorDetailInfo(e);
 		}
@@ -773,7 +793,7 @@
 						continue;
 					}
 
-					String jumpLink = getJumpLink(goodsVO, user,relationId, inviteCode);
+					String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode);
 					if (!StringUtil.isNullOrEmpty(jumpLink)) {
 						list.add(jumpLink);
 					}
@@ -785,7 +805,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);
 								if (!StringUtil.isNullOrEmpty(jumpLink)) {
 									list.add(jumpLink);
 								}
@@ -795,7 +815,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);
 							if (!StringUtil.isNullOrEmpty(jumpLink)) {
 								list.add(jumpLink);
 							}
@@ -816,7 +836,6 @@
 				}
 			}
 		}
-	
 
 		Integer shareCount = goodsEvaluate.getShareNum();
 		if (shareCount == null) {
@@ -838,21 +857,22 @@
 		data.put("list", list);
 		out.print(JsonUtil.loadTrueResult(data));
 	}
-	
+
 	@Resource
 	private ShareGoodsService shareGoodsService;
 
-	private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user,String relationId, String inviteCode) {
+	private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode) {
 		String jumpLink = null;
 		if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
-			TaoBaoLink taoBaoLink=null;
+			TaoBaoLink taoBaoLink = null;
 			try {
 				taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), goodsVO.getGoodsId(), relationId);
 			} catch (ShareGoodsException e) {
 				e.printStackTrace();
 			}
-			
-			jumpLink =configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()).replace("[娣樺彛浠", taoBaoLink.getTaoToken());
+
+			jumpLink = configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()).replace("[娣樺彛浠",
+					taoBaoLink.getTaoToken());
 		} else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
 			JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsVO.getGoodsId());
 			if (jdGoods == null) {
@@ -933,12 +953,12 @@
 				}
 			}
 		}
-		
+
 		try {
-			text=convertLinkManager.convertLinkFromText(text, uid, true);
+			text = convertLinkManager.convertLinkFromText(text, uid, true);
 		} catch (Exception e) {
 			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult("杞摼澶辫触"));
+			out.print(JsonUtil.loadFalseResult("璇勮鐢熸垚澶辫触"));
 			return;
 		}
 
@@ -946,6 +966,5 @@
 		data.put("text", text);
 		out.print(JsonUtil.loadTrueResult(data));
 	}
-	
-}
 
+}

--
Gitblit v1.8.0