Browse Source

update 处理关闭、取消乐团没有学生问题

周箭河 4 years ago
parent
commit
2114a7b2a1

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1351,8 +1351,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     + musicGroupId, "", PlatformCashAccountDetailTypeEnum.REFUNDS, null, SUCCESS, "取消乐团", null);
                     + musicGroupId, "", PlatformCashAccountDetailTypeEnum.REFUNDS, null, SUCCESS, "取消乐团", null);
         }*/
         }*/
         //获取当前乐团所有已报名学员
         //获取当前乐团所有已报名学员
+        List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
         if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
         if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
-            List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
             if (registrations != null && registrations.size() > 0) {
             if (registrations != null && registrations.size() > 0) {
                 Map<Integer, String> map = new HashMap<>(registrations.size());
                 Map<Integer, String> map = new HashMap<>(registrations.size());
                 registrations.forEach(e -> {
                 registrations.forEach(e -> {
@@ -1363,7 +1363,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
             }
         }
         }
         //将学生退团
         //将学生退团
-        if (studentRegistrationService.quitAllStudent(musicGroup.getId(), "退团(乐团关闭)") <= 0) {
+        if (registrations.size() > 0 && studentRegistrationService.quitAllStudent(musicGroup.getId(), "退团(乐团关闭)") <= 0) {
             throw new BizException("处理学生退团失败,请重试");
             throw new BizException("处理学生退团失败,请重试");
         }
         }
         //记录建团日志
         //记录建团日志
@@ -2975,7 +2975,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         courseScheduleDao.logicDeleteCourseSchedulesByMusicGroupID(musicGroup.getId());
         courseScheduleDao.logicDeleteCourseSchedulesByMusicGroupID(musicGroup.getId());
 
 
         //将学生退团
         //将学生退团
-        if (studentRegistrationService.quitAllStudent(musicGroup.getId(), "退团(乐团关闭)") <= 0) {
+        List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroup.getId(), null);
+        if (registrations.size() > 0 && studentRegistrationService.quitAllStudent(musicGroup.getId(), "退团(乐团关闭)") <= 0) {
             throw new BizException("处理学生退团失败,请重试");
             throw new BizException("处理学生退团失败,请重试");
         }
         }