yonge 3 سال پیش
والد
کامیت
4db6a304d0

+ 23 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -24,6 +24,7 @@ import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDetailDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.service.*;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.MusicArrearageStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
+import com.ym.mec.biz.dal.dto.StudentSubTotalCourseTimesDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
@@ -433,10 +435,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		// 所有缴费项目已完成排课才能创建下一个缴费项目
 		List<String> batchNoList = new ArrayList<>();
 		batchNoList.add(batchNo);
-		String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,batchNoList);
+		/*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,batchNoList);
 		if (StringUtils.isNoneBlank(orignBatchNo)) {
 			throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
-		}
+		}*/
 		//获取欠费学员列表
 		List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroupId, new ArrayList<>(userIdList));
 		if(noPaymentUserIds.size() > 0){
@@ -465,6 +467,25 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(Collections.disjoint(userList, userIdList) == false){
 			throw new BizException("操作失败:包含已存在的学员");
 		}
+		
+		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
+		
+		if (courseSettingsList != null && courseSettingsList.size() > 0) {
+			List<StudentSubTotalCourseTimesDto> studentCourseTypeDtos = musicGroupPaymentStudentCourseDetailDao.queryStudentSubTotalCourseTimes(musicGroupId);
+
+			Set<String> courseTypes = new HashSet<String>();
+			for (StudentSubTotalCourseTimesDto dto : studentCourseTypeDtos) {
+				if (userIdList.contains(dto.getUserId())) {
+					courseTypes.addAll(dto.getMapDtos().stream().map(t -> t.getKey()).collect(Collectors.toSet()));
+				}
+			}
+
+			for (MusicGroupPaymentCalenderCourseSettings mgpccs : courseSettingsList) {
+				if (courseTypes.contains(mgpccs.getCourseType().name())) {
+					throw new BizException("操作失败:存在未排完的[{}]", mgpccs.getCourseType().getMsg());
+				}
+			}
+		}
 
 		Date date = new Date();
 		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
@@ -540,7 +561,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
 
 		//创建学生课排课分钟数
-		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		if(courseSettingsList != null && courseSettingsList.size() > 0){
 			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<>();
 			MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;

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

@@ -247,10 +247,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("创建缴费失败:已存在缴费项目");
         }
         // 所有缴费项目已完成排课才能创建下一个缴费项目
-        String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
+        /*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
         if (StringUtils.isNoneBlank(orignBatchNo)) {
             throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
-        }
+        }*/
 
         // 不是进行中,只能创建一次缴费
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {