|
@@ -626,67 +626,83 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public UserPlanVo userPlanSeven(UserPlanQueryBo bo) throws ParseException {
|
|
|
- UserPlan userPlan = this.baseMapper.selectById(bo.getPlanId());
|
|
|
- //得到日历日期
|
|
|
- UserPlanVo userPlanVo = new UserPlanVo();
|
|
|
- userPlanVo.setUserId(userPlan.getUserId());
|
|
|
- userPlanVo.setExamDate(userPlan.getExamDate());
|
|
|
- userPlanVo.setReminderTime(userPlan.getReminderTime());
|
|
|
- userPlanVo.setStudyDay(userPlan.getStudyDay());
|
|
|
- userPlanVo.setStartTime(userPlan.getStartTime());
|
|
|
- userPlanVo.setEndTime(userPlan.getEndTime());
|
|
|
- userPlanVo.setPitchNum(userPlan.getPitchNum());
|
|
|
- userPlanVo.setStudyNum(userPlan.getStudyNum());
|
|
|
- userPlanVo.setPlanId(userPlan.getPlanId());
|
|
|
- List<GoodsUserVo> goodsVos = userPlanGoodsService.selectGoods(bo.getPlanId(),bo.getUserId());
|
|
|
- userPlanVo.setGoodsVos(goodsVos);
|
|
|
- // List转成数组
|
|
|
- Long[] array = new Long[goodsVos.size()];
|
|
|
- // 输出数组
|
|
|
- List<Long> arrys = new ArrayList<>();
|
|
|
- for (GoodsUserVo goodsVo : goodsVos) {
|
|
|
- arrys.add(goodsVo.getGoodsId());
|
|
|
- }
|
|
|
- arrys.toArray(array);
|
|
|
- userPlanVo.setGoodsId(array);
|
|
|
- //得到日历日期
|
|
|
- List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
|
|
|
+ public List<UserPlanVo> userPlanSeven(UserPlanQueryBo bo) throws ParseException {
|
|
|
+ LambdaQueryWrapper<UserPlan> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getSchedule()), UserPlan::getSchedule, bo.getSchedule());
|
|
|
+ lqw.eq(bo.getUserId() != null, UserPlan::getUserId, bo.getUserId());
|
|
|
+ lqw.eq(bo.getExamDate() != null, UserPlan::getExamDate, bo.getExamDate());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getReminderTime()), UserPlan::getReminderTime, bo.getReminderTime());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getStudyCount()), UserPlan::getStudyCount, bo.getStudyCount());
|
|
|
+ lqw.eq(bo.getStudyDay() != null, UserPlan::getStudyDay, bo.getStudyDay());
|
|
|
+ lqw.eq(bo.getEndTime() != null, UserPlan::getEndTime, bo.getEndTime());
|
|
|
+ lqw.eq(bo.getStartTime() != null, UserPlan::getStartTime, bo.getStartTime());
|
|
|
+ lqw.in(bo.getStatus() != null, UserPlan::getStatus, bo.getStatus());
|
|
|
+ lqw.eq(bo.getPitchNum() != null, UserPlan::getPitchNum, bo.getPitchNum());
|
|
|
+ lqw.eq(bo.getStudyNum() != null, UserPlan::getStudyNum, bo.getStudyNum());
|
|
|
+ List<UserPlan> userPlans = this.list(lqw);
|
|
|
+ List<UserPlanVo> userPlanVos = new ArrayList<>();
|
|
|
+ for (UserPlan userPlan : userPlans) {
|
|
|
+ //得到日历日期
|
|
|
+ UserPlanVo userPlanVo = new UserPlanVo();
|
|
|
+ userPlanVo.setUserId(userPlan.getUserId());
|
|
|
+ userPlanVo.setExamDate(userPlan.getExamDate());
|
|
|
+ userPlanVo.setReminderTime(userPlan.getReminderTime());
|
|
|
+ userPlanVo.setStudyDay(userPlan.getStudyDay());
|
|
|
+ userPlanVo.setStartTime(userPlan.getStartTime());
|
|
|
+ userPlanVo.setEndTime(userPlan.getEndTime());
|
|
|
+ userPlanVo.setPitchNum(userPlan.getPitchNum());
|
|
|
+ userPlanVo.setStudyNum(userPlan.getStudyNum());
|
|
|
+ userPlanVo.setPlanId(userPlan.getPlanId());
|
|
|
+ List<GoodsUserVo> goodsVos = userPlanGoodsService.selectGoods(bo.getPlanId(), bo.getUserId());
|
|
|
+ userPlanVo.setGoodsVos(goodsVos);
|
|
|
+ // List转成数组
|
|
|
+ Long[] array = new Long[goodsVos.size()];
|
|
|
+ // 输出数组
|
|
|
+ List<Long> arrys = new ArrayList<>();
|
|
|
+ for (GoodsUserVo goodsVo : goodsVos) {
|
|
|
+ arrys.add(goodsVo.getGoodsId());
|
|
|
+ }
|
|
|
+ arrys.toArray(array);
|
|
|
+ userPlanVo.setGoodsId(array);
|
|
|
+ //得到日历日期
|
|
|
+ List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
|
|
|
|
|
|
- Calendar cal=Calendar.getInstance();
|
|
|
- cal.add(Calendar.WEEK_OF_MONTH, 0);
|
|
|
- cal.set(Calendar.DAY_OF_WEEK, 2);
|
|
|
- Long timeInMillisStart = cal.getTimeInMillis()/1000-86400;
|
|
|
- Calendar cal2=Calendar.getInstance();
|
|
|
- cal2.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));
|
|
|
- cal2.add(Calendar.DAY_OF_WEEK, 1);
|
|
|
- Long timeInMillis = cal2.getTimeInMillis()/1000;
|
|
|
- List<CalendarStudyVo> sevenDates = findSevenDates(timeInMillisStart, timeInMillis);
|
|
|
- for (CalendarStudyVo sevenDate : sevenDates) {
|
|
|
- for (DayStudyVo dayStudyVo : sevenDate.getDayStudyList()) {
|
|
|
- List<CalendarStudyVo> collect = calendarStudyVos.stream().filter(CalendarStudyVo -> CalendarStudyVo.getMonth().equals(sevenDate.getMonth())).collect(Collectors.toList());
|
|
|
- if (!CollectionUtils.isEmpty(collect)) {
|
|
|
- for (CalendarStudyVo calendarStudyVo : collect) {
|
|
|
- for (DayStudyVo studyVo : calendarStudyVo.getDayStudyList()) {
|
|
|
- if (studyVo.getDate().equals(dayStudyVo.getDate())){
|
|
|
- dayStudyVo.setStudyCourseKnob(studyVo.getStudyCourseKnob());
|
|
|
- dayStudyVo.setPerform(studyVo.getPerform());
|
|
|
- dayStudyVo.setDaySectionList(studyVo.getDaySectionList());
|
|
|
- break;
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.add(Calendar.WEEK_OF_MONTH, 0);
|
|
|
+ cal.set(Calendar.DAY_OF_WEEK, 2);
|
|
|
+ Long timeInMillisStart = cal.getTimeInMillis() / 1000 - 86400;
|
|
|
+ Calendar cal2 = Calendar.getInstance();
|
|
|
+ cal2.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));
|
|
|
+ cal2.add(Calendar.DAY_OF_WEEK, 1);
|
|
|
+ Long timeInMillis = cal2.getTimeInMillis() / 1000;
|
|
|
+ List<CalendarStudyVo> sevenDates = findSevenDates(timeInMillisStart, timeInMillis);
|
|
|
+ for (CalendarStudyVo sevenDate : sevenDates) {
|
|
|
+ for (DayStudyVo dayStudyVo : sevenDate.getDayStudyList()) {
|
|
|
+ List<CalendarStudyVo> collect = calendarStudyVos.stream().filter(CalendarStudyVo -> CalendarStudyVo.getMonth().equals(sevenDate.getMonth())).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(collect)) {
|
|
|
+ for (CalendarStudyVo calendarStudyVo : collect) {
|
|
|
+ for (DayStudyVo studyVo : calendarStudyVo.getDayStudyList()) {
|
|
|
+ if (studyVo.getDate().equals(dayStudyVo.getDate())) {
|
|
|
+ dayStudyVo.setStudyCourseKnob(studyVo.getStudyCourseKnob());
|
|
|
+ dayStudyVo.setPerform(studyVo.getPerform());
|
|
|
+ dayStudyVo.setDaySectionList(studyVo.getDaySectionList());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- //得到学习的周
|
|
|
- List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
|
|
|
- Long[] strings = new Long[cont.size()];
|
|
|
- cont.toArray(strings);
|
|
|
+ //得到学习的周
|
|
|
+ List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
|
|
|
+ Long[] strings = new Long[cont.size()];
|
|
|
+ cont.toArray(strings);
|
|
|
|
|
|
- userPlanVo.setCalendarStudyVo(sevenDates);
|
|
|
- userPlanVo.setStudyCount(strings);
|
|
|
- return userPlanVo;
|
|
|
+ userPlanVo.setCalendarStudyVo(sevenDates);
|
|
|
+ userPlanVo.setStudyCount(strings);
|
|
|
+ userPlanVos.add(userPlanVo);
|
|
|
+ }
|
|
|
+ return userPlanVos;
|
|
|
}
|
|
|
|
|
|
|