|
@@ -941,39 +941,45 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
if(fsUser.getCompanyUserId() == null) {
|
|
if(fsUser.getCompanyUserId() == null) {
|
|
return ResponseResult.fail(503, "暂时未绑定销售,请联系管理员");
|
|
return ResponseResult.fail(503, "暂时未绑定销售,请联系管理员");
|
|
}
|
|
}
|
|
- if(companyUser.getUserId().equals(fsUser.getCompanyUserId())){
|
|
|
|
- //查询看课记录
|
|
|
|
- FsCourseWatchLog log = new FsCourseWatchLog();
|
|
|
|
- log.setUserId(param.getUserId());
|
|
|
|
- log.setCompanyUserId(param.getCompanyUserId());
|
|
|
|
- log.setVideoId(param.getVideoId());
|
|
|
|
- List<FsCourseWatchLog> fsCourseWatchLogs = courseWatchLogMapper.selectFsCourseWatchLogList(log);
|
|
|
|
-
|
|
|
|
- // 获取课程所属项目id
|
|
|
|
- FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
|
- Long courseProject = null;
|
|
|
|
- if(fsUserCourse != null){
|
|
|
|
- courseProject = fsUserCourse.getProject();
|
|
|
|
- }
|
|
|
|
- //如果存在,则更新
|
|
|
|
- if (fsCourseWatchLogs != null && !fsCourseWatchLogs.isEmpty()){
|
|
|
|
- FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
|
|
- updateLog.setPeriodId(param.getPeriodId());
|
|
|
|
- updateLog.setProject(courseProject);
|
|
|
|
- updateLog.setUpdateTime(new Date());
|
|
|
|
- courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
|
|
|
|
- } else {
|
|
|
|
- //如果是会员,则需要添加看课记录
|
|
|
|
- FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
|
|
|
|
- BeanUtils.copyProperties(param, fsCourseWatchLog);
|
|
|
|
- fsCourseWatchLog.setSendType(1);
|
|
|
|
- fsCourseWatchLog.setDuration(0L);
|
|
|
|
- fsCourseWatchLog.setCreateTime(new Date());
|
|
|
|
- fsCourseWatchLog.setLogType(1);
|
|
|
|
- fsCourseWatchLog.setProject(courseProject);
|
|
|
|
- courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
|
|
|
|
+
|
|
|
|
+ //添加判断:该用户是否已经存在此课程的看课记录,并且看课记录的销售id不是传入的销售id
|
|
|
|
+ //查询看课记录
|
|
|
|
+ FsCourseWatchLog log = new FsCourseWatchLog();
|
|
|
|
+ log.setUserId(param.getUserId());
|
|
|
|
+ log.setCompanyUserId(param.getCompanyUserId());
|
|
|
|
+ log.setVideoId(param.getVideoId());
|
|
|
|
+ FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getWatchCourseVideoByFsUser(param.getUserId(), param.getVideoId(), param.getCompanyUserId());
|
|
|
|
+
|
|
|
|
+ // 获取课程所属项目id
|
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
|
+ Long courseProject = null;
|
|
|
|
+ if(fsUserCourse != null){
|
|
|
|
+ courseProject = fsUserCourse.getProject();
|
|
|
|
+ }
|
|
|
|
+ if(watchCourseVideo != null){
|
|
|
|
+ if(!watchCourseVideo.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
|
|
+ //提示
|
|
|
|
+ return ResponseResult.fail(504, "已看过其他销售分享的此课程,不能重复观看");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
|
|
+ updateLog.setPeriodId(param.getPeriodId());
|
|
|
|
+ updateLog.setProject(courseProject);
|
|
|
|
+ updateLog.setUpdateTime(new Date());
|
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
|
|
} else {
|
|
} else {
|
|
|
|
+ FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
|
|
|
|
+ BeanUtils.copyProperties(param, fsCourseWatchLog);
|
|
|
|
+ fsCourseWatchLog.setSendType(1);
|
|
|
|
+ fsCourseWatchLog.setDuration(0L);
|
|
|
|
+ fsCourseWatchLog.setCreateTime(new Date());
|
|
|
|
+ fsCourseWatchLog.setLogType(1);
|
|
|
|
+ fsCourseWatchLog.setProject(courseProject);
|
|
|
|
+ courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 判断是否重粉
|
|
|
|
+ if(!companyUser.getUserId().equals(fsUser.getCompanyUserId())){
|
|
FsUserCompanyUser fsUserCompanyUser = new FsUserCompanyUser();
|
|
FsUserCompanyUser fsUserCompanyUser = new FsUserCompanyUser();
|
|
fsUserCompanyUser.setIsRepeatFans(1);
|
|
fsUserCompanyUser.setIsRepeatFans(1);
|
|
fsUserCompanyUser.setUserId(param.getUserId());
|
|
fsUserCompanyUser.setUserId(param.getUserId());
|