|
@@ -21,6 +21,10 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -61,6 +65,9 @@ public class UserMusicServiceImpl extends ServiceImpl<UserMusicMapper, UserMusic
|
|
|
@Autowired
|
|
|
private TeacherService teacherService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserMusicMapper userMusicMapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询详情
|
|
@@ -220,6 +227,24 @@ public class UserMusicServiceImpl extends ServiceImpl<UserMusicMapper, UserMusic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 草稿过期时间
|
|
|
+ SysConfig byParamName = sysConfigService.findByParamName(SysConfigConstant.USER_MUSIC_DRAFT_TIME);
|
|
|
+ Integer time = 7;
|
|
|
+ try {
|
|
|
+ time = Integer.parseInt(byParamName.getParamName());
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("作品草稿过期时间配置错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (UserMusicWrapper.UserMusic record : records) {
|
|
|
+ if (record.getType() == EUserMusicType.DRAFT && record.getCreateTime() != null) {
|
|
|
+ LocalDate localDate = record.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(time);
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.of(localDate, LocalTime.MAX);
|
|
|
+ record.setExpireTime(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 评测记录ID集合
|
|
|
List<Long> musicPracticeRecordIds = records.stream()
|
|
|
.map(UserMusicWrapper.UserMusic::getMusicPracticeRecordId).collect(Collectors.toList());
|
|
@@ -326,4 +351,18 @@ public class UserMusicServiceImpl extends ServiceImpl<UserMusicMapper, UserMusic
|
|
|
|
|
|
return userMusicIPage;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void workOverdue() {
|
|
|
+ String value = sysConfigService.findConfigValue(SysConfigConstant.USER_MUSIC_DRAFT_TIME);
|
|
|
+ Integer time = 7;
|
|
|
+ try {
|
|
|
+ time = Integer.parseInt(value);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("作品草稿过期时间配置错误");
|
|
|
+ }
|
|
|
+ userMusicMapper.workOverdue(time);
|
|
|
+ }
|
|
|
}
|