|
@@ -48,7 +48,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
|
|
|
@Override
|
|
|
public ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(Integer userId, Integer classGroupId) {
|
|
|
- return classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
|
|
|
+ return classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId,"NORMAL");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -152,23 +152,28 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
|
|
|
Iterator<String> iterator = userIdStrSet.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
- String userIdStr = iterator.next();
|
|
|
- List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), Integer.parseInt(userIdStr), classGroup.getType());
|
|
|
+ Integer userId = Integer.parseInt(iterator.next());
|
|
|
+ List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), userId, classGroup.getType());
|
|
|
if (highClassGroupHasUser != null && highClassGroupHasUser.size() > 0) {
|
|
|
iterator.remove();
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
- classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroupId);
|
|
|
- classGroupStudentMapper.setUserId(Integer.parseInt(userIdStr));
|
|
|
- classGroupStudentMapper.setCreateTime(nowDate);
|
|
|
- classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
- classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
+ //校验是否存在历史记录
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId, null);
|
|
|
+ if(classGroupStudentMapper != null){
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ }else {
|
|
|
+ classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroupId);
|
|
|
+ classGroupStudentMapper.setUserId(userId);
|
|
|
+ classGroupStudentMapper.setCreateTime(nowDate);
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
+ classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
+ }
|
|
|
if (classGroup.getType().equals(ClassGroupTypeEnum.NORMAL)) {
|
|
|
- StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(Integer.parseInt(userIdStr), classGroup.getMusicGroupId());
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, classGroup.getMusicGroupId());
|
|
|
studentRegistration.setClassGroupId(classGroupId);
|
|
|
studentRegistrationService.update(studentRegistration);
|
|
|
}
|
|
@@ -177,13 +182,13 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
|
|
|
- classGroupStudentMapper.setUserId(Integer.parseInt(userIdStr));
|
|
|
+ classGroupStudentMapper.setUserId(userId);
|
|
|
classGroupStudentMapper.setCreateTime(nowDate);
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
}
|
|
|
- imGroupMemberList.add(new ImGroupMember(userIdStr));
|
|
|
+ imGroupMemberList.add(new ImGroupMember(userId.toString()));
|
|
|
}
|
|
|
if (classGroupStudentMappers.size() > 0) {
|
|
|
classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
|