|
@@ -65,7 +65,6 @@ import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
import com.ym.mec.biz.dal.entity.Organization;
|
|
import com.ym.mec.biz.dal.entity.Organization;
|
|
import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
|
|
import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
|
|
-import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
@@ -263,6 +262,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();
|
|
@@ -273,23 +273,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());
|
|
@@ -445,14 +458,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
throw new BizException("请登录");
|
|
throw new BizException("请登录");
|
|
}
|
|
}
|
|
|
|
|
|
- // 不是进行中,只能创建一次缴费
|
|
|
|
- if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
|
|
|
|
- List<MusicGroupPaymentCalender> list = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
|
- if (list.size() > 0) {
|
|
|
|
- throw new BizException("创建失败,已经存在缴费信息");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender :: getId).collect(Collectors.toList());
|
|
List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender :: getId).collect(Collectors.toList());
|
|
//删除原来数据
|
|
//删除原来数据
|
|
musicGroupPaymentCalenderDao.delByIds(calenderIds);
|
|
musicGroupPaymentCalenderDao.delByIds(calenderIds);
|
|
@@ -539,6 +544,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();
|
|
@@ -549,23 +555,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());
|
|
@@ -1145,7 +1164,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
calender.setActualNum(actualNum + 1);
|
|
calender.setActualNum(actualNum + 1);
|
|
calender.setUpdateTime(date);
|
|
calender.setUpdateTime(date);
|
|
musicGroupPaymentCalenderDao.update(calender);
|
|
musicGroupPaymentCalenderDao.update(calender);
|
|
- courseScheduleStudentPaymentService.updateForMusicGroupWithPaymentCalender(calender.getBatchNo());
|
|
|
|
return musicGroupStudentFee;
|
|
return musicGroupStudentFee;
|
|
}
|
|
}
|
|
|
|
|