|
|
@@ -667,10 +667,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
|
|
|
if("益善缘".equals(signProjectName)){
|
|
|
- R result = validateSalesAndUserRelationship(param, fsUser);
|
|
|
- if (result != null) {
|
|
|
- return result;
|
|
|
- }
|
|
|
+ R result = validateSalesAndUserRelationship(param, fsUser);
|
|
|
+ if (result != null) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Long qwExternalId = param.getQwExternalId();
|
|
|
@@ -802,32 +802,39 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
* @return 验证结果,null表示验证通过
|
|
|
*/
|
|
|
private R validateSalesAndUserRelationship(FsUserCourseVideoAddKfUParam param, FsUser fsUser) {
|
|
|
- // 判断该销售是否存在
|
|
|
- CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
|
|
|
- if (companyUser == null) {
|
|
|
- return R.error(405, "当前客服不存在");
|
|
|
- }
|
|
|
|
|
|
- if (companyUser.getIsAllowedEveryoneView() == 2) {
|
|
|
- // 获取课程所属项目id
|
|
|
- FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
- Long courseProject = fsUserCourse.getProject();
|
|
|
- if (Objects.isNull(courseProject)) {
|
|
|
- return R.error(504, "课程配置错误,项目归属为空,课程ID: " + param.getCourseId());
|
|
|
- }
|
|
|
+ try {
|
|
|
+ // 判断该销售是否存在
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
|
|
|
+ if (companyUser == null) {
|
|
|
+ return R.error(405, "当前客服不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (companyUser.getIsAllowedEveryoneView() == 2) {
|
|
|
+ // 获取课程所属项目id
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
+ Long courseProject = fsUserCourse.getProject();
|
|
|
+ if (Objects.isNull(courseProject)) {
|
|
|
+ return R.error(504, "课程配置错误,项目归属为空,课程ID: " + param.getCourseId());
|
|
|
+ }
|
|
|
|
|
|
- // 查询【用户-项目】关系
|
|
|
- FsUserCompanyUserQw userCompanyUserQw = userCompanyUserQwService.selectByUserIdAndProjectId(fsUser.getUserId(), courseProject);
|
|
|
+ // 查询【用户-项目】关系
|
|
|
+ FsUserCompanyUserQw userCompanyUserQw = userCompanyUserQwService.selectByUserIdAndProjectId(fsUser.getUserId(), courseProject);
|
|
|
|
|
|
- // 添加逻辑:如果存在fs_user表数据,但是又不存在fs_user_company_user表,则表示给他绑上(看客户更喜欢哪个销售)
|
|
|
- if (Objects.isNull(userCompanyUserQw)) {
|
|
|
- userCompanyUserQw = userCompanyUserQwService.bindRelationship(param.getUserId(), courseProject, companyUser.getCompanyId(), companyUser.getUserId(), 1);
|
|
|
- }
|
|
|
+ // 添加逻辑:如果存在fs_user表数据,但是又不存在fs_user_company_user表,则表示给他绑上(看客户更喜欢哪个销售)
|
|
|
+ if (Objects.isNull(userCompanyUserQw)) {
|
|
|
+ userCompanyUserQw = userCompanyUserQwService.bindRelationship(param.getUserId(), courseProject, companyUser.getCompanyId(), companyUser.getUserId(), 1);
|
|
|
+ }
|
|
|
|
|
|
- // 逻辑调整:如果客户已经绑定了销售,直接提示,
|
|
|
- if (!param.getCompanyUserId().equals(userCompanyUserQw.getCompanyUserId())) {
|
|
|
- return R.error(500, "该用户(" + fsUser.getUserId() + ")已成为其他客服会员,请在相应客服上观看");
|
|
|
+ // 逻辑调整:如果客户已经绑定了销售,直接提示,
|
|
|
+ if (!param.getCompanyUserId().equals(userCompanyUserQw.getCompanyUserId())) {
|
|
|
+ return R.error(500, "该用户(" + fsUser.getUserId() + ")已成为其他客服会员,请在相应客服上观看");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.error("用户课程视频添加失败{}",param,e);
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
return null;
|