From 81da61b828e29b7745e1382dfbbaeb685dc083ef Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 23 一月 2024 17:17:55 +0800
Subject: [PATCH] 抖音转链修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountCouponServiceImpl.java |  332 +++++++++++++++++++++++++++---------------------------
 1 files changed, 166 insertions(+), 166 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountCouponServiceImpl.java
index b42b1dc..bce5066 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountCouponServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountCouponServiceImpl.java
@@ -1,166 +1,166 @@
-package com.yeshi.fanli.service.impl.count;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-import org.yeshi.utils.DateUtil;
-
-import com.yeshi.fanli.dao.user.count.DailyCountCouponDao;
-import com.yeshi.fanli.entity.admin.count.DailyCountCoupon;
-import com.yeshi.fanli.entity.admin.count.DailyCountCoupon.DailyCountCouponEnum;
-import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
-import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
-import com.yeshi.fanli.service.inter.count.DailyCountCouponService;
-import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
-import com.yeshi.fanli.util.StringUtil;
-import org.yeshi.utils.TimeUtil;
-
-@Service
-public class DailyCountCouponServiceImpl implements DailyCountCouponService {
-
-	@Resource
-	private DailyCountCouponDao dailyCountCouponDao;
-	
-	@Resource
-	private UserSystemCouponCountService userSystemCouponCountService;
-
-	@Override
-	public List<DailyCountCoupon> getDailyCountList(String type, Date startTime, Date endTime) throws Exception {
-		// 鏌ヨ绫诲瀷
-		DailyCountCouponEnum typeEnum = getTypeEnum(type);
-		if (typeEnum == null) {
-			return null;
-		}
-
-		// 鍒濆鍖栨暟鎹�
-		initData(typeEnum);
-
-		return dailyCountCouponDao.query(typeEnum, startTime, endTime);
-	}
-
-	/**
-	 * 鑾峰彇鏋氫妇绫诲瀷
-	 * @param type
-	 * @return
-	 */
-	private DailyCountCouponEnum getTypeEnum(String name) {
-		if (StringUtil.isNullOrEmpty(name)) {
-			return null;
-		}
-		
-		DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
-		for (int i = 0; i < array.length; i ++) {
-			if (array[i].name().equals(name)) {
-				return array[i];
-			}
-		}
-		return null;
-	}
-
-	
-	/**
-	 * 鑾峰彇鏋氫妇绫诲瀷
-	 * @param type
-	 * @return
-	 */
-	@Override
-	public String getTypeEnumDesc(String name) {
-		if (StringUtil.isNullOrEmpty(name)) {
-			return "";
-		}
-		
-		DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
-		for (int i = 0; i < array.length; i ++) {
-			if (array[i].name().equals(name)) {
-				return array[i].getDesc();
-			}
-		}
-
-		return "";
-	}
-
-	
-	
-	/**
-	 * 鍒濆鏁版嵁
-	 * @param typeEnum
-	 * @throws Exception
-	 */
-	@Override
-	public void initData(DailyCountCouponEnum typeEnum) throws Exception {
-		Date lastDate = null;
-		DailyCountCoupon lastRecord = dailyCountCouponDao.getMaxDate(typeEnum);
-		if (lastRecord != null) {
-			lastDate = lastRecord.getUpdateDate();
-		} else {
-			lastDate = TimeUtil.parse("2019-03-04");
-		}
-		
-		long min = DateUtil.dateDiffMin(lastDate, new Date());
-		if (min <= 10) { // 10鍒嗛挓浠ュ唴涓嶇粺璁�
-			return;
-		}
-		
-
-		Date today = new Date();
-		int betweenDays = DateUtil.daysBetween2(lastDate, today);
-		for (int i = 0; i <= betweenDays; i++) {
-			// 璁$畻鏃ユ湡
-			String preDay = DateUtil.plusDay(i, lastDate);
-			// 缁熻鏁版嵁
-			BigDecimal total = getCountByType(preDay, typeEnum);
-
-			// 淇濆瓨淇℃伅
-			DailyCountCoupon obj = new DailyCountCoupon();
-			obj.setTotal(total);
-			obj.setType(typeEnum);
-			obj.setUpdateDate(new Date());
-			obj.setDay(TimeUtil.parse(preDay));
-			obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
-			dailyCountCouponDao.save(obj);
-		}
-	}
-
-	/**
-	 * 鏁版嵁缁熻
-	 * @param preDay
-	 * @param typeEnum
-	 * @return
-	 */
-	private BigDecimal getCountByType(String preDay, DailyCountCouponEnum typeEnum) {
-		BigDecimal total = null;
-		if (DailyCountCouponEnum.freeCouponNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCoupon, preDay);
-		} else if (DailyCountCouponEnum.freeCouponMoney == typeEnum) {
-			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCoupon, preDay);
-		} else if (DailyCountCouponEnum.freeCouponBuyNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponBuy, preDay);
-		} else if (DailyCountCouponEnum.freeCouponBuyMoney == typeEnum) {
-			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCouponBuy, preDay);
-		} else if (DailyCountCouponEnum.welfareFreeCouponNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.welfareFreeCoupon, preDay);
-		} else if (DailyCountCouponEnum.welfareFreeCouponMoney == typeEnum) {
-			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.welfareFreeCoupon, preDay);
-		} else if (DailyCountCouponEnum.freeCouponGiveNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponGive, preDay);
-		} else if (DailyCountCouponEnum.rebateCouponNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.rebatePercentCoupon, preDay);
-		} else if (DailyCountCouponEnum.rebateCouponMoney == typeEnum) {
-			total = userSystemCouponCountService.countRebateMoneyByDay(preDay);
-		} else if (DailyCountCouponEnum.pullNewCouponNum == typeEnum) {
-			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCoupon, preDay, UserSystemCoupon.SOURCE_PULL_NEW);
-		} else if (DailyCountCouponEnum.pullNewCouponMoney == typeEnum) {
-			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCoupon, preDay, UserSystemCoupon.SOURCE_PULL_NEW);
-		}
-
-		if (total == null) {
-			total = new BigDecimal(0);
-		}
-		return total;
-	}
-
-}
+package com.yeshi.fanli.service.impl.count;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.yeshi.utils.DateUtil;
+
+import com.yeshi.fanli.dao.user.count.DailyCountCouponDao;
+import com.yeshi.fanli.entity.admin.count.DailyCountCoupon;
+import com.yeshi.fanli.entity.admin.count.DailyCountCoupon.DailyCountCouponEnum;
+import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
+import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
+import com.yeshi.fanli.service.inter.count.DailyCountCouponService;
+import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
+import com.yeshi.fanli.util.StringUtil;
+import org.yeshi.utils.TimeUtil;
+
+@Service
+public class DailyCountCouponServiceImpl implements DailyCountCouponService {
+
+	@Resource
+	private DailyCountCouponDao dailyCountCouponDao;
+	
+	@Resource
+	private UserSystemCouponCountService userSystemCouponCountService;
+
+	@Override
+	public List<DailyCountCoupon> getDailyCountList(String type, Date startTime, Date endTime) throws Exception {
+		// 鏌ヨ绫诲瀷
+		DailyCountCouponEnum typeEnum = getTypeEnum(type);
+		if (typeEnum == null) {
+			return null;
+		}
+
+		// 鍒濆鍖栨暟鎹�
+		initData(typeEnum);
+
+		return dailyCountCouponDao.query(typeEnum, startTime, endTime);
+	}
+
+	/**
+	 * 鑾峰彇鏋氫妇绫诲瀷
+	 * @param type
+	 * @return
+	 */
+	private DailyCountCouponEnum getTypeEnum(String name) {
+		if (StringUtil.isNullOrEmpty(name)) {
+			return null;
+		}
+		
+		DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
+		for (int i = 0; i < array.length; i ++) {
+			if (array[i].name().equals(name)) {
+				return array[i];
+			}
+		}
+		return null;
+	}
+
+	
+	/**
+	 * 鑾峰彇鏋氫妇绫诲瀷
+	 * @param type
+	 * @return
+	 */
+	@Override
+	public String getTypeEnumDesc(String name) {
+		if (StringUtil.isNullOrEmpty(name)) {
+			return "";
+		}
+		
+		DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
+		for (int i = 0; i < array.length; i ++) {
+			if (array[i].name().equals(name)) {
+				return array[i].getDesc();
+			}
+		}
+
+		return "";
+	}
+
+	
+	
+	/**
+	 * 鍒濆鏁版嵁
+	 * @param typeEnum
+	 * @throws Exception
+	 */
+	@Override
+	public void initData(DailyCountCouponEnum typeEnum) throws Exception {
+		Date lastDate = null;
+		DailyCountCoupon lastRecord = dailyCountCouponDao.getMaxDate(typeEnum);
+		if (lastRecord != null) {
+			lastDate = lastRecord.getUpdateDate();
+		} else {
+			lastDate = TimeUtil.parse("2019-03-04");
+		}
+		
+		long min = DateUtil.dateDiffMin(lastDate, new Date());
+		if (min <= 10) { // 10鍒嗛挓浠ュ唴涓嶇粺璁�
+			return;
+		}
+		
+
+		Date today = new Date();
+		int betweenDays = DateUtil.daysBetween2(lastDate, today);
+		for (int i = 0; i <= betweenDays; i++) {
+			// 璁$畻鏃ユ湡
+			String preDay = DateUtil.plusDay(i, lastDate);
+			// 缁熻鏁版嵁
+			BigDecimal total = getCountByType(preDay, typeEnum);
+
+			// 淇濆瓨淇℃伅
+			DailyCountCoupon obj = new DailyCountCoupon();
+			obj.setTotal(total);
+			obj.setType(typeEnum);
+			obj.setUpdateDate(new Date());
+			obj.setDay(TimeUtil.parse(preDay));
+			obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
+			dailyCountCouponDao.save(obj);
+		}
+	}
+
+	/**
+	 * 鏁版嵁缁熻
+	 * @param preDay
+	 * @param typeEnum
+	 * @return
+	 */
+	private BigDecimal getCountByType(String preDay, DailyCountCouponEnum typeEnum) {
+		BigDecimal total = null;
+		if (DailyCountCouponEnum.freeCouponNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCoupon, preDay);
+		} else if (DailyCountCouponEnum.freeCouponMoney == typeEnum) {
+			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCoupon, preDay);
+		} else if (DailyCountCouponEnum.freeCouponBuyNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponBuy, preDay);
+		} else if (DailyCountCouponEnum.freeCouponBuyMoney == typeEnum) {
+			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCouponBuy, preDay);
+		} else if (DailyCountCouponEnum.welfareFreeCouponNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.welfareFreeCoupon, preDay);
+		} else if (DailyCountCouponEnum.welfareFreeCouponMoney == typeEnum) {
+			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.welfareFreeCoupon, preDay);
+		} else if (DailyCountCouponEnum.freeCouponGiveNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponGive, preDay);
+		} else if (DailyCountCouponEnum.rebateCouponNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.rebatePercentCoupon, preDay);
+		} else if (DailyCountCouponEnum.rebateCouponMoney == typeEnum) {
+			total = userSystemCouponCountService.countRebateMoneyByDay(preDay);
+		} else if (DailyCountCouponEnum.pullNewCouponNum == typeEnum) {
+			total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCoupon, preDay, UserSystemCoupon.SOURCE_PULL_NEW);
+		} else if (DailyCountCouponEnum.pullNewCouponMoney == typeEnum) {
+			total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCoupon, preDay, UserSystemCoupon.SOURCE_PULL_NEW);
+		}
+
+		if (total == null) {
+			total = new BigDecimal(0);
+		}
+		return total;
+	}
+
+}

--
Gitblit v1.8.0