| 
					
				 | 
			
			
				@@ -13,7 +13,6 @@ import com.yonge.cooleshow.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.wrapper.DiscountCardRecordWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.VipCardRecordWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.page.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.mybatis.support.PageUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,7 +33,6 @@ import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.ZoneId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.concurrent.CompletableFuture; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -61,6 +59,12 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysUserService sysUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private DiscountCardRecordService discountCardRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private UserTenantAlbumRecordService userTenantAlbumRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public VipCardRecordVo detail(Long orderDetilId) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -476,6 +480,8 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentService.updateVipStatus(addVipCardRecord.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (Boolean.TRUE.equals(addVipCardRecord.getSendMsg())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sendAddVipMsg(addVipCardRecord.getUserId(),addVipCardRecord.getClientType(),addVipCardRecord.getStatus(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addVipCardRecord.getVipType(),addVipCardRecord.getType(),addVipCardRecord.getTimes(),addVipCardRecord.getReason()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -690,6 +696,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentService.updateVipStatus(result.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (Boolean.TRUE.equals(result.getSendMsg())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sendAddVipMsg(record.getUserId(),record.getClientType(),EVipRecordStatus.DEDUCTION, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     record.getVipType(),record.getType(),record.getTimes(),result.getReason()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -762,6 +769,79 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return vipCardRecordIPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<Long> updateUserVipStatus() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 更新会员状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<VipCardRecord> vipCardRecords = this.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(VipCardRecord::getEfficientFlag, true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(VipCardRecord::getDeductionStatus, EDeductionStatus.EFFECTIVE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .lt(VipCardRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(vipCardRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<VipCardRecord> updateList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (VipCardRecord vipCardRecord : vipCardRecords) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                VipCardRecord record = new VipCardRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setId(vipCardRecord.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setDeductionStatus(EDeductionStatus.EXPIRED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateList.add(record); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.updateBatchById(updateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 更新畅学卡状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<DiscountCardRecord> discountCardRecords = discountCardRecordService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(DiscountCardRecord::getEfficientFlag, true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .lt(DiscountCardRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(DiscountCardRecord::getDeductionStatus, EDeductionStatus.EFFECTIVE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(discountCardRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<DiscountCardRecord> updateList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (DiscountCardRecord discountCardRecord : discountCardRecords) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DiscountCardRecord record = new DiscountCardRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setId(discountCardRecord.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setDeductionStatus(EDeductionStatus.EXPIRED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateList.add(record); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            discountCardRecordService.updateBatchById(updateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 更新机构专辑状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<UserTenantAlbumRecord> userTenantAlbumRecords = userTenantAlbumRecordService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(UserTenantAlbumRecord::getEfficientFlag, true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .lt(UserTenantAlbumRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(UserTenantAlbumRecord::getDeductionStatus, EDeductionStatus.EFFECTIVE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(userTenantAlbumRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<UserTenantAlbumRecord> updateList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (UserTenantAlbumRecord userTenantAlbumRecord : userTenantAlbumRecords) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                UserTenantAlbumRecord record = new UserTenantAlbumRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setId(userTenantAlbumRecord.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.setDeductionStatus(EDeductionStatus.EXPIRED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateList.add(record); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userTenantAlbumRecordService.updateBatchById(updateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 更新学生表 权益字段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> userIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(vipCardRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userIds.addAll(vipCardRecords.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .filter(o->o.getClientType() == ClientEnum.STUDENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(VipCardRecord::getUserId).distinct().collect(Collectors.toList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(discountCardRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userIds.addAll(discountCardRecords.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(DiscountCardRecord::getUserId).distinct().collect(Collectors.toList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(userTenantAlbumRecords)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userIds.addAll(userTenantAlbumRecords.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(UserTenantAlbumRecord::getUserId).distinct().collect(Collectors.toList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return userIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 会员扣减 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private VipCardRecord deductVip(VipCardRecordWrapper.AddVipCardRecord addVipCardRecord) { 
			 |