|
@@ -321,17 +321,16 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
List<Long> studentPaymentIds = JSON.parseArray(classAdjust.getStudentPaymentIds(), Long.class);
|
|
|
String batchNo = classAdjust.getBatchNo();
|
|
|
|
|
|
- List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
-
|
|
|
//获取默认的排课时长
|
|
|
// classAdjust.getDefaultCourseTypeMinute();
|
|
|
// String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
|
|
|
JSONObject jsonObject = JSON.parseObject(classAdjust.getDefaultCourseTypeMinute());
|
|
|
-
|
|
|
+ List<CourseScheduleStudentPayment> totalCourseScheduleStudentPayments = new ArrayList<>();
|
|
|
for (Integer studentId : studentIds) {
|
|
|
List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = null;
|
|
|
BigDecimal typeCourseTotalOriginalPrice = new BigDecimal("0"), typeCourseTotalCurrentPrice = new BigDecimal("0");
|
|
|
- int index = courseScheduleStudentPayments.size();
|
|
|
+ List<CourseScheduleStudentPayment> oldCourseScheduleStudentPayments = new ArrayList<>();
|
|
|
+ List<CourseScheduleStudentPayment> newCourseScheduleStudentPayments = new ArrayList<>();
|
|
|
for (int i = 0; i < courseSchedules.size(); i++) {
|
|
|
CourseSchedule courseSchedule = courseSchedules.get(i);
|
|
|
//优先处理之前的剩余课程
|
|
@@ -352,7 +351,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
studentPayment.setSettlementTime(null);
|
|
|
studentPayment.setExamSongDownloadJson(null);
|
|
|
studentPayment.setId(null);
|
|
|
- courseScheduleStudentPayments.add(studentPayment);
|
|
|
+ oldCourseScheduleStudentPayments.add(studentPayment);
|
|
|
+ totalCourseScheduleStudentPayments.add(studentPayment);
|
|
|
continue ;
|
|
|
}
|
|
|
}
|
|
@@ -365,13 +365,13 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
//获取合班时的缴费项目
|
|
|
Set<Long> calenderIds = musicGroupPaymentCalenderDao.findByBatchNoAndStudentId(batchNo,studentId);
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, null);
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, courseSchedule.getType());
|
|
|
MusicGroupPaymentCalenderCourseSettings courseSetting = musicGroupPaymentCalenderCourseSettings.get(0);
|
|
|
//课程每分钟原价
|
|
|
- BigDecimal unitMinuteOriginalPrice = courseSetting.getCourseOriginalPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal unitMinuteOriginalPrice = courseSetting.getCourseOriginalPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
//课程每分钟现价
|
|
|
- BigDecimal unitMinuteCurrentPrice = courseSetting.getCourseCurrentPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal unitMinuteCurrentPrice = courseSetting.getCourseCurrentPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
//默认课程时长
|
|
|
int courseDuration = Integer.parseInt(jsonObject.get(courseSchedule.getType().getCode()).toString());
|
|
@@ -391,11 +391,12 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
cssp.setOriginalPrice(courseOriginalPrice);
|
|
|
cssp.setExpectPrice(courseCurrentPrice);
|
|
|
cssp.setActualPrice(BigDecimal.ZERO);
|
|
|
- courseScheduleStudentPayments.add(cssp);
|
|
|
+ newCourseScheduleStudentPayments.add(cssp);
|
|
|
if(courseSchedules.size() - 1 == i){
|
|
|
- CourseScheduleStudentPayment scheduleStudentPayment = courseScheduleStudentPayments.get(index);
|
|
|
+ CourseScheduleStudentPayment scheduleStudentPayment = newCourseScheduleStudentPayments.get(0);
|
|
|
scheduleStudentPayment.setOriginalPrice(scheduleStudentPayment.getOriginalPrice().add(courseSetting.getCourseOriginalPrice().subtract(typeCourseTotalOriginalPrice)));
|
|
|
scheduleStudentPayment.setExpectPrice(scheduleStudentPayment.getExpectPrice().add(courseSetting.getCourseCurrentPrice().subtract(typeCourseTotalCurrentPrice)));
|
|
|
+ totalCourseScheduleStudentPayments.addAll(newCourseScheduleStudentPayments);
|
|
|
}
|
|
|
//获取课程类型默认排课时长
|
|
|
int typeCourseDuration = Integer.parseInt(jsonObject.get(courseSchedule.getType().getCode()).toString());
|
|
@@ -411,7 +412,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
|
|
|
}
|
|
|
}
|
|
|
- courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
+ courseScheduleStudentPaymentDao.batchInsert(totalCourseScheduleStudentPayments);
|
|
|
}
|
|
|
|
|
|
|