yonge 4 tahun lalu
induk
melakukan
9445137f55

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java

@@ -78,4 +78,11 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      * @return
      */
     int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
+    
+    /**
+     * 查询对象
+     * @param musicGroupPaymentCalenderDetailIdList
+     * @return
+     */
+    List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
 }

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

@@ -450,16 +450,23 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(details == null || details.size() == 0){
 			throw new BizException("删除失败: 数据不可为空");
 		}
+		//是否已缴费
 		long count = details.stream().filter(e -> e.getPaymentStatus() != NON_PAYMENT).count();
 		if(count > 0){
 			throw new BizException("删除失败: 存在已缴费的学员");
 		}
-		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
-		
 		List<Long> musicGroupPaymentCalenderDetailIdList = new ArrayList<Long>();
 		for(String s : musicGroupPaymentCalenderDetailIds.split(",")){
 			musicGroupPaymentCalenderDetailIdList.add(Long.parseLong(s));
 		}
+		//是否已排课
+		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList);
+		count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
+		if(count > 0){
+			throw new BizException("删除失败:存在已排课的学员");
+		}
+		
+		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
 		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
 	}
 }

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

@@ -1225,8 +1225,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING || calender.getStatus() != PaymentCalenderStatusEnum.NO
-				|| calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
+		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
+				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
 			throw new BizException("删除失败,只有[审核中]、[拒绝]或[未开启缴费]状态才能删除");
 		}
 
@@ -1238,6 +1238,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			if (paidList.size() > 0) {
 				throw new BizException("存在已缴费的学生不能删除");
 			}
+			
+			List<Long> calenderDetailIdList = musicGroupPaymentCalenderDetailList.stream().map(cd -> cd.getId()).collect(Collectors.toList());
+			//是否已排课
+			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(calenderDetailIdList);
+			long count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
+			if(count > 0){
+				throw new BizException("存在已排课的学员");
+			}
 		}
 
 		musicGroupPaymentCalenderDao.delete(id);

+ 12 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -138,6 +138,18 @@
     </delete>
 
     <!-- 分页查询 -->
+    <select id="queryByMusicGroupPaymentStudentCourseDetailId" resultMap="MusicGroupPaymentStudentCourseDetail"
+            parameterType="map">
+        SELECT * FROM music_group_payment_student_course_detail 
+        <where>
+        	music_group_payment_calender_detail_id_ in    
+		    <foreach item="item" collection="list" separator="," open="(" close=")" index="">    
+		      #{item}    
+		    </foreach>
+        </where>
+    </select>
+
+    <!-- 分页查询 -->
     <select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"
             parameterType="map">
         SELECT * FROM music_group_payment_student_course_detail ORDER BY id_