Ver código fonte

会员营期-勾选课程修改后,所选课程根据时间重新选择排序

luolinsong 1 semana atrás
pai
commit
f2247dfc9f

+ 114 - 99
fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodDaysServiceImpl.java

@@ -39,6 +39,7 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
@@ -65,6 +66,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     @Autowired
     private FsUserCourseVideoRedPackageMapper fsUserCourseVideoRedPackageMapper;
+
     /**
      * 查询营期课程
      *
@@ -72,8 +74,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 营期课程
      */
     @Override
-    public FsUserCoursePeriodDays selectFsUserCoursePeriodDaysById(Long id)
-    {
+    public FsUserCoursePeriodDays selectFsUserCoursePeriodDaysById(Long id) {
         return baseMapper.selectFsUserCoursePeriodDaysById(id);
     }
 
@@ -84,8 +85,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 营期课程
      */
     @Override
-    public List<FsUserCoursePeriodDays> selectFsUserCoursePeriodDaysList(FsUserCoursePeriodDays fsUserCoursePeriodDays)
-    {
+    public List<FsUserCoursePeriodDays> selectFsUserCoursePeriodDaysList(FsUserCoursePeriodDays fsUserCoursePeriodDays) {
         return baseMapper.selectFsUserCoursePeriodDaysList(fsUserCoursePeriodDays);
     }
 
@@ -96,8 +96,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 结果
      */
     @Override
-    public int insertFsUserCoursePeriodDays(FsUserCoursePeriodDays fsUserCoursePeriodDays)
-    {
+    public int insertFsUserCoursePeriodDays(FsUserCoursePeriodDays fsUserCoursePeriodDays) {
         fsUserCoursePeriodDays.setCreateTime(DateUtils.getNowDate());
         return baseMapper.insert(fsUserCoursePeriodDays);
     }
@@ -109,8 +108,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 结果
      */
     @Override
-    public int updateFsUserCoursePeriodDays(FsUserCoursePeriodDays fsUserCoursePeriodDays)
-    {
+    public int updateFsUserCoursePeriodDays(FsUserCoursePeriodDays fsUserCoursePeriodDays) {
         fsUserCoursePeriodDays.setUpdateTime(DateUtils.getNowDate());
         return baseMapper.updateById(fsUserCoursePeriodDays);
     }
@@ -122,14 +120,13 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 结果
      */
     @Override
-    public int deleteFsUserCoursePeriodDaysByIds(Long[] ids)
-    {
+    public int deleteFsUserCoursePeriodDaysByIds(Long[] ids) {
         int flag = 0;
         List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectBatchIds(Arrays.asList(ids));
         List<Long> periodDayIds = fsUserCoursePeriodDays.stream().map(FsUserCoursePeriodDays::getId).collect(Collectors.toList());
         List<Long> videoIds = fsUserCoursePeriodDays.stream().map(FsUserCoursePeriodDays::getVideoId).collect(Collectors.toList());
-        if(!periodDayIds.isEmpty()){
-            flag = fsUserCoursePeriodDaysMapper.updateBatchDelFlag(periodDayIds.toArray(new Long[0]),1);
+        if (!periodDayIds.isEmpty()) {
+            flag = fsUserCoursePeriodDaysMapper.updateBatchDelFlag(periodDayIds.toArray(new Long[0]), 1);
             //删除红包记录
             fsUserCourseVideoRedPackageMapper.deleteFsUserCourseVideoRedPackageByVedioIds(videoIds.toArray(new Long[0]));
         }
@@ -143,29 +140,28 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
      * @return 结果
      */
     @Override
-    public int deleteFsUserCoursePeriodDaysById(Long id)
-    {
+    public int deleteFsUserCoursePeriodDaysById(Long id) {
         return baseMapper.deleteFsUserCoursePeriodDaysById(id);
     }
 
     @Override
     public R addCourse(FsUserCoursePeriodDays entity) {
         FsUserCoursePeriod period = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(entity.getPeriodId());
-        List<FsUserCoursePeriodDays> dayList = list(new QueryWrapper<FsUserCoursePeriodDays>().eq("period_id", period.getPeriodId()).eq("del_flag","0"));
-        
+        List<FsUserCoursePeriodDays> dayList = list(new QueryWrapper<FsUserCoursePeriodDays>().eq("period_id", period.getPeriodId()).eq("del_flag", "0"));
+
         // 如果开启了自由模式,则不需要检查营期天数限制
         if (period.getFreeMode() == null || period.getFreeMode() != 1) {
             long days;
-            if(period.getPeriodType() == 2){
+            if (period.getPeriodType() == 2) {
                 days = 1;
-            }else{
+            } else {
                 days = DateUtil.differenceTime(period.getPeriodStartingTime(), period.getPeriodEndTime(), TimeTypeEnum.DAY);
             }
             days++;
-            if(dayList.size() + entity.getVideoIds().size() > days) return R.error("课程不能超过营期范围");
+            if (dayList.size() + entity.getVideoIds().size() > days) return R.error("课程不能超过营期范围");
         }
-        
-        if(dayList.stream().anyMatch(e -> entity.getVideoIds().contains(e.getVideoId()))) return R.error("不能添加相同章节");
+
+        if (dayList.stream().anyMatch(e -> entity.getVideoIds().contains(e.getVideoId()))) return R.error("不能添加相同章节");
         AtomicInteger i = new AtomicInteger(0);
         FsUserCourseVideo fsUserCourseVideo = new FsUserCourseVideo();
         fsUserCourseVideo.setCourseId(entity.getCourseId());
@@ -178,28 +174,28 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             day.setLesson(dayList.size() + i.getAndIncrement());
             day.setDayDate(period.getPeriodStartingTime().plusDays(day.getLesson()));
             day.setCourseId(entity.getCourseId());
-            if(entity.getStartTime() != null){
+            if (entity.getStartTime() != null) {
                 day.setStartDateTime(LocalDateTime.of(day.getDayDate(), entity.getStartTime()));
-            }else if(video.getViewStartTime() != null){
+            } else if (video.getViewStartTime() != null) {
                 day.setStartDateTime(LocalDateTime.of(day.getDayDate(), video.getViewStartTime()));
             }
-            if(entity.getEndTime1() != null){
+            if (entity.getEndTime1() != null) {
                 day.setEndDateTime(LocalDateTime.of(day.getDayDate(), entity.getEndTime1()));
-            }else if(video.getViewEndTime() != null){
+            } else if (video.getViewEndTime() != null) {
                 day.setEndDateTime(LocalDateTime.of(day.getDayDate(), video.getViewEndTime()));
             }
             SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
-            if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
+            if (ObjectUtils.isNotEmpty(config) && config.getConfigValue().equals("1")) {
                 entity.setJoinTime(entity.getEndTime1());
             }
-            if(entity.getJoinTime() != null){
+            if (entity.getJoinTime() != null) {
                 day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), entity.getJoinTime()));
-            }else if(video.getLastJoinTime() != null){
+            } else if (video.getLastJoinTime() != null) {
                 day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), video.getLastJoinTime()));
             }
             day.setVideoId(e);
             day.setCreateTime(new Date());
-            
+
             // 设置课程状态:如果开启自由模式,默认为进行中(status=1)
             if (period.getFreeMode() != null && period.getFreeMode() == 1) {
                 // 自由模式:直接设置为进行中
@@ -207,7 +203,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             } else {
                 // 固定模式:默认开启今天及以后的两天
                 LocalDate compareDay = LocalDate.now().plusDays(1);
-                if(day.getDayDate().isBefore(compareDay)){
+                if (day.getDayDate().isBefore(compareDay)) {
                     day.setStatus(1);
                 } else {
                     day.setStatus(0);
@@ -221,6 +217,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     /**
      * 批量添加课程小节
+     *
      * @param param 批量添加参数
      * @return 操作结果
      */
@@ -247,8 +244,8 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             } else {
                 totalDays = DateUtil.differenceTime(period.getPeriodStartingTime(), period.getPeriodEndTime(), TimeTypeEnum.DAY);
             }
-            totalDays ++;
-            
+            totalDays++;
+
             // 5. 验证是否超过营期范围(开启自由模式时跳过此验证)
             if (period.getFreeMode() == null || period.getFreeMode() != 1) {
                 if (existingDays.size() + param.getVideoIds().size() > totalDays) {
@@ -260,11 +257,11 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             Set<Long> existingVideoIds = existingDays.stream()
                     .map(FsUserCoursePeriodDays::getVideoId)
                     .collect(Collectors.toSet());
-            
+
             List<Long> duplicateVideoIds = param.getVideoIds().stream()
                     .filter(existingVideoIds::contains)
                     .collect(Collectors.toList());
-            
+
             if (!duplicateVideoIds.isEmpty()) {
                 if (param.getSkipDuplicate() != null && param.getSkipDuplicate()) {
                     // 跳过重复的视频
@@ -300,21 +297,21 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                         return sort1.compareTo(sort2);
                     })
                     .collect(Collectors.toList());
-            
+
             log.info("按courseSort排序后的视频顺序:");
             for (int i = 0; i < sortedVideos.size(); i++) {
                 FsUserCourseVideo video = sortedVideos.get(i);
-                log.info("  序号: {}, 视频ID: {}, 标题: {}, courseSort: {}", 
-                    i + 1, video.getVideoId(), video.getTitle(), video.getCourseSort());
+                log.info("  序号: {}, 视频ID: {}, 标题: {}, courseSort: {}",
+                        i + 1, video.getVideoId(), video.getTitle(), video.getCourseSort());
             }
 
             // 10. 准备添加的小节数据,使用按courseSort排序后的视频列表
             List<FsUserCoursePeriodDays> newDays = new ArrayList<>();
-            
+
             // 确定开始课次 - 从现有最大课次+1开始,确保连续性
             int startLesson;
             LocalDate startDate; // 新增:确定开始日期
-            
+
             if (param.getStartLesson() != null) {
                 startLesson = param.getStartLesson();
                 // 如果指定了起始课次,仍然基于营期开始时间计算日期
@@ -325,7 +322,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                         .mapToInt(FsUserCoursePeriodDays::getLesson)
                         .max()
                         .orElse(0) + 1;
-                
+
                 // 关键修复:获取已存在课程的最后日期,从该日期的下一天开始
                 if (!existingDays.isEmpty()) {
                     // 按日期排序,获取最后一个课程的日期
@@ -334,7 +331,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                             .filter(date -> date != null)
                             .max(LocalDate::compareTo)
                             .orElse(period.getPeriodStartingTime().plusDays(startLesson - 2));
-                    
+
                     startDate = lastDate.plusDays(1); // 从最后日期的下一天开始
                     log.info("基于已存在课程的最后日期计算起始日期:最后日期={}, 新起始日期={}", lastDate, startDate);
                 } else {
@@ -343,39 +340,39 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                     log.info("营期暂无课程,从营期开始时间计算起始日期:{}", startDate);
                 }
             }
-            
+
             // 使用排序后的视频列表进行处理,确保按courseSort顺序添加
             for (int i = 0; i < sortedVideos.size(); i++) {
                 FsUserCourseVideo video = sortedVideos.get(i);
                 Long videoId = video.getVideoId();
-                
+
                 FsUserCoursePeriodDays newDay = new FsUserCoursePeriodDays();
                 newDay.setPeriodId(param.getPeriodId());
                 newDay.setCourseId(param.getCourseId());
                 newDay.setVideoId(videoId);
-                
+
                 // 设置课次 - 严格按排序后的顺序递增,确保有序
                 newDay.setLesson(startLesson + i);
-                
+
                 // 计算日期 - 修复:基于起始日期递增,而不是基于课次计算
                 // 这样可以避免当已存在课程的日期与课次不对应时出现重复日期
                 LocalDate courseDate = startDate.plusDays(i);
                 newDay.setDayDate(courseDate);
-                
+
                 // 设置时间 - 优先使用参数中的时间,其次使用视频默认时间
                 if (param.getStartTime() != null) {
                     newDay.setStartDateTime(LocalDateTime.of(courseDate, param.getStartTime()));
                 } else if (video.getViewStartTime() != null) {
                     newDay.setStartDateTime(LocalDateTime.of(courseDate, video.getViewStartTime()));
                 }
-                
+
                 if (param.getEndDateTime() != null) {
                     newDay.setEndDateTime(LocalDateTime.of(courseDate, param.getEndDateTime()));
                 } else if (video.getViewEndTime() != null) {
                     newDay.setEndDateTime(LocalDateTime.of(courseDate, video.getViewEndTime()));
                 }
-                
-                // 设置加入时间 
+
+                // 设置加入时间
                 SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
                 if (ObjectUtils.isNotEmpty(config) && config.getConfigValue().equals("1")) {
                     // 如果开启了配置,使用结束时间作为加入时间
@@ -387,7 +384,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                         newDay.setLastJoinTime(LocalDateTime.of(courseDate, video.getLastJoinTime()));
                     }
                 }
-                
+
                 // 设置状态:如果开启自由模式,默认为进行中(status=1)
                 if (period.getFreeMode() != null && period.getFreeMode() == 1) {
                     // 自由模式:直接设置为进行中
@@ -401,40 +398,40 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
                         newDay.setStatus(0); // 未开始
                     }
                 }
-                
+
                 newDay.setCreateTime(new Date());
                 newDays.add(newDay);
-                
-                log.debug("准备添加课程:课次={}, 日期={}, 视频ID={}, 标题={}, courseSort={}", 
-                    newDay.getLesson(), newDay.getDayDate(), videoId, video.getTitle(), video.getCourseSort());
+
+                log.debug("准备添加课程:课次={}, 日期={}, 视频ID={}, 标题={}, courseSort={}",
+                        newDay.getLesson(), newDay.getDayDate(), videoId, video.getTitle(), video.getCourseSort());
             }
-            
+
             // 11. 批量保存,确保按courseSort排序的结果保存
             if (!newDays.isEmpty()) {
                 // 再次按课次排序,确保数据库中的顺序正确(按照批量操作排序保障规范)
                 newDays.sort(Comparator.comparing(FsUserCoursePeriodDays::getLesson));
-                
+
                 log.info("即将批量添加课程小节(按courseSort排序):");
                 for (int i = 0; i < newDays.size(); i++) {
                     FsUserCoursePeriodDays day = newDays.get(i);
                     FsUserCourseVideo video = videoMap.get(day.getVideoId());
-                    log.info("  序号: {}, 课次: {}, 日期: {}, 视频ID: {}, 标题: {}, courseSort: {}", 
-                        i + 1, day.getLesson(), day.getDayDate(), day.getVideoId(), 
-                        video != null ? video.getTitle() : "Unknown", 
-                        video != null ? video.getCourseSort() : "null");
+                    log.info("  序号: {}, 课次: {}, 日期: {}, 视频ID: {}, 标题: {}, courseSort: {}",
+                            i + 1, day.getLesson(), day.getDayDate(), day.getVideoId(),
+                            video != null ? video.getTitle() : "Unknown",
+                            video != null ? video.getCourseSort() : "null");
                 }
-                
+
                 super.saveBatch(newDays);
-                log.info("批量添加课程小节成功(按courseSort排序),营期ID:{},添加数量:{},课次范围:{}-{}", 
-                    param.getPeriodId(), newDays.size(), 
-                    newDays.get(0).getLesson(), 
-                    newDays.get(newDays.size() - 1).getLesson());
-                return R.ok("成功按courseSort排序添加 " + newDays.size() + " 个课程小节,课次范围:" + 
-                          newDays.get(0).getLesson() + "-" + newDays.get(newDays.size() - 1).getLesson());
+                log.info("批量添加课程小节成功(按courseSort排序),营期ID:{},添加数量:{},课次范围:{}-{}",
+                        param.getPeriodId(), newDays.size(),
+                        newDays.get(0).getLesson(),
+                        newDays.get(newDays.size() - 1).getLesson());
+                return R.ok("成功按courseSort排序添加 " + newDays.size() + " 个课程小节,课次范围:" +
+                        newDays.get(0).getLesson() + "-" + newDays.get(newDays.size() - 1).getLesson());
             } else {
                 return R.ok("没有需要添加的课程小节");
             }
-            
+
         } catch (Exception e) {
             log.error("批量添加课程小节失败,营期ID:{},错误信息:{}", param.getPeriodId(), e.getMessage(), e);
             throw new RuntimeException("批量添加课程小节失败:" + e.getMessage(), e);
@@ -455,7 +452,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     @Override
     public List<CompanyRedPacketParam> getCompanyByPeriod(Long periodId, Long videoId) {
-        if(videoId == null ){
+        if (videoId == null) {
             return fsUserCoursePeriodMapper.selectCompanyByPeriod(periodId);
         }
         return fsUserCoursePeriodMapper.selectCompanyByPeriodVideo(periodId, videoId);
@@ -575,35 +572,51 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     @Override
     public R updateCourseTime(UpdateCourseTimeVo vo) {
+        // 1. 查询数据库,获取需要更新的营期日期记录列表
         List<FsUserCoursePeriodDays> list = fsUserCoursePeriodDaysMapper.selectBatchIds(vo.getIds());
-        list.forEach(day -> {
-//            day.setStartDateTime(LocalDateTime.of(day.getDayDate(), vo.getStartTime()));
-//            day.setEndDateTime(LocalDateTime.of(day.getDayDate(), vo.getEndTime1()));
-//            day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), vo.getJoinTime()));
-            // 调整时间为直接接收前端传入的年月日,不使用营期的日期(2025年6月11日 10点41分)
-            day.setStartDateTime(vo.getStartTime());
-            day.setEndDateTime(vo.getEndTime1());
-
+        // 2. 生成从 startTime 到 endTime1 之间的所有日期列表
+        List<LocalDate> dateList = new ArrayList<>();
+        LocalDate startDate = vo.getStartTime().toLocalDate();
+        LocalDate endDate = vo.getEndTime1().toLocalDate();
+        // 计算天数差
+        long daysBetween = ChronoUnit.DAYS.between(startDate, endDate);
+
+        // 遍历并添加每一天到 dateList
+        for (long i = 0; i <= daysBetween; i++) {
+            dateList.add(startDate.plusDays(i));
+        }
+        // 检查日期数量和数据库记录数量是否一致,避免数组越界
+        if (list.size() != dateList.size()) {
+            //log.warn("营期日期记录数量或开始时间结束时间记录数量与选择修改的课程数量不匹配");
+            return R.error("营期日期记录数量与选择修改的课程数量不匹配");
+        }
+        // 遍历数据库记录列表,为每个记录设置对应的日期和其他字段
+        for (int i = 0; i < list.size(); i++) {
+            FsUserCoursePeriodDays day = list.get(i);
+            LocalDate currentDate = dateList.get(i); // 从生成的日期列表中获取对应日期
+            // 设置营期日期
+            day.setDayDate(currentDate);
+            // 设置开始时间和结束时间
+            day.setStartDateTime(LocalDateTime.of(currentDate, vo.getStartTime().toLocalTime()));
+            day.setEndDateTime(LocalDateTime.of(currentDate, vo.getEndTime1().toLocalTime()));
             SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
-            if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
-                day.setLastJoinTime(vo.getEndTime1());
-            }else {
-                day.setLastJoinTime(vo.getJoinTime());
+            if (ObjectUtils.isNotEmpty(config) && "1".equals(config.getConfigValue())) {
+                day.setLastJoinTime(LocalDateTime.of(currentDate, vo.getEndTime1().toLocalTime()));
+            } else {
+                day.setLastJoinTime(LocalDateTime.of(currentDate, vo.getJoinTime().toLocalTime()));
             }
-
-            // 把营期时间改成开始时间
-            day.setDayDate(vo.getStartTime().toLocalDate());
-            // 设置状态
-            LocalDateTime compareDayTime = LocalDateTime.now();
-            if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
+            // 设置状态(根据当前时间与营期时间对比)
+            LocalDateTime now = LocalDateTime.now();
+            if (now.isAfter(day.getStartDateTime()) && now.isBefore(day.getEndDateTime())) {
                 day.setStatus(1);
-            } else if(compareDayTime.isBefore(day.getStartDateTime())){
+            } else if (now.isBefore(day.getStartDateTime())) {
                 day.setStatus(0);
             } else {
                 day.setStatus(2);
             }
-            fsUserCoursePeriodDaysMapper.updateById(day);
-        });
+        }
+        // 批量更新到数据库
+        fsUserCoursePeriodDaysMapper.batchUpdateCoursePeriodDays(list);
         return R.ok();
     }
 
@@ -611,19 +624,20 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
     public R updateCourseDate(UpdateCourseTimeVo vo) {
         FsUserCoursePeriodDays day = getById(vo.getId());
         FsUserCoursePeriod period = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(day.getPeriodId());
-        
+
         // 如果未开启自由模式,则需要检查日期是否在营期范围内
         if (period.getFreeMode() == null || period.getFreeMode() != 1) {
-            if(!DateUtil.isWithinRangeSafe(vo.getDayDate(), period.getPeriodStartingTime(), period.getPeriodEndTime())) {
+            if (!DateUtil.isWithinRangeSafe(vo.getDayDate(), period.getPeriodStartingTime(), period.getPeriodEndTime())) {
                 return R.error("时间不在营期范围内");
             }
         }
-        
+
         day.setDayDate(vo.getDayDate());
         day.setStartDateTime(LocalDateTime.of(day.getDayDate(), day.getStartDateTime().toLocalTime()));
         day.setEndDateTime(LocalDateTime.of(day.getDayDate(), day.getEndDateTime().toLocalTime()));
+        //day.setStartJoinTime(LocalDateTime.of(day.getDayDate(), vo.getStartJoinTime().toLocalTime()));
         day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), day.getLastJoinTime().toLocalTime()));
-        
+
         // 设置状态:如果开启自由模式,默认为进行中(status=1)
         if (period.getFreeMode() != null && period.getFreeMode() == 1) {
             // 自由模式:直接设置为进行中
@@ -631,7 +645,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
         } else {
             // 固定模式:默认开启今天及以后的两天,为进行中
             LocalDate compareDay = LocalDate.now().plusDays(1);
-            if(day.getDayDate().isBefore(compareDay)){
+            if (day.getDayDate().isBefore(compareDay)) {
                 day.setStatus(1);
             } else {
                 day.setStatus(0);
@@ -667,7 +681,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     @Override
     public List<Long> selectFsUserCoursePeriodDaysByTime(String periodSTime, String periodETime) {
-        return fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysByTime(periodSTime,periodETime);
+        return fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysByTime(periodSTime, periodETime);
     }
 
     private static FsCourseAnalysisCountVO getCourseAnalysisCountVO(FsUserCoursePeriodDays v, Map<Long, FsCourseAnalysisCountVO> courseMap, Map<Long, FsCourseAnalysisCountVO> redPacketMap, Map<Long, FsCourseAnalysisCountVO> answerMap) {
@@ -682,15 +696,16 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
         countVO.setRedPacketNum(redPacketVO.getRedPacketNum())
                 .setRedPacketAmount(redPacketVO.getRedPacketAmount() != null ? redPacketVO.getRedPacketAmount() : new BigDecimal(BigInteger.ZERO));
         countVO.setAnswerNum(answerVO.getAnswerNum()).setAnswerRightNum(answerVO.getAnswerRightNum())
-                .setAnswerRightRate(answerVO.getAnswerRightRate()!=null ? answerVO.getAnswerRightRate() : new BigDecimal(BigInteger.ZERO))
+                .setAnswerRightRate(answerVO.getAnswerRightRate() != null ? answerVO.getAnswerRightRate() : new BigDecimal(BigInteger.ZERO))
                 .setAnswerTimes(answerVO.getAnswerTimes()).setAnswerRightTimes(answerVO.getAnswerRightTimes());
         return countVO;
     }
 
     /**
      * 查询营期选项列表
-     * @param params    参数
-     * @return  list
+     *
+     * @param params 参数
+     * @return list
      */
     @Override
     public List<OptionsVO> selectPeriodListByMap(Map<String, Object> params) {