瀏覽代碼

修改进行中乐团插入学生缴费,回调处理

周箭河 5 年之前
父節點
當前提交
046566be6e

+ 13 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dto.TeacherClassStudentDto;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
@@ -132,38 +133,39 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      *
      * @param musicGroupId
      * @param userId
+     * @param type
      * @return
      */
-    List<ClassGroupStudentMapper> findHighClassGroupHasUser(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
+    List<ClassGroupStudentMapper> findHighClassGroupHasUser(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("type") ClassGroupTypeEnum type);
 
     /**
-     * @describe 获取学生在指定日期对应状态的班级编号
-     * @author Joburgess
-     * @date 2019/11/20
      * @param userId: 用户编号
-     * @param date: 日期
+     * @param date:   日期
      * @param status: 状态
      * @return java.util.List<java.lang.Integer>
+     * @describe 获取学生在指定日期对应状态的班级编号
+     * @author Joburgess
+     * @date 2019/11/20
      */
     List<Integer> findClassGroupIdByUserAndCourseDateAndStatus(@Param("userId") Integer userId,
-                                                               @Param("data")Date date,
+                                                               @Param("data") Date date,
                                                                @Param("status") String status);
 
     /**
+     * @param classGroupIds: 班级编号列表
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.Integer>>
      * @describe 统计班级学生人数
      * @author Joburgess
      * @date 2019/11/21
-     * @param classGroupIds: 班级编号列表
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
      */
-    List<Map<Integer,Integer>> countClassGroupsStudentNum(@Param("classGroupIds") List<Integer> classGroupIds);
+    List<Map<Integer, Integer>> countClassGroupsStudentNum(@Param("classGroupIds") List<Integer> classGroupIds);
 
     /**
+     * @param classGroupId: 班级编号
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.Integer>>
      * @describe 统计班级学生人数
      * @author Joburgess
      * @date 2019/11/21
-     * @param classGroupId: 班级编号
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
      */
     Integer countClassGroupStudentNum(@Param("classGroupId") Integer classGroupId);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -14,6 +14,7 @@ import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -340,4 +341,12 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @return
      */
     Boolean checkSetSalary(String musicGroupId);
+
+    /**
+     * 根据classGroupIds获取班级列表
+     * @param classGroupIds
+     * @return
+     */
+    List<ClassGroup> findByClassGroupIds(List<Integer> classGroupIds);
+
 }

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

@@ -1779,4 +1779,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
         return false;
     }
+
+    @Override
+    public List<ClassGroup> findByClassGroupIds(List<Integer> classGroupIds) {
+        return classGroupDao.findByClassGroupIds(classGroupIds);
+    }
 }

+ 9 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -68,7 +68,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         //3、删除学生对应班级的课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
-        if(courseScheduleList.size() > 0 ) {
+        if (courseScheduleList.size() > 0) {
             courseScheduleStudentPaymentService.deleteStudentCourseSchedule(userId, courseScheduleList);
         }
 
@@ -122,7 +122,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             courseScheduleStudentPayment.setUpdateTime(date);
             courseScheduleStudentPayments.add(courseScheduleStudentPayment);
         }
-        if(courseScheduleStudentPayments.size() ==0){
+        if (courseScheduleStudentPayments.size() == 0) {
             return true;
         }
 
@@ -147,6 +147,12 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
 
         for (String userIdStr : userIdStrSet) {
+            List<ClassGroupStudentMapper> highClassGroupHasUser = classGroupStudentMapperDao.findHighClassGroupHasUser(classGroup.getMusicGroupId(), Integer.parseInt(userIdStr), classGroup.getType());
+            if (highClassGroupHasUser != null && highClassGroupHasUser.size() >= 0) {
+                userIdStrSet.remove(userIdStr);
+                continue;
+            }
+
             ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
             classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
             classGroupStudentMapper.setClassGroupId(classGroupId);
@@ -161,7 +167,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
                 studentRegistrationService.update(studentRegistration);
             }
             //班级在合奏班中
-            if(classGroupRelation != null){
+            if (classGroupRelation != null) {
                 classGroupStudentMapper = new ClassGroupStudentMapper();
                 classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
                 classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -175,7 +175,10 @@
     <select id="findHighClassGroupHasUser" resultMap="ClassGroupStudentMapper">
         SELECT cgsm.* FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
-        WHERE cgsm.music_group_id_ = #{musicGroupId} AND cgsm.user_id_=#{userId} AND cg.type_ ='HIGH' AND cgsm.status_='NORMAL'
+        WHERE cgsm.music_group_id_ = #{musicGroupId}
+        AND cgsm.user_id_=#{userId}
+        AND cg.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        AND cgsm.status_='NORMAL'
     </select>
     <select id="findClassGroupIdByUserAndCourseDateAndStatus" resultType="int">
         SELECT

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/ClassGroupController.java

@@ -75,7 +75,7 @@ public class ClassGroupController extends BaseController {
         }
         Map<String, Object> classGroupAndStatusMap = new HashMap<>();
         List<HighClassGroupDto> highClassGroups = classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId());
-        List<ClassGroupStudentMapper> ClassGroupStudentMapper = classGroupStudentMapperDao.findHighClassGroupHasUser(musicGroupId, userId);
+        List<ClassGroupStudentMapper> ClassGroupStudentMapper = classGroupStudentMapperDao.findHighClassGroupHasUser(musicGroupId, userId,ClassGroupTypeEnum.HIGH);
         classGroupAndStatusMap.put("highClassGroups", highClassGroups);
         classGroupAndStatusMap.put("hasReg", false);
         if (ClassGroupStudentMapper.size() > 0) {