|
@@ -3,16 +3,14 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.StudentStarDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.CacheNameEnum;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.*;
|
|
|
+import com.yonge.toolset.utils.date.DateUtil;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -21,10 +19,8 @@ import com.yonge.cooleshow.biz.dal.dao.StudentDao;
|
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -71,17 +67,48 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
totalVo.setUserId(student.getUserId());
|
|
|
StudentTotalVo starTotal = studentStarMap.get(student.getUserId());
|
|
|
if (null != starTotal) {
|
|
|
- totalVo.setStarNum(starTotal.getStarNum());
|
|
|
+ totalVo.setStarTeacherNum(starTotal.getStarTeacherNum());
|
|
|
}
|
|
|
StudentTotalVo courseTotal = studentCourseMap.get(student.getUserId());
|
|
|
if (null != courseTotal) {
|
|
|
- totalVo.setExpTime(courseTotal.getExpTime());
|
|
|
- totalVo.setUnExpTime(courseTotal.getUnExpTime());
|
|
|
+ totalVo.setFinshClassHours(courseTotal.getFinshClassHours());
|
|
|
+ totalVo.setUnfinshClassHours(courseTotal.getUnfinshClassHours());
|
|
|
}
|
|
|
+ //todo 缺少累计练习天数 累计练习时长 累计评测次数
|
|
|
resultList.add(totalVo);
|
|
|
redissonClient.getBucket(CacheNameEnum.STUDENT_HOME_TOTAL.getRedisKey(totalVo.getUserId()))
|
|
|
.set(totalVo);
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public StudentHomeVo queryUserInfo(SysUser user) {
|
|
|
+ Student student = getById(user.getId());
|
|
|
+ StudentHomeVo studentHomeVo = new StudentHomeVo();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(studentHomeVo, student);
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ studentHomeVo.setHeardUrl(user.getAvatar());
|
|
|
+ studentHomeVo.setUsername(user.getUsername());
|
|
|
+ int num = DateUtil.daysBetween(new Date(), student.getMembershipEndTime());
|
|
|
+ studentHomeVo.setMembershipDays(num < 0 ? 0 : num);
|
|
|
+ StudentTotalVo totalVo = (StudentTotalVo)redissonClient.getBucket(CacheNameEnum.STUDENT_HOME_TOTAL.getRedisKey(user.getId()))
|
|
|
+ .get();
|
|
|
+ if (null == totalVo) {
|
|
|
+ totalVo = new StudentTotalVo();
|
|
|
+ }
|
|
|
+ studentHomeVo.setExerciseDays(null == totalVo.getExerciseDays() ? 0 : totalVo.getExerciseDays());
|
|
|
+ studentHomeVo.setExerciseHours(null == totalVo.getExerciseHours() ? 0 :totalVo.getExerciseHours());
|
|
|
+ studentHomeVo.setTestingNum(null == totalVo.getTestingNum() ? 0 : totalVo.getTestingNum());
|
|
|
+ studentHomeVo.setFinshClassHours(null == totalVo.getFinshClassHours() ? 0 :totalVo.getFinshClassHours());
|
|
|
+ studentHomeVo.setUnfinshClassHours(null == totalVo.getUnfinshClassHours() ? 0 : totalVo.getUnfinshClassHours());
|
|
|
+ studentHomeVo.setStarTeacherNum(null == totalVo.getStarTeacherNum() ? 0 : totalVo.getStarTeacherNum());
|
|
|
+ return studentHomeVo;
|
|
|
+ }
|
|
|
}
|