|
@@ -1257,19 +1257,40 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
|
|
|
Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
|
|
|
+ //商品ID
|
|
|
Long goodsId = Long.valueOf(split.get("gid"));
|
|
|
+ //观看权限
|
|
|
+ String per = split.get("watchPer");
|
|
|
+ //课程ID
|
|
|
+ String cid = split.get("cid");
|
|
|
+ //节ID
|
|
|
+ String sid = split.get("sid");
|
|
|
|
|
|
//获取对应商品
|
|
|
Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
|
|
|
+ User user = new User();
|
|
|
+ if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
|
|
|
+ //所有人都可以看
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ Long tenantId = item.getTenantId();
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+ return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
|
|
|
+ }).findFirst().orElse(null);
|
|
|
|
|
|
- User user = userList.stream().filter(item -> {
|
|
|
- //判断用户是否购买商品
|
|
|
- Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
- return count > 0;
|
|
|
- }).findFirst().orElse(null);
|
|
|
+ }else {
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ //判断用户是否购买商品
|
|
|
+ Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
+ return count > 0;
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+ }
|
|
|
|
|
|
if(Validator.isEmpty(user)){
|
|
|
- throw new CustomException("登录信息错误");
|
|
|
+ throw new CustomException("账号未注册,请联系管理员!");
|
|
|
}
|
|
|
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
{
|
|
@@ -1310,8 +1331,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- String cid = split.get("cid");
|
|
|
- String sid = split.get("sid");
|
|
|
Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
@@ -1388,19 +1407,39 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
|
|
|
Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
|
|
|
+ //商品ID
|
|
|
Long goodsId = Long.valueOf(split.get("gid"));
|
|
|
-
|
|
|
+ //观看权限
|
|
|
+ String per = split.get("watchPer");
|
|
|
+ //课程ID
|
|
|
+ String cid = split.get("cid");
|
|
|
+ //节ID
|
|
|
+ String sid = split.get("sid");
|
|
|
//获取对应商品
|
|
|
Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
|
|
|
+ User user = new User();
|
|
|
+ if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
|
|
|
+ //所有人都可以看
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ Long tenantId = item.getTenantId();
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+ return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
|
|
|
+ }).findFirst().orElse(null);
|
|
|
|
|
|
- User user = userList.stream().filter(item -> {
|
|
|
- //判断用户是否购买商品
|
|
|
- Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
- return count > 0;
|
|
|
- }).findFirst().orElse(null);
|
|
|
+ }else {
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ //判断用户是否购买商品
|
|
|
+ Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
+ return count > 0;
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+ }
|
|
|
|
|
|
if(Validator.isEmpty(user)){
|
|
|
- throw new CustomException("登录信息错误");
|
|
|
+ throw new CustomException("账号未注册,请联系管理员!");
|
|
|
}
|
|
|
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
{
|
|
@@ -1422,9 +1461,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
path = "living-room";
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- String cid = split.get("cid");
|
|
|
- String sid = split.get("sid");
|
|
|
Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|