From 0019bfde4bb8188bc7d8d9ae7878d117c7bd539c Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期四, 02 四月 2020 17:07:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   94 ++++++++++++++++++++--------------------------
 1 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
index 45a984c..767430c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -34,10 +34,8 @@
 import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
 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;
-import com.yeshi.fanli.entity.dynamic.GoodsPicture;
 import com.yeshi.fanli.entity.dynamic.ImgInfo;
 import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
 import com.yeshi.fanli.entity.dynamic.SimpleGoods;
@@ -48,7 +46,6 @@
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
 import com.yeshi.fanli.exception.dynamic.ActivityUserException;
 import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException;
-import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException;
 import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.activity.ActivityUserService;
@@ -735,8 +732,6 @@
 				}
 			}
 		}
-		
-		
 
 		// 鏁版嵁瀵规瘮 鍒犻櫎鍥剧墖
 		if (oldGoodsList != null && oldGoodsList.size() > 0) {
@@ -955,14 +950,15 @@
 			throw new GoodsEvaluateException(1, "璇峰~鍐欏埜鎴鏃堕棿");
 		}
 
-		 // 鍧囦笉楠岃瘉
+		// 鍧囦笉楠岃瘉
 		/*
 		 * if (!StringUtil.isNullOrEmpty(content) && kind != 3) { try {
 		 * convertLinkManager.convertLinkFromText(content,
-		 * Constant.LINK_TOKEN_VERIFY_UID, true); } catch (ConvertLinkExceptionException
-		 * e) { if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { throw new
-		 * GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } catch (Exception e) { throw
-		 * new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } }
+		 * Constant.LINK_TOKEN_VERIFY_UID, true); } catch
+		 * (ConvertLinkExceptionException e) { if
+		 * (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { throw new
+		 * GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } catch (Exception e) {
+		 * throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } }
 		 */
 
 		GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid);
@@ -1302,7 +1298,6 @@
 			totalImg++;
 		}
 
-		
 		// 娓呯悊鑰佸浘鐗�
 		if (listOld != null && listOld.size() > 0) {
 			for (int j = 0; j < listOld.size(); j++) {
@@ -1851,11 +1846,12 @@
 	}
 
 	@Override
-	public void addGoodsEvaluate(Long goodsId, Integer cid, String title, String comment) throws GoodsEvaluateException{
-		if (goodsId == null || cid == null || StringUtil.isNullOrEmpty(title)) {
+	public void addGoodsEvaluate(Long goodsId, List<ImgInfo> imgList, ActivityUser user, String title, String comment)
+			throws GoodsEvaluateException {
+		if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) {
 			throw new GoodsEvaluateException(1, "鐩稿叧鍙傛暟涓嶈兘涓虹┖");
 		}
-		
+
 		TaoBaoGoodsBrief goodsBrief = null;
 		try {
 			goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId);
@@ -1872,13 +1868,6 @@
 			throw new GoodsEvaluateException(1, "璇ュ晢鍝佹棤鍒�");
 		}
 
-		// 鍙戝竷鐢ㄦ埛
-		ActivityUser user = activityUserService.getRandomByDaTaoKeCid(cid);
-		if (user == null) {
-			throw new GoodsEvaluateException(1, "鏈壘鍒板彂甯冪敤鎴�");
-		}
-
-		
 		// 鐧藉簳鍥�
 		List<String> imgs = new ArrayList<>();
 		if (!StringUtil.isNullOrEmpty(goodsBrief.getPictUrlWhite())) {
@@ -1893,36 +1882,36 @@
 
 		// 鍟嗗搧鍥剧墖淇℃伅
 		int i = 0;
-		List<ImgInfo> imgList = new ArrayList<>();
-		for (String img : imgs) {
-			ImgInfo imgInfo = new ImgInfo();
-			imgInfo.setH(1);
-			imgInfo.setW(1);
-			imgInfo.setLarge(false);
-			imgInfo.setUrl(img);
-			imgInfo.setUrlHD(img);
-			if (i != 0) {
-				imgInfo.setType(ImgEnum.img);
-			} else {
-				imgInfo.setType(ImgEnum.goods);
-				SimpleGoods simpleGoods = new SimpleGoods();
-				simpleGoods.setGoodsId(goodsVO.getGoodsId());
-				simpleGoods.setGoodsType(goodsVO.getGoodsType());
-				simpleGoods.setState(goodsVO.getState());
-				CouponInfoVO couponInfo = goodsVO.getCouponInfo();
-				if (couponInfo == null) {
-					simpleGoods.setPrice(goodsVO.getZkPrice());
+		if (imgList == null || imgList.size() == 0)
+			for (String img : imgs) {
+				ImgInfo imgInfo = new ImgInfo();
+				imgInfo.setH(1);
+				imgInfo.setW(1);
+				imgInfo.setLarge(false);
+				imgInfo.setUrl(img);
+				imgInfo.setUrlHD(img);
+				if (i != 0) {
+					imgInfo.setType(ImgEnum.img);
 				} else {
-					simpleGoods.setPrice(goodsVO.getCouponPrice());
-					simpleGoods.setAmount(couponInfo.getAmount());
+					imgInfo.setType(ImgEnum.goods);
+					SimpleGoods simpleGoods = new SimpleGoods();
+					simpleGoods.setGoodsId(goodsVO.getGoodsId());
+					simpleGoods.setGoodsType(goodsVO.getGoodsType());
+					simpleGoods.setState(goodsVO.getState());
+					CouponInfoVO couponInfo = goodsVO.getCouponInfo();
+					if (couponInfo == null) {
+						simpleGoods.setPrice(goodsVO.getZkPrice());
+					} else {
+						simpleGoods.setPrice(goodsVO.getCouponPrice());
+						simpleGoods.setAmount(couponInfo.getAmount());
+					}
+					imgInfo.setGoods(simpleGoods);
+					imgInfo.setGoodsVO(goodsVO);
 				}
-				imgInfo.setGoods(simpleGoods);
-				imgInfo.setGoodsVO(goodsVO);
+				imgList.add(imgInfo);
+				i++;
 			}
-			imgList.add(imgInfo);
-			i++;
-		}
-		
+
 		// 璇勮鍐呭
 		CommentInfo commentInfo = new CommentInfo();
 		commentInfo.setId(UUID.randomUUID().toString().replace("-", ""));
@@ -1942,14 +1931,15 @@
 				commentText = commentText.replace("[鍒稿悗浠穄",
 						MoneyBigDecimalUtil.getWithNoZera(goodsVO.getCouponPrice()) + "");
 			}
-			commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n","\r\n");
+			commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n",
+					"\r\n");
 			commentInfo.setContent(commentText);
 			commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc());
 		}
 
 		List<CommentInfo> commentsNew = new ArrayList<>();
 		commentsNew.add(commentInfo);
-		
+
 		// 涓�琛屾樉绀哄灏戜釜鍥剧墖
 		int lineNum = 0;
 		if (imgs.size() > 0) {
@@ -1963,7 +1953,6 @@
 				lineNum = 3;
 			}
 		}
-		
 
 		GoodsEvaluate goodsEvaluate = new GoodsEvaluate();
 		goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", ""));
@@ -2195,7 +2184,7 @@
 				imgList.add(imgInfo);
 				i++;
 			}
-			
+
 			goodsEvaluate.setGoods(goodsVO);
 			goodsEvaluate.setImgList(imgList);
 			goodsEvaluateDao.save(goodsEvaluate);
@@ -2246,7 +2235,6 @@
 		}
 		return descNew;
 	}
-
 
 	@Override
 	public void updateTaoBaoGoods(TaoBaoGoodsBrief goods) {

--
Gitblit v1.8.0