From 1e1ae4f19489644c9ff35125d075a30f89536d16 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期四, 21 五月 2020 17:35:36 +0800
Subject: [PATCH] 后台编辑

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   78 +++++++++++++++++++++++----------------
 1 files changed, 46 insertions(+), 32 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 b078e5f..9eb5d29 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
@@ -64,6 +64,7 @@
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
+import com.yeshi.fanli.util.TimeUtil;
 import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
 import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
@@ -930,36 +931,43 @@
 			throw new GoodsEvaluateException(1, "璇蜂繚瀛樼涓�閮ㄥ垎淇℃伅");
 		}
 
-		if (StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
-			throw new GoodsEvaluateException(1, "鍒搁潰棰濅笉鑳戒负绌�");
-		}
-
-		if (StringUtil.isNullOrEmpty(commentInfo.getTagDesc())) {
-			throw new GoodsEvaluateException(1, "鎻忚堪璇笉鑳戒负绌�");
-		}
-
-		String tagUrl = commentInfo.getTagUrl();
-		String content = commentInfo.getContent();
-		if (StringUtil.isNullOrEmpty(tagUrl) && StringUtil.isNullOrEmpty(content)) {
-			throw new GoodsEvaluateException(1, "璇勮璇拰閾炬帴涓嶈兘鍚屾椂涓虹┖");
-		}
-
-		String endTime = commentInfo.getEndTime();
-		if (!StringUtil.isNullOrEmpty(endTime)) {
-			try {
-				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-				sdf.parse(endTime);
-			} catch (Exception e) {
-				throw new GoodsEvaluateException(1, "璇峰~鍐欐纭殑鏃堕棿鏍煎紡锛�2020-03-05");
+		GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid);
+		if (resultObj == null)
+			throw new GoodsEvaluateException(1, "绗竴閮ㄥ垎淇℃伅缂哄け");
+		
+		if (EvaluateEnum.activity != resultObj.getType()) {
+			if (StringUtil.isNullOrEmpty(commentInfo.getCoupon())) {
+				throw new GoodsEvaluateException(1, "鍒搁潰棰濅笉鑳戒负绌�");
 			}
-		} else {
-			throw new GoodsEvaluateException(1, "璇峰~鍐欏埜鎴鏃堕棿");
+
+			if (StringUtil.isNullOrEmpty(commentInfo.getTagDesc())) {
+				throw new GoodsEvaluateException(1, "鎻忚堪璇笉鑳戒负绌�");
+			}
+
+			String tagUrl = commentInfo.getTagUrl();
+			String content = commentInfo.getContent();
+			if (StringUtil.isNullOrEmpty(tagUrl) && StringUtil.isNullOrEmpty(content)) {
+				throw new GoodsEvaluateException(1, "璇勮璇拰閾炬帴涓嶈兘鍚屾椂涓虹┖");
+			}
+
+			String endTime = commentInfo.getEndTime();
+			if (!StringUtil.isNullOrEmpty(endTime)) {
+				try {
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+					sdf.parse(endTime);
+				} catch (Exception e) {
+					throw new GoodsEvaluateException(1, "璇峰~鍐欐纭殑鏃堕棿鏍煎紡锛�2020-03-05");
+				}
+			} else {
+				throw new GoodsEvaluateException(1, "璇峰~鍐欏埜鎴鏃堕棿");
+			}
 		}
 
 		if (commentInfo.getNeedSpin() == null) {
 			commentInfo.setNeedSpin(false);
 		}
 		
+		String content = commentInfo.getContent();
 		if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) {
 			try {
 				convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true);
@@ -972,9 +980,6 @@
 			}
 		}
 
-		GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid);
-		if (resultObj == null)
-			throw new GoodsEvaluateException(1, "绗竴閮ㄥ垎淇℃伅缂哄け");
 
 		List<CommentInfo> comments = new ArrayList<>();
 		CommentInfo currencyCoupon = null;
@@ -1103,6 +1108,7 @@
 			}
 		}
  
+		String activityUrl = imgInfo.getActivityUrl();
 		// 缂栬緫鍥剧墖
 		List<ImgInfo> tempList = new ArrayList<ImgInfo>();
 		if (!StringUtil.isNullOrEmpty(picUrls)) {
@@ -1114,6 +1120,7 @@
 						if (listOld != null) {
 							for (ImgInfo info: listOld) {
 								if (info.getUrl().equals(picLink)) {
+									info.setActivityUrl(activityUrl);
 									tempList.add(info);
 									break;
 								}
@@ -1124,6 +1131,7 @@
 			}
 		}
 
+		
 		// 涓婁紶鏂囦欢鏇挎崲
 		if (fileRequest != null) {
 			for (int i = 0; i < 9; i++) {
@@ -1136,10 +1144,10 @@
 					imgInfo0.setPid(pid);
 					imgInfo0.setUrl(info.getUrl());
 					imgInfo0.setUrlHD(info.getUrl());
-					imgInfo0.setType(ImgEnum.img);
+					imgInfo0.setType(ImgEnum.activity);
 					imgInfo0.setW(info.getW());
 					imgInfo0.setH(info.getH());
-					
+					imgInfo0.setActivityUrl(activityUrl);
 					if (i < tempList.size()) {
 						tempList.set(i, imgInfo0);
 					} else {
@@ -1148,6 +1156,7 @@
 				} 
 			}
 		}
+		
 		
 		int lineNum = 0;
 		int totalImg = tempList.size();
@@ -1187,7 +1196,7 @@
 			}
 		}
 		
-		resultObj.setJumpLink(imgInfo.getActivityUrl());
+		resultObj.setJumpLink(activityUrl);
 		resultObj.setLineNum(lineNum);
 		resultObj.setImgList(listImg);
 		goodsEvaluateDao.save(resultObj);
@@ -1626,7 +1635,7 @@
 			}
 
 			// 鎸夌収鍙戝竷鏄剧ず鏃堕棿娈佃捣濮嬫椂闂翠负鍑嗐��
-			goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime());
+			evaluateNew.setPublishTime(evaluateNew.getStartTime());
 
 			List<CommentInfo> comments = evaluateNew.getComments();
 			if (comments != null && comments.size() > 0) {
@@ -1788,7 +1797,7 @@
 
 		try {
 			Date now = new Date();
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 			ConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55");
 			params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
 			for (GoodsEvaluate goodsEvaluate : list) {
@@ -1814,7 +1823,7 @@
 							if (commentInfoEnum != null && commentInfoEnum == CommentInfoEnum.currencyCoupon) {
 								String endTime = commentInfo.getEndTime();
 								if (!StringUtil.isNullOrEmpty(endTime)) {
-									Date endDay = sdf.parse(endTime);
+									Date endDay = format.parse(endTime);
 									if (endDay.getTime() < now.getTime()) {
 										goodsEvaluate.setState(0); // 娲诲姩杩囨湡
 									}
@@ -2455,6 +2464,9 @@
 	 * 鍒犻櫎宸茶繃鏈熸椂闂�
 	 */
 	private void removeOverdue() {
+		if(1>0)
+			return;
+		
 		List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue();
 		if (list == null || list.size() == 0) {
 			return;
@@ -2479,6 +2491,8 @@
 	 * 鍒犻櫎鍟嗗搧宸蹭笅鏋�-鍗曞搧
 	 */
 	private void removeDownGoods() {
+		if(1>0)
+			return;
 		try {
 			List<GoodsEvaluate> list = goodsEvaluateDao.removeDownGoods();
 			if (list == null || list.size() == 0) {

--
Gitblit v1.8.0