|
@@ -48,6 +48,7 @@ import com.fs.course.service.IFsUserCompanyUserService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.vo.*;
|
|
import com.fs.course.vo.*;
|
|
|
import com.fs.course.vo.newfs.*;
|
|
import com.fs.course.vo.newfs.*;
|
|
|
|
|
+import com.fs.enums.ExceptionCodeEnum;
|
|
|
import com.fs.his.config.AppConfig;
|
|
import com.fs.his.config.AppConfig;
|
|
|
import com.fs.his.domain.FsUser;
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.domain.FsUserIntegralLogs;
|
|
import com.fs.his.domain.FsUserIntegralLogs;
|
|
@@ -713,11 +714,11 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
//用户不存在唤起重新授权
|
|
//用户不存在唤起重新授权
|
|
|
if (fsUser == null) {
|
|
if (fsUser == null) {
|
|
|
- return R.error(401, "未授权");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.USER_NOT_FOUND.getCode(), ExceptionCodeEnum.USER_NOT_FOUND.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (fsUser.getStatus() == 0) {
|
|
if (fsUser.getStatus() == 0) {
|
|
|
- return R.error("会员被停用,无权限,请联系客服!");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.MEMBER_DISABLED.getCode(), ExceptionCodeEnum.MEMBER_DISABLED.getDescription());
|
|
|
}
|
|
}
|
|
|
// if (param.getIsOpenCourse()!=null&¶m.getIsOpenCourse()==1){
|
|
// if (param.getIsOpenCourse()!=null&¶m.getIsOpenCourse()==1){
|
|
|
// FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByUserId(param.getUserId(), param.getVideoId());
|
|
// FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByUserId(param.getUserId(), param.getVideoId());
|
|
@@ -763,7 +764,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
if (oneCompanyCourse && fsUser.getQwExtId() != null) {
|
|
if (oneCompanyCourse && fsUser.getQwExtId() != null) {
|
|
|
QwExternalContact qwExternalContact = qwExternalContactMapper.selectById(fsUser.getQwExtId());
|
|
QwExternalContact qwExternalContact = qwExternalContactMapper.selectById(fsUser.getQwExtId());
|
|
|
if (qwExternalContact.getCompanyUserId() != null && !qwExternalContact.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
if (qwExternalContact.getCompanyUserId() != null && !qwExternalContact.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
|
- return R.error(500, "该用户(" + fsUser.getUserId() + ")已成为其他销售会员");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.USER_ALREADY_OTHER_SALES_MEMBER.getCode(), ExceptionCodeEnum.USER_ALREADY_OTHER_SALES_MEMBER.getFormattedDescription(fsUser.getUserId()));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -775,7 +776,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactList(query);
|
|
List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactList(query);
|
|
|
if (qwExternalContacts != null && !qwExternalContacts.isEmpty() && !Objects.equals(qwExternalContacts.get(0).getCompanyUserId(), param.getCompanyUserId())) {
|
|
if (qwExternalContacts != null && !qwExternalContacts.isEmpty() && !Objects.equals(qwExternalContacts.get(0).getCompanyUserId(), param.getCompanyUserId())) {
|
|
|
String msgInfo = "该用户(" + fsUser.getUserId() + ")已在公司" + param.getCompanyId() + "成为其他销售会员";
|
|
String msgInfo = "该用户(" + fsUser.getUserId() + ")已在公司" + param.getCompanyId() + "成为其他销售会员";
|
|
|
- return R.error(500, msgInfo);
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.USER_COMPANY_OTHER_SALES_MEMBER.getCode(), ExceptionCodeEnum.USER_COMPANY_OTHER_SALES_MEMBER.getFormattedDescription(fsUser.getUserId(),param.getCompanyId()));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -794,7 +795,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
} else {
|
|
} else {
|
|
|
// 非法参数
|
|
// 非法参数
|
|
|
logger.warn("非法参数 isRoom: {}", isRoom);
|
|
logger.warn("非法参数 isRoom: {}", isRoom);
|
|
|
- return R.error("参数错误!");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.PARAM_ERROR.getCode(), ExceptionCodeEnum.PARAM_ERROR.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -804,13 +805,13 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
// "\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
|
|
// "\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
|
|
|
QwGroupChat qwGroupChat = qwGroupChatMapper.selectQwGroupChatByChatId(courseLink.getChatId());
|
|
QwGroupChat qwGroupChat = qwGroupChatMapper.selectQwGroupChatByChatId(courseLink.getChatId());
|
|
|
if (qwGroupChat == null) {
|
|
if (qwGroupChat == null) {
|
|
|
- return R.error("群参数异常");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.GROUP_PARAM_ERROR.getCode(), ExceptionCodeEnum.GROUP_PARAM_ERROR.getDescription());
|
|
|
}
|
|
}
|
|
|
SopUserLogsInfo sopUserLogsInfo = new SopUserLogsInfo();
|
|
SopUserLogsInfo sopUserLogsInfo = new SopUserLogsInfo();
|
|
|
sopUserLogsInfo.setChatId(courseLink.getChatId());
|
|
sopUserLogsInfo.setChatId(courseLink.getChatId());
|
|
|
List<QwGroupChatUser> qwGroupChatUsers = qwGroupChatUserMapper.selectByChatId(sopUserLogsInfo);
|
|
List<QwGroupChatUser> qwGroupChatUsers = qwGroupChatUserMapper.selectByChatId(sopUserLogsInfo);
|
|
|
if (qwGroupChatUsers == null || qwGroupChatUsers.isEmpty()) {
|
|
if (qwGroupChatUsers == null || qwGroupChatUsers.isEmpty()) {
|
|
|
- return R.error("群参数异常");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.GROUP_PARAM_ERROR.getCode(), ExceptionCodeEnum.GROUP_PARAM_ERROR.getDescription());
|
|
|
}
|
|
}
|
|
|
//群聊寻找用户新逻辑
|
|
//群聊寻找用户新逻辑
|
|
|
QwExternalContact qwExternalContact = null;
|
|
QwExternalContact qwExternalContact = null;
|
|
@@ -2529,10 +2530,10 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
//查询用户
|
|
//查询用户
|
|
|
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(ExceptionCodeEnum.USER_NOT_FOUND.getCode(), ExceptionCodeEnum.USER_NOT_FOUND.getDescription());
|
|
|
}
|
|
}
|
|
|
if (fsUser.getStatus() == 0) {
|
|
if (fsUser.getStatus() == 0) {
|
|
|
- return ResponseResult.fail(503, "会员被停用,无权限,请联系客服!");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.MEMBER_DISABLED.getCode(), ExceptionCodeEnum.MEMBER_DISABLED.getDescription());
|
|
|
}
|
|
}
|
|
|
//公开课
|
|
//公开课
|
|
|
if (param.getIsOpenCourse() != null && param.getIsOpenCourse() == 1) {
|
|
if (param.getIsOpenCourse() != null && param.getIsOpenCourse() == 1) {
|
|
@@ -2560,14 +2561,14 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
//判断该销售是否存在
|
|
//判断该销售是否存在
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
|
|
|
if (companyUser == null) {
|
|
if (companyUser == null) {
|
|
|
- return ResponseResult.fail(405, "当前销售不存在");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.SALES_NOT_FOUND.getCode(), ExceptionCodeEnum.SALES_NOT_FOUND.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取课程所属项目id
|
|
// 获取课程所属项目id
|
|
|
FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
Long courseProject = fsUserCourse.getProject();
|
|
Long courseProject = fsUserCourse.getProject();
|
|
|
if (Objects.isNull(courseProject)) {
|
|
if (Objects.isNull(courseProject)) {
|
|
|
- return ResponseResult.fail(504, "课程配置错误,项目归属为空,课程ID: " + param.getCourseId());
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.COURSE_CONFIG_ERROR.getCode(), ExceptionCodeEnum.COURSE_CONFIG_ERROR.getFormattedDescription(param.getCourseId()));
|
|
|
}
|
|
}
|
|
|
FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(param.getPeriodId());
|
|
FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(param.getPeriodId());
|
|
|
FsUserCompanyUser userCompanyUser = userCompanyUserService.selectByUserIdAndProjectId(fsUser.getUserId(), courseProject);
|
|
FsUserCompanyUser userCompanyUser = userCompanyUserService.selectByUserIdAndProjectId(fsUser.getUserId(), courseProject);
|
|
@@ -2580,7 +2581,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
Company company = companyService.selectCompanyById(param.getCompanyId());
|
|
Company company = companyService.selectCompanyById(param.getCompanyId());
|
|
|
|
|
|
|
|
if ((companyUser.getIsAllowedAllRegister() != null && companyUser.getIsAllowedAllRegister() != 1)) {
|
|
if ((companyUser.getIsAllowedAllRegister() != null && companyUser.getIsAllowedAllRegister() != 1)) {
|
|
|
- return ResponseResult.fail(504, "当前销售禁止绑定会员,请联系销售!");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.SALES_FORBIDDEN_BIND.getCode(), ExceptionCodeEnum.SALES_FORBIDDEN_BIND.getDescription());
|
|
|
}
|
|
}
|
|
|
// 使用 Stream API 检查是否包含 companyId
|
|
// 使用 Stream API 检查是否包含 companyId
|
|
|
// 修正类型转换问题
|
|
// 修正类型转换问题
|
|
@@ -2590,7 +2591,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
&& Arrays.stream(fsUserCoursePeriod.getIsNeedRegisterMember().split(","))
|
|
&& Arrays.stream(fsUserCoursePeriod.getIsNeedRegisterMember().split(","))
|
|
|
.map(String::trim)
|
|
.map(String::trim)
|
|
|
.anyMatch(id -> id.equals(String.valueOf(company.getCompanyId()))))) {
|
|
.anyMatch(id -> id.equals(String.valueOf(company.getCompanyId()))))) {
|
|
|
- return ResponseResult.fail(504, "请联系销售发送邀请链接成为会员!");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.CONTACT_SALES_FOR_INVITATION.getCode(), ExceptionCodeEnum.CONTACT_SALES_FOR_INVITATION.getDescription());
|
|
|
}
|
|
}
|
|
|
int defaultStatus = (company != null ? company.getFsUserIsDefaultBlack() : 0) == 1 ? 0 : 1;
|
|
int defaultStatus = (company != null ? company.getFsUserIsDefaultBlack() : 0) == 1 ? 0 : 1;
|
|
|
userCompanyUser = userCompanyUserService.bindRelationship(param.getUserId(), courseProject, companyUser.getCompanyId(), companyUser.getUserId(), defaultStatus);
|
|
userCompanyUser = userCompanyUserService.bindRelationship(param.getUserId(), courseProject, companyUser.getCompanyId(), companyUser.getUserId(), defaultStatus);
|
|
@@ -2601,7 +2602,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
if (!param.getCompanyUserId().equals(userCompanyUser.getCompanyUserId())) {
|
|
if (!param.getCompanyUserId().equals(userCompanyUser.getCompanyUserId())) {
|
|
|
log.error("进入::isAddCompanyUser 该用户fsUser={},companyUser={},param={}", fsUser, companyUser, param);
|
|
log.error("进入::isAddCompanyUser 该用户fsUser={},companyUser={},param={}", fsUser, companyUser, param);
|
|
|
|
|
|
|
|
- return ResponseResult.fail(500, "该用户(" + fsUser.getUserId() + ")已成为其他销售会员");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.USER_ALREADY_OTHER_SALES_MEMBER.getCode(), ExceptionCodeEnum.USER_ALREADY_OTHER_SALES_MEMBER.getFormattedDescription(fsUser.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果开启了黑名单审核,需要提示
|
|
// 如果开启了黑名单审核,需要提示
|
|
@@ -2612,9 +2613,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
|
|
|
|
|
if (userCompanyUser.getStatus() == 2) {
|
|
if (userCompanyUser.getStatus() == 2) {
|
|
|
if ("福本源".equals(signProjectName)) {
|
|
if ("福本源".equals(signProjectName)) {
|
|
|
- return ResponseResult.fail(504, "服务暂时不可用,请联系管理员");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.SERVICE_UNAVAILABLE.getCode(), ExceptionCodeEnum.SERVICE_UNAVAILABLE.getDescription());
|
|
|
} else {
|
|
} else {
|
|
|
- return ResponseResult.fail(504, "已被拉黑,请联系管理员");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.USER_BLACKLISTED.getCode(), ExceptionCodeEnum.USER_BLACKLISTED.getDescription());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2623,14 +2624,14 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId(), param.getPeriodId());
|
|
FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId(), param.getPeriodId());
|
|
|
|
|
|
|
|
if (!isUserCoursePeriodValid(param)) {
|
|
if (!isUserCoursePeriodValid(param)) {
|
|
|
- return ResponseResult.fail(504, "请观看最新的课程项目");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.WATCH_LATEST_COURSE.getCode(), ExceptionCodeEnum.WATCH_LATEST_COURSE.getDescription());
|
|
|
}
|
|
}
|
|
|
// 项目看课数限制
|
|
// 项目看课数限制
|
|
|
if (!EXCLUDE_PROJECTS.contains(signProjectName) && !CloudHostUtils.hasCloudHostName("弘德堂")) {
|
|
if (!EXCLUDE_PROJECTS.contains(signProjectName) && !CloudHostUtils.hasCloudHostName("弘德堂")) {
|
|
|
log.error("进入了看课限制:传入参数:={},watchCourseVideo={}",param, watchCourseVideo);
|
|
log.error("进入了看课限制:传入参数:={},watchCourseVideo={}",param, watchCourseVideo);
|
|
|
Integer logCount = fsUserCourseMapper.selectTodayCourseWatchLogCountByUserIdAndProjectId(param.getUserId(), courseProject);
|
|
Integer logCount = fsUserCourseMapper.selectTodayCourseWatchLogCountByUserIdAndProjectId(param.getUserId(), courseProject);
|
|
|
if (Objects.isNull(watchCourseVideo) && logCount > 0) {
|
|
if (Objects.isNull(watchCourseVideo) && logCount > 0) {
|
|
|
- return ResponseResult.fail(504, "超过项目看课数量限制");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.EXCEED_COURSE_LIMIT.getCode(), ExceptionCodeEnum.EXCEED_COURSE_LIMIT.getDescription());
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
log.error("没有进入看课限制:传入参数:={},watchCourseVideo={}存在问题 ",param, watchCourseVideo);
|
|
log.error("没有进入看课限制:传入参数:={},watchCourseVideo={}存在问题 ",param, watchCourseVideo);
|
|
@@ -2640,7 +2641,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
if (!watchCourseVideo.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
if (!watchCourseVideo.getCompanyUserId().equals(param.getCompanyUserId())) {
|
|
|
//提示
|
|
//提示
|
|
|
log.error("数据库存在销售信息:{},分享得销售信息:{}", watchCourseVideo.getCompanyUserId(), param.getCompanyUserId());
|
|
log.error("数据库存在销售信息:{},分享得销售信息:{}", watchCourseVideo.getCompanyUserId(), param.getCompanyUserId());
|
|
|
- return ResponseResult.fail(504, "已看过其他销售分享的此课程,不能重复观看");
|
|
|
|
|
|
|
+ return ResponseResult.fail(ExceptionCodeEnum.ALREADY_WATCHED_OTHER_SALES_COURSE.getCode(), ExceptionCodeEnum.ALREADY_WATCHED_OTHER_SALES_COURSE.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
@@ -3684,11 +3685,11 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
//用户不存在唤起重新授权
|
|
//用户不存在唤起重新授权
|
|
|
if (fsUser == null) {
|
|
if (fsUser == null) {
|
|
|
- return R.error(504, "未授权");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.USER_NOT_FOUND.getCode(), ExceptionCodeEnum.USER_NOT_FOUND.getDescription());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (fsUser.getStatus() == 0) {
|
|
if (fsUser.getStatus() == 0) {
|
|
|
- return R.error("会员被停用,无权限,请联系客服!");
|
|
|
|
|
|
|
+ return R.error(ExceptionCodeEnum.MEMBER_DISABLED.getCode(), ExceptionCodeEnum.MEMBER_DISABLED.getDescription());
|
|
|
}
|
|
}
|
|
|
return createWatchIsOpen(param);
|
|
return createWatchIsOpen(param);
|
|
|
}
|
|
}
|