yonge 4 年 前
コミット
31b816dfbc

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

@@ -253,6 +253,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList) {
 		
 		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
@@ -260,6 +261,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			throw new BizException("查询缴费信息失败");
 		}
 		
+		if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.AUDITING
+				|| musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.REJECT) {
+			throw new BizException("当前缴费状态不能添加学生");
+		}
+		
 		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		
 		BigDecimal totalPrice = new BigDecimal(0);
@@ -289,6 +295,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if (musicGroupPaymentCalenderDetailList.size() > 0) {
 			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
 		}
+		//更新预计缴费人数
+		musicGroupPaymentCalender.setExpectNum(userIdList.size());
+		musicGroupPaymentCalender.setUpdateTime(date);
+		musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
 	}
 
 	@Override