|
@@ -8,6 +8,7 @@ import com.yonge.cooleshow.biz.dal.dao.StudentDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.StudentStarDao;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.StudentStar;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
|
|
|
import com.yonge.cooleshow.common.enums.CacheNameEnum;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -40,6 +41,8 @@ public class StudentTotalServiceImpl extends ServiceImpl<StudentTotalDao, Studen
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
@Autowired
|
|
|
private RedissonClient redissonClient;
|
|
|
+ @Autowired
|
|
|
+ private MusicSheetService musicSheetService;
|
|
|
|
|
|
@Override
|
|
|
public StudentTotalVo detail(Long id) {
|
|
@@ -68,23 +71,34 @@ public class StudentTotalServiceImpl extends ServiceImpl<StudentTotalDao, Studen
|
|
|
if (!CollectionUtils.isEmpty(studentCourseTotal)) {
|
|
|
studentCourseMap = studentCourseTotal.stream().collect(Collectors.toMap(StudentTotalVo::getUserId, o -> o));
|
|
|
}
|
|
|
+
|
|
|
+ //乐谱统计
|
|
|
+ List<StudentTotalVo> studentMusicTotal = musicSheetService.queryStudentTotal(null);
|
|
|
+ Map<Long, StudentTotalVo> studentMusicMap = new HashMap<>();
|
|
|
+ if (!CollectionUtils.isEmpty(studentMusicTotal)) {
|
|
|
+ studentMusicMap = studentMusicTotal.stream().collect(Collectors.toMap(StudentTotalVo::getUserId, o -> o));
|
|
|
+ }
|
|
|
+
|
|
|
List<StudentTotal> resultList = new ArrayList<>();
|
|
|
for (Student student : students) {
|
|
|
StudentTotal studentTotal = new StudentTotal();
|
|
|
studentTotal.setUserId(student.getUserId());
|
|
|
StudentTotalVo starTotal = studentStarMap.get(student.getUserId());
|
|
|
- if (null != starTotal && null != starTotal.getStarTeacherNum()) {
|
|
|
- studentTotal.setStarTeacherNum(starTotal.getStarTeacherNum());
|
|
|
+ if (null != starTotal) {
|
|
|
+ studentTotal.setStarTeacherNum(null == starTotal.getStarTeacherNum() ? 0 : starTotal.getStarTeacherNum());
|
|
|
}
|
|
|
StudentTotalVo courseTotal = studentCourseMap.get(student.getUserId());
|
|
|
if (null != courseTotal) {
|
|
|
- if (null != courseTotal.getFinshHours()) {
|
|
|
- studentTotal.setFinshHours(courseTotal.getFinshHours());
|
|
|
- }
|
|
|
- if (null != courseTotal.getUnfinshHours()) {
|
|
|
- studentTotal.setUnfinshHours(courseTotal.getUnfinshHours());
|
|
|
- }
|
|
|
+ studentTotal.setFinshHours(null == courseTotal.getFinshHours() ? 0 : courseTotal.getFinshHours());
|
|
|
+ studentTotal.setUnfinshHours(null == courseTotal.getUnfinshHours() ? 0 : courseTotal.getFinshHours());
|
|
|
}
|
|
|
+
|
|
|
+ StudentTotalVo musicTotal = studentMusicMap.get(student.getUserId());
|
|
|
+ if (null != musicTotal) {
|
|
|
+ studentTotal.setMusicAlbumNum(null == musicTotal.getMusicAlbumNum() ? 0 : musicTotal.getMusicAlbumNum());
|
|
|
+ studentTotal.setMusicSheetNum(null == musicTotal.getMusicSheetNum() ? 0 : musicTotal.getMusicSheetNum());
|
|
|
+ }
|
|
|
+
|
|
|
//todo 缺少累计练习天数 累计练习时长 累计评测次数
|
|
|
resultList.add(studentTotal);
|
|
|
redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(studentTotal.getUserId()))
|
|
@@ -108,7 +122,7 @@ public class StudentTotalServiceImpl extends ServiceImpl<StudentTotalDao, Studen
|
|
|
|
|
|
@Override
|
|
|
public void updateTotalCache(StudentTotal studentTotal) {
|
|
|
- if(null != studentTotal && null != studentTotal.getUserId()){
|
|
|
+ if (null != studentTotal && null != studentTotal.getUserId()) {
|
|
|
redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(studentTotal.getUserId())).set(studentTotal);
|
|
|
}
|
|
|
}
|
|
@@ -124,14 +138,25 @@ public class StudentTotalServiceImpl extends ServiceImpl<StudentTotalDao, Studen
|
|
|
);
|
|
|
studentTotal.setStarTeacherNum(starTeacherNum);
|
|
|
|
|
|
- List<StudentTotalVo> studentTotalVos = courseScheduleDao.queryStudentTotal(id);
|
|
|
- if (!CollectionUtils.isEmpty(studentTotalVos)) {
|
|
|
- StudentTotalVo studentTotalVo = studentTotalVos.get(0);
|
|
|
- studentTotal.setFinshHours(null == studentTotalVo.getFinshHours() ? 0 : studentTotalVo.getFinshHours());
|
|
|
- studentTotal.setUnfinshHours(null == studentTotalVo.getUnfinshHours() ? 0 : studentTotalVo.getUnfinshHours());
|
|
|
+ List<StudentTotalVo> studentScheduleTotal = courseScheduleDao.queryStudentTotal(id);
|
|
|
+ if (!CollectionUtils.isEmpty(studentScheduleTotal)) {
|
|
|
+ StudentTotalVo scheduleTotal = studentScheduleTotal.get(0);
|
|
|
+ if (null != scheduleTotal) {
|
|
|
+ studentTotal.setFinshHours(null == scheduleTotal.getFinshHours() ? 0 : scheduleTotal.getFinshHours());
|
|
|
+ studentTotal.setUnfinshHours(null == scheduleTotal.getUnfinshHours() ? 0 : scheduleTotal.getUnfinshHours());
|
|
|
+ }
|
|
|
}
|
|
|
- //todo 缺少累计练习天数 累计练习时长 累计评测次数
|
|
|
|
|
|
+ List<StudentTotalVo> studentMuiscTotal = musicSheetService.queryStudentTotal(id);
|
|
|
+ if (!CollectionUtils.isEmpty(studentMuiscTotal)) {
|
|
|
+ StudentTotalVo muiscTotal = studentMuiscTotal.get(0);
|
|
|
+ if (null != muiscTotal) {
|
|
|
+ studentTotal.setMusicAlbumNum(null == muiscTotal.getMusicAlbumNum() ? 0 : muiscTotal.getMusicAlbumNum());
|
|
|
+ studentTotal.setMusicSheetNum(null == muiscTotal.getMusicSheetNum() ? 0 : muiscTotal.getMusicSheetNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 缺少累计练习天数 累计练习时长 累计评测次数
|
|
|
redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(studentTotal.getUserId()))
|
|
|
.set(studentTotal);
|
|
|
|
|
@@ -144,7 +169,6 @@ public class StudentTotalServiceImpl extends ServiceImpl<StudentTotalDao, Studen
|
|
|
return studentTotal;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
int batchSize = 100;
|
|
|
|
|
|
/***
|