| 
					
				 | 
			
			
				@@ -35,9 +35,11 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.time.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.ZoneId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -260,21 +262,33 @@ public class CouponIssueServiceImp extends ServiceImpl<CouponIssueMapper, Coupon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public List<CouponInfoWrapper.CouponStat> queryCouponStateStatInfo(Long id, CouponInfoQuery.CouponStateStatQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<CouponInfoWrapper.CouponStat> couponStats = Lists.newCopyOnWriteArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 优惠券统计状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Integer> collect = getBaseMapper().selectCouponStateStatInfo(id, query).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*Map<String, Integer> collect = getBaseMapper().selectCouponStateStatInfo(id, query).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .collect(Collectors.toMap(StatGroupWrapper::getGid, StatGroupWrapper::getTotal, (o, n) -> n)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        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)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .useState(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .total(collect.getOrDefault(item.getCode(), 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 分享统计优惠状态数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Lists.newArrayList(CouponUseStateEnum.values()).parallelStream().forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CouponInfoQuery.CouponStateStatQuery queryParam = CouponInfoQuery.CouponStateStatQuery.from(query.jsonString()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .timestamp(DateTime.now().getMillis()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .userState(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int sum = getBaseMapper().selectCouponStateStatInfo(id, queryParam).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .mapToInt(StatGroupWrapper::getTotal).sum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            couponStats.add(CouponInfoWrapper.CouponStat.builder().useState(item).total(sum).build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return couponStats; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |