|
|
@@ -214,7 +214,7 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
.eq(UserTenantAlbumRecord::getTenantId, userTenantAlbumRecord.getTenantId())
|
|
|
.eq(UserTenantAlbumRecord::getUserId, userTenantAlbumRecord.getUserId())
|
|
|
.eq(UserTenantAlbumRecord::getTenantAlbumId, userTenantAlbumRecord.getTenantAlbumId())
|
|
|
- .eq(UserTenantAlbumRecord::getClientType, ClientEnum.STUDENT)
|
|
|
+ .eq(UserTenantAlbumRecord::getClientType, userTenantAlbumRecord.getClientType())
|
|
|
.orderByDesc(UserTenantAlbumRecord::getEndTime));
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
@@ -909,19 +909,20 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord last(Long userId,Long tenantId,Long albumId) {
|
|
|
+ public UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord last(Long userId,Long tenantId,Long albumId, ClientEnum clientType) {
|
|
|
//获取最近有效期最近的一条记录,(没过期)
|
|
|
List<UserTenantAlbumRecord> albumRecords = this.lambdaQuery()
|
|
|
.eq(UserTenantAlbumRecord::getUserId, userId)
|
|
|
.eq(UserTenantAlbumRecord::getTenantId, tenantId)
|
|
|
.eq(UserTenantAlbumRecord::getEfficientFlag, true)
|
|
|
.eq(UserTenantAlbumRecord::getDeductionStatus, EDeductionStatus.EFFECTIVE)
|
|
|
+ .eq(UserTenantAlbumRecord::getClientType, clientType)
|
|
|
.eq(albumId != null, UserTenantAlbumRecord::getTenantAlbumId, albumId).list();
|
|
|
UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord lastUserTenantAlbumRecord = new UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord();
|
|
|
Long tenantAlbumId = null;
|
|
|
Date endTime = null;
|
|
|
//忽略已删除的专辑
|
|
|
- albumRecords = this.ignoreTenantAlbumIds(albumRecords,userId);
|
|
|
+ albumRecords = this.ignoreTenantAlbumIds(albumRecords, userId, clientType);
|
|
|
if (CollectionUtils.isNotEmpty(albumRecords)) {
|
|
|
//按专辑编号分组,然后找出截止时间最大的记录
|
|
|
Map<Long, UserTenantAlbumRecord> recordMap = albumRecords.stream()
|
|
|
@@ -938,12 +939,13 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
.eq(UserTenantAlbumRecord::getUserId, userId)
|
|
|
.eq(UserTenantAlbumRecord::getEfficientFlag, true)
|
|
|
.eq(UserTenantAlbumRecord::getTenantId, tenantId)
|
|
|
+ .eq(UserTenantAlbumRecord::getClientType, clientType)
|
|
|
.lt(UserTenantAlbumRecord::getEndTime, new Date())
|
|
|
.eq(albumId != null, UserTenantAlbumRecord::getTenantAlbumId, albumId)
|
|
|
.orderByDesc(UserTenantAlbumRecord::getEndTime)
|
|
|
.orderByAsc(UserTenantAlbumRecord::getId).list();
|
|
|
//忽略已删除的专辑
|
|
|
- tenantAlbumRecords = this.ignoreTenantAlbumIds(tenantAlbumRecords,userId);
|
|
|
+ tenantAlbumRecords = this.ignoreTenantAlbumIds(tenantAlbumRecords, userId, clientType);
|
|
|
if (CollectionUtils.isNotEmpty(tenantAlbumRecords)) {
|
|
|
UserTenantAlbumRecord record = tenantAlbumRecords.get(0);
|
|
|
tenantAlbumId = record.getTenantAlbumId();
|
|
|
@@ -962,7 +964,7 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
}
|
|
|
|
|
|
//忽略已删除的专辑
|
|
|
- private List<UserTenantAlbumRecord> ignoreTenantAlbumIds(List<UserTenantAlbumRecord> albumRecords,Long userId) {
|
|
|
+ private List<UserTenantAlbumRecord> ignoreTenantAlbumIds(List<UserTenantAlbumRecord> albumRecords,Long userId, ClientEnum clientType) {
|
|
|
if(CollectionUtils.isNotEmpty(albumRecords)){
|
|
|
//获取所有专辑列表
|
|
|
List<Long> tenantAlbumIds = albumRecords.stream().map(UserTenantAlbumRecord::getTenantAlbumId).distinct().collect(Collectors.toList());
|
|
|
@@ -972,13 +974,16 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
|
ignoreTenantAlbumIds = list.stream().map(TenantAlbum::getId).collect(Collectors.toList());
|
|
|
}
|
|
|
- Student student = studentDao.selectById(userId);
|
|
|
- if(student != null && student.getTenantGroupId() != null){
|
|
|
- List<TenantGroupAlbum> groupAlbums = tenantGroupAlbumService.lambdaQuery().in(TenantGroupAlbum::getTenantAlbumId, tenantAlbumIds)
|
|
|
- .eq(TenantGroupAlbum::getTenantGroupId, student.getTenantGroupId())
|
|
|
- .and(x -> x.eq(TenantGroupAlbum::getDelFlag, true).or().eq(TenantGroupAlbum::getStatus, false)).list();
|
|
|
- if (CollectionUtils.isNotEmpty(groupAlbums)){
|
|
|
- ignoreTenantAlbumIds.addAll(groupAlbums.stream().map(TenantGroupAlbum::getTenantAlbumId).distinct().collect(Collectors.toList()));
|
|
|
+
|
|
|
+ if(clientType == ClientEnum.STUDENT) {
|
|
|
+ Student student = studentDao.selectById(userId);
|
|
|
+ if(student != null && student.getTenantGroupId() != null){
|
|
|
+ List<TenantGroupAlbum> groupAlbums = tenantGroupAlbumService.lambdaQuery().in(TenantGroupAlbum::getTenantAlbumId, tenantAlbumIds)
|
|
|
+ .eq(TenantGroupAlbum::getTenantGroupId, student.getTenantGroupId())
|
|
|
+ .and(x -> x.eq(TenantGroupAlbum::getDelFlag, true).or().eq(TenantGroupAlbum::getStatus, false)).list();
|
|
|
+ if (CollectionUtils.isNotEmpty(groupAlbums)){
|
|
|
+ ignoreTenantAlbumIds.addAll(groupAlbums.stream().map(TenantGroupAlbum::getTenantAlbumId).distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
List<Long> finalIgnoreTenantAlbumIds = ignoreTenantAlbumIds;
|