From 2e9aa4267b4e6df56ab3166d72ab9edf87322ef7 Mon Sep 17 00:00:00 2001
From: yj <Administrator@192>
Date: 星期四, 05 三月 2020 22:22:01 +0800
Subject: [PATCH] 发圈

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java |   80 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 73 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java
index b73d88e..8accb1d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java
@@ -24,6 +24,7 @@
 import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
 import com.yeshi.fanli.entity.dynamic.ImgInfo;
 import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
+import com.yeshi.fanli.entity.dynamic.ListComment;
 import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -41,8 +42,6 @@
 import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
 import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
-import com.yeshi.fanli.util.jd.JDApiUtil;
-import com.yeshi.fanli.util.jd.JDUtil;
 import com.yeshi.fanli.vo.goods.GoodsDetailVO;
 
 import net.sf.json.JSONObject;
@@ -152,14 +151,14 @@
 	 * 淇濆瓨淇℃伅
 	 * 
 	 * @param callback
-	 * @param special
-	 *            0a39676f138c4dcba722e321d43c4284
+	 * @param pid
+	 * @param kind : 1鍗曞搧  2澶氬搧 3娲诲姩
 	 * @param out
 	 */
-	@RequestMapping(value = "saveSingleGoodsCoupon")
-	public void saveSingleGoodsCoupon(String callback, String pid, CommentInfo commentInfo, PrintWriter out) {
+	@RequestMapping(value = "saveCurrencyCoupon")
+	public void saveCurrencyCoupon(String callback, String pid, int kind, CommentInfo commentInfo, PrintWriter out) {
 		try {
-			goodsEvaluateService.saveSingleGoodsCoupon(pid, commentInfo);
+			goodsEvaluateService.saveCurrencyCoupon(pid, kind,commentInfo);
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛"));
 		} catch (GoodsEvaluateException e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -304,8 +303,75 @@
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触"));
 			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
+			LogHelper.test(e);
 		}
 	}
+	
+	
+	/**
+	 * 
+	 * @param callback
+	 * @param comments
+	 * @param out
+	 */
+	@RequestMapping(value = "saveGoodsComment")
+	public void saveGoodsComment(String callback, String id, int kind, ListComment comments, PrintWriter out) {
+		try {
+			if (StringUtil.isNullOrEmpty(id)) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇峰厛淇濆瓨鎺ㄨ崘璇俊鎭�"));
+				return;
+			}
+			if (comments == null) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏂囨湰鍐呭涓虹┖"));
+				return;
+			}
+			goodsEvaluateService.saveGoodsComment(id, kind, comments.getComment());
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎴愬姛"));
+		} catch (GoodsEvaluateException e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触"));
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 
+	 * @param callback
+	 * @param comments
+	 * @param out
+	 */
+	@RequestMapping(value = "getGoodsComment")
+	public void getGoodsComment(String callback, String id, PrintWriter out) {
+		try {
+			if (StringUtil.isNullOrEmpty(id)) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇峰厛淇濆瓨鎺ㄨ崘璇俊鎭�"));
+				return;
+			}
+			
+			List<CommentInfo> newList = new ArrayList<>();
+			GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
+			if (goodsEvaluate != null) {
+				List<CommentInfo> comments = goodsEvaluate.getComments();
+				if (comments != null && comments.size() > 0) {
+					for (CommentInfo commentInfo: comments) {
+						CommentInfoEnum typeEnum = commentInfo.getTypeEnum();
+						if (typeEnum == CommentInfoEnum.goodsCoupon) {
+							newList.add(commentInfo);
+						}
+					}
+				}
+			}
+			JSONObject data = new JSONObject();
+			data.put("list", newList);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触"));
+			e.printStackTrace();
+		}
+	}
+	
 
 	/**
 	 * 鑾峰彇澶氫釜鍟嗗搧淇℃伅

--
Gitblit v1.8.0