Merge branch 'master' of 39.106.16.162:/home/git/teaching-backend/teaching-backend

master
youhang20021127 3 months ago
commit fac39973ea
  1. 1
      src/main/java/com/teaching/backend/common/ErrorCode.java
  2. 2
      src/main/java/com/teaching/backend/controller/courses/CoursesController.java
  3. 2
      src/main/java/com/teaching/backend/controller/message/MessagesController.java
  4. 7
      src/main/java/com/teaching/backend/service/impl/message/MessagesServiceImpl.java

@ -33,6 +33,7 @@ public enum ErrorCode {
CONTENT_EXISTS(41000, "内容存在"),
STUDENT_ROLE_CANT_MULTIPLESEND(41001, "学生用户不能群发,只能单发"),
LEAST_ONE_USER(41002, "最少选择一个用户"),
MOST_ONE_COURSE(41003, "您一次性最多只能在一个课程下发消息!"),
KNOWS_EXISTS(41001, "存在关联的知识点"),
ADD_RELATION_FAILED(41002, "添加关系失败"),

@ -140,7 +140,7 @@ public class CoursesController {
}
@ApiOperation("根据用户id,查询与用户有关的课程列表,并在课程列表显示所有用户信息")
// @ValidateParams({"userId"})
@ValidateParams({"userId"})
@GetMapping("/page/courseusers")
public BaseResponse<List<CourseUserInfVO>> getUserInfByCourse(@RequestParam Long userId){
List<CourseUserInfVO> courseUsersInfList = coursesService.getUserInfByCourse(userId);

@ -37,7 +37,7 @@ public class MessagesController {
private IMessagesService messagesService;
@ApiOperation("发送消息")
@ValidateParams({"senderId","title","content","receiverId"}) // 需要校验的参数
@ValidateParams({"senderId","title","content","receiverId","courseId"}) // 需要校验的参数
@PostMapping("/addmessage")
public BaseResponse<String> sendMessage(@RequestBody SysMessageDTO sysMessageDTO){
String data = messagesService.sendMessageToUserInbox(sysMessageDTO);

@ -59,6 +59,13 @@ public class MessagesServiceImpl extends ServiceImpl<MessagesMapper, SysMessages
throw new BusinessException(ErrorCode.LEAST_ONE_USER);
}
List<String> courseIds = Arrays.stream(sysMessageDTO.getCourseId().split(","))
.map(String::valueOf)
.collect(Collectors.toList());
if (courseIds.size()>1){
throw new BusinessException(ErrorCode.MOST_ONE_COURSE);
}
// 4.判断是什么用户,只有教师可以群发,学生只能单发
String roleId = umsUserMapper.selectOne(new LambdaQueryWrapper<>(UmsUser.class)
.eq(UmsUser::getId, sysMessageDTO.getSenderId())).getRoleId();

Loading…
Cancel
Save