Browse Source

确认成团逻辑修改

周箭河 4 years ago
parent
commit
f170068bb3

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java

@@ -377,4 +377,6 @@ public interface MusicGroupDao extends BaseDAO<String, MusicGroup> {
     List<MusicGroup> getMusicGroupByIds(@Param("ids") List<String> ids);
 
     List<String> getNoClassStudentMusicGroupIds(@Param("organIds") List<Integer> organIds);
+
+    Integer getCooperationMusicGroupNum(Integer cooperationOrganId,String musicGroupId);
 }

+ 27 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -2742,24 +2742,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         } else {
             throw new BizException("当前乐团状态不支持此操作");
         }
+        //新建团:(乐团合作单位没有进行中 、暂停、关闭 的乐团)
+        //若乐团新建团,则操作【确认开团】时,若【已缴费】学员达到98人,则无需对【未缴费】学员新增回访
+        //若乐团不是新建团,则操作【确认开团】时,若【已缴费】学员达到58人,则无需对【未缴费】学员新增回访
         //报名未交费的学生,完成回访才能到下一步
-        boolean hasNoVisit = false;
-        StringBuilder tipsMsg = new StringBuilder();
-        List<StudentRegistration> noPaymentStudents = studentRegistrationDao.getNoPaymentStudent(musicGroupId);
-        if (noPaymentStudents.size() > 0) {
-            tipsMsg.append("以下学生未完成回访,");
-            List<Integer> studentIds = noPaymentStudents.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
-            List<Integer> musicGroupVisitStudent = studentVisitDao.getMusicGroupVisitStudent(musicGroupId, studentIds);
-            for (StudentRegistration noPaymentStudent : noPaymentStudents) {
-                if (!musicGroupVisitStudent.contains(noPaymentStudent.getUserId())) {
-                    hasNoVisit = true;
-                    tipsMsg.append(noPaymentStudent.getName()).append("(").append(noPaymentStudent.getUserId()).append(")、");
-                }
-            }
-        }
-        if (hasNoVisit) {
-            throw new BizException(tipsMsg.append("请完成回访").toString());
-        }
+
+        //获取乐团合作单位乐团数量
+        musicGroupDao.getCooperationMusicGroupNum(musicGroup.getCooperationOrganId(),musicGroupId);
+        checkStudentVisit(musicGroupId);
 
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, event, sysUser.getId(), ""));
         musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
@@ -2788,6 +2778,26 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         sysMessageService.batchSeoMessage(integers, MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_MARKING, "", musicGroup.getName());
     }
 
+    private void checkStudentVisit(String musicGroupId){
+        boolean hasNoVisit = false;
+        StringBuilder tipsMsg = new StringBuilder();
+        List<StudentRegistration> noPaymentStudents = studentRegistrationDao.getNoPaymentStudent(musicGroupId);
+        if (noPaymentStudents.size() > 0) {
+            tipsMsg.append("以下学生未完成回访,");
+            List<Integer> studentIds = noPaymentStudents.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
+            List<Integer> musicGroupVisitStudent = studentVisitDao.getMusicGroupVisitStudent(musicGroupId, studentIds);
+            for (StudentRegistration noPaymentStudent : noPaymentStudents) {
+                if (!musicGroupVisitStudent.contains(noPaymentStudent.getUserId())) {
+                    hasNoVisit = true;
+                    tipsMsg.append(noPaymentStudent.getName()).append("(").append(noPaymentStudent.getUserId()).append(")、");
+                }
+            }
+        }
+        if (hasNoVisit) {
+            throw new BizException(tipsMsg.append("请完成回访").toString());
+        }
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public List<StudentRegistration> addMusicGroupRegs(String musicGroupId, List<Long> registerIds) throws Exception {