|
@@ -257,6 +257,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
musicGroupPaymentCalenderCourseSettingsList.size());
|
|
musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
|
|
|
|
|
+ BigDecimal totalPaymentAmount = new BigDecimal(0);
|
|
for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
|
|
|
MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
@@ -267,23 +268,36 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
}
|
|
}
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
- pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
|
|
|
+ pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
|
+ .setScale(2, BigDecimal.ROUND_DOWN)));
|
|
tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
- pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
|
|
|
+ pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
|
+ .setScale(2, BigDecimal.ROUND_DOWN)));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
} else {
|
|
} else {
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
|
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
}
|
|
}
|
|
|
|
+ totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
newCSList.add(tempPccs);
|
|
newCSList.add(tempPccs);
|
|
}
|
|
}
|
|
musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
|
+ musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
|
|
|
|
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
- musicGroupPaymentCalender.setPaymentType(musicGroupPaymentCalenderDto.getPaymentType());
|
|
|
|
|
|
+
|
|
|
|
+ if (paymentType == PaymentType.MUSIC_APPLY) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
|
+ } else {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(PaymentType.MUSIC_RENEW);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
|
+ }
|
|
musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
|
|
musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
|
|
musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
|
|
musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
|
|
musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
|
|
musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
|
|
@@ -533,6 +547,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
musicGroupPaymentCalenderCourseSettingsList.size());
|
|
musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
|
|
|
|
|
+ BigDecimal totalPaymentAmount = new BigDecimal(0);
|
|
for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
|
|
|
MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
@@ -543,23 +558,36 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
}
|
|
}
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
- pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
|
|
|
+ pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
|
+ .setScale(2, BigDecimal.ROUND_DOWN)));
|
|
tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
- pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
|
|
|
+ pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
|
+ .setScale(2, BigDecimal.ROUND_DOWN)));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
} else {
|
|
} else {
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
|
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 2, BigDecimal.ROUND_DOWN));
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
}
|
|
}
|
|
|
|
+ totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
newCSList.add(tempPccs);
|
|
newCSList.add(tempPccs);
|
|
}
|
|
}
|
|
musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
|
+ musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
|
|
|
|
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
- musicGroupPaymentCalender.setPaymentType(musicGroupPaymentCalenderDto.getPaymentType());
|
|
|
|
|
|
+
|
|
|
|
+ if (paymentType == PaymentType.MUSIC_APPLY) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
|
+ } else {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(PaymentType.MUSIC_RENEW);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
|
+ }
|
|
musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
|
|
musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
|
|
musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
|
|
musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
|
|
musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
|
|
musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
|