|
@@ -98,6 +98,65 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
|
|
|
+ Date date = new Date();
|
|
|
+ List<PaymentStatusEnum> statusList = new ArrayList<PaymentStatusEnum>();
|
|
|
+ statusList.add(PaymentStatusEnum.NO);
|
|
|
+ statusList.add(PaymentStatusEnum.OPEN);
|
|
|
+ List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(statusList);
|
|
|
+
|
|
|
+ List<MusicGroupPaymentCalender> updateMusicGroupPaymentCalenderList = new ArrayList<MusicGroupPaymentCalender>();
|
|
|
+
|
|
|
+ MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
|
|
|
+ List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
|
|
|
+
|
|
|
+ for(MusicGroupPaymentCalender mgpc : musicGroupPaymentCalenderList){
|
|
|
+
|
|
|
+ if(date.after(mgpc.getDeadlinePaymentDate())){
|
|
|
+ //“进行中”更新至“已结束”
|
|
|
+ mgpc.setUpdateTime(date);
|
|
|
+ mgpc.setPaymentStatus(PaymentStatusEnum.YES);
|
|
|
+ updateMusicGroupPaymentCalenderList.add(mgpc);
|
|
|
+
|
|
|
+ //学生状态更新已结束
|
|
|
+
|
|
|
+ } else if (date.after(mgpc.getStartPaymentDate())) {
|
|
|
+ //“未开始”更新至“进行中”
|
|
|
+ mgpc.setUpdateTime(date);
|
|
|
+ mgpc.setPaymentStatus(PaymentStatusEnum.OPEN);
|
|
|
+ updateMusicGroupPaymentCalenderList.add(mgpc);
|
|
|
+
|
|
|
+ //学生状态更新进行中
|
|
|
+ List<MusicGroupStudentFee> list = musicGroupStudentFeeDao.queryByMusicGroupId(mgpc.getMusicGroupId());
|
|
|
+
|
|
|
+ // 创建缴费明细
|
|
|
+ for (MusicGroupStudentFee mgsf : list) {
|
|
|
+ musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
|
|
|
+ musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(mgpc.getId());
|
|
|
+ musicGroupPaymentCalenderDetail.setCreateTime(date);
|
|
|
+ musicGroupPaymentCalenderDetail.setExpectAmount(mgsf.getCourseFee());
|
|
|
+ musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
|
|
|
+ musicGroupPaymentCalenderDetail.setUpdateTime(date);
|
|
|
+ musicGroupPaymentCalenderDetail.setUserId(mgsf.getUserId());
|
|
|
+
|
|
|
+ musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(updateMusicGroupPaymentCalenderList.size() > 0){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (musicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
+ musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void batchInsert(List<MusicGroupPaymentCalender> musicGroupPaymentCalenders) {
|
|
|
if (musicGroupPaymentCalenders != null && musicGroupPaymentCalenders.size() > 0) {
|
|
|
musicGroupPaymentCalenderDao.delByGroupId(musicGroupPaymentCalenders.get(0).getMusicGroupId());
|