change vor 4 Jahren
Ursprung
Commit
798d76c6cf

+ 72 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -369,9 +369,24 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
             userPlan1.setUpdateTime(DateUtils.getNowTime());
             userPlan1.setStudyNum(studyNum);
             int i = baseMapper.updateById(userPlan1);
-
-
             userPlanVo.setCoursePlanVo(coursePlanVo);
+            out:if (!CollectionUtils.isEmpty(userPlanVo.getCalendarStudyVo())){
+                for (CalendarStudyVo calendarStudyVo : userPlanVo.getCalendarStudyVo()) {
+                    if (calendarStudyVo.getMonth() == (cal.get(Calendar.MONTH)+1)){
+                        break out;
+                    }
+                }
+                //得到日历日期
+                Long firstDayOfMonth = getFirstDayOfMonth(cal.get(Calendar.MONTH)+1);
+                Long lastDayOfMonth = getLastDayOfMonth(cal.get(Calendar.MONTH)+1);
+                List<DayStudyVo> dayStudyVosOne = getDays(firstDayOfMonth,lastDayOfMonth);
+                CalendarStudyVo calendarStudyVo = new CalendarStudyVo();
+                calendarStudyVo.setDayStudyList(dayStudyVosOne);
+                calendarStudyVo.setYear(Convert.toLong(cal.get(Calendar.YEAR)));
+                calendarStudyVo.setMonth(Convert.toLong(cal.get(Calendar.MONTH)+1));
+                calendarStudyVos.add(calendarStudyVo);
+                userPlanVo.setCalendarStudyVo(calendarStudyVos);
+            }
             userPlanVos.add(userPlanVo);
 
         }
@@ -618,7 +633,61 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                 c.setDayStudyList(finalDayStudyVos1);
             });
             userPlanVos.setCalendarStudyVo(calendarStudyVos);
-        }else {
+            out:if (!CollectionUtils.isEmpty(userPlanVos.getCoursePlanVo())){
+                for (CalendarStudyVo calendarStudyVo : userPlanVos.getCalendarStudyVo()) {
+                    if (calendarStudyVo.getMonth() == (cal.get(Calendar.MONTH)+1)){
+                        break out;
+                    }
+                }
+                //得到日历日期
+                Long firstDayOfMonth = getFirstDayOfMonth(cal.get(Calendar.MONTH)+1);
+                Long lastDayOfMonth = getLastDayOfMonth(cal.get(Calendar.MONTH)+1);
+                List<DayStudyVo> dayStudyVosOne = getDays(firstDayOfMonth,lastDayOfMonth);
+                switch (cal.get(Calendar.DAY_OF_WEEK)- 1){
+                    case 0:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v -> v.getDate() <= cal.get(Calendar.DAY_OF_MONTH) + 7)
+                                .collect(Collectors.toList());
+                        break;
+                    case 1:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 6 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) -1)
+                                .collect(Collectors.toList());
+                        break;
+                    case 2:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 5 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) - 2)
+                                .collect(Collectors.toList());
+                        break;
+                    case 3:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 4 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) - 3)
+                                .collect(Collectors.toList());
+                        break;
+                    case 4:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 3 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) - 4)
+                                .collect(Collectors.toList());
+                        break;
+                    case 5:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 2 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) - 5)
+                                .collect(Collectors.toList());
+                        break;
+                    case 6:
+                        dayStudyVosOne=dayStudyVosOne.stream()
+                                .filter(v ->  v.getDate() < 1 + cal.get(Calendar.DAY_OF_MONTH) && v.getDate() >= cal.get(Calendar.DAY_OF_MONTH) - 6)
+                                .collect(Collectors.toList());
+                        break;
+                }
+                CalendarStudyVo calendarStudyVo = new CalendarStudyVo();
+                calendarStudyVo.setDayStudyList(dayStudyVosOne);
+                calendarStudyVo.setYear(Convert.toLong(cal.get(Calendar.YEAR)));
+                calendarStudyVo.setMonth(Convert.toLong(cal.get(Calendar.MONTH)+1));
+                calendarStudyVos.add(calendarStudyVo);
+                userPlanVos.setCalendarStudyVo(calendarStudyVos);
+            }
+        }else  {
             //得到日历日期
             List<CalendarStudyVo> calendarStudyVos = new ArrayList<>();
             Long firstDayOfMonth = getFirstDayOfMonth(cal.get(Calendar.MONTH)+1);