|
|
@@ -253,6 +253,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public List<UserPlanVo> userPlan(UserPlanQueryBo bo) {
|
|
|
List<UserPlan> userPlans = baseMapper.selectByUserPlan(bo);
|
|
|
List<UserPlanVo> userPlanVos = new ArrayList<>();
|
|
|
@@ -305,66 +306,81 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
+ //更新当天学习节数是否已经完成
|
|
|
+ //代表前面是否有未完成课程
|
|
|
+ Long studyNum = 0L;
|
|
|
+ boolean goal = true;
|
|
|
+ for (CoursePlanVo b : coursePlanVo) {
|
|
|
+ if (goal == false) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<UserStudyRecord> studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(), Convert.toInt(b.getCourseId()));
|
|
|
+ List<UserStudyRecord> myList = studyCount.stream().distinct().collect(Collectors.toList());
|
|
|
+ studyNum= studyNum+Convert.toLong(myList.size());
|
|
|
//更新当天学习节数是否已经完成
|
|
|
- //代表前面是否有未完成课程
|
|
|
- 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 (s.getStudyGoal() != null && 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) {
|
|
|
- Map<Long, Long> sectionIdMap = d.getSectionIdMap();
|
|
|
- for (UserStudyRecord userStudyRecord : collect) {
|
|
|
- sectionIdMap.remove(userStudyRecord.getSectionId());
|
|
|
- }
|
|
|
- if (sectionIdMap.isEmpty()) {
|
|
|
- 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 (b.getStudyGoal() != null && studyCount.size() >= b.getStudyGoal() ) {
|
|
|
+ for (CalendarStudyVo calendarStudyVo : calendarStudyVos) {
|
|
|
+ if (calendarStudyVo.getMonth() == cal.get(Calendar.MONTH) + 1) {
|
|
|
+ for (DayStudyVo d : calendarStudyVo.getDayStudyList()) {
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() == cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ if (d.getPerform() == 1){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Map<Long, Long> sectionIdMap = d.getSectionIdMap();
|
|
|
+ for (UserStudyRecord userStudyRecord : studyCount) {
|
|
|
+ sectionIdMap.remove(userStudyRecord.getSectionId());
|
|
|
+ }
|
|
|
+ if (sectionIdMap.isEmpty()) {
|
|
|
+ d.setPerform(1);
|
|
|
+ } else {
|
|
|
+ d.setPerform(0);
|
|
|
+ goal = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
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);
|
|
|
+ } else {
|
|
|
+ for (CalendarStudyVo calendarStudyVo : calendarStudyVos) {
|
|
|
+ for (DayStudyVo d : calendarStudyVo.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;
|
|
|
}
|
|
|
|
|
|
- userPlanVo.setCoursePlanVo(coursePlanVo);
|
|
|
+ }
|
|
|
+ UserPlan userPlan1 = new UserPlan();
|
|
|
+ userPlan1.setPlanId(userPlan.getPlanId());
|
|
|
+ String calendar = JSON.toJSONString(calendarStudyVos);
|
|
|
+ userPlan1.setSchedule(calendar);
|
|
|
+ userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ userPlan1.setStudyNum(studyNum);
|
|
|
+ int i = baseMapper.updateById(userPlan1);
|
|
|
+
|
|
|
+
|
|
|
+ userPlanVo.setCoursePlanVo(coursePlanVo);
|
|
|
userPlanVos.add(userPlanVo);
|
|
|
- });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return userPlanVos;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateGenerate(UserPlanAddBo bo) throws ParseException {
|
|
|
UserPlanQueryBo userPlanQueryBo = BeanUtil.toBean(bo, UserPlanQueryBo.class);
|
|
|
if (bo.getStatus() == 0) {
|
|
|
@@ -463,6 +479,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public UserPlanVo userPlanSeven(UserPlanQueryBo bo) {
|
|
|
List<UserPlan> userPlans = baseMapper.selectByUserPlan(bo);
|
|
|
UserPlanVo userPlanVos = new UserPlanVo();
|
|
|
@@ -489,36 +506,48 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
List<DayStudyVo> dayStudyVos = new ArrayList<>();
|
|
|
List<DayStudyVo> finalDayStudyVos = dayStudyVos;
|
|
|
|
|
|
+ //更新当天学习节数是否已经完成
|
|
|
//代表前面是否有未完成课程
|
|
|
- List<UserStudyRecord> studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(),array,getTimesmorning(),getTimesnight());
|
|
|
+ Long studyNum = 0L;
|
|
|
boolean goal = true;
|
|
|
- for (CoursePlanVo s : coursePlanVo) {
|
|
|
- if (goal == false){
|
|
|
+ for (CoursePlanVo b : coursePlanVo) {
|
|
|
+ if (goal == false) {
|
|
|
break;
|
|
|
}
|
|
|
+ List<UserStudyRecord> studyCount = userStudyRecordService.selectUserStudy(bo.getUserId(), Convert.toInt(b.getCourseId()));
|
|
|
+ List<UserStudyRecord> myList = studyCount.stream().distinct().collect(Collectors.toList());
|
|
|
+ studyNum= studyNum+Convert.toLong(myList.size());
|
|
|
//更新当天学习节数是否已经完成
|
|
|
- List<UserStudyRecord> collect = studyCount.stream().filter(v -> v.getCourseId().equals(s.getCourseId())).collect(Collectors.toList());
|
|
|
- if (s.getStudyGoal() != null && 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) && d.getPerform() == 0) {
|
|
|
- Map<Long, Long> sectionIdMap = d.getSectionIdMap();
|
|
|
- for (UserStudyRecord userStudyRecord : collect) {
|
|
|
- sectionIdMap.remove(userStudyRecord.getSectionId());
|
|
|
- }
|
|
|
- if (sectionIdMap.isEmpty()) {
|
|
|
- d.setPerform(1);
|
|
|
- }
|
|
|
+ if (b.getStudyGoal() != null && studyCount.size() >= b.getStudyGoal() ) {
|
|
|
+ for (CalendarStudyVo calendarStudyVo : calendarStudyVos) {
|
|
|
+ if (calendarStudyVo.getMonth() == cal.get(Calendar.MONTH) + 1) {
|
|
|
+ for (DayStudyVo d : calendarStudyVo.getDayStudyList()) {
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() == cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ if (d.getPerform() == 1){
|
|
|
+ break;
|
|
|
}
|
|
|
- if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
- d.setPerform(2);
|
|
|
+ Map<Long, Long> sectionIdMap = d.getSectionIdMap();
|
|
|
+ for (UserStudyRecord userStudyRecord : studyCount) {
|
|
|
+ sectionIdMap.remove(userStudyRecord.getSectionId());
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
- }else {
|
|
|
- calendarStudyVos.stream().filter(c -> c.getMonth()==cal.get(Calendar.MONTH) + 1).forEach(c -> {
|
|
|
- for (DayStudyVo d : c.getDayStudyList()) {
|
|
|
+ if (sectionIdMap.isEmpty()) {
|
|
|
+ d.setPerform(1);
|
|
|
+ } else {
|
|
|
+ d.setPerform(0);
|
|
|
+ goal = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
+ d.setPerform(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ for (CalendarStudyVo calendarStudyVo : calendarStudyVos) {
|
|
|
+ for (DayStudyVo d : calendarStudyVo.getDayStudyList()) {
|
|
|
if (d.getStudyCourseKnob() != null && d.getStudyCourseKnob() != 0 && d.getDate() < cal.get(Calendar.DAY_OF_MONTH) && d.getPerform() == 0) {
|
|
|
d.setPerform(2);
|
|
|
}
|
|
|
@@ -526,17 +555,21 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
d.setPerform(0);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- goal=false;
|
|
|
+ }
|
|
|
+ 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(userPlan.getPlanId());
|
|
|
+ String calendar = JSON.toJSONString(calendarStudyVos);
|
|
|
+ userPlan1.setSchedule(calendar);
|
|
|
+ userPlan1.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ userPlan1.setStudyNum(studyNum);
|
|
|
+ int i = baseMapper.updateById(userPlan1);
|
|
|
+
|
|
|
+
|
|
|
calendarStudyVos.stream().filter(c -> c.getMonth() == (cal.get(Calendar.MONTH)+1))
|
|
|
.forEach(c -> {
|
|
|
finalDayStudyVos.addAll(c.getDayStudyList().stream()
|
|
|
@@ -640,6 +673,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
return userPlanVos;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean editPlan(UserPlanAddBo bo) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private UserPlanVo generateSelfBo(UserPlanQueryBo bo) throws ParseException {
|