|
@@ -217,11 +217,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
|
|
if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) {
|
|
if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) {
|
|
- String subjectIds = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? classGroup.getMemo() : classGroup.getSubjectIdList();
|
|
|
|
- HighClassGroupNumDto highClassGroupNumDto = getSubjectMaxHighClassGroupNum(classGroup.getMusicGroupId(), classGroup.getType(), subjectIds);
|
|
|
|
|
|
+ HighClassGroupNumDto highClassGroupNumDto = getSubjectMaxHighClassGroupNum(classGroup.getMusicGroupId(), classGroup.getType());
|
|
if (highClassGroupNumDto.getNowHighClassGroupNum() >= highClassGroupNumDto.getMaxHighClassGroupNum()) {
|
|
if (highClassGroupNumDto.getNowHighClassGroupNum() >= highClassGroupNumDto.getMaxHighClassGroupNum()) {
|
|
String errMsg = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
|
|
String errMsg = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
|
|
- throw new BizException("此乐团所选声部," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
|
|
|
|
|
|
+ throw new BizException("此乐团," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3553,18 +3552,27 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type, String subjectIds) {
|
|
|
|
|
|
+ public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type) {
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
|
|
- String[] subjectIdArr = subjectIds.split(",");
|
|
|
|
- List<String> subjectIdList = Arrays.asList(subjectIdArr);
|
|
|
|
- if (subjectIdList.contains("14") || subjectIdList.contains("15")) {
|
|
|
|
- subjectIds += ",14,15";
|
|
|
|
- }
|
|
|
|
|
|
+ List<StudentRegistration> musicGroupStudents = studentRegistrationDao.findMusicGroupStudent(musicGroupId, null);
|
|
|
|
+ Map<Integer, List<StudentRegistration>> regMap = musicGroupStudents.stream().collect(Collectors.groupingBy(StudentRegistration::getActualSubjectId));
|
|
|
|
+ int maxClassGroupNum = 0;
|
|
|
|
+ int otherSubjectRegNum = 0;
|
|
|
|
+ for (Map.Entry<Integer, List<StudentRegistration>> regEntry : regMap.entrySet()) {
|
|
|
|
+ //上低音号、长号 合并计算
|
|
|
|
+ if (regEntry.getKey().equals(14) || regEntry.getKey().equals(15)) {
|
|
|
|
+ otherSubjectRegNum += regEntry.getValue().size();
|
|
|
|
+ }
|
|
|
|
+ int classNum = regEntry.getValue().size() / 6;
|
|
|
|
+ classNum += (regEntry.getValue().size() % 6) > 0 ? 1 : 0;
|
|
|
|
+ maxClassGroupNum += classNum;
|
|
|
|
+ }
|
|
|
|
+ maxClassGroupNum += otherSubjectRegNum / 6;
|
|
|
|
+ maxClassGroupNum += (otherSubjectRegNum % 6) > 0 ? 1 : 0;
|
|
|
|
+
|
|
HighClassGroupNumDto highClassGroupNumDto = new HighClassGroupNumDto();
|
|
HighClassGroupNumDto highClassGroupNumDto = new HighClassGroupNumDto();
|
|
- int nowClassGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(musicGroupId, subjectIds, type);
|
|
|
|
- int subjectStudentNum = studentRegistrationDao.getMusicGroupSubjectStudentNum(musicGroupId, subjectIds);
|
|
|
|
- int maxClassGroupNum = subjectStudentNum / 6;
|
|
|
|
- maxClassGroupNum += (subjectStudentNum % 6) > 0 ? 1 : 0;
|
|
|
|
|
|
+ int nowClassGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(musicGroupId, type);
|
|
|
|
+
|
|
highClassGroupNumDto.setNowHighClassGroupNum(nowClassGroupNum);
|
|
highClassGroupNumDto.setNowHighClassGroupNum(nowClassGroupNum);
|
|
highClassGroupNumDto.setMaxHighClassGroupNum(maxClassGroupNum);
|
|
highClassGroupNumDto.setMaxHighClassGroupNum(maxClassGroupNum);
|
|
return highClassGroupNumDto;
|
|
return highClassGroupNumDto;
|