|
@@ -83,14 +83,14 @@ public class GroupServiceImpl implements GroupService {
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
public GroupDTO addGroupMember(GroupMemberVO groupMemberVO) {
|
|
public GroupDTO addGroupMember(GroupMemberVO groupMemberVO) {
|
|
|
Long courseId = groupMemberVO.getCourseId();
|
|
Long courseId = groupMemberVO.getCourseId();
|
|
|
|
|
+ Long userId = groupMemberVO.getUserId();
|
|
|
String tableName = getGroupMemberTableName(courseId);
|
|
String tableName = getGroupMemberTableName(courseId);
|
|
|
- DomainUserDetails user = SecurityUtils.getCurrentUser();
|
|
|
|
|
// 验证选课
|
|
// 验证选课
|
|
|
- if (!courseService.checkSelection(user.getId(), courseId)) {
|
|
|
|
|
|
|
+ if (!courseService.checkSelection(userId, courseId)) {
|
|
|
throw CustomErrorException.courseSelectionNotFound();
|
|
throw CustomErrorException.courseSelectionNotFound();
|
|
|
}
|
|
}
|
|
|
// 验证尚未加入小组
|
|
// 验证尚未加入小组
|
|
|
- if (groupMemberRepository.findByUserId(tableName, user.getId()) != null) {
|
|
|
|
|
|
|
+ if (groupMemberRepository.findByUserId(tableName, userId) != null) {
|
|
|
throw CustomErrorException.groupMemberAlreadyExists();
|
|
throw CustomErrorException.groupMemberAlreadyExists();
|
|
|
}
|
|
}
|
|
|
// 验证小组未满员
|
|
// 验证小组未满员
|