From 885c66fcc29c3b1b4d1cc94883aaff0ed64e435c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 24 三月 2020 16:35:06 +0800
Subject: [PATCH] 发圈活动支持淘宝活动,团队补贴/团队奖励增加生效/失效时间

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |  139 ++++++++++++++++++++++++++--------------------
 1 files changed, 79 insertions(+), 60 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 c2ec6b4..fe3e8aa 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
@@ -339,8 +339,7 @@
 				}
 			}
 		}
-		
-		
+
 		// 涓婁紶鏂囦欢鏇挎崲
 		if (fileRequest != null) {
 			for (int i = 0; i < 9; i++) {
@@ -476,8 +475,9 @@
 		}
 
 		/*
-		 * // 鏃犲埜涓嶈兘鑷姩 鐢熸垚璇勮 CouponInfoVO couponInfo1 = goodsDetailVO.getCouponInfo(); if
-		 * (couponInfo1 == null) { addComment = false; }
+		 * // 鏃犲埜涓嶈兘鑷姩 鐢熸垚璇勮 CouponInfoVO couponInfo1 =
+		 * goodsDetailVO.getCouponInfo(); if (couponInfo1 == null) { addComment
+		 * = false; }
 		 */
 
 		String commentText = "";
@@ -509,16 +509,19 @@
 				commentText = template.replace("[閾炬帴]", jumpLink);
 			}
 
-//			commentText = commentText.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goodsDetailVO.getZkPrice())+"");
-//			if (!goodsDetailVO.isHasCoupon()) {
-//				commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
-//				commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
-//			} else {
-//				commentText = commentText.replace("[鍒稿悗浠穄",  MoneyBigDecimalUtil.getWithNoZera(goodsDetailVO.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("[鍘熶环]",
+			// MoneyBigDecimalUtil.getWithNoZera(goodsDetailVO.getZkPrice())+"");
+			// if (!goodsDetailVO.isHasCoupon()) {
+			// commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
+			// commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
+			// } else {
+			// commentText = commentText.replace("[鍒稿悗浠穄",
+			// MoneyBigDecimalUtil.getWithNoZera(goodsDetailVO.getCouponPrice())+"");
+			// }
+			//
+			// commentText = commentText.replace("\r\n\r\n",
+			// "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n",
+			// "\r\n");
 
 			CommentInfo commentInfo = new CommentInfo();
 			commentInfo.setId(UUID.randomUUID().toString().replace("-", ""));
@@ -1269,7 +1272,7 @@
 				}
 			}
 		}
-				
+
 		// 涓婁紶鏂囦欢鏇挎崲
 		if (fileRequest != null) {
 			for (int i = 0; i < 9; i++) {
@@ -1284,7 +1287,7 @@
 				}
 			}
 		}
-		
+
 		int totalImg = 0;
 		for (String pic : listpic) {
 			ImgInfo imgInfo0 = new ImgInfo();
@@ -1482,14 +1485,13 @@
 		return goodsEvaluateDao.count(key, state, dynamicType);
 	}
 
-	
 	@Override
 	public void addRanDomShareCount() {
 		// 鍙戝湀
 		try {
 			List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(0, Integer.MAX_VALUE, 1);
 			if (list != null) {
-				for (GoodsEvaluate goodsEvaluate: list) {
+				for (GoodsEvaluate goodsEvaluate : list) {
 					Integer shareNum = goodsEvaluate.getShareNum();
 					if (shareNum == null) {
 						shareNum = 0;
@@ -1501,12 +1503,12 @@
 		} catch (Exception e) {
 			LogHelper.errorDetailInfo(e);
 		}
-		
+
 		// 绱犳潗
 		try {
 			List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(0, Integer.MAX_VALUE, 2);
 			if (list != null) {
-				for (GoodsEvaluate goodsEvaluate: list) {
+				for (GoodsEvaluate goodsEvaluate : list) {
 					Integer shareNum = goodsEvaluate.getShareNum();
 					if (shareNum == null) {
 						shareNum = 0;
@@ -1519,8 +1521,7 @@
 			LogHelper.errorDetailInfo(e);
 		}
 	}
-	
-	
+
 	@Override
 	@Cacheable(value = "dynamicCache", key = "'queryValidEvaluateCache-'+#start")
 	public List<GoodsEvaluate> queryValidEvaluateCache(int start, int count) {
@@ -1532,7 +1533,7 @@
 			public void run() {
 				// 鏇存柊淇℃伅
 				updateGoodInfo(list);
-				
+
 				// 鍒犻櫎宸茶繃鏈�
 				removeOverdue();
 			}
@@ -1592,20 +1593,35 @@
 						if (goods != null) {
 							String content = commentInfoNew.getContent();
 							if (!StringUtil.isNullOrEmpty(content)) {
-								content = content.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice())+"");
+								content = content.replace("[鍘熶环]",
+										MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) + "");
 								if (goods.isHasCoupon()) {
-									content = content.replace("[鍒稿悗浠穄",MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+"");
+									content = content.replace("[鍒稿悗浠穄",
+											MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice()) + "");
 								} else {
 									singleCoupn = false;
 									content = content.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
 									content = content.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
 								}
 								content = content.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
+								// 鏇挎崲娣樺疂瀹樻柟娲诲姩
+								List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content);
+								for (String st : activityIdList)
+									content = content.replace(st, "");
+
 								commentInfoNew.setContent(content);
 							}
 						}
 					}
-					
+					if (typeEnum != null && typeEnum == EvaluateEnum.activity) {
+						// 鏇挎崲娣樺疂瀹樻柟娲诲姩
+						String content = commentInfoNew.getContent();
+						List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content);
+						for (String st : activityIdList)
+							content = content.replace(st, "");
+						commentInfoNew.setContent(content);
+					}
+
 					CommentInfoEnum typeComment = commentInfoNew.getTypeEnum();
 					if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) {
 						GoodsDetailVO goods = evaluateNew.getGoods();
@@ -1681,7 +1697,7 @@
 			@Override
 			public void run() {
 				updateGoodInfo(listOBJ);
-				
+
 				// 鍒犻櫎宸茶繃鏈�
 				removeOverdue();
 			}
@@ -1896,7 +1912,9 @@
 
 					TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(1L, goodsVO.getGoodsId(), "0");
 
-//					TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(Constant.LINK_TOKEN_VERIFY_UID, goodsVO.getGoodsId(), null);
+					// TaoBaoLink taoBaoLink =
+					// shareGoodsService.getTaoBaoLinkForShare(Constant.LINK_TOKEN_VERIFY_UID,
+					// goodsVO.getGoodsId(), null);
 					String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
 					String commentText = template.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
 
@@ -2089,12 +2107,14 @@
 					String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey());
 					String commentText = template.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(token));
 
-					commentText = commentText.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goodsVO.getZkPrice())+"");
+					commentText = commentText.replace("[鍘熶环]",
+							MoneyBigDecimalUtil.getWithNoZera(goodsVO.getZkPrice()) + "");
 					if (!goodsVO.isHasCoupon()) {
 						commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘");
 						commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", "");
 					} else {
-						commentText = commentText.replace("[鍒稿悗浠穄", MoneyBigDecimalUtil.getWithNoZera(goodsVO.getCouponPrice())+"");
+						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");
@@ -2115,27 +2135,26 @@
 					if (!StringUtil.isNullOrEmpty(evaluateText)) {
 						text2 += evaluateText;
 					}
-					
+
 					String dtitle = daTaoKe.getDtitle();
 					if (!StringUtil.isNullOrEmpty(dtitle)) {
-						text2 = text2 + dtitle +"\n";
+						text2 = text2 + dtitle + "\n";
 					} else if (!StringUtil.isNullOrEmpty(evaluateText)) {
 						text2 += "\n";
 					}
-					text2 += "鍏堥銆�"+ couponAmount +"鍏冧紭鎯犲埜銆戜笅鍗�";
-							
+					text2 += "鍏堥銆�" + couponAmount + "鍏冧紭鎯犲埜銆戜笅鍗�";
+
 					CommentInfo commentInfo2 = new CommentInfo();
 					commentInfo2.setId(UUID.randomUUID().toString().replace("-", ""));
 					commentInfo2.setContent(text2);
 					commentInfo2.setTypeEnum(CommentInfoEnum.goodsCoupon);
 					commentInfo2.setType("");
-					
-					
+
 					List<CommentInfo> commentsNew = new ArrayList<>();
 					commentsNew.add(commentInfo);
 					commentsNew.add(commentInfo2);
 					goodsEvaluate.setComments(commentsNew);
-					
+
 					goodsEvaluate.setGoods(goodsVO);
 				}
 				imgList.add(imgInfo);
@@ -2245,28 +2264,29 @@
 		}
 		return true;
 	}
-	
+
 	@Override
 	public void updateTaoBaoGoods(TaoBaoGoodsBrief goods) {
 		try {
 			if (goods == null) {
 				return;
 			}
-			List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO, goods.getAuctionId());
+			List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO,
+					goods.getAuctionId());
 			if (queryExist == null || queryExist.size() == 0) {
 				return;
 			}
-			
+
 			ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate("android", "55");
 			paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
 			GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
 			updateGoods(queryExist, goodsNew);
-		
+
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
-	
+
 	@Override
 	public void updateJDGoods(JDGoods jdGoods) {
 		if (jdGoods == null) {
@@ -2276,14 +2296,14 @@
 		if (queryExist == null || queryExist.size() == 0) {
 			return;
 		}
-		
+
 		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate("android", "55");
 		paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
 		GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
-		
+
 		updateGoods(queryExist, goodsNew);
 	}
-	
+
 	@Override
 	public void updatePDDGoods(PDDGoodsDetail pddGoods) {
 		if (pddGoods == null) {
@@ -2293,23 +2313,23 @@
 		if (queryExist == null || queryExist.size() == 0) {
 			return;
 		}
-		
+
 		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate("android", "55");
 		paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
 		GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
 		updateGoods(queryExist, goodsNew);
 	}
-	
+
 	private void updateGoods(List<GoodsEvaluate> listExist, GoodsDetailVO goodsNew) {
 		long goodsId = goodsNew.getGoodsId();
 		int goodsType = goodsNew.getGoodsType();
-		for (GoodsEvaluate goodsEvaluate: listExist) {
+		for (GoodsEvaluate goodsEvaluate : listExist) {
 			GoodsDetailVO goodsDetailVO = goodsEvaluate.getGoods();
-			if (goodsDetailVO != null && goodsDetailVO.getGoodsId() != null 
-				&& goodsDetailVO.getGoodsId() == goodsId && goodsDetailVO.getGoodsType() == goodsType) {
+			if (goodsDetailVO != null && goodsDetailVO.getGoodsId() != null && goodsDetailVO.getGoodsId() == goodsId
+					&& goodsDetailVO.getGoodsType() == goodsType) {
 				goodsEvaluate.setGoods(goodsNew);
 			}
-			
+
 			// 鏇存柊鍟嗗搧淇℃伅
 			List<ImgInfo> imgList = goodsEvaluate.getImgList();
 			if (imgList == null || imgList.size() == 0) {
@@ -2318,12 +2338,11 @@
 
 			for (ImgInfo imgInfo : imgList) {
 				SimpleGoods simpleGoods = imgInfo.getGoods();
-				if (simpleGoods == null || simpleGoods.getGoodsId() != goodsId  
+				if (simpleGoods == null || simpleGoods.getGoodsId() != goodsId
 						|| goodsType != simpleGoods.getGoodsType()) {
 					continue;
 				}
 
-				
 				simpleGoods.setState(0);
 				simpleGoods.setPrice(goodsNew.getCouponPrice());
 				CouponInfoVO couponInfo = goodsNew.getCouponInfo();
@@ -2333,17 +2352,17 @@
 					simpleGoods.setPrice(goodsNew.getCouponPrice());
 					simpleGoods.setAmount(couponInfo.getAmount());
 				}
-				
+
 				imgInfo.setGoods(simpleGoods);
 				imgInfo.setGoodsVO(goodsNew);
 			}
-			
+
 			goodsEvaluate.setImgList(imgList);
 			goodsEvaluate.setUpdateTime(new Date());
 			goodsEvaluateDao.save(goodsEvaluate);
 		}
 	}
-	
+
 	private void removeOverdue() {
 		List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue();
 		if (list == null || list.size() == 0) {
@@ -2352,12 +2371,12 @@
 		long nm = 1000 * 60;// 涓�鍒嗛挓鐨勬绉掓暟
 		long nh = 1000 * 60 * 60;// 涓�灏忔椂鐨勬绉掓暟
 		long nd = 1000 * 24 * 60 * 60;// 涓�澶╃殑姣鏁�
-		
+
 		long time = java.lang.System.currentTimeMillis();
-		for (GoodsEvaluate goodsEvaluate: list) {
+		for (GoodsEvaluate goodsEvaluate : list) {
 			long diff = time - goodsEvaluate.getEndTime().getTime();
-			long min = diff % nd % nh / nm; 
-			
+			long min = diff % nd % nh / nm;
+
 			// 杩囨湡瓒呰繃10鍒嗛挓灏卞垹闄�
 			if (min > 10) {
 				goodsEvaluateDao.remove(goodsEvaluate);

--
Gitblit v1.8.0