From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserSystemCouponCountServiceImpl.java |  579 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 299 insertions(+), 280 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserSystemCouponCountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserSystemCouponCountServiceImpl.java
index daeafa1..a02cd06 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserSystemCouponCountServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/UserSystemCouponCountServiceImpl.java
@@ -1,280 +1,299 @@
-package com.yeshi.fanli.service.impl.count;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponCountMapper;
-import com.yeshi.fanli.entity.bus.user.UserInfo;
-import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
-import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
-import com.yeshi.fanli.entity.system.SystemCoupon;
-import com.yeshi.fanli.service.inter.config.SystemCouponService;
-import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
-import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
-import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
-import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
-import com.yeshi.fanli.service.inter.user.UserInfoService;
-import com.yeshi.fanli.vo.user.SystemCouponVO;
-import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
-
-@Service
-public class UserSystemCouponCountServiceImpl implements UserSystemCouponCountService {
-
-
-	@Resource
-	private UserSystemCouponCountMapper userSystemCouponCountMapper;
-
-	@Resource
-	private UserInfoService userInfoService;
-	
-	@Resource
-	private OrderHongBaoMapService orderHongBaoMapService;
-	
-	@Resource
-	private CommonOrderCountService commonOrderCountService;
-	
-	@Resource
-	private HongBaoV2CountService hongBaoV2CountService;
-	
-	@Resource
-	private SystemCouponService systemCouponService;
-	
-	/**
-	 * 濂栧姳鍒哥粺璁�
-	 */
-	@Override
-	public List<UserSystemCouponCountVO> listRebateCoupon(long start,int count, String key, Integer keyType,
-			 Integer state,  Integer percent){
-		
-		List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listRebateCoupon(start, count, key,
-				keyType, state, percent);
-		
-		if (list == null ) {
-			list = new ArrayList<UserSystemCouponCountVO>();
-		}
-		
-		for (UserSystemCouponCountVO userSystemCouponVO: list) {
-			// 鐢ㄦ埛淇℃伅
-			Long uid = userSystemCouponVO.getUid();
-			UserInfo userInfo = userInfoService.selectByPKey(uid);
-			if (userInfo == null) {
-				userInfo = new UserInfo();
-				userInfo.setId(uid);
-			}
-			userSystemCouponVO.setUserInfo(userInfo);
-			
-			UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
-			if (couponRecord != null) {
-				String orderNo = couponRecord.getOrderNo();
-				// 鑾峰彇濂栧姳閲戦
-				BigDecimal royaltyMoney = orderHongBaoMapService.getCouponHongbaoByOrderNo(orderNo, uid);
-				if (royaltyMoney == null) {
-					royaltyMoney = new BigDecimal(0);
-				}
-				userSystemCouponVO.setRoyaltyMoney(royaltyMoney);
-				
-				BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
-				if (orderMoney == null) {
-					orderMoney = new BigDecimal(0);
-				}
-				userSystemCouponVO.setOrderMoney(orderMoney);
-				
-			}
-		}
-		
-		return list;
-	}
-	
-	@Override
-	public long countRebateCoupon(String key, Integer keyType,  Integer state, Integer percent){
-		return userSystemCouponCountMapper.countRebateCoupon(key, keyType, state, percent);
-	}
-	
-	
-	/**
-	 * 绯荤粺濂栧姳鍒哥粺璁�
-	 */
-	@Override
-	public List<SystemCouponVO> listSystemCouponByRebate(long start,int count, String key, Integer sort){
-		
-		List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByRebate(start, count, key, sort);
-		
-		if (list == null ) {
-			list = new ArrayList<SystemCouponVO>();
-		}
-		
-		for (SystemCouponVO systemCouponVO: list) {
-			
-			BigDecimal money = userSystemCouponCountMapper.countRebateMoneyByCouponId(systemCouponVO.getId());
-			if (money == null) {
-				money = new BigDecimal(0);
-			}
-			systemCouponVO.setMoney(money);
-		}
-		return list;
-	}
-	
-	@Override
-	public long countSystemCouponRebate(String key){
-		return userSystemCouponCountMapper.countSystemCouponRebate(key);
-	}
-	
-	
-	/**
-	 * 绯荤粺鍏嶅崟鍒哥粺璁�
-	 */
-	@Override
-	public List<SystemCouponVO> listSystemCouponByFree(long start,int count, String key, Integer sort){
-		
-		List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByFree(start, count, key, sort);
-		
-		if (list == null ) {
-			list = new ArrayList<SystemCouponVO>();
-		}
-		
-		for (SystemCouponVO systemCouponVO: list) {
-			
-			BigDecimal money = userSystemCouponCountMapper.countFreeMoneyByCouponId(systemCouponVO.getId());
-			if (money == null) {
-				money = new BigDecimal(0);
-			}
-			systemCouponVO.setMoney(money);
-		}
-		return list;
-	}
-	
-	@Override
-	public long countSystemCouponFree(String key){
-		return userSystemCouponCountMapper.countSystemCouponFree(key);
-	}
-	
-	
-	
-	@Override
-	public List<UserSystemCouponCountVO> listFreeCoupon(long start,int count, String key, Integer keyType,
-			 Integer state, Integer activated){
-		
-		List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listFreeCoupon(start, count, key,
-				keyType, state, activated);
-		
-		if (list == null ) {
-			list = new ArrayList<UserSystemCouponCountVO>();
-		}
-		
-		for (UserSystemCouponCountVO userSystemCouponVO: list) {
-			// 鐢ㄦ埛淇℃伅
-			Long uid = userSystemCouponVO.getUid();
-			UserInfo userInfo = userInfoService.selectByPKey(uid);
-			if (userInfo == null) {
-				userInfo = new UserInfo();
-				userInfo.setId(uid);
-			}
-			userSystemCouponVO.setUserInfo(userInfo);
-			
-			UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
-			if (couponRecord != null) {
-				String orderNo = couponRecord.getOrderNo();
-				BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
-				if (orderMoney == null) {
-					orderMoney = new BigDecimal(0);
-				}
-				userSystemCouponVO.setOrderMoney(orderMoney);
-			}
-		}
-		
-		return list;
-	}
-	
-	
-	@Override
-	public long countFreeCoupon(String key, Integer keyType,  Integer state,Integer activated){
-		return userSystemCouponCountMapper.countFreeCoupon(key, keyType, state, activated);
-	}
-	
-	
-	@Override
-	public List<UserSystemCouponCountVO> listFreeCouponRecord(long start,int count, String key, Integer keyType,
-			 Integer state){
-		
-		List<UserSystemCouponRecord> list = userSystemCouponCountMapper.listFreeCouponRecord(start, count, key,
-				keyType, state);
-		
-		if (list == null || list.size() == 0) {
-			return null;
-		}
-		
-		List<UserSystemCouponCountVO> listvo = new ArrayList<UserSystemCouponCountVO>();
-		
-		for (UserSystemCouponRecord couponRecord: list) {
-			
-			UserSystemCouponCountVO vo = new UserSystemCouponCountVO();
-			UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
-			try {
-				PropertyUtils.copyProperties(vo, userSystemCoupon);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			
-			vo.setUserSystemCouponRecord(couponRecord);
-			
-//			SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
-//			SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
-//			if (baseCoupon == null || baseCoupon.getId() == null) {
-//				continue;
-//			}
-//			vo.setSystemCoupon(baseCoupon);
-			
-			// 鐢ㄦ埛淇℃伅
-			Long uid = userSystemCoupon.getUid();
-			UserInfo userInfo = userInfoService.selectByPKey(uid);
-			if (userInfo == null) {
-				userInfo = new UserInfo();
-				userInfo.setId(uid);
-			}
-			vo.setUserInfo(userInfo);
-			
-			String orderNo = couponRecord.getOrderNo();
-			BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
-			if (orderMoney == null) {
-				orderMoney = new BigDecimal(0);
-			}
-			vo.setOrderMoney(orderMoney);
-				
-			listvo.add(vo);
-		}
-		return listvo;
-	}
-	
-	
-	@Override
-	public long countFreeCouponRecord(String key, Integer keyType,  Integer state){
-		return userSystemCouponCountMapper.countFreeCouponRecord(key, keyType, state);
-	}
-	
-	
-	@Override
-	public List<Map<String, Object>> getRebateCouponUsedNumToCharts(Integer dateType,  String year, 
-			String startTime, String endTime){
-		return userSystemCouponCountMapper.getRebateCouponUsedNumToCharts(dateType, year, startTime, endTime);
-	}
-	
-	@Override
-	public List<Map<String, Object>> getRebateCouponMoneyToCharts(Integer dateType,  String year, 
-			String startTime, String endTime){
-		return userSystemCouponCountMapper.getRebateCouponMoneyToCharts(dateType, year, startTime, endTime);
-	}
-	
-	@Override
-	public List<Map<String, Object>> getFreeCouponMoneyToCharts(Integer dateType,  String year, String startTime, 
-			String endTime, String couponType){
-		return userSystemCouponCountMapper.getFreeCouponMoneyToCharts(dateType, year, startTime, endTime, couponType);
-	}
-	
-}
+package com.yeshi.fanli.service.impl.count;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponCountMapper;
+import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
+import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
+import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
+import com.yeshi.fanli.service.inter.config.SystemCouponService;
+import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
+import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
+import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
+import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
+import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.vo.user.SystemCouponVO;
+import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
+
+@Service
+public class UserSystemCouponCountServiceImpl implements UserSystemCouponCountService {
+
+
+	@Resource
+	private UserSystemCouponCountMapper userSystemCouponCountMapper;
+
+	@Resource
+	private UserInfoService userInfoService;
+	
+	@Resource
+	private OrderHongBaoMapService orderHongBaoMapService;
+	
+	@Resource
+	private CommonOrderCountService commonOrderCountService;
+	
+	@Resource
+	private HongBaoV2CountService hongBaoV2CountService;
+	
+	@Resource
+	private SystemCouponService systemCouponService;
+	
+	/**
+	 * 濂栧姳鍒哥粺璁�
+	 */
+	@Override
+	public List<UserSystemCouponCountVO> listRebateCoupon(long start,int count, String key, Integer keyType,
+			 Integer state,  Integer percent){
+		
+		List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listRebateCoupon(start, count, key,
+				keyType, state, percent);
+		
+		if (list == null ) {
+			list = new ArrayList<UserSystemCouponCountVO>();
+		}
+		
+		for (UserSystemCouponCountVO userSystemCouponVO: list) {
+			// 鐢ㄦ埛淇℃伅
+			Long uid = userSystemCouponVO.getUid();
+			UserInfo userInfo = userInfoService.selectByPKey(uid);
+			if (userInfo == null) {
+				userInfo = new UserInfo();
+				userInfo.setId(uid);
+			}
+			userSystemCouponVO.setUserInfo(userInfo);
+			
+			UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
+			if (couponRecord != null) {
+				String orderNo = couponRecord.getOrderNo();
+				// 鑾峰彇濂栧姳閲戦
+				BigDecimal royaltyMoney = orderHongBaoMapService.getCouponHongbaoByOrderNo(orderNo, uid);
+				if (royaltyMoney == null) {
+					royaltyMoney = new BigDecimal(0);
+				}
+				userSystemCouponVO.setRoyaltyMoney(royaltyMoney);
+				
+				BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
+				if (orderMoney == null) {
+					orderMoney = new BigDecimal(0);
+				}
+				userSystemCouponVO.setOrderMoney(orderMoney);
+				
+			}
+		}
+		
+		return list;
+	}
+	
+	@Override
+	public long countRebateCoupon(String key, Integer keyType,  Integer state, Integer percent){
+		return userSystemCouponCountMapper.countRebateCoupon(key, keyType, state, percent);
+	}
+	
+	
+	/**
+	 * 绯荤粺濂栧姳鍒哥粺璁�
+	 */
+	@Override
+	public List<SystemCouponVO> listSystemCouponByRebate(long start,int count, String key, Integer sort){
+		
+		List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByRebate(start, count, key, sort);
+		
+		if (list == null ) {
+			list = new ArrayList<SystemCouponVO>();
+		}
+		
+		for (SystemCouponVO systemCouponVO: list) {
+			
+			BigDecimal money = userSystemCouponCountMapper.countRebateMoneyByCouponId(systemCouponVO.getId());
+			if (money == null) {
+				money = new BigDecimal(0);
+			}
+			systemCouponVO.setMoney(money);
+		}
+		return list;
+	}
+	
+	@Override
+	public long countSystemCouponRebate(String key){
+		return userSystemCouponCountMapper.countSystemCouponRebate(key);
+	}
+	
+	
+	/**
+	 * 绯荤粺鍏嶅崟鍒哥粺璁�
+	 */
+	@Override
+	public List<SystemCouponVO> listSystemCouponByFree(long start,int count, String key, Integer sort){
+		
+		List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByFree(start, count, key, sort);
+		
+		if (list == null ) {
+			list = new ArrayList<SystemCouponVO>();
+		}
+		
+		for (SystemCouponVO systemCouponVO: list) {
+			BigDecimal money  = null;
+			if (systemCouponVO.getType() != CouponTypeEnum.freeCouponGive) 
+				money = userSystemCouponCountMapper.countFreeMoneyByCouponId(systemCouponVO.getId());
+			
+			if (money == null) 
+				money = new BigDecimal(0);
+			
+			systemCouponVO.setMoney(money);
+		}
+		return list;
+	}
+	
+	@Override
+	public long countSystemCouponFree(String key){
+		return userSystemCouponCountMapper.countSystemCouponFree(key);
+	}
+	
+	
+	
+	@Override
+	public List<UserSystemCouponCountVO> listFreeCoupon(long start,int count, String key, Integer keyType,
+			 Integer state, Integer activated){
+		
+		List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listFreeCoupon(start, count, key,
+				keyType, state, activated);
+		
+		if (list == null ) {
+			list = new ArrayList<UserSystemCouponCountVO>();
+		}
+		
+		for (UserSystemCouponCountVO userSystemCouponVO: list) {
+			// 鐢ㄦ埛淇℃伅
+			Long uid = userSystemCouponVO.getUid();
+			UserInfo userInfo = userInfoService.selectByPKey(uid);
+			if (userInfo == null) {
+				userInfo = new UserInfo();
+				userInfo.setId(uid);
+			}
+			userSystemCouponVO.setUserInfo(userInfo);
+			
+			UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
+			if (couponRecord != null) {
+				String orderNo = couponRecord.getOrderNo();
+				BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
+				if (orderMoney == null) {
+					orderMoney = new BigDecimal(0);
+				}
+				userSystemCouponVO.setOrderMoney(orderMoney);
+			}
+		}
+		
+		return list;
+	}
+	
+	
+	@Override
+	public long countFreeCoupon(String key, Integer keyType,  Integer state,Integer activated){
+		return userSystemCouponCountMapper.countFreeCoupon(key, keyType, state, activated);
+	}
+	
+	
+	@Override
+	public List<UserSystemCouponCountVO> listFreeCouponRecord(long start,int count, String key, Integer keyType,
+			 Integer state){
+		
+		List<UserSystemCouponRecord> list = userSystemCouponCountMapper.listFreeCouponRecord(start, count, key,
+				keyType, state);
+		
+		if (list == null || list.size() == 0) {
+			return null;
+		}
+		
+		List<UserSystemCouponCountVO> listvo = new ArrayList<UserSystemCouponCountVO>();
+		
+		for (UserSystemCouponRecord couponRecord: list) {
+			
+			UserSystemCouponCountVO vo = new UserSystemCouponCountVO();
+			UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
+			try {
+				PropertyUtils.copyProperties(vo, userSystemCoupon);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+			
+			vo.setUserSystemCouponRecord(couponRecord);
+			
+//			SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
+//			SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
+//			if (baseCoupon == null || baseCoupon.getId() == null) {
+//				continue;
+//			}
+//			vo.setSystemCoupon(baseCoupon);
+			
+			// 鐢ㄦ埛淇℃伅
+			Long uid = userSystemCoupon.getUid();
+			UserInfo userInfo = userInfoService.selectByPKey(uid);
+			if (userInfo == null) {
+				userInfo = new UserInfo();
+				userInfo.setId(uid);
+			}
+			vo.setUserInfo(userInfo);
+			
+			String orderNo = couponRecord.getOrderNo();
+			BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
+			if (orderMoney == null) {
+				orderMoney = new BigDecimal(0);
+			}
+			vo.setOrderMoney(orderMoney);
+				
+			listvo.add(vo);
+		}
+		return listvo;
+	}
+	
+	
+	@Override
+	public long countFreeCouponRecord(String key, Integer keyType,  Integer state){
+		return userSystemCouponCountMapper.countFreeCouponRecord(key, keyType, state);
+	}
+	
+	
+	@Override
+	public BigDecimal countRebateMoneyByDay(String preDay){
+		return userSystemCouponCountMapper.countRebateMoneyByDay(preDay);
+	}
+	
+	
+	@Override
+	public BigDecimal countFreeMoneyByTypeAndDay(CouponTypeEnum typeEnum, String preDay){
+		return userSystemCouponCountMapper.countFreeMoneyByTypeAndDay(typeEnum.name(), preDay, null);
+	}
+	
+	@Override
+	public BigDecimal countFreeMoneyByTypeAndDay(CouponTypeEnum typeEnum, String preDay, String source){
+		return userSystemCouponCountMapper.countFreeMoneyByTypeAndDay(typeEnum.name(), preDay, source);
+	}
+	
+	
+	@Override
+	public BigDecimal countCouponNumByDay(CouponTypeEnum typeEnum, String preDay){
+		return userSystemCouponCountMapper.countCouponNumByDay(typeEnum.name(), preDay, null);
+	}
+	
+	@Override
+	public BigDecimal countCouponNumByDay(CouponTypeEnum typeEnum, String preDay, String source){
+		return userSystemCouponCountMapper.countCouponNumByDay(typeEnum.name(), preDay, source);
+	}
+	
+	@Override
+	public long countCouponNum(Long uid, Integer state, Integer activated, List<String> list, List<String> listSource){
+		 Long count = userSystemCouponCountMapper.countCouponNum(uid, state, activated, list, listSource);
+		 if (count == null) 
+			 count = 0L;
+		 return count;
+	}
+	
+	
+}

--
Gitblit v1.8.0