|
@@ -124,6 +124,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
userPlanVo.setPitchNum(userPlan.getPitchNum());
|
|
|
userPlanVo.setStudyNum(userPlan.getStudyNum());
|
|
|
userPlanVo.setPlanId(userPlan.getPlanId());
|
|
|
+ //查询计划绑定的商品
|
|
|
List<GoodsUserVo> goodsVos = userPlanGoodsService.selectGoods(userPlanVo.getPlanId(),userPlanVo.getUserId());
|
|
|
userPlanVo.setGoodsVos(goodsVos);
|
|
|
// List转成数组
|
|
@@ -198,11 +199,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
c1.setTime(dateTwo);
|
|
|
//设置为当月最后一天
|
|
|
c1.set(Calendar.DAY_OF_MONTH, c1.getActualMaximum(Calendar.DAY_OF_MONTH));
|
|
|
- System.out.println(c.getTimeInMillis());
|
|
|
- System.out.println(c1.getTimeInMillis());
|
|
|
-
|
|
|
+ //获得学习时间范围的日历
|
|
|
List<CalendarStudyVo> clCalendarStudyVos = findDates(c.getTimeInMillis()/1000,c1.getTimeInMillis()/1000);
|
|
|
+ //所有商品总节数
|
|
|
Long secAll = 0L;
|
|
|
+ //当前商品总节数
|
|
|
Long sumUp = 0L;
|
|
|
for (Long aLong : bo.getGoodsId()) {
|
|
|
//最近考试时间七天前到现在的天数,学习视频时长
|
|
@@ -212,6 +213,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (dutyDays < 1){
|
|
|
throw new IllegalArgumentException("没有学习天数,请认真填写开始结束时间");
|
|
|
}
|
|
|
+ //查询商品每个课程得总节数
|
|
|
List<Long> seLongs = baseMapper.selectGoods(aLong);
|
|
|
Long allNum = 0L;
|
|
|
for (Long seLong : seLongs) {
|
|
@@ -221,6 +223,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
//计算每天需要学习多少节课
|
|
|
int Sec = (int) Math.ceil((double) allNum / dutyDays);
|
|
|
secAll+=Sec;
|
|
|
+ //给大于等于今天的天数赋值学习节数
|
|
|
for (CalendarStudyVo clCalendarStudyVo : clCalendarStudyVos) {
|
|
|
for (DayStudyVo dayStudyVo : clCalendarStudyVo.getDayStudyList()) {
|
|
|
if (Arrays.asList(bo.getStudyCount()).contains(dayStudyVo.getStudyDay())){
|
|
@@ -229,10 +232,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
Calendar c5 = Calendar.getInstance();
|
|
|
c.setTime(new Date(bo.getStartTime()));
|
|
|
+ //小于今天直接下一次循环
|
|
|
if (dayStudyVo.getDate() < c5.get(Calendar.DAY_OF_MONTH) && clCalendarStudyVo.getMonth() == (c5.get(Calendar.MONTH) + 1) && clCalendarStudyVo.getYear() == (c5.get(Calendar.YEAR))){
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ //未赋值过,赋值,赋值过增加
|
|
|
if (dayStudyVo.getStudyCourseKnob() != null) {
|
|
|
if (allNum < Sec) {
|
|
|
dayStudyVo.setStudyCourseKnob(dayStudyVo.getStudyCourseKnob() + allNum);
|
|
@@ -254,6 +258,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
DaySectionVo daySectionVo = new DaySectionVo();
|
|
|
daySectionVo.setGoodsId(aLong);
|
|
|
+ //小于学习节数,直接加上剩余学习节数
|
|
|
if (allNum < Sec) {
|
|
|
daySectionVo.setStudyGoodsKnob(Convert.toLong(allNum));
|
|
|
} else{
|
|
@@ -333,9 +338,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
c1.set(Calendar.DAY_OF_MONTH, c1.getActualMaximum(Calendar.DAY_OF_MONTH));
|
|
|
System.out.println(c.getTimeInMillis());
|
|
|
System.out.println(c1.getTimeInMillis());
|
|
|
-
|
|
|
+ //获得学习时间范围的日历
|
|
|
List<CalendarStudyVo> clCalendarStudyVos = findDates(c.getTimeInMillis()/1000,c1.getTimeInMillis()/1000);
|
|
|
+ //所有商品总节数
|
|
|
Long secAll = 0L;
|
|
|
+ //当前商品总节数
|
|
|
Long sumUp = 0L;
|
|
|
for (Long aLong : bo.getGoodsId()) {
|
|
|
//最近考试时间七天前到现在的天数,学习视频时长
|
|
@@ -345,6 +352,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (dutyDays < 1){
|
|
|
throw new IllegalArgumentException("没有学习天数,请认真填写开始结束时间");
|
|
|
}
|
|
|
+ //查询每个商品的总节数
|
|
|
List<Long> seLongs = baseMapper.selectGoods(aLong);
|
|
|
Long allNum = 0L;
|
|
|
for (Long seLong : seLongs) {
|
|
@@ -362,6 +370,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
Calendar c5 = Calendar.getInstance();
|
|
|
c.setTime(new Date(bo.getStartTime()));
|
|
|
+ //给大于等于今天的天数赋值学习节数,小于跳过
|
|
|
if (dayStudyVo.getDate() < c5.get(Calendar.DAY_OF_MONTH) && clCalendarStudyVo.getMonth() == (c5.get(Calendar.MONTH) + 1) && clCalendarStudyVo.getYear() == (c5.get(Calendar.YEAR))){
|
|
|
continue;
|
|
|
}
|
|
@@ -679,7 +688,9 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
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());
|