| 
					
				 | 
			
			
				@@ -21,6 +21,7 @@ import com.yonge.cooleshow.biz.dal.service.CouponInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.CouponIssueService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.SysMessageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.CouponIssueUserVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.vo.coupon.CouponInfoWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.coupon.CouponIssueWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.enums.EStatus; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -35,7 +36,12 @@ import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.ZoneId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Optional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -197,14 +203,27 @@ public class CouponIssueServiceImp extends ServiceImpl<CouponIssueMapper, Coupon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param id         用户ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param query     CouponInfoQuery.CouponStateStatQuery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @return List<StatGroupWrapper> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return List<CouponInfoWrapper.CouponStat> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public List<StatGroupWrapper> queryCouponStateStatInfo(Long id, CouponInfoQuery.CouponStateStatQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<CouponInfoWrapper.CouponStat> queryCouponStateStatInfo(Long id, CouponInfoQuery.CouponStateStatQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 优惠券统计状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<StatGroupWrapper> wrappers = getBaseMapper().selectCouponStateStatInfo(id, query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Integer> collect = getBaseMapper().selectCouponStateStatInfo(id, query).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toMap(StatGroupWrapper::getGid, StatGroupWrapper::getTotal, (o, n) -> n)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return Optional.ofNullable(wrappers).orElse(Lists.newArrayList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<CouponInfoWrapper.CouponStat> couponStats = Lists.newArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 统计数据封装 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CouponUseStateEnum[] values = CouponUseStateEnum.values(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (CouponUseStateEnum item : values) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            couponStats.add(CouponInfoWrapper.CouponStat.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .useState(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .total(collect.getOrDefault(item.getCode(), 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return couponStats; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |