|
@@ -2573,6 +2573,20 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("获取用户信息失败");
|
|
|
}
|
|
|
List<StudentRegistration> studentRegistrations = studentRegistrationDao.findStudentListByIdList(registerIds);
|
|
|
+ List<StudentRegistration> oldRegs = studentRegistrationDao.getMusicGroupStu(musicGroupId);
|
|
|
+ Map<Integer, List<StudentRegistration>> oldRegMap = oldRegs.stream().collect(Collectors.groupingBy(StudentRegistration::getUserId));
|
|
|
+ //去掉相同的人
|
|
|
+ List<StudentRegistration> newRegs = new ArrayList<>();
|
|
|
+ Set<Integer> hasUsers = new HashSet<>();
|
|
|
+ for (StudentRegistration studentRegistration : studentRegistrations) {
|
|
|
+ if (oldRegMap.containsKey(studentRegistration.getUserId()) || hasUsers.contains(studentRegistration.getUserId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ hasUsers.add(studentRegistration.getUserId());
|
|
|
+ newRegs.add(studentRegistration);
|
|
|
+ }
|
|
|
+ studentRegistrations = newRegs;
|
|
|
+
|
|
|
List<Integer> subjectIds = studentRegistrations.stream().map(StudentRegistration::getActualSubjectId).collect(Collectors.toList());
|
|
|
List<Subject> subjects = subjectDao.findBySubjectIds(subjectIds);
|
|
|
Map<Integer, List<Subject>> subjectMap = subjects.stream().collect(Collectors.groupingBy(Subject::getId));
|
|
@@ -2586,7 +2600,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
for (MusicGroupSubjectPlan musicGroupSubjectPlan : musicSubjectClassPlans) {
|
|
|
if (!subjectId.equals(musicGroupSubjectPlan.getSubjectId())) continue;
|
|
|
hasSubject = true;
|
|
|
- musicGroupSubjectPlan.setApplyStudentNum(regs.size());
|
|
|
+ musicGroupSubjectPlan.setApplyStudentNum(musicGroupSubjectPlan.getApplyStudentNum() + regs.size());
|
|
|
subjectPlan = musicGroupSubjectPlan;
|
|
|
}
|
|
|
if (!hasSubject) {
|