Parcourir la source

增加课程小节状态错误问题处理,上移下移状态变更问题

yfh il y a 3 jours
Parent
commit
5355ef6f6f

+ 2 - 1
fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -107,7 +107,8 @@ public class FsCourseRedPacketLogController extends BaseController
         }
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
-
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);

+ 15 - 2
fs-company/src/main/java/com/fs/company/controller/course/FsCourseRedPacketLogController.java

@@ -13,10 +13,12 @@ import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsCourseRedPacketLog;
+import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.FsCourseRedPacketLogParam;
 import com.fs.course.service.IFsCourseRedPacketLogService;
+import com.fs.course.service.IFsUserCoursePeriodService;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
@@ -51,6 +53,9 @@ public class FsCourseRedPacketLogController extends BaseController
     private TokenService tokenService;
     @Autowired
     private ISysConfigService configService;
+
+    @Autowired
+    private IFsUserCoursePeriodService fsUserCoursePeriodService;
     /**
      * 查询短链课程看课记录列表
      */
@@ -73,7 +78,8 @@ public class FsCourseRedPacketLogController extends BaseController
 
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
-
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         return getDataTable(list);
@@ -96,6 +102,8 @@ public class FsCourseRedPacketLogController extends BaseController
 
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         return getDataTable(list);
@@ -115,6 +123,8 @@ public class FsCourseRedPacketLogController extends BaseController
 
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVONew(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         return getDataTable(list);
@@ -136,7 +146,8 @@ public class FsCourseRedPacketLogController extends BaseController
         }
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
-
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);
@@ -158,6 +169,8 @@ public class FsCourseRedPacketLogController extends BaseController
         }
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
+            FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
+            fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
         ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);

+ 13 - 6
fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodDaysServiceImpl.java

@@ -198,11 +198,13 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             day.setVideoId(e);
             day.setCreateTime(new Date());
             // 默认开启今天及以后的两天
-            LocalDate compareDay = LocalDate.now().plusDays(1);
-            if(day.getDayDate().isBefore(compareDay)){
+            LocalDateTime compareDayTime = LocalDateTime.now();
+            if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
                 day.setStatus(1);
-            } else {
+            } else if(compareDayTime.isBefore(day.getStartDateTime())){
                 day.setStatus(0);
+            } else {
+                day.setStatus(2);
             }
             return day;
         }).collect(Collectors.toList());
@@ -326,17 +328,20 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
         LocalDateTime tempStartDateTime = source.getStartDateTime();
         LocalDateTime tempEndDateTime = source.getEndDateTime();
         LocalDateTime tempLastJoinTime = source.getLastJoinTime();
+        Integer status = source.getStatus();
 
         // 将目标数据赋给源
         source.setDayDate(target.getDayDate());
         source.setLesson(target.getLesson());
         source.setStartDateTime(target.getStartDateTime());
         source.setEndDateTime(target.getEndDateTime());
+        source.setStatus(target.getStatus());
         source.setLastJoinTime(target.getLastJoinTime());
 
         // 将保存的源数据赋给目标
         target.setDayDate(tempDayDate);
         target.setLesson(tempLesson);
+        target.setStatus(status);
         target.setStartDateTime(tempStartDateTime);
         target.setEndDateTime(tempEndDateTime);
         target.setLastJoinTime(tempLastJoinTime);
@@ -440,11 +445,13 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
         day.setEndDateTime(LocalDateTime.of(day.getDayDate(), day.getEndDateTime().toLocalTime()));
         day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), day.getLastJoinTime().toLocalTime()));
         // 默认开启今天及以后的两天,为进行中
-        LocalDate compareDay = LocalDate.now().plusDays(1);
-        if(day.getDayDate().isBefore(compareDay)){
+        LocalDateTime compareDayTime = LocalDateTime.now();
+        if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
             day.setStatus(1);
-        } else {
+        } else if(compareDayTime.isBefore(day.getStartDateTime())){
             day.setStatus(0);
+        } else {
+            day.setStatus(2);
         }
         updateById(day);
         return R.ok();

+ 6 - 1
fs-service/src/main/resources/mapper/course/FsUserCoursePeriodDaysMapper.xml

@@ -194,7 +194,12 @@
                     when id=#{item.id} then #{item.lesson}
                 </if>
             </foreach>
-
+            `status` =
+            <foreach collection="list" item="item" open="case" close=" end,">
+                <if test="item.status != null">
+                    when id=#{item.id} then #{item.status}
+                </if>
+            </foreach>
         </trim>
         where id in
         <foreach collection="list" index="index" item="item" separator="," open="(" close=")">