|
@@ -215,11 +215,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
|
|
|
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()) {
|
|
|
String errMsg = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
|
|
|
- throw new BizException("此乐团所选声部," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
|
|
|
+ throw new BizException("此乐团," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1354,7 +1353,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TeacherClassGroupDto> findTeacherClassGroups(String type,String status) {
|
|
|
+ public List<TeacherClassGroupDto> findTeacherClassGroups(String type, String status) {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
if (Objects.isNull(user)) {
|
|
|
throw new BizException("请登录");
|
|
@@ -1367,13 +1366,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
List<TeacherClassGroupDto> teacherMusicClassGroup;
|
|
|
switch (type) {
|
|
|
case "VIP":
|
|
|
- teacherMusicClassGroup = classGroupDao.findTeacherVipClassGroup(user.getId().longValue(),status);
|
|
|
+ teacherMusicClassGroup = classGroupDao.findTeacherVipClassGroup(user.getId().longValue(), status);
|
|
|
break;
|
|
|
case "MUSIC_GROUP":
|
|
|
teacherMusicClassGroup = classGroupDao.findTeacherMusicClassGroup(user.getId().longValue());
|
|
|
break;
|
|
|
case "PRACTICE":
|
|
|
- teacherMusicClassGroup = classGroupDao.findTeacherPracticeClassGroup(user.getId().longValue(),status);
|
|
|
+ teacherMusicClassGroup = classGroupDao.findTeacherPracticeClassGroup(user.getId().longValue(), status);
|
|
|
break;
|
|
|
default:
|
|
|
throw new BizException("课程类型错误");
|
|
@@ -1626,7 +1625,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
.filter(studentAttendanceViewDto -> studentAttendanceViewDto.getGroupType().equals("MUSIC"))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- if (!CollectionUtils.isEmpty(tempIds)&&schedule.getGroupType() == MUSIC) {
|
|
|
+ if (!CollectionUtils.isEmpty(tempIds) && schedule.getGroupType() == MUSIC) {
|
|
|
List<Map<Integer, String>> studentSubjectNameMaps = subjectDao.findStudentSubjectNameMaps(tempIds);
|
|
|
Map<Integer, String> studentSubjectNameMap = MapUtil.convertIntegerMap(studentSubjectNameMaps);
|
|
|
List<Map<Integer, Long>> studentSubjectIdMaps = subjectDao.findStudentSubjectIdMaps(tempIds);
|
|
@@ -1635,12 +1634,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
studentAttendanceViewDto.setSubjectName(studentSubjectNameMap.get(studentAttendanceViewDto.getStudentId().intValue()));
|
|
|
studentAttendanceViewDto.setSubjectId(studentSubjectIdMap.get(studentAttendanceViewDto.getStudentId().intValue()));
|
|
|
});
|
|
|
- }else if(schedule.getGroupType() != MUSIC){
|
|
|
+ } else if (schedule.getGroupType() != MUSIC) {
|
|
|
ClassGroup classGroup = classGroupDao.get(schedule.getClassGroupId());
|
|
|
Subject subject = subjectDao.get(Integer.valueOf(classGroup.getSubjectIdList()));
|
|
|
truantStudent.forEach(studentAttendanceViewDto -> {
|
|
|
studentAttendanceViewDto.setSubjectName(subject.getName());
|
|
|
- studentAttendanceViewDto.setSubjectId(Objects.nonNull(subject.getId())?subject.getId().longValue():0);
|
|
|
+ studentAttendanceViewDto.setSubjectId(Objects.nonNull(subject.getId()) ? subject.getId().longValue() : 0);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -3556,43 +3555,52 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type, String subjectIds) {
|
|
|
+ public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type) {
|
|
|
//基础技能班和线上基础技能班,可分班原则为声部人数/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();
|
|
|
- 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.setMaxHighClassGroupNum(maxClassGroupNum);
|
|
|
return highClassGroupNumDto;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,List<Map<Integer, String>> classGroupStudents,List<Integer> studentIds) {
|
|
|
+ public List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId, List<Map<Integer, String>> classGroupStudents, List<Integer> studentIds) {
|
|
|
//获取主班剩余时长
|
|
|
Map<String, Long> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(masterClassGroupId));
|
|
|
- if(masterMap.size() <= 0){
|
|
|
+ if (masterMap.size() <= 0) {
|
|
|
throw new BizException("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
|
//获取学员列表
|
|
|
Map<Integer, String> userNames = MapUtil.convertMybatisMap(teacherDao.queryUsernameByIds(studentIds));
|
|
|
- Map<Integer, String> phoneMaps = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(StringUtils.join(studentIds,",")));
|
|
|
+ Map<Integer, String> phoneMaps = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(StringUtils.join(studentIds, ",")));
|
|
|
|
|
|
Map<Integer, Integer> studentCLassMap = new HashMap<>();
|
|
|
List<Map<Integer, BigDecimal>> surplusCourseFeeMapList = new ArrayList<>();
|
|
|
for (Map<Integer, String> classGroupStudent : classGroupStudents) {
|
|
|
for (Integer integer : classGroupStudent.keySet()) {
|
|
|
//获取学员剩余课程费用
|
|
|
- surplusCourseFeeMapList.addAll(studentRegistrationDao.querySurplusCourseFeeByClassGroupId(integer,classGroupStudent.get(integer)));
|
|
|
+ surplusCourseFeeMapList.addAll(studentRegistrationDao.querySurplusCourseFeeByClassGroupId(integer, classGroupStudent.get(integer)));
|
|
|
String[] s = classGroupStudent.get(integer).split(",");
|
|
|
for (String s1 : s) {
|
|
|
- studentCLassMap.put(Integer.parseInt(s1),integer);
|
|
|
+ studentCLassMap.put(Integer.parseInt(s1), integer);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3613,12 +3621,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
Long courseTime = masterMap.get(s);
|
|
|
//获取主班剩余课程价值,按分部默认单价计算
|
|
|
- if(courseTime == 0l){
|
|
|
- masterTotalPriceMap.put(s,BigDecimal.ZERO);
|
|
|
+ if (courseTime == 0l) {
|
|
|
+ masterTotalPriceMap.put(s, BigDecimal.ZERO);
|
|
|
}
|
|
|
//总价四舍五入取整
|
|
|
BigDecimal totalPrice = unitPrice.multiply(new BigDecimal(courseTime)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
- masterTotalPriceMap.put(s,totalPrice);
|
|
|
+ masterTotalPriceMap.put(s, totalPrice);
|
|
|
//课程余额转移
|
|
|
for (Integer studentId : studentCLassMap.keySet()) {
|
|
|
//学员剩余课程余额
|
|
@@ -3627,21 +3635,21 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
MusicGroupPaymentCalenderStudentDetail calenderDto = new MusicGroupPaymentCalenderStudentDetail();
|
|
|
calenderDto.setClassGroupId(studentCLassMap.get(studentId));
|
|
|
//如果剩余课程余额小于等于0
|
|
|
- if(bigDecimal.doubleValue() <= 0d){
|
|
|
+ if (bigDecimal.doubleValue() <= 0d) {
|
|
|
calenderDto.setCourseCurrentPrice(totalPrice);
|
|
|
calenderDto.setCourseOriginalPrice(totalPrice);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//如果剩余课程余额大于等于总价值,那么补交0元
|
|
|
- if(bigDecimal.doubleValue() >= totalPrice.doubleValue()){
|
|
|
+ if (bigDecimal.doubleValue() >= totalPrice.doubleValue()) {
|
|
|
calenderDto.setCourseCurrentPrice(BigDecimal.ZERO);
|
|
|
calenderDto.setCourseOriginalPrice(BigDecimal.ZERO);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
calenderDto.setCourseCurrentPrice(totalPrice.subtract(bigDecimal));
|
|
|
calenderDto.setCourseOriginalPrice(totalPrice.subtract(bigDecimal));
|
|
|
}
|
|
|
//剩余课程余额减去主班对应课程类型总的课程价值,负数就是需要补交的金额
|
|
|
// bigDecimal = bigDecimal.subtract(totalPrice);
|
|
|
- surplusCourseFeeMap.put(studentId,bigDecimal.subtract(totalPrice));
|
|
|
+ surplusCourseFeeMap.put(studentId, bigDecimal.subtract(totalPrice));
|
|
|
}
|
|
|
calenderDto.setCourseTime(courseTime);
|
|
|
calenderDto.setCourseType(s);
|
|
@@ -3660,7 +3668,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
public BigDecimal getMasterTotalPrice(Integer masterClassGroupId) {
|
|
|
//获取主班剩余时长
|
|
|
Map<String, Long> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(masterClassGroupId));
|
|
|
- if(masterMap.size() <= 0){
|
|
|
+ if (masterMap.size() <= 0) {
|
|
|
throw new BizException("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
|
//获取分布默认的课程类型单价
|
|
@@ -3699,8 +3707,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//学员列表
|
|
|
List<Integer> studentIds = mergeClassSplitClassAffirmDto.getStudentIds();
|
|
|
//主班是否包含所选学员学员
|
|
|
- Boolean hasStudent = classGroupStudentMapperDao.hasStudent(masterClassGroupId,studentIds);
|
|
|
- if(hasStudent){
|
|
|
+ Boolean hasStudent = classGroupStudentMapperDao.hasStudent(masterClassGroupId, studentIds);
|
|
|
+ if (hasStudent) {
|
|
|
throw new BizException("操作失败: 主班包含部分已选学员");
|
|
|
}
|
|
|
//学员列表
|
|
@@ -3721,13 +3729,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//是否有需要审核的缴费项目
|
|
|
for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
//将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
|
|
|
- studentRegistrationService.insertStudent(calenderDto.getStudentIds(),calenderDto.getMusicGroupId(),musicGroup.getId(),masterTotalPrice);
|
|
|
+ studentRegistrationService.insertStudent(calenderDto.getStudentIds(), calenderDto.getMusicGroupId(), musicGroup.getId(), masterTotalPrice);
|
|
|
calenderDto.setMusicGroupId(musicGroup.getId());
|
|
|
List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = calenderDto.getMusicGroupPaymentCalenderStudentDetails();
|
|
|
boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
|
|
|
- if(!containsAll){
|
|
|
+ if (!containsAll) {
|
|
|
calenderDto.setStatus(AUDITING);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
calenderDto.setStatus(NO);
|
|
|
}
|
|
|
calenderDto.setPaymentType(SPAN_GROUP_CLASS_ADJUST);
|
|
@@ -3740,7 +3748,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
batchNoList.add(calenderDto.getBatchNo());
|
|
|
batchNos.append(calenderDto.getBatchNo());
|
|
|
if (status == null || status != AUDITING) {
|
|
|
- if(!containsAll){
|
|
|
+ if (!containsAll) {
|
|
|
status = AUDITING;
|
|
|
}
|
|
|
}
|
|
@@ -3769,8 +3777,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
|
|
|
//没有需要审核的缴费项目
|
|
|
if (status == null) {
|
|
|
- spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents);
|
|
|
- }else {
|
|
|
+ spanGroupClassAdjustPass(masterClassGroupId, studentIds, courseIds, classGroupStudents);
|
|
|
+ } else {
|
|
|
// 冻结班级
|
|
|
classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
|
|
|
// 冻结所选班级的课程
|
|
@@ -3779,9 +3787,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void spanGroupClassAdjustPass(Integer masterClassGroupId,List<Integer> studentIds,List<Long> courseIds,List<Map<Integer, String>> classGroupStudents){
|
|
|
+ public void spanGroupClassAdjustPass(Integer masterClassGroupId, List<Integer> studentIds, List<Long> courseIds, List<Map<Integer, String>> classGroupStudents) {
|
|
|
//将学员加进班级未开始的课程,以及班级关联、加群
|
|
|
- classGroupStudentMapperService.updateClassGroupStudents(masterClassGroupId.longValue(),new HashSet<>(studentIds));
|
|
|
+ classGroupStudentMapperService.updateClassGroupStudents(masterClassGroupId.longValue(), new HashSet<>(studentIds));
|
|
|
//删除学员课程
|
|
|
courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, studentIds);
|
|
|
//删除班级关联的学员
|