| 
					
				 | 
			
			
				@@ -15,6 +15,7 @@ import com.ym.mec.common.dal.BaseDAO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.exception.BizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.service.impl.BaseServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,8 +33,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl< 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -318,6 +319,98 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl< 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public void batchAdd(String batchNo, List<Integer> userIdList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByBatchNo(batchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Long musicGroupPaymentCalenderId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for(MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentCalenderId = musicGroupPaymentCalender.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//剔除可选课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if (courseSettings.getIsStudentOptional() == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					totalPrice = totalPrice.add(courseSettings.getCourseCurrentPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<Integer,MusicGroupPaymentCalenderDetail> userMap = new HashMap<Integer, MusicGroupPaymentCalenderDetail>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//创建缴费明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for(Integer studentId : userIdList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setUserId(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				userMap.put(studentId, musicGroupPaymentCalenderDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (musicGroupPaymentCalenderDetailList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//更新预计缴费人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + userIdList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentCalender.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentCalenderService.update(musicGroupPaymentCalender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//创建学生课排课分钟数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for(Integer studentId : userIdList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if (courseSettings.getIsStudentOptional() == true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(userMap.get(studentId).getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetail.setUserId(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(musicGroupPaymentStudentCourseDetailList.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//给学员推送缴费通知 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalenderId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public List<FeeStudentDto> queryFeeStudents(String musicGroupId,String search,Integer subjectId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return musicGroupStudentFeeDao.queryFeeStudents(musicGroupId,search,subjectId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 |