瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 年之前
父節點
當前提交
87490f4f09

+ 18 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
@@ -101,7 +102,7 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      * @param classGroupId
      * @return
      */
-    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId,@Param("status") String status);
+    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId, @Param("status") String status);
 
     /**
      * @param classGroupIds: 班级编号列表
@@ -172,33 +173,42 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     Integer countClassGroupStudentNum(@Param("classGroupId") Integer classGroupId);
 
     /**
+     * @param classGroupId: 班级编号
+     * @param userIds:      学生编号
+     * @return java.lang.Integer
      * @describe 统计指定班级的重复人数
      * @author Joburgess
      * @date 2019/11/22
-     * @param classGroupId: 班级编号
-     * @param userIds: 学生编号
-     * @return java.lang.Integer
      */
     Integer countClassGroupExitStudentNum(@Param("classGroupId") Integer classGroupId,
                                           @Param("userIds") List<Integer> userIds);
 
     /**
+     * @param userId:    用户编号
+     * @param groupType: 乐团编号
+     * @return java.lang.Integer
      * @describe 统计用户对应加入乐团/小课/试听课的数量
      * @author Joburgess
      * @date 2019/11/29
-     * @param userId: 用户编号
-     * @param groupType: 乐团编号
-     * @return java.lang.Integer
      */
     Integer countUserGroups(@Param("userId") Integer userId,
                             @Param("groupType") String groupType);
 
     /**
      * 查询学生所在的班级编号
+     *
      * @param musicGroupId
      * @param userId
      * @param groupTpye
      * @return
      */
-	List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+    List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+
+    /**
+     * 查询乐团某种类型班级的学生
+     * @param musicGroupId
+     * @param classGroupType
+     * @return
+     */
+    List<ClassGroupStudentMapper> findMusicGroupClassGroupByType(@Param("musicGroupId") String musicGroupId, @Param("classGroupType") ClassGroupTypeEnum classGroupType);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -9,6 +9,7 @@ import java.util.Set;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -228,4 +229,13 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentRegistration queryUserByPhone(String mobile);
+
+	/**
+	 * 获取没有某种班级类型的学生
+	 * @param musicGroupId
+	 * @param type
+	 * @param subjectId
+	 * @return
+	 */
+	List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId);
 }

+ 10 - 33
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -263,11 +263,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public List<HighClassGroupDto> addHighClassGroup(List<HighClassGroupDto> highClassGroupList) throws Exception {
-        MusicGroup musicGroup = musicGroupDao.get(highClassGroupList.get(0).getMusicGroupId());
+        MusicGroup musicGroup = musicGroupDao.getLocked(highClassGroupList.get(0).getMusicGroupId());
 
         int highClassGroupNum = studentRegistrationDao.findMusicGroupStudentNum(musicGroup.getId()) / 5;
-        if(highClassGroupList.size() > highClassGroupNum){
-            throw new BizException("班数不能大于"+highClassGroupNum);
+        if (highClassGroupList.size() > highClassGroupNum) {
+            throw new BizException("班数不能大于" + highClassGroupNum);
         }
 
         List<ClassGroup> classGroups = classGroupDao.findClassGroupByMusicGroupIdAndType(musicGroup.getId(), ClassGroupTypeEnum.HIGH);
@@ -832,9 +832,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
             ClassGroup classGroup = classGorupIdMap.get(teacherClassGroupDto.getClassGroupId().intValue());
 
-            teacherClassGroupDto.setSurplusClassTimes(classGroup.getTotalClassTimes()-classGroup.getCurrentClassTimes());
-            Long studentNum=classGroupStudentNumMap.get(teacherClassGroupDto.getClassGroupId().intValue());
-            teacherClassGroupDto.setStudentNum(Objects.isNull(studentNum)?0:studentNum.intValue());
+            teacherClassGroupDto.setSurplusClassTimes(classGroup.getTotalClassTimes() - classGroup.getCurrentClassTimes());
+            Long studentNum = classGroupStudentNumMap.get(teacherClassGroupDto.getClassGroupId().intValue());
+            teacherClassGroupDto.setStudentNum(Objects.isNull(studentNum) ? 0 : studentNum.intValue());
 
             String subjectIdList = teacherClassGroupDto.getSubjectIdList();
             if (StringUtils.isNotEmpty(subjectIdList)) {
@@ -1132,29 +1132,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //老师结算表
         courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
 
-        //加入合奏班
-        ClassGroupRelation classGroupRelation = new ClassGroupRelation();
-        classGroupRelation.setClassGroupId(classGroup4MixDto.getMixClassGroupId());
-        classGroupRelation.setSubClassGroupId(classGroup.getId());
-        classGroupRelation.setCreateTime(date);
-        classGroupRelationService.insert(classGroupRelation);
-
-        //6、添加学生未上合奏课课程
-        List<CourseSchedule> noStartCourses = courseScheduleDao.findNoStartCoursesByClassGroupId(classGroup4MixDto.getMixClassGroupId());
-        for (CourseSchedule noStartCourse : noStartCourses) {
-            for (StudentRegistration studentRegistration : studentList) {
-                CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
-                courseScheduleStudentPayment.setCourseScheduleId(noStartCourse.getId());
-                courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
-                courseScheduleStudentPayment.setExpectPrice(expectPrice);
-                courseScheduleStudentPayment.setCreateTime(date);
-                courseScheduleStudentPayment.setUpdateTime(date);
-                courseScheduleStudentPayment.setClassGroupId(noStartCourse.getClassGroupId());
-                courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
-                courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
-                courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
-            }
-        }
         //学生结算表
         courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
         return classGroup;
@@ -1633,15 +1610,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 e.setMixClassGroupName(classGroupNames.get(e.getMixClassGroupId()));
                 List<CourseScheduleTeacherSalary> currentBishopTeacher = courseScheduleBishopTeacherMaps.get(e.getCourseScheduleId().longValue());
                 List<CourseScheduleTeacherSalary> TeachingTeachers = new ArrayList<>();
-                if (!Objects.isNull(currentBishopTeacher)&&!CollectionUtils.isEmpty(currentBishopTeacher)) {
+                if (!Objects.isNull(currentBishopTeacher) && !CollectionUtils.isEmpty(currentBishopTeacher)) {
                     e.setMasterTeacherId(currentBishopTeacher.get(0).getUserId());
                     e.setMasterTeacherName(currentBishopTeacher.get(0).getUserName());
-                }else {
+                } else {
                     currentBishopTeacher = new ArrayList<>();
                 }
                 TeachingTeachers.addAll(currentBishopTeacher);
                 List<CourseScheduleTeacherSalary> currentCourseTeachingTeachers = courseScheduleTeachingTeacherMaps.get(e.getCourseScheduleId().longValue());
-                if(Objects.isNull(currentCourseTeachingTeachers) || CollectionUtils.isEmpty(currentCourseTeachingTeachers)){
+                if (Objects.isNull(currentCourseTeachingTeachers) || CollectionUtils.isEmpty(currentCourseTeachingTeachers)) {
                     currentCourseTeachingTeachers = new ArrayList<>();
                 }
                 TeachingTeachers.addAll(currentCourseTeachingTeachers);
@@ -1784,7 +1761,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     public Boolean checkSetSalary(String musicGroupId) {
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalary = courseScheduleTeacherSalaryDao.findCourseScheduleTeacherSalaryByMusicGroupId(musicGroupId, GroupType.MUSIC);
-        if(courseScheduleTeacherSalary != null && courseScheduleTeacherSalary.size() > 0){
+        if (courseScheduleTeacherSalary != null && courseScheduleTeacherSalary.size() > 0) {
             return true;
         }
         return false;

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -781,4 +781,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentRegistration queryUserByPhone(String mobile) {
         return studentRegistrationDao.queryUserByPhone(mobile);
     }
+
+    @Override
+    public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId) {
+        List<StudentRegistration> students = studentRegistrationDao.findMusicGroupStudent(musicGroupId, subjectId);
+        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findMusicGroupClassGroupByType(musicGroupId, type);
+        for (StudentRegistration student : students) {
+            for (ClassGroupStudentMapper classGroupStudentMapper : classGroupStudentMappers) {
+                if(classGroupStudentMapper.getUserId().equals(student.getUserId())){
+                    students.remove(student);
+                }
+            }
+        }
+        return null;
+    }
 }

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -240,4 +240,10 @@
     <select id="queryClassGroupIdList" resultType="int" parameterType="map">
       SELECT distinct class_group_id_ FROM class_group_student_mapper WHERE user_id_=#{userId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND music_group_id_ = #{musicGroupId}
     </select>
+
+    <select id="findMusicGroupClassGroupByType" 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 cg.group_type_ ='MUSIC' AND cg.type_=#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND cg.del_flag_='0' AND cgsm.status_='NORMAL'
+    </select>
 </mapper>

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

@@ -110,7 +110,7 @@
 	</delete>
 
     <delete id="batchDeleteByCourseSchedules">
-        DELETE FROM teacher_attendance WHERE id_ IN
+        DELETE FROM teacher_attendance WHERE course_schedule_id_ IN
         <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
             #{courseScheduleId}
         </foreach>

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -123,4 +124,14 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentRegistrationService.openPayment(ids));
     }
 
+    @ApiOperation(value = "获取乐团(声部)的(没有某种班级类型)学生")
+    @GetMapping("/getMusicGroupStuNoClassType")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStuNoClassType')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
+    public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+    }
+
 }