|
@@ -4,14 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
+import com.google.gson.JsonArray;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
|
|
import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
|
|
|
import com.zhongzheng.modules.user.vo.CalendarStudyVo;
|
|
import com.zhongzheng.modules.user.vo.CalendarStudyVo;
|
|
|
import com.zhongzheng.modules.user.vo.CoursePlanVo;
|
|
import com.zhongzheng.modules.user.vo.CoursePlanVo;
|
|
|
import com.zhongzheng.modules.user.vo.DayStudyVo;
|
|
import com.zhongzheng.modules.user.vo.DayStudyVo;
|
|
|
import io.micrometer.core.instrument.util.TimeUtils;
|
|
import io.micrometer.core.instrument.util.TimeUtils;
|
|
|
-import org.codehaus.jettison.json.JSONArray;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -126,7 +128,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (bo.getStatus() != null && bo.getStatus() == 1){
|
|
if (bo.getStatus() != null && bo.getStatus() == 1){
|
|
|
UserPlan userPlan = new UserPlan();
|
|
UserPlan userPlan = new UserPlan();
|
|
|
String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
|
- String s1 = JSON.toJSONString(userPlanVo);
|
|
|
|
|
|
|
+ String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
|
|
|
|
|
|
|
|
userPlan.setStudyDay(bo.getStudyDay());
|
|
userPlan.setStudyDay(bo.getStudyDay());
|
|
|
userPlan.setStudyCount(s1);
|
|
userPlan.setStudyCount(s1);
|
|
@@ -139,7 +141,13 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (bo.getStatus() != null){
|
|
if (bo.getStatus() != null){
|
|
|
userPlan.setStatus(bo.getStatus());
|
|
userPlan.setStatus(bo.getStatus());
|
|
|
}
|
|
}
|
|
|
- boolean save = this.save(userPlan);
|
|
|
|
|
|
|
+ if (bo.getStatus() == 1) {
|
|
|
|
|
+ boolean save = this.save(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 2){
|
|
|
|
|
+ userPlan.setPlanId(bo.getPlanId());
|
|
|
|
|
+ boolean save = this.updateById(userPlan);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return userPlanVo;
|
|
return userPlanVo;
|
|
|
}else{
|
|
}else{
|
|
@@ -147,7 +155,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (bo.getStatus() != null && bo.getStatus() == 1) {
|
|
if (bo.getStatus() != null && bo.getStatus() == 1) {
|
|
|
UserPlan userPlan = new UserPlan();
|
|
UserPlan userPlan = new UserPlan();
|
|
|
String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
|
- String s1 = JSON.toJSONString(userPlanVo);
|
|
|
|
|
|
|
+ String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
|
|
|
|
|
|
|
|
userPlan.setStudyDay(bo.getStudyDay());
|
|
userPlan.setStudyDay(bo.getStudyDay());
|
|
|
userPlan.setStudyCount(s1);
|
|
userPlan.setStudyCount(s1);
|
|
@@ -165,7 +173,13 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (bo.getStatus() != null){
|
|
if (bo.getStatus() != null){
|
|
|
userPlan.setStatus(bo.getStatus());
|
|
userPlan.setStatus(bo.getStatus());
|
|
|
}
|
|
}
|
|
|
- boolean save = this.save(userPlan);
|
|
|
|
|
|
|
+ if (bo.getStatus() == 1) {
|
|
|
|
|
+ boolean save = this.save(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 2){
|
|
|
|
|
+ userPlan.setPlanId(bo.getPlanId());
|
|
|
|
|
+ boolean save = this.updateById(userPlan);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return userPlanVo;
|
|
return userPlanVo;
|
|
|
}
|
|
}
|
|
@@ -173,8 +187,98 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public UserPlanVo userPlan(UserPlanQueryBo bo) {
|
|
public UserPlanVo userPlan(UserPlanQueryBo bo) {
|
|
|
- UserPlan UserPlan = baseMapper.selectByUserPlan(bo);
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ UserPlan userPlan = baseMapper.selectByUserPlan(bo);
|
|
|
|
|
+ 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());
|
|
|
|
|
+
|
|
|
|
|
+ List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
|
|
|
|
|
+ List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
|
|
|
|
|
+ Long[] strings = new Long[cont.size()];
|
|
|
|
|
+ cont.toArray(strings);
|
|
|
|
|
+ userPlanVo.setCalendarStudyVo(calendarStudyVos);
|
|
|
|
|
+ userPlanVo.setStudyCount(strings);
|
|
|
|
|
+ userPlanVo.setCoursePlanVo(null);
|
|
|
|
|
+
|
|
|
|
|
+ return userPlanVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean updateGenerate(UserPlanQueryBo bo) throws ParseException {
|
|
|
|
|
+ if (bo.getStatus() == 0) {
|
|
|
|
|
+ UserPlan userPlan = new UserPlan();
|
|
|
|
|
+ userPlan.setPlanId(bo.getPlanId());
|
|
|
|
|
+ userPlan.setStatus(0);
|
|
|
|
|
+ int i = baseMapper.updateById(userPlan);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ //自定义学习计划,自动生成计划
|
|
|
|
|
+ if (bo.getCourseId() != null && bo.getStudyCount() == null) {
|
|
|
|
|
+ UserPlanVo userPlanVo = generateSelf(bo);
|
|
|
|
|
+ if (bo.getStatus() != null && bo.getStatus() == 1) {
|
|
|
|
|
+ UserPlan userPlan = new UserPlan();
|
|
|
|
|
+ String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
|
|
|
+ String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
|
|
|
|
|
+
|
|
|
|
|
+ userPlan.setStudyDay(bo.getStudyDay());
|
|
|
|
|
+ userPlan.setStudyCount(s1);
|
|
|
|
|
+ userPlan.setUserId(bo.getUserId());
|
|
|
|
|
+ userPlan.setSchedule(s);
|
|
|
|
|
+ userPlan.setPitchNum(userPlanVo.getPitchNum());
|
|
|
|
|
+ userPlan.setStudyNum(0L);
|
|
|
|
|
+ userPlan.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ userPlan.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ if (bo.getStatus() != null) {
|
|
|
|
|
+ userPlan.setStatus(bo.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 1) {
|
|
|
|
|
+ boolean save = this.save(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 2) {
|
|
|
|
|
+ userPlan.setPlanId(bo.getPlanId());
|
|
|
|
|
+ boolean save = this.updateById(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ UserPlanVo userPlanVo = generateSelfBo(bo);
|
|
|
|
|
+ if (bo.getStatus() != null && bo.getStatus() == 1) {
|
|
|
|
|
+ UserPlan userPlan = new UserPlan();
|
|
|
|
|
+ String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
|
|
|
|
|
+ String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
|
|
|
|
|
+
|
|
|
|
|
+ userPlan.setStudyDay(bo.getStudyDay());
|
|
|
|
|
+ userPlan.setStudyCount(s1);
|
|
|
|
|
+ userPlan.setUserId(bo.getUserId());
|
|
|
|
|
+ userPlan.setSchedule(s);
|
|
|
|
|
+ userPlan.setExamDate(bo.getExamDate());
|
|
|
|
|
+ userPlan.setReminderTime(bo.getReminderTime());
|
|
|
|
|
+ userPlan.setPitchNum(userPlanVo.getPitchNum());
|
|
|
|
|
+ userPlan.setStudyNum(0L);
|
|
|
|
|
+ userPlan.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ userPlan.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ userPlan.setStartTime(bo.getStartTime());
|
|
|
|
|
+ userPlan.setEndTime(bo.getEndTime());
|
|
|
|
|
+ userPlan.setStudyDay(bo.getStudyDay());
|
|
|
|
|
+ if (bo.getStatus() != null) {
|
|
|
|
|
+ userPlan.setStatus(bo.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 1) {
|
|
|
|
|
+ boolean save = this.save(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getStatus() == 2) {
|
|
|
|
|
+ userPlan.setPlanId(bo.getPlanId());
|
|
|
|
|
+ boolean save = this.updateById(userPlan);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private UserPlanVo generateSelfBo(UserPlanQueryBo bo) throws ParseException {
|
|
private UserPlanVo generateSelfBo(UserPlanQueryBo bo) throws ParseException {
|