|
|
@@ -11,11 +11,10 @@ import com.google.gson.JsonArray;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
|
|
|
import com.zhongzheng.modules.user.domain.UserPlanCource;
|
|
|
+import com.zhongzheng.modules.user.domain.UserStudyRecord;
|
|
|
import com.zhongzheng.modules.user.service.IUserPlanCourceService;
|
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
-import com.zhongzheng.modules.user.vo.CalendarStudyVo;
|
|
|
-import com.zhongzheng.modules.user.vo.CoursePlanVo;
|
|
|
-import com.zhongzheng.modules.user.vo.DayStudyVo;
|
|
|
+import com.zhongzheng.modules.user.vo.*;
|
|
|
import io.micrometer.core.instrument.util.TimeUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -29,7 +28,6 @@ import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserPlanEditBo;
|
|
|
import com.zhongzheng.modules.user.domain.UserPlan;
|
|
|
import com.zhongzheng.modules.user.mapper.UserPlanMapper;
|
|
|
-import com.zhongzheng.modules.user.vo.UserPlanVo;
|
|
|
import com.zhongzheng.modules.user.service.IUserPlanService;
|
|
|
|
|
|
import java.text.DateFormat;
|
|
|
@@ -271,7 +269,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
//初始化需要得到的数组
|
|
|
Integer[] array = new Integer[userPlanClsList.size()];
|
|
|
//使用for循环得到数组
|
|
|
- for(int i = 0; i < userPlanClsList.size();i++){
|
|
|
+ for (int i = 0; i < userPlanClsList.size(); i++) {
|
|
|
array[i] = Convert.toInt(userPlanClsList.get(i).getSourceId());
|
|
|
}
|
|
|
bo.setCourseId(array);
|
|
|
@@ -280,11 +278,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
|
|
|
coursePlanVo.stream().forEach(s -> {
|
|
|
//获得当天学习课程节数
|
|
|
- calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
+ calendarStudyVos.stream().filter(c -> c.getMonth() == cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
c.getDayStudyList().stream()
|
|
|
.filter(g -> g.getDate() == cal.get(Calendar.DAY_OF_MONTH))
|
|
|
.forEach(d -> {
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0){
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0) {
|
|
|
Map<Long, Long> courseDayMap = d.getCourseDayMap();
|
|
|
Long aLong = courseDayMap.get(s.getCourseId());
|
|
|
s.setStudyGoal(aLong);
|
|
|
@@ -293,42 +291,52 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
});
|
|
|
|
|
|
//更新当天学习节数是否已经完成
|
|
|
- int studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(),s.getCourseId(),getTimesmorning(),getTimesnight());
|
|
|
- if (studyCount > 0){
|
|
|
- calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
- c.getDayStudyList().stream()
|
|
|
- .forEach(d -> {
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()== cal.get(Calendar.DAY_OF_MONTH)){
|
|
|
- d.setPerform(1);
|
|
|
- }
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()< cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0){
|
|
|
- d.setPerform(2);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }else {
|
|
|
- calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
- c.getDayStudyList().stream()
|
|
|
- .forEach(d -> {
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()< cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0){
|
|
|
- d.setPerform(2);
|
|
|
- }
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()== cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 1){
|
|
|
- d.setPerform(0);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ //代表前面是否有未完成课程
|
|
|
+ List<UserStudyRecord> studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(), array, getTimesmorning(), getTimesnight());
|
|
|
+ boolean goal = true;
|
|
|
+ for (CoursePlanVo b : coursePlanVo) {
|
|
|
+ if (goal == false) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //更新当天学习节数是否已经完成
|
|
|
+ List<UserStudyRecord> collect = studyCount.stream().filter(v -> v.getCourseId().equals(s.getCourseId())).collect(Collectors.toList());
|
|
|
+ if (collect.size() >= b.getStudyGoal()) {
|
|
|
+ calendarStudyVos.stream().filter(c -> c.getMonth() == cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
+ c.getDayStudyList().stream()
|
|
|
+ .forEach(d -> {
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() == cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ d.setPerform(1);
|
|
|
+ }
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ d.setPerform(2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ calendarStudyVos.stream().filter(c -> c.getMonth() == cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
+ for (DayStudyVo d : c.getDayStudyList()) {
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ d.setPerform(2);
|
|
|
+ }
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() == cal.get(Calendar.DAY_OF_MONTH)) {
|
|
|
+ d.setPerform(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ goal = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserPlan userPlan1 = new UserPlan();
|
|
|
+ userPlan1.setPlanId(s.getPlanId());
|
|
|
+ String calendar = JSON.toJSONString(calendarStudyVos);
|
|
|
+ userPlan1.setSchedule(calendar);
|
|
|
+ userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ baseMapper.updateById(userPlan1);
|
|
|
}
|
|
|
- UserPlan userPlan1 = new UserPlan();
|
|
|
- userPlan1.setPlanId(s.getPlanId());
|
|
|
- String calendar = JSON.toJSONString(calendarStudyVos);
|
|
|
- userPlan1.setSchedule(calendar);
|
|
|
- userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
- baseMapper.updateById(userPlan1);
|
|
|
- });
|
|
|
|
|
|
- userPlanVo.setCoursePlanVo(coursePlanVo);
|
|
|
- userPlanVos.add(userPlanVo);
|
|
|
+ userPlanVo.setCoursePlanVo(coursePlanVo);
|
|
|
+ userPlanVos.add(userPlanVo);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return userPlanVos;
|
|
|
@@ -459,14 +467,20 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
List<DayStudyVo> dayStudyVos = new ArrayList<>();
|
|
|
List<DayStudyVo> finalDayStudyVos = dayStudyVos;
|
|
|
|
|
|
- coursePlanVo.stream().forEach(s -> {
|
|
|
+ //代表前面是否有未完成课程
|
|
|
+ List<UserStudyRecord> studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(),array,getTimesmorning(),getTimesnight());
|
|
|
+ boolean goal = true;
|
|
|
+ for (CoursePlanVo s : coursePlanVo) {
|
|
|
+ if (goal == false){
|
|
|
+ break;
|
|
|
+ }
|
|
|
//更新当天学习节数是否已经完成
|
|
|
- int studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(),s.getCourseId(),getTimesmorning(),getTimesnight());
|
|
|
- if (studyCount > 0){
|
|
|
+ List<UserStudyRecord> collect = studyCount.stream().filter(v -> v.getCourseId().equals(s.getCourseId())).collect(Collectors.toList());
|
|
|
+ if (collect.size() >= s.getStudyGoal()){
|
|
|
calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
c.getDayStudyList().stream()
|
|
|
.forEach(d -> {
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()== cal.get(Calendar.DAY_OF_MONTH)){
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()== cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0){
|
|
|
d.setPerform(1);
|
|
|
}
|
|
|
if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()< cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0){
|
|
|
@@ -476,16 +490,16 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
});
|
|
|
}else {
|
|
|
calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
- c.getDayStudyList().stream()
|
|
|
- .forEach(d -> {
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()< cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0){
|
|
|
- d.setPerform(2);
|
|
|
- }
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate()== cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 1){
|
|
|
- d.setPerform(0);
|
|
|
- }
|
|
|
- });
|
|
|
+ for (DayStudyVo d : c.getDayStudyList()) {
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ d.setPerform(2);
|
|
|
+ }
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() == cal.get(Calendar.DAY_OF_MONTH)) {
|
|
|
+ d.setPerform(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
+ goal=false;
|
|
|
}
|
|
|
UserPlan userPlan1 = new UserPlan();
|
|
|
userPlan1.setPlanId(s.getPlanId());
|
|
|
@@ -493,7 +507,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
userPlan1.setSchedule(calendar);
|
|
|
userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
baseMapper.updateById(userPlan1);
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
calendarStudyVos.stream().filter(c -> c.getMonth() == (cal.get(Calendar.MONTH)+1))
|
|
|
.forEach(c -> {
|