From 2f2860b50f24e5e3598d223db03d43df61d95c97 Mon Sep 17 00:00:00 2001
From: yj <Administrator@192>
Date: 星期五, 13 三月 2020 16:31:30 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   57 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 29 insertions(+), 28 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 5e2f0ca..663d431 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
@@ -166,6 +166,7 @@
 			record.setId(id);
 			record.setShareNumReal(0);
 			record.setCreateTime(new Date());
+			record.setUpdateTime(new Date());
 			goodsEvaluateDao.save(record);
 		} else {
 			GoodsEvaluate resultObj = goodsEvaluateDao.getById(id);
@@ -179,6 +180,7 @@
 			resultObj.setStartTime(record.getStartTime());
 			resultObj.setEndTime(record.getEndTime());
 			resultObj.setTitle(tilte);
+			resultObj.setUpdateTime(new Date());
 			goodsEvaluateDao.save(resultObj);
 		}
 		return id;
@@ -488,9 +490,15 @@
 				String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl,
 						JDApiUtil.POSITION_SHARE + "", "1");
 				String template = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey());
+				if (jumpLink == null) {
+					throw new GoodsEvaluateException(1, "璇ュ晢鍝佽浆閾惧け璐�");
+				}
 				commentText = template.replace("[閾炬帴]", jumpLink);
 			} else if (goodsType == Constant.SOURCE_TYPE_PDD) {
 				String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", "1");
+				if (jumpLink == null) {
+					throw new GoodsEvaluateException(1, "璇ュ晢鍝佽浆閾惧け璐�");
+				}
 				String template = configService.get(ConfigKeyEnum.quickSharePDDCommentText.getKey());
 				commentText = template.replace("[閾炬帴]", jumpLink);
 			}
@@ -513,6 +521,7 @@
 			commentsNew.add(commentInfo);
 			resultObj.setComments(commentsNew);
 		}
+		resultObj.setUpdateTime(new Date());
 		goodsEvaluateDao.save(resultObj);
 
 		// 鍒犻櫎鍥剧墖
@@ -845,6 +854,7 @@
 		}
 
 		resultObj.setComments(comments);
+		resultObj.setUpdateTime(new Date());
 		goodsEvaluateDao.save(resultObj);
 	}
 
@@ -1537,7 +1547,6 @@
 
 		List<GoodsEvaluate> listNew = new ArrayList<>();
 		for (GoodsEvaluate goodsEvaluate : list) {
-
 			GoodsEvaluate evaluateNew = new GoodsEvaluate();
 			try {
 				PropertyUtils.copyProperties(evaluateNew, goodsEvaluate);
@@ -1546,12 +1555,13 @@
 				continue;
 			}
 
-			int comment = 0;
 			List<CommentInfo> comments = evaluateNew.getComments();
 			if (comments != null && comments.size() > 0) {
 				EvaluateEnum typeEnum = evaluateNew.getType();
 				List<CommentInfo> commentNew = new ArrayList<>();
 
+				boolean singleCoupn = true;
+				boolean currencyCoupon = true;
 				for (CommentInfo commentInfo : comments) {
 					if (StringUtil.isNullOrEmpty(commentInfo.getContent())
 							&& StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
@@ -1575,6 +1585,7 @@
 								if (goods.isHasCoupon()) {
 									content = content.replace("[鍒稿悗浠穄",MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+"");
 								} else {
+									singleCoupn = false;
 									content = content.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
 									content = content.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
 								}
@@ -1584,8 +1595,6 @@
 						}
 					}
 					
-					
-					comment++;
 					CommentInfoEnum typeComment = commentInfoNew.getTypeEnum();
 					if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) {
 						GoodsDetailVO goods = evaluateNew.getGoods();
@@ -1616,9 +1625,11 @@
 								commentNew.add(commentInfoNew);
 								continue;
 							} else {
+								currencyCoupon = false;
 								continue;
 							}
 						} else {
+							currencyCoupon = false;
 							continue;
 						}
 					}
@@ -1628,11 +1639,11 @@
 				evaluateNew.setComments(commentNew);
 
 				if (typeEnum != null && typeEnum == EvaluateEnum.single) {
-					if (comment > 0 && commentNew.size() == 0) { // 鎵�鏈夊埜璇勮涓嬫灦
+					if (!currencyCoupon && !singleCoupn) { // 鎵�鏈夊埜璇勮涓嬫灦
 						GoodsDetailVO goods = evaluateNew.getGoods();
 						if (goods != null) {
 							goods.setState(1); // 璇勮涓嶅瓨鍦� 涓嬫灦
-							LogHelper.test("鑾峰彇鍒楄〃鍟嗗搧涓嬫灦1");
+							evaluateNew.setRemarks("璇勮楠岃瘉涓嬫灦");
 						}
 
 						List<ImgInfo> imgList = evaluateNew.getImgList();
@@ -1641,7 +1652,7 @@
 								SimpleGoods simpleGoods = imgInfo.getGoods();
 								if (simpleGoods != null) {
 									simpleGoods.setState(1);
-									LogHelper.test("鑾峰彇鍒楄〃鍟嗗搧涓嬫灦2");
+									simpleGoods.setRemarks("璇勮楠岃瘉涓嬫灦");
 								}
 							}
 
@@ -1727,6 +1738,7 @@
 					if (goodsNew != null) {
 						goodsEvaluate.setGoods(goodsNew);
 					} else {
+						goodsEvaluate.setRemarks("鏇存柊-浣嶇疆鎵惧埌鍟嗗搧淇℃伅");
 						goodsEvaluate.setState(0); // 宸插晢鍝佷笅鏋�
 						goods.setState(1);
 						goodsEvaluate.setGoods(goods);
@@ -1759,6 +1771,7 @@
 						imgInfo.setGoods(simpleGoods);
 						imgInfo.setGoodsVO(goodsDetailVO);
 					} else {
+						simpleGoods.setRemarks("鏇存柊-浣嶇疆鎵惧埌鍟嗗搧淇℃伅");
 						simpleGoods.setState(1);
 						imgInfo.setGoods(simpleGoods);
 						GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
@@ -2279,13 +2292,8 @@
 		for (GoodsEvaluate goodsEvaluate: listExist) {
 			GoodsDetailVO goodsDetailVO = goodsEvaluate.getGoods();
 			if (goodsDetailVO != null && goodsDetailVO.getGoodsId() != null 
-				&& goodsDetailVO.getGoodsId() == goodsId && goodsDetailVO.getGoodsType() == goodsType ) {
-				if (goodsDetailVO.getTitle().equalsIgnoreCase(goodsNew.getTitle())) {
-					goodsEvaluate.setGoods(goodsNew);
-				} else {
-					goodsEvaluate.setState(1);
-					goodsEvaluate.setRemarks("鍟嗗搧鏍囬鍙戠敓鍙樺寲涓嬫灦锛�" + goodsDetailVO.getTitle() +" / 鏂帮細" + goodsNew.getTitle());
-				}
+				&& goodsDetailVO.getGoodsId() == goodsId && goodsDetailVO.getGoodsType() == goodsType) {
+				goodsEvaluate.setGoods(goodsNew);
 			}
 			
 			// 鏇存柊鍟嗗搧淇℃伅
@@ -2301,26 +2309,19 @@
 					continue;
 				}
 
-				GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
-				if (goodsVO != null) {
-					if (goodsVO.getTitle().equalsIgnoreCase(goodsNew.getTitle())) {
-						simpleGoods.setState(0);
-					} else {
-						simpleGoods.setState(1);
-						simpleGoods.setRemarks("鍟嗗搧鏍囬鍙戠敓鍙樺寲涓嬫灦锛�" + goodsVO.getTitle() +" / 鏂帮細" + goodsNew.getTitle());
-					}
-				}
 				
-				simpleGoods.setPrice(goodsDetailVO.getCouponPrice());
-				CouponInfoVO couponInfo = goodsDetailVO.getCouponInfo();
+				simpleGoods.setState(0);
+				simpleGoods.setPrice(goodsNew.getCouponPrice());
+				CouponInfoVO couponInfo = goodsNew.getCouponInfo();
 				if (couponInfo == null) {
-					simpleGoods.setPrice(goodsDetailVO.getZkPrice());
+					simpleGoods.setPrice(goodsNew.getZkPrice());
 				} else {
-					simpleGoods.setPrice(goodsDetailVO.getCouponPrice());
+					simpleGoods.setPrice(goodsNew.getCouponPrice());
 					simpleGoods.setAmount(couponInfo.getAmount());
 				}
+				
 				imgInfo.setGoods(simpleGoods);
-				imgInfo.setGoodsVO(goodsDetailVO);
+				imgInfo.setGoodsVO(goodsNew);
 			}
 			
 			goodsEvaluate.setImgList(imgList);

--
Gitblit v1.8.0