|
@@ -3494,7 +3494,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("请填写班级信息");
|
|
@@ -3574,9 +3573,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("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
@@ -3611,13 +3611,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()) {
|
|
@@ -3643,7 +3640,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));
|
|
@@ -3659,7 +3656,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("所选主班没有剩余课程,请重新选择");
|
|
|
}
|
|
@@ -3674,10 +3671,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;
|
|
@@ -3703,6 +3700,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if(hasStudent){
|
|
|
throw new BizException("操作失败: 主班包含部分已选学员");
|
|
|
}
|
|
|
+
|
|
|
//学员列表
|
|
|
List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
|
|
|
//班级和学员关联
|
|
@@ -3754,24 +3752,33 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
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);
|
|
|
+ spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents,allLockCourseIds,paymentCalenderDto.getBatchNo());
|
|
|
}else {
|
|
|
// 冻结班级
|
|
|
classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
|
|
|
// 冻结所选班级的课程
|
|
|
courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 1);
|
|
|
}
|
|
|
- int i = 1/0;
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
//删除班级关联的学员
|