|
|
@@ -2626,8 +2626,15 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
// FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getWatchCourseVideoByFsUser(param.getUserId(), param.getVideoId(), param.getCompanyUserId());
|
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId(), param.getPeriodId());
|
|
|
|
|
|
- if (!isUserCoursePeriodValid(param)) {
|
|
|
- return ResponseResult.fail(ExceptionCodeEnum.WATCH_LATEST_COURSE.getCode(), ExceptionCodeEnum.WATCH_LATEST_COURSE.getDescription());
|
|
|
+ Map<String, Object> userCoursePeriodValid = isUserCoursePeriodValid(param);
|
|
|
+ if (CloudHostUtils.hasCloudHostName("叮当国医") ) {
|
|
|
+ if (!((boolean)userCoursePeriodValid.get("isWithinRangeSafe"))) {
|
|
|
+ return ResponseResult.fail(BizResponseEnum.WATCH_LATEST_COURSE, userCoursePeriodValid);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!((boolean)userCoursePeriodValid.get("isWithinRangeSafe"))) {
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.WATCH_LATEST_COURSE.getCode(), ExceptionCodeEnum.WATCH_LATEST_COURSE.getDescription());
|
|
|
+ }
|
|
|
}
|
|
|
// 项目看课数限制
|
|
|
if (!EXCLUDE_PROJECTS.contains(signProjectName) && !CloudHostUtils.hasCloudHostName("弘德堂")) {
|
|
|
@@ -2702,7 +2709,8 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
* @param param 查询参数
|
|
|
* @return 如果当前时间在有效范围内且状态为1,返回true,否则返回false
|
|
|
*/
|
|
|
- public boolean isUserCoursePeriodValid(FsUserCourseAddCompanyUserParam param) {
|
|
|
+ public Map<String, Object> isUserCoursePeriodValid(FsUserCourseAddCompanyUserParam param) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
// 查询课程周期信息
|
|
|
FsUserCoursePeriodDays periodDays = getPeriodDaysInfo(param);
|
|
|
|
|
|
@@ -2720,9 +2728,20 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
log.error("传入参数:开始时间:{},结束时间:{},periodDays={}", effectiveStartTime, effectiveEndTime, periodDays);
|
|
|
if (ObjectUtils.isEmpty(effectiveStartTime) || ObjectUtils.isEmpty(effectiveEndTime)) {
|
|
|
log.error("请检查营期时间!");
|
|
|
- return false;
|
|
|
+ map.put("isWithinRangeSafe", false);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ boolean isWithinRangeSafe = DateUtil.isWithinRangeSafe(LocalDateTime.now(), effectiveStartTime, effectiveEndTime) && periodDays.getStatus() == 1;
|
|
|
+ map.put("isWithinRangeSafe", isWithinRangeSafe);
|
|
|
+ // 计算差值,如果是未到开课时间的课程,计算出时间差值
|
|
|
+ if(periodDays.getStatus() != 2 && LocalDateTime.now().isBefore(effectiveStartTime)){
|
|
|
+ long millis = Duration.between(LocalDateTime.now(), effectiveStartTime).toMillis();
|
|
|
+ map.put("millis", millis);
|
|
|
+ map.put("countdown", true);
|
|
|
+ } else {
|
|
|
+ map.put("countdown", false);
|
|
|
}
|
|
|
- return DateUtil.isWithinRangeSafe(LocalDateTime.now(), effectiveStartTime, effectiveEndTime) && periodDays.getStatus() == 1;
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
// 其他辅助方法保持不变
|