|
@@ -20,10 +20,8 @@ import com.zhongzheng.modules.user.mapper.UserPlanMapper;
|
|
|
import com.zhongzheng.modules.user.vo.UserPlanVo;
|
|
import com.zhongzheng.modules.user.vo.UserPlanVo;
|
|
|
import com.zhongzheng.modules.user.service.IUserPlanService;
|
|
import com.zhongzheng.modules.user.service.IUserPlanService;
|
|
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.Collections;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -115,9 +113,47 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
@Override
|
|
@Override
|
|
|
public UserPlanVo listPlan(UserPlanEditBo bo) {
|
|
public UserPlanVo listPlan(UserPlanEditBo bo) {
|
|
|
validEntityPlanBeforeSave(bo);
|
|
validEntityPlanBeforeSave(bo);
|
|
|
|
|
+ UserPlanVo userPlanVo = new UserPlanVo();
|
|
|
|
|
+ for (Long aLong : bo.getGoodsId()) {
|
|
|
|
|
+ //最近考试时间七天前到现在的天数,学习视频时长
|
|
|
|
|
+ Date date1 = new Date(bo.getEndTime() * 1000L);
|
|
|
|
|
+ //获得相隔天数
|
|
|
|
|
+ Long[] longs = {1L, 2L, 3L, 4L, 5L, 6L};
|
|
|
|
|
+ int dutyDays = getDutyDays(new Date(), date1, longs, bo.getStudyDay());
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> seLongs = baseMapper.selectGoods(aLong);
|
|
|
|
|
+ Long allNum = 0L;
|
|
|
|
|
+ for (Long seLong : seLongs) {
|
|
|
|
|
+ allNum += seLong;
|
|
|
|
|
+ }
|
|
|
|
|
+ //计算每天需要学习多少节课
|
|
|
|
|
+ int Sec = (int) Math.ceil((double) allNum / dutyDays);
|
|
|
|
|
+ }
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static int getDutyDays(Date startDateStr, Date endDateStr,Long[] longs,Long studyDay) {
|
|
|
|
|
+ int result = 0;
|
|
|
|
|
+ Date endDate = endDateStr;
|
|
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
|
|
+ c.setTime(endDate);
|
|
|
|
|
+ c.add(Calendar.DATE, - Convert.toInt(studyDay));
|
|
|
|
|
+ endDate = c.getTime();
|
|
|
|
|
+
|
|
|
|
|
+ Date startDate = startDateStr;
|
|
|
|
|
+
|
|
|
|
|
+ while (startDate.compareTo(endDate) <= 0) {
|
|
|
|
|
+ for (Long integer : longs) {
|
|
|
|
|
+ if (startDate.getDay() != integer) {
|
|
|
|
|
+ result++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ startDate.setDate(startDate.getDate() + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result-1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public List<GoodsVo> listGoods(UserPlanQueryBo bo) {
|
|
public List<GoodsVo> listGoods(UserPlanQueryBo bo) {
|
|
|
return baseMapper.listGoods(bo);
|
|
return baseMapper.listGoods(bo);
|
|
@@ -135,6 +171,5 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
|
|
|
if (rank > 0){
|
|
if (rank > 0){
|
|
|
throw new IllegalArgumentException("此网课学习计划正在进行中,若想再次制定请将计划完成或删除");
|
|
throw new IllegalArgumentException("此网课学习计划正在进行中,若想再次制定请将计划完成或删除");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|