Procházet zdrojové kódy

主班有报名状态的学员不允许合并

zouxuan před 4 roky
rodič
revize
ea61ebd144

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -507,4 +507,12 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @return
      */
     Integer getPaymentStudentNum(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 查找报名中的学员
+     * @param musicGroupId
+     * @param studentIds
+     * @return
+     */
+    Integer findApplyStudent(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -4015,6 +4015,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 studentIds);
         //创建缴费项目
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
+        //主班是否有报名状态的学员
+        Integer applyStudentNum = studentRegistrationDao.findApplyStudent(musicGroup.getId(), studentIds);
+        if (applyStudentNum != null && applyStudentNum > 0) {
+            throw new BizException("操作失败: 学员{学员姓名/学员编号}在主班所属乐团中为报名状态不可合并,请将该学员退团处理后再次合并");
+        }
         //获取缴费状态在审核中或者已拒绝的缴费项目的学员
         String studentId = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroup.getId(), null);
         if (StringUtils.isNotEmpty(studentId)) {

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -959,4 +959,12 @@
     <select id="getPaymentStudentNum" resultType="int">
         SELECT COUNT(*) FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = 2 AND music_group_status_ = 'NORMAL'
     </select>
+    <select id="findApplyStudent" resultType="java.lang.Integer">
+        SELECT COUNT(id_) FROM student_registration
+        WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = 1 AND music_group_status_ = 'APPLY'
+        AND user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+    </select>
 </mapper>