|  | @@ -920,6 +920,8 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
 | 
	
		
			
				|  |  |          UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord lastUserTenantAlbumRecord = new UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord();
 | 
	
		
			
				|  |  |          Long tenantAlbumId = null;
 | 
	
		
			
				|  |  |          Date endTime = null;
 | 
	
		
			
				|  |  | +        //忽略已删除的专辑
 | 
	
		
			
				|  |  | +        this.ignoreTenantAlbumIds(albumRecords);
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(albumRecords)) {
 | 
	
		
			
				|  |  |              //按专辑编号分组,然后找出截止时间最大的记录
 | 
	
		
			
				|  |  |              Map<Long, UserTenantAlbumRecord> recordMap = albumRecords.stream()
 | 
	
	
		
			
				|  | @@ -932,17 +934,18 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
 | 
	
		
			
				|  |  |              endTime = record.getEndTime();
 | 
	
		
			
				|  |  |          }else {
 | 
	
		
			
				|  |  |              //获取最近一条记录已过期的记录
 | 
	
		
			
				|  |  | -            UserTenantAlbumRecord record = this.lambdaQuery()
 | 
	
		
			
				|  |  | +            List<UserTenantAlbumRecord> tenantAlbumRecords = this.lambdaQuery()
 | 
	
		
			
				|  |  |                      .eq(UserTenantAlbumRecord::getUserId, userId)
 | 
	
		
			
				|  |  |                      .eq(UserTenantAlbumRecord::getEfficientFlag, true)
 | 
	
		
			
				|  |  |                      .eq(UserTenantAlbumRecord::getTenantId, tenantId)
 | 
	
		
			
				|  |  |                      .lt(UserTenantAlbumRecord::getEndTime, new Date())
 | 
	
		
			
				|  |  |                      .eq(albumId != null, UserTenantAlbumRecord::getTenantAlbumId, albumId)
 | 
	
		
			
				|  |  |                      .orderByDesc(UserTenantAlbumRecord::getEndTime)
 | 
	
		
			
				|  |  | -                    .orderByAsc(UserTenantAlbumRecord::getId)
 | 
	
		
			
				|  |  | -                    .last("limit 1")
 | 
	
		
			
				|  |  | -                    .one();
 | 
	
		
			
				|  |  | -            if (record != null) {
 | 
	
		
			
				|  |  | +                    .orderByAsc(UserTenantAlbumRecord::getId).list();
 | 
	
		
			
				|  |  | +            //忽略已删除的专辑
 | 
	
		
			
				|  |  | +            this.ignoreTenantAlbumIds(tenantAlbumRecords);
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(tenantAlbumRecords)) {
 | 
	
		
			
				|  |  | +                UserTenantAlbumRecord record = tenantAlbumRecords.get(0);
 | 
	
		
			
				|  |  |                  tenantAlbumId = record.getTenantAlbumId();
 | 
	
		
			
				|  |  |                  endTime = record.getEndTime();
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -958,6 +961,27 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
 | 
	
		
			
				|  |  |          return lastUserTenantAlbumRecord;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    //忽略已删除的专辑
 | 
	
		
			
				|  |  | +    private void ignoreTenantAlbumIds(List<UserTenantAlbumRecord> albumRecords) {
 | 
	
		
			
				|  |  | +        if(CollectionUtils.isNotEmpty(albumRecords)){
 | 
	
		
			
				|  |  | +            //获取所有专辑列表
 | 
	
		
			
				|  |  | +            List<Long> tenantAlbumIds = albumRecords.stream().map(UserTenantAlbumRecord::getTenantAlbumId).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            List<Long> ignoreTenantAlbumIds = new ArrayList<>();
 | 
	
		
			
				|  |  | +            List<TenantAlbum> list = tenantAlbumService.lambdaQuery().in(TenantAlbum::getId, tenantAlbumIds)
 | 
	
		
			
				|  |  | +                    .eq(TenantAlbum::getDelFlag, true).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(list)){
 | 
	
		
			
				|  |  | +                ignoreTenantAlbumIds = list.stream().map(TenantAlbum::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            List<TenantGroupAlbum> groupAlbums = tenantGroupAlbumService.lambdaQuery().in(TenantGroupAlbum::getTenantAlbumId, tenantAlbumIds)
 | 
	
		
			
				|  |  | +                    .eq(TenantGroupAlbum::getDelFlag, true).or().eq(TenantGroupAlbum::getStatus, false).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(groupAlbums)){
 | 
	
		
			
				|  |  | +                ignoreTenantAlbumIds.addAll(groupAlbums.stream().map(TenantGroupAlbum::getTenantAlbumId).collect(Collectors.toList()));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            List<Long> finalIgnoreTenantAlbumIds = ignoreTenantAlbumIds;
 | 
	
		
			
				|  |  | +            albumRecords = albumRecords.stream().filter(x -> !finalIgnoreTenantAlbumIds.contains(x.getTenantAlbumId())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void sendVipDeductionMessage(Long userId, Integer num,PeriodEnum period,String reason,String tenantAlbumName) {
 | 
	
		
			
				|  |  |          // 添加VIP时长短信
 |