|
|
@@ -293,8 +293,38 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
});
|
|
|
|
|
|
//更新当天学习节数是否已经完成
|
|
|
-
|
|
|
- //int studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(),s.getCourseId(),startTime,endTime);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ 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);
|
|
|
@@ -428,6 +458,43 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
userPlanVos.setCoursePlanVo(coursePlanVo);
|
|
|
List<DayStudyVo> dayStudyVos = new ArrayList<>();
|
|
|
List<DayStudyVo> finalDayStudyVos = dayStudyVos;
|
|
|
+
|
|
|
+ coursePlanVo.stream().forEach(s -> {
|
|
|
+ //更新当天学习节数是否已经完成
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ UserPlan userPlan1 = new UserPlan();
|
|
|
+ userPlan1.setPlanId(s.getPlanId());
|
|
|
+ String calendar = JSON.toJSONString(calendarStudyVos);
|
|
|
+ userPlan1.setSchedule(calendar);
|
|
|
+ userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ baseMapper.updateById(userPlan1);
|
|
|
+ });
|
|
|
+
|
|
|
calendarStudyVos.stream().filter(c -> c.getMonth() == (cal.get(Calendar.MONTH)+1))
|
|
|
.forEach(c -> {
|
|
|
finalDayStudyVos.addAll(c.getDayStudyList().stream()
|
|
|
@@ -1032,4 +1099,36 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
return result-1;
|
|
|
}
|
|
|
|
|
|
+ //获得今天时间的0点
|
|
|
+ public static int getTimesmorning(){
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+
|
|
|
+ cal.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+
|
|
|
+ cal.set(Calendar.SECOND, 0);
|
|
|
+
|
|
|
+ cal.set(Calendar.MINUTE, 0);
|
|
|
+
|
|
|
+ cal.set(Calendar.MILLISECOND, 0);
|
|
|
+
|
|
|
+ return (int) (cal.getTimeInMillis()/1000);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得当天24点时间
|
|
|
+ public static int getTimesnight(){
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+
|
|
|
+ cal.set(Calendar.HOUR_OF_DAY, 24);
|
|
|
+
|
|
|
+ cal.set(Calendar.SECOND, 0);
|
|
|
+
|
|
|
+ cal.set(Calendar.MINUTE, 0);
|
|
|
+
|
|
|
+ cal.set(Calendar.MILLISECOND, 0);
|
|
|
+
|
|
|
+ return (int) (cal.getTimeInMillis()/1000);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|