|
@@ -3492,7 +3492,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
|
|
|
throw new BizException("主教与助教存在冲突");
|
|
|
}
|
|
|
- //所选班级不能有未开始的临时合并课程
|
|
|
List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
|
|
|
if (classGroupIds == null || classGroupIds.size() == 0) {
|
|
|
throw new BizException("请填写班级信息");
|
|
@@ -3572,9 +3571,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public List<MusicGroupPaymentCalenderStudentDetail> queryStudentPaymentCalenders(Integer masterClassGroupId,List<Map<Integer, String>> classGroupStudents,List<Integer> studentIds) {
|
|
|
- //获取主班剩余时长
|
|
|
- Map<String, Long> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(masterClassGroupId));
|
|
|
+ //获取主班剩余课程时长
|
|
|
+ Map<String, BigDecimal> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseTimeMap(masterClassGroupId));
|
|
|
if(masterMap.size() <= 0){
|
|
|
throw new BizException("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
@@ -3609,13 +3609,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (unitPrice == null) {
|
|
|
throw new BizException("分部默认课程类型单价不存在,请设置");
|
|
|
}
|
|
|
- Long courseTime = masterMap.get(s);
|
|
|
+ BigDecimal courseTime = masterMap.get(s);
|
|
|
//获取主班剩余课程价值,按分部默认单价计算
|
|
|
- if(courseTime == 0l){
|
|
|
- masterTotalPriceMap.put(s,BigDecimal.ZERO);
|
|
|
- }
|
|
|
//总价四舍五入取整
|
|
|
- BigDecimal totalPrice = unitPrice.multiply(new BigDecimal(courseTime)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal totalPrice = unitPrice.multiply(courseTime).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
masterTotalPriceMap.put(s,totalPrice);
|
|
|
//课程余额转移
|
|
|
for (Integer studentId : studentCLassMap.keySet()) {
|
|
@@ -3641,7 +3638,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
// bigDecimal = bigDecimal.subtract(totalPrice);
|
|
|
surplusCourseFeeMap.put(studentId,bigDecimal.subtract(totalPrice));
|
|
|
}
|
|
|
- calenderDto.setCourseTime(courseTime);
|
|
|
+ calenderDto.setCourseTime(courseTime.intValue());
|
|
|
calenderDto.setCourseType(s);
|
|
|
|
|
|
calenderDto.setPhone(phoneMaps.get(studentId));
|
|
@@ -3657,7 +3654,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
public BigDecimal getMasterTotalPrice(Integer masterClassGroupId) {
|
|
|
//获取主班剩余时长
|
|
|
- Map<String, Long> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(masterClassGroupId));
|
|
|
+ Map<String, BigDecimal> masterMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseTimeMap(masterClassGroupId));
|
|
|
if(masterMap.size() <= 0){
|
|
|
throw new BizException("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
@@ -3672,10 +3669,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (unitPrice == null) {
|
|
|
throw new BizException("分部默认课程类型单价不存在,请设置");
|
|
|
}
|
|
|
- Long courseTime = masterMap.get(s);
|
|
|
+ BigDecimal courseTime = masterMap.get(s);
|
|
|
//获取主班剩余课程价值,按分部默认单价计算
|
|
|
//总价四舍五入取整
|
|
|
- BigDecimal totalPrice = unitPrice.multiply(new BigDecimal(courseTime)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal totalPrice = unitPrice.multiply(courseTime).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
masterTotalPrice = masterTotalPrice.add(totalPrice);
|
|
|
}
|
|
|
return masterTotalPrice;
|
|
@@ -3691,7 +3688,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
public void spanGroupMergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
//缴费项目
|
|
|
- List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
|
|
|
+ MusicGroupPaymentCalenderDto paymentCalenderDto = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos().get(0);
|
|
|
//主班
|
|
|
Integer masterClassGroupId = mergeClassSplitClassAffirmDto.getMasterClassGroupId();
|
|
|
//学员列表
|
|
@@ -3701,6 +3698,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if(hasStudent){
|
|
|
throw new BizException("操作失败: 主班包含部分已选学员");
|
|
|
}
|
|
|
+
|
|
|
//学员列表
|
|
|
List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
|
|
|
//班级和学员关联
|
|
@@ -3711,75 +3709,74 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
studentIds);
|
|
|
//创建缴费项目
|
|
|
MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
|
|
|
- MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
|
|
|
- StringBuffer batchNos = new StringBuffer();
|
|
|
- List<String> batchNoList = new ArrayList<>();
|
|
|
- if (paymentCalenderDtos != null && paymentCalenderDtos.size() > 0) {
|
|
|
- BigDecimal masterTotalPrice = getMasterTotalPrice(masterClassGroupId);
|
|
|
- //是否有需要审核的缴费项目
|
|
|
- for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
- //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
|
|
|
- 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){
|
|
|
- calenderDto.setStatus(AUDITING);
|
|
|
- }else {
|
|
|
- calenderDto.setStatus(NO);
|
|
|
- }
|
|
|
- calenderDto.setPaymentType(SPAN_GROUP_CLASS_ADJUST);
|
|
|
- //生成缴费项目
|
|
|
- calenderDto.setMasterTotalPrice(masterTotalPrice);
|
|
|
- musicGroupPaymentCalenderService.create(calenderDto);
|
|
|
- if (batchNos.length() > 0) {
|
|
|
- batchNos.append(",");
|
|
|
- }
|
|
|
- batchNoList.add(calenderDto.getBatchNo());
|
|
|
- batchNos.append(calenderDto.getBatchNo());
|
|
|
- if (status == null || status != AUDITING) {
|
|
|
- if(!containsAll){
|
|
|
- status = AUDITING;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //记录申请信息
|
|
|
- MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = new MusicGroupStudentClassAdjust();
|
|
|
- musicGroupStudentClassAdjust.setMasterClassGroupId(masterClassGroupId);
|
|
|
- musicGroupStudentClassAdjust.setBatchNo(batchNos.toString());
|
|
|
- musicGroupStudentClassAdjust.setMusicGroupId(musicGroup.getId());
|
|
|
- musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
|
|
|
- musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
|
|
|
- musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
|
|
|
- if (classGroupStudents != null && classGroupStudents.size() > 0) {
|
|
|
- musicGroupStudentClassAdjust.setClassGroupStudents(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()));
|
|
|
- }
|
|
|
- //获取需要删除的学员关联的课程
|
|
|
- List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
|
|
|
- musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
|
|
|
- //获取关联的学员缴费信息
|
|
|
- List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
|
|
|
- musicGroupStudentClassAdjust.setStudentPaymentIds(JSON.toJSONString(studentPaymentIds));
|
|
|
- //获取需要冻结的课程
|
|
|
- classGroupIds.add(masterClassGroupId);
|
|
|
- List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, null);
|
|
|
- musicGroupStudentClassAdjust.setAllLockCourseIds(JSON.toJSONString(allLockCourseIds));
|
|
|
- musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
|
|
|
- //没有需要审核的缴费项目
|
|
|
- if (status == null) {
|
|
|
- spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents);
|
|
|
- }else {
|
|
|
+ BigDecimal masterTotalPrice = getMasterTotalPrice(masterClassGroupId);
|
|
|
+ //是否有需要审核的缴费项目
|
|
|
+ //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
|
|
|
+ for (Map<Integer, String> classGroupStudent : classGroupStudents) {
|
|
|
+ Integer classGroupId = classGroupStudent.keySet().iterator().next();
|
|
|
+ studentRegistrationService.insertStudent(classGroupStudent.get(classGroupId),musicGroupDao.findByClassGroupId(classGroupId).getId(),musicGroup.getId(),masterTotalPrice);
|
|
|
+ }
|
|
|
+
|
|
|
+ paymentCalenderDto.setMusicGroupId(musicGroup.getId());
|
|
|
+ List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = paymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
|
|
|
+ boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
|
|
|
+ if(!containsAll){
|
|
|
+ paymentCalenderDto.setStatus(AUDITING);
|
|
|
+ }else {
|
|
|
+ paymentCalenderDto.setStatus(NO);
|
|
|
+ }
|
|
|
+ paymentCalenderDto.setPayUserType(MusicGroupPaymentCalender.PayUserType.STUDENT);
|
|
|
+ paymentCalenderDto.setPaymentType(SPAN_GROUP_CLASS_ADJUST);
|
|
|
+ //生成缴费项目
|
|
|
+ paymentCalenderDto.setMasterTotalPrice(masterTotalPrice);
|
|
|
+ paymentCalenderDto.setStudentIds(StringUtils.join(studentIds,","));
|
|
|
+ musicGroupPaymentCalenderService.create(paymentCalenderDto);
|
|
|
+ //记录申请信息
|
|
|
+ MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = new MusicGroupStudentClassAdjust();
|
|
|
+ musicGroupStudentClassAdjust.setMasterClassGroupId(masterClassGroupId);
|
|
|
+ musicGroupStudentClassAdjust.setBatchNo(paymentCalenderDto.getBatchNo());
|
|
|
+ musicGroupStudentClassAdjust.setMusicGroupId(musicGroup.getId());
|
|
|
+ musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
|
|
|
+ musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
|
|
|
+ musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
|
|
|
+ if (classGroupStudents != null && classGroupStudents.size() > 0) {
|
|
|
+ musicGroupStudentClassAdjust.setClassGroupStudents(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()));
|
|
|
+ }
|
|
|
+ //获取需要删除的学员关联的课程
|
|
|
+ List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
|
|
|
+ musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
|
|
|
+ //获取关联的学员缴费信息
|
|
|
+ List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
|
|
|
+ musicGroupStudentClassAdjust.setStudentPaymentIds(JSON.toJSONString(studentPaymentIds));
|
|
|
+ //获取需要冻结的课程
|
|
|
+ classGroupIds.add(masterClassGroupId);
|
|
|
+ //所选班级列表,是否包含已冻结的班级
|
|
|
+ List<ClassGroup> lockClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds, 1);
|
|
|
+ if (lockClassGroupIds != null && lockClassGroupIds.size() > 0) {
|
|
|
+ throw new BizException("所选班级包含审核中的学员班级调整申请");
|
|
|
+ }
|
|
|
+ //所选班级不能有未开始的临时合并课程
|
|
|
+ int courseNum = courseScheduleDao.findNoStartMasterCourseNum(classGroupIds);
|
|
|
+ if (courseNum > 0) {
|
|
|
+ throw new BizException("所选班级不能有未开始的临时合并课程");
|
|
|
+ }
|
|
|
+ List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, null);
|
|
|
+ musicGroupStudentClassAdjust.setAllLockCourseIds(JSON.toJSONString(allLockCourseIds));
|
|
|
+ musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
|
|
|
+ //没有需要审核的缴费项目
|
|
|
+ if (paymentCalenderDto.getStatus() != AUDITING) {
|
|
|
+ spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents,allLockCourseIds,paymentCalenderDto.getBatchNo());
|
|
|
+ }else {
|
|
|
// 冻结班级
|
|
|
- classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
|
|
|
+ classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
|
|
|
// 冻结所选班级的课程
|
|
|
- courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 1);
|
|
|
- }
|
|
|
+ courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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,List<Long> allLockCourseIds,String batchNo){
|
|
|
//将学员加进班级未开始的课程,以及班级关联、加群
|
|
|
- classGroupStudentMapperService.updateClassGroupStudents(masterClassGroupId.longValue(),new HashSet<>(studentIds));
|
|
|
+ classGroupStudentMapperService.updateClassGroupStudents1(masterClassGroupId.longValue(),studentIds,allLockCourseIds,batchNo);
|
|
|
//删除学员课程
|
|
|
courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, studentIds);
|
|
|
//删除班级关联的学员
|