Просмотр исходного кода

update 缴费金额为0时,报名、续费不能建多期

周箭河 4 лет назад
Родитель
Сommit
fd09b70311

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -206,6 +206,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
 		}
 
+		// 缴费金额为0时,报名、续费不能建多期
+		if(paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW){
+			BigDecimal noOptionalCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream()
+					.filter(e -> !e.getIsStudentOptional()).map(MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice)
+					.reduce(BigDecimal.ZERO, BigDecimal::add);
+			if(noOptionalCoursePrice.compareTo(BigDecimal.ZERO) <= 0 && musicGroupPaymentDateRangeList.size() > 1){
+				throw new BizException("缴费金额为0时不支持多周期缴费");
+			}
+		}
+
 		if (payUserType == SCHOOL) {
 			status = AUDITING;
 		} else {