| 
														
															@@ -57,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.math.BigDecimal; 
														 | 
														
														 | 
														
															 import java.math.BigDecimal; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.math.RoundingMode; 
														 | 
														
														 | 
														
															 import java.math.RoundingMode; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.time.LocalDateTime; 
														 | 
														
														 | 
														
															 import java.time.LocalDateTime; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.time.LocalTime; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.*; 
														 | 
														
														 | 
														
															 import java.util.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.concurrent.TimeUnit; 
														 | 
														
														 | 
														
															 import java.util.concurrent.TimeUnit; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.concurrent.atomic.AtomicLong; 
														 | 
														
														 | 
														
															 import java.util.concurrent.atomic.AtomicLong; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -137,6 +138,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private FsUserCourseMapper fsUserCourseMapper; 
														 | 
														
														 | 
														
															     private FsUserCourseMapper fsUserCourseMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private FsUserCoursePeriodMapper fsUserCoursePeriodMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * 查询课堂视频 
														 | 
														
														 | 
														
															      * 查询课堂视频 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * 
														 | 
														
														 | 
														
															      * 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -730,6 +737,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return 处理结果 
														 | 
														
														 | 
														
															      * @return 处理结果 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      */ 
														 | 
														
														 | 
														
															      */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private R sendRedPacketReward(FsCourseSendRewardUParam param, FsUser user, FsCourseWatchLog log, FsUserCourseVideo video, CourseConfig config) { 
														 | 
														
														 | 
														
															     private R sendRedPacketReward(FsCourseSendRewardUParam param, FsUser user, FsCourseWatchLog log, FsUserCourseVideo video, CourseConfig config) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 判断是否属于领取红包时间(会员看课发放红包) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(param.getPeriodId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(fsUserCoursePeriod != null && fsUserCoursePeriod.getLastJoinTime() !=null && LocalTime.now().isAfter(fsUserCoursePeriod.getLastJoinTime())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            R.error(403,"已超过领取红包时间"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 确定红包金额 
														 | 
														
														 | 
														
															         // 确定红包金额 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         BigDecimal amount = BigDecimal.ZERO; 
														 | 
														
														 | 
														
															         BigDecimal amount = BigDecimal.ZERO; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         FsUserCourseVideoRedPackage redPackage = fsUserCourseVideoRedPackageMapper.selectRedPacketByCompanyId(param.getVideoId(), param.getCompanyId(), param.getPeriodId()); 
														 | 
														
														 | 
														
															         FsUserCourseVideoRedPackage redPackage = fsUserCourseVideoRedPackageMapper.selectRedPacketByCompanyId(param.getVideoId(), param.getCompanyId(), param.getPeriodId()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -776,6 +789,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             redPacketLog.setCreateTime(new Date()); 
														 | 
														
														 | 
														
															             redPacketLog.setCreateTime(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             redPacketLog.setAmount(amount); 
														 | 
														
														 | 
														
															             redPacketLog.setAmount(amount); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             redPacketLog.setWatchLogId(log.getLogId() != null ? log.getLogId() : null); 
														 | 
														
														 | 
														
															             redPacketLog.setWatchLogId(log.getLogId() != null ? log.getLogId() : null); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            redPacketLog.setPeriodId(param.getPeriodId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog); 
														 | 
														
														 | 
														
															             redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 更新观看记录的奖励类型 
														 | 
														
														 | 
														
															             // 更新观看记录的奖励类型 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -956,6 +970,26 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public ResponseResult<FsUserCourseVideoLinkDetailsVO> getLinkCourseVideoDetails(FsUserCourseVideoLinkParam param) { 
														 | 
														
														 | 
														
															     public ResponseResult<FsUserCourseVideoLinkDetailsVO> getLinkCourseVideoDetails(FsUserCourseVideoLinkParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //判断营期的课程状态是否是进行中 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        FsUserCoursePeriodDays periodDays = new FsUserCoursePeriodDays(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        periodDays.setVideoId(param.getVideoId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        periodDays.setPeriodId(param.getPeriodId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //正常情况是只能查询到一条,之前可能存在重复的脏数据,暂使用查询list的方式 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysList(periodDays); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(fsUserCoursePeriodDays != null && !fsUserCoursePeriodDays.isEmpty()){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            periodDays = fsUserCoursePeriodDays.get(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(periodDays.getStatus() != 1){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            ResponseResult.fail(403, "当前课程未开始或已结束,暂不能看课"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 判断当前是否在看课时间范围内 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(param.getPeriodId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(fsUserCoursePeriod != null && fsUserCoursePeriod.getViewStartTime() != null && fsUserCoursePeriod.getViewEndTime() != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (LocalTime.now().isBefore(fsUserCoursePeriod.getViewStartTime()) || LocalTime.now().isAfter(fsUserCoursePeriod.getViewEndTime())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                ResponseResult.fail(403, "当前非看课时间,暂不能看课"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String json = configService.selectConfigByKey("course.config"); 
														 | 
														
														 | 
														
															         String json = configService.selectConfigByKey("course.config"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class); 
														 | 
														
														 | 
														
															         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |