|
@@ -2012,14 +2012,20 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public ResponseResult<FsUser> isAddCompanyUser(FsUserCourseAddCompanyUserParam param) {
|
|
public ResponseResult<FsUser> isAddCompanyUser(FsUserCourseAddCompanyUserParam param) {
|
|
|
logger.info("\n 【进入个微-判断是否添加客服】,入参:{}", param);
|
|
logger.info("\n 【进入个微-判断是否添加客服】,入参:{}", param);
|
|
|
- String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
- CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
- boolean oneCompanyCourse = config.isOneCompanyCourse();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!isUserCoursePeriodValid(param)) {
|
|
|
|
|
+ return ResponseResult.fail(504, "请观看最新的课程项目");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//查询用户
|
|
//查询用户
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserById(param.getUserId());
|
|
FsUser fsUser = fsUserMapper.selectFsUserById(param.getUserId());
|
|
|
if (fsUser == null) {
|
|
if (fsUser == null) {
|
|
|
return ResponseResult.fail(401, "当前用户信息不存在");
|
|
return ResponseResult.fail(401, "当前用户信息不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (fsUser.getStatus() == 0) {
|
|
|
|
|
+ return ResponseResult.fail(504, "已被禁用,请联系管理员#" + fsUser.getUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//公开课
|
|
//公开课
|
|
|
if (param.getIsOpenCourse() != null && param.getIsOpenCourse() == 1) {
|
|
if (param.getIsOpenCourse() != null && param.getIsOpenCourse() == 1) {
|
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId(), null);
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId(), null);
|
|
@@ -2110,26 +2116,21 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (userCompanyUser.getStatus() == 2) {
|
|
if (userCompanyUser.getStatus() == 2) {
|
|
|
- if ("福本源".equals(signProjectName)) {
|
|
|
|
|
- return ResponseResult.fail(504, "服务暂时不可用,请联系管理员");
|
|
|
|
|
- } else {
|
|
|
|
|
- return ResponseResult.fail(504, "已被拉黑,请联系管理员");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return ResponseResult.fail(504, "已被拉黑,请联系管理员#" + userCompanyUser.getUserId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//查询看课记录
|
|
//查询看课记录
|
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.selectWatchLogByUserIdAndVideoIdAndPeriodId(param.getUserId(), param.getVideoId(), param.getPeriodId());
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.selectWatchLogByUserIdAndVideoIdAndPeriodId(param.getUserId(), param.getVideoId(), param.getPeriodId());
|
|
|
|
|
|
|
|
- if (!isUserCoursePeriodValid(param)) {
|
|
|
|
|
- return ResponseResult.fail(504, "请观看最新的课程项目");
|
|
|
|
|
- }
|
|
|
|
|
// 项目看课数限制
|
|
// 项目看课数限制
|
|
|
- if (!EXCLUDE_PROJECTS.contains(signProjectName) && !CloudHostUtils.hasCloudHostName("弘德堂")) {
|
|
|
|
|
- Integer logCount = fsUserCourseMapper.selectTodayCourseWatchLogCountByUserIdAndProjectId(param.getUserId(), courseProject);
|
|
|
|
|
- if (Objects.isNull(watchCourseVideo) && logCount > 0) {
|
|
|
|
|
- return ResponseResult.fail(504, "超过项目看课数量限制");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Integer logCount = fsUserCourseMapper.selectTodayCourseWatchLogCountByUserIdAndProjectId(param.getUserId(), courseProject);
|
|
|
|
|
+
|
|
|
|
|
+ // 院长大讲堂#11 要求可以看两节
|
|
|
|
|
+ int maxWatchCount = courseProject == 11 ? 2 : 1;
|
|
|
|
|
+ if (Objects.isNull(watchCourseVideo) && logCount >= maxWatchCount) {
|
|
|
|
|
+ return ResponseResult.fail(504, "超过项目看课数量限制");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//添加判断:该用户是否已经存在此课程的看课记录,并且看课记录的销售id不是传入的销售id
|
|
//添加判断:该用户是否已经存在此课程的看课记录,并且看课记录的销售id不是传入的销售id
|
|
|
if (watchCourseVideo != null) {
|
|
if (watchCourseVideo != null) {
|
|
|
if (!watchCourseVideo.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
if (!watchCourseVideo.getCompanyUserId().equals(param.getCompanyUserId())) {
|