Browse Source

缴费项目已结束,并且没有单独开启缴费的学员,不能修改缴费金额

zouxuan 4 năm trước cách đây
mục cha
commit
6d32545418

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

@@ -1,7 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
 
 import java.math.BigDecimal;
@@ -17,6 +17,7 @@ import java.util.Set;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -87,17 +88,21 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		}
 		Date date = new Date();
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderDetails.get(0).getMusicGroupPaymentCalenderId());
+		//缴费项目已结束,并且没有单独开启缴费的学员,不能修改缴费金额
+		if(calender.getStatus() == OVER){
+			List<MusicGroupPaymentCalenderDetail> paymentCalenderDetails = calenderDetails.stream().filter(e -> e.getOpenFlag() == YesOrNoEnum.NO).collect(Collectors.toList());
+			if(paymentCalenderDetails != null && paymentCalenderDetails.size() > 0){
+				throw new BizException("修改失败:存在未开启缴费的学员");
+			}
+		}
 		Set<Integer> studentIds = new HashSet<>();
 				calenderDetails.forEach(e->{
 			if(e.getPaymentStatus() == null || e.getPaymentStatus() != NON_PAYMENT){
-				throw new BizException("修改失败,缴费状态不匹配");
+				throw new BizException("修改失败缴费状态不匹配");
 			}
 			if(expectAmount.doubleValue() != 0){
 
 			}
-			/*if(expectAmount.doubleValue() == 0){
-				e.setPaymentStatus(PAID_COMPLETED);
-			}*/
 			e.setUpdateTime(date);
 			e.setExpectAmount(expectAmount);
 			if(expectAmount.doubleValue() > 0){
@@ -106,16 +111,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				}
 			}
 		});
-		/*if(expectAmount.doubleValue() == 0){
-			//如果是设置为0元
-			MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(calenderDetails.get(0).getMusicGroupPaymentCalenderId());
-			if(calender.getType() == ONLINE){
-				//剩余网管课可购买次数加一
-				musicGroupStudentFeeDao.remainNetworkClassTimesAdd(ids);
-			}
-			//缴费完成
-			musicGroupStudentFeeDao.setPaidCompleted(calenderDetails);
-		}*/
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 		//推送消息
 		if (calender.getPayUserType() == STUDENT && studentIds.size() > 0) {
@@ -138,7 +133,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 						null, 0, memo, null, musicGroup.getName());
 			}
 		}
-//		}
 	}
 
 	@Override