yonge 5 년 전
부모
커밋
86870690fd

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java

@@ -16,7 +16,7 @@ public class MusicGroupPaymentCalenderDetail {
 	private Long musicGroupPaymentCalenderId;
 	
 	/**  */
-	private Long userId;
+	private Integer userId;
 	
 	/**  */
 	private java.math.BigDecimal expectAmount;
@@ -55,11 +55,11 @@ public class MusicGroupPaymentCalenderDetail {
 		return this.musicGroupPaymentCalenderId;
 	}
 			
-	public void setUserId(Long userId){
+	public void setUserId(Integer userId){
 		this.userId = userId;
 	}
 	
-	public Long getUserId(){
+	public Integer getUserId(){
 		return this.userId;
 	}
 			

+ 21 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.common.exception.BizException;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -17,7 +18,9 @@ import org.springframework.transaction.annotation.Transactional;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -44,6 +47,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Transactional(rollbackFor = Exception.class)
 	public boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		Date date = new Date();
+		List<MusicGroupStudentFee> list = null;
+		
 		musicGroupPaymentCalender.setCreateTime(date);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
@@ -52,7 +57,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		} else if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
 			musicGroupPaymentCalender.setPaymentStatus(PaymentStatusEnum.OPEN);
 			//统计缴费人数
-			List<MusicGroupStudentFee> list = musicGroupStudentFeeDao.queryByMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
+			list = musicGroupStudentFeeDao.queryByMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
 			if(list == null){
 				list = new ArrayList<MusicGroupStudentFee>();
 			}
@@ -63,7 +68,21 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		
 		this.insert(musicGroupPaymentCalender);
 		
-		//创建缴费明细
+		if(musicGroupPaymentCalender.getPaymentStatus() == PaymentStatusEnum.OPEN){
+			if(list != null && list.size() > 0){
+				MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
+				//创建缴费明细
+				for(MusicGroupStudentFee mgsf : list){
+					musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
+					musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+					musicGroupPaymentCalenderDetail.setCreateTime(date);
+					musicGroupPaymentCalenderDetail.setExpectAmount(mgsf.getCourseFee());
+					musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
+					musicGroupPaymentCalenderDetail.setUpdateTime(date);
+					musicGroupPaymentCalenderDetail.setUserId(mgsf.getUserId());
+				}
+			}
+		}
 
 		return true;
 	}