浏览代码

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

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
#	mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
#	mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
zouxuan 5 年之前
父节点
当前提交
b94eb1b15b
共有 37 个文件被更改,包括 789 次插入399 次删除
  1. 92 55
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 11 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 92 82
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  4. 7 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupAdjustDto.java
  5. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  6. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TeacherLeaveRecord.java
  7. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  8. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  9. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  10. 18 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TeacherLeaveRecordService.java
  11. 14 3
      mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java
  12. 44 39
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  13. 17 57
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  14. 30 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  15. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  16. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  17. 72 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherLeaveRecordServiceImpl.java
  18. 127 75
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  19. 1 1
      mec-biz/src/main/resources/config/contracts/courses.ftl
  20. 30 5
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  21. 7 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  22. 2 2
      mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml
  23. 4 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  24. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  25. 22 9
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  26. 5 0
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  27. 6 1
      mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java
  28. 1 1
      mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java
  29. 7 14
      mec-student/src/main/java/com/ym/mec/student/controller/CourseController.java
  30. 10 3
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  31. 5 0
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  32. 4 1
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java
  33. 58 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherLeaveRecordController.java
  34. 2 2
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/union/UnionPay.java
  35. 15 24
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java
  36. 10 1
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  37. 17 6
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

+ 92 - 55
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1,18 +1,20 @@
 package com.ym.mec.biz.dal.dao;
 
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
 
 public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
@@ -25,13 +27,13 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     TeacherAttendanceDto getCurrentCourseDetail(@Param("courseID") Long courseID);
 
     /**
-     * @describe 根据时间区间获取教师上课的课程
-     * @author Joburgess
-     * @date 2019/10/18
      * @param startTime:
      * @param endTime:
      * @param teacherId:
      * @return com.ym.mec.biz.dal.dto.TeacherAttendanceDto
+     * @describe 根据时间区间获取教师上课的课程
+     * @author Joburgess
+     * @date 2019/10/18
      */
     TeacherAttendanceDto getTeacherCourseByDateSpeed(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("teacherId") Long teacherId);
 
@@ -45,6 +47,15 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     Integer[] countStudentInClass(List<Integer> classGroupIDs);
 
     /**
+     * @describe 根据课程编号列表获取课程列表
+     * @author Joburgess
+     * @date 2019/10/22
+     * @param courseScheduleIds: 课程编号列表
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
+     */
+    List<CourseSchedule> findByCourseScheduleIds(List<Long> courseScheduleIds);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/9/17
      * 根据日期获取当日排课信息
@@ -52,10 +63,10 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<CourseScheduleDto> getCourseSchedulesWithDate(@Param("classDate") Date classDate);
 
     /**
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
      * @Author: Joburgess
      * @Date: 2019/10/14
      * @params [classDates, classGroupId]
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
      * @describe 根据班级和上课日期获取课程计划
      */
     List<CourseSchedule> findByClassGroupAndDate(@Param("classDates") List<Date> classDates, @Param("classGroupId") Long classGroupId);
@@ -68,82 +79,82 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<CourseScheduleDto> getStudentCourseSchedulesWithDate(@Param("classDate") Date classDate, @Param("studentId") Long studentId);
 
     /**
+     * @return java.util.List<java.lang.String>
      * @Author: Joburgess
      * @Date: 2019/10/11
      * @params [courseScheduleId]
-     * @return java.util.List<java.lang.String>
      * @describe 获取课程签到学生姓名
      */
     List<String> findStudentNamesByCourseSchedule(Long courseScheduleId);
 
     /**
-     * @describe 根据日期获取老师当日排课信息
-     * @author Joburgess
-     * @date 2019/10/18
      * @param classDate: 上课日期
      * @param teacherId: 教师编号
      * @return java.util.List<com.ym.mec.biz.dal.dto.CourseScheduleDto>
+     * @describe 根据日期获取老师当日排课信息
+     * @author Joburgess
+     * @date 2019/10/18
      */
     List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(@Param("classDate") Date classDate, @Param("teacherId") Long teacherId);
 
     /**
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.CourseScheduleDto>
      * @describe 根据日期获取排课
      * @author Joburgess
      * @date 2019/10/18
-     * @param params:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.CourseScheduleDto>
      */
     List<CourseScheduleDto> getCourseSchedulesWithDate(Map<String, Object> params);
 
     int countCourseSchedulesWithDate(Map<String, Object> params);
 
     /**
+     * @param musicGroupID: 乐团编号
+     * @return int
      * @describe 根据乐团ID删除排课
      * @author Joburgess
      * @date 2019/10/18
-     * @param musicGroupID: 乐团编号
-     * @return int
      */
     int deleteCourseSchedulesByMusicGroupID(@Param("musicGroupID") Long musicGroupID);
 
     /**
+     * @param musicGroupID: 乐团编号
+     * @param month:        月份
+     * @return java.util.List<java.util.Date>
      * @describe 根据月份获取乐团在该月有课的日期
      * @author Joburgess
      * @date 2019/10/18
-     * @param musicGroupID: 乐团编号
-     * @param month: 月份
-     * @return java.util.List<java.util.Date>
      */
     List<Date> getCourseScheduleDateByMonth(@Param("musicGroupID") Long musicGroupID, @Param("month") Date month);
 
     /**
-     * @describe 获取学生有课日期
-     * @author Joburgess
-     * @date 2019/10/18
      * @param studentId:
      * @param month:
      * @param isAttend:
      * @return java.util.List<java.util.Date>
+     * @describe 获取学生有课日期
+     * @author Joburgess
+     * @date 2019/10/18
      */
     List<Date> getStudentCourseScheduleDate(@Param("studentId") Long studentId, @Param("month") Date month, @Param("isAttend") Integer isAttend);
 
     /**
-     * @describe 获取教师有课日期
-     * @author Joburgess
-     * @date 2019/10/18
      * @param teacherId:
      * @param month:
      * @return java.util.List<java.util.Date>
+     * @describe 获取教师有课日期
+     * @author Joburgess
+     * @date 2019/10/18
      */
     List<Date> getTeacherCourseScheduleDate(@Param("teacherId") Long teacherId, @Param("month") Date month);
 
     /**
-     * @describe 获取当月有课的日期
-     * @author Joburgess
-     * @date 2019/10/18
      * @param month:
      * @param organId:
      * @return java.util.List<java.util.Date>
+     * @describe 获取当月有课的日期
+     * @author Joburgess
+     * @date 2019/10/18
      */
     List<Date> getCourseScheduleDate(@Param("month") Date month, @Param("organId") Long organId);
 
@@ -192,6 +203,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     /**
      * 获取班级未开始的课程计划
+     *
      * @param classGroupTeacherMapperList
      * @return
      */
@@ -219,10 +231,10 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<StudentCourseScheduleRecordDto> findStudentCourseScheduleNotStartRecords(@Param("userId") Long userId, @Param("date") Date date);
 
     /**
+     * @return int
      * @Author: Joburgess
      * @Date: 2019/10/8
      * @params [classGroupId]
-     * @return int
      * @describe 统计已上课次
      */
     int countClassTimes(Long classGroupId);
@@ -235,104 +247,129 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     CourseScheduleDto getCourseSchedules(@Param("courseScheduleId") Long courseScheduleId);
 
     /**
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
      * @Author: Joburgess
      * @Date: 2019/10/14
      * @params [vipGroupId]
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
      * @describe 获取vip课排课计划
      */
     List<CourseSchedule> findVipGroupCourseSchedules(@Param("vipGroupId") Long vipGroupId);
 
     /**
+     * @return java.lang.String
      * @Author: Joburgess
      * @Date: 2019/10/16
      * @params [courseScheduleId]
-     * @return java.lang.String
      * @describe 获取课程关联班级类型
      */
     String findClassTypeByCourse(@Param("courseScheduleId") Long courseScheduleId);
 
     /**
      * 根据课程状态查询老师指定月份的VIP课程记录数
+     *
      * @param monthDate 指定月份
-     * @param status 课程状态
+     * @param status    课程状态
      * @return
      */
-    List<Map<Integer, Integer>> queryVipGroupTeachereClassTimesByMonth(@Param("monthDate") Date monthDate,@Param("status") CourseStatusEnum status);
+    List<Map<Integer, Integer>> queryVipGroupTeachereClassTimesByMonth(@Param("monthDate") Date monthDate, @Param("status") CourseStatusEnum status);
 
     /**
      * 查询已完成未更新状态的课程列表
+     *
      * @return
      */
     List<CourseSchedule> queryFinishedWithNoUpdateStatus();
-    
+
     int batchUpdate(List<CourseSchedule> courseScheduleList);
-    
+
     /**
      * 查询提前指定分钟数还未签到的用户
+     *
      * @param minutes 分钟数
      * @return
      */
     List<CourseSchedule> queryNoSignInListByBeforeMinutes(Integer minutes);
 
     /**
+     * @param params: 参数
+     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto>
      * @describe 查询老师指定班级的排课信息
      * @author Joburgess
      * @date 2019/10/18
-     * @param params: 参数
-     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto>
      */
-    List<TeacherClassCourseSchudeleDto> queryTeacherClassCourseSchedule(Map<String,Object> params);
+    List<TeacherClassCourseSchudeleDto> queryTeacherClassCourseSchedule(Map<String, Object> params);
 
     /**
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto>
      * @describe 查询老师指定班级历史排课信息
      * @author Joburgess
      * @date 2019/10/19
-     * @param params:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto>
      */
-    List<TeacherClassCourseSchudeleDto> queryTeacherHistoryClassCourseSchedule(Map<String,Object> params);
+    List<TeacherClassCourseSchudeleDto> queryTeacherHistoryClassCourseSchedule(Map<String, Object> params);
 
     /**
+     * @param params: 参数
+     * @return int
      * @describe 统计老师指定班级的排课数量
      * @author Joburgess
      * @date 2019/10/18
-     * @param params: 参数
-     * @return int
      */
-    int countTeacherClassCourseSchedule(Map<String,Object> params);
+    int countTeacherClassCourseSchedule(Map<String, Object> params);
 
     /**
+     * @param params:
+     * @return int
      * @describe 统计历史老师指定班级的排课数量
      * @author Joburgess
      * @date 2019/10/19
-     * @param params:
-     * @return int
      */
-    int countTeacherHistoryClassCourseSchedule(Map<String,Object> params);
+    int countTeacherHistoryClassCourseSchedule(Map<String, Object> params);
 
     /**
+     * @param musicGroupId: 乐团编号
+     * @return java.util.List<java.util.Map < java.lang.Long, java.lang.Integer>>
      * @describe 统计乐团下班级的排课数
      * @author Joburgess
      * @date 2019/10/18
-     * @param musicGroupId: 乐团编号
-     * @return java.util.List<java.util.Map<java.lang.Long,java.lang.Integer>>
      */
-    List<Map<Integer,Long>> countClassCourseNumByMusicGroup(String musicGroupId);
+    List<Map<Integer, Long>> countClassCourseNumByMusicGroup(String musicGroupId);
 
     /**
+     * @param courseSchedules: 课程计划编号列表
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.Integer>>
      * @describe 根据课程计划获取对应课次
      * @author Joburgess
      * @date 2019/10/20
-     * @param courseSchedules: 课程计划编号列表
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
      */
-    List<Map<Integer,Integer>> findCourseScheduleCurrentTimes(List<Integer> courseSchedules);
+    List<Map<Integer, Integer>> findCourseScheduleCurrentTimes(List<Integer> courseSchedules);
 
     /**
      * 根据乐团编号修改课程教学点
+     *
      * @param musicGroupId
      * @param schoolId
      */
-    void updateByMusicGroupId(@Param("musicGroupId") String musicGroupId,@Param("schoolId") Integer schoolId);
+    void updateByMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("schoolId") Integer schoolId);
+
+    /**
+     * 获取班级时间段内的课程
+     *
+     * @param classGroupId
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    List<CourseSchedule> findCourseScheduleByClassGroupIdAndDate(@Param("classGroupId") Integer classGroupId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
+    
+    /**
+     * 根据时间范围查询老师指定类型的课程列表
+     * @param teacherId 老师编号
+     * @param type 课程类型 (如果为null,查询所有类型)
+     * @param startTime 开始时间
+     * @param endTime 结束时间
+     * @return
+     */
+	List<CourseSchedule> queryTeacherCourseScheduleListByTimeRangeAndType(@Param("teacherId") Integer teacherId, @Param("type") CourseScheduleType type,
+			@Param("startTime") Date startTime, @Param("endTime") Date endTime);
 }

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
@@ -9,21 +10,28 @@ import java.util.List;
 public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseScheduleStudentPayment> {
 
     /**
+     * @return int
      * @Author: Joburgess
      * @Date: 2019/10/10
      * @params [courseScheduleStudentPayments]
-     * @return int
      * @describe 批量插入
      */
     int batchInsert(List<CourseScheduleStudentPayment> courseScheduleStudentPayments);
 
     /**
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      * @Author: Joburgess
      * @Date: 2019/10/15
      * @params [ids]
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      * @describe 根据课程编号批量获取学生缴费信息
      */
     List<CourseScheduleStudentPayment> findByCourseScheduleIds(@Param("ids") List<Long> ids);
-	
+
+    /**
+     * 删除学生对应的课程
+     * @param userId
+     * @param courseScheduleList
+     * @return
+     */
+    int deleteStudentCourseSchedule(@Param("userId") Integer userId, @Param("courseScheduleList") List<CourseSchedule> courseScheduleList);
 }

+ 92 - 82
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -15,21 +15,21 @@ import java.util.Map;
 
 public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistration> {
 
-	/**
-	 * 获取乐团学员报名详情
-	 *
-	 * @param params
-	 * @return
-	 */
-	List<StudentApplyDetailDto> queryStudentDetailPage(Map<String, Object> params);
-
-	/**
-	 * 获取乐团学员报名详情条数
-	 *
-	 * @param params
-	 * @return
-	 */
-	int queryStudentDetailCount(Map<String, Object> params);
+    /**
+     * 获取乐团学员报名详情
+     *
+     * @param params
+     * @return
+     */
+    List<StudentApplyDetailDto> queryStudentDetailPage(Map<String, Object> params);
+
+    /**
+     * 获取乐团学员报名详情条数
+     *
+     * @param params
+     * @return
+     */
+    int queryStudentDetailCount(Map<String, Object> params);
 
 	/**
 	 * 根据乐团编号和声部获取缴费学员人数
@@ -48,73 +48,83 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 	 */
 	StudentFeeDetailDto queryFeeDetail(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
 
-	/**
-	 * 获取乐团声部未分配的班级的学生
-	 *
-	 * @param musicGroupId    乐团id
-	 * @param actualSubjectId 科目id
-	 * @return
-	 */
-	List<StudentRegistration> getNoClassStuBySubjectId(@Param("musicGroupId") String musicGroupId, @Param("actualSubjectId") String actualSubjectId);
-
-	/**
-	 * 获取乐团声部未分配学生数
-	 *
-	 * @param musicGroupId
-	 * @return
-	 */
-	List<Map<Integer, Long>> getNoClassStuCountBySubjectId(@Param("musicGroupId") String musicGroupId);
-
-	/**
-	 * 根据乐团id和user_id 更新
-	 *
-	 * @param studentRegistration
-	 * @return
-	 */
-	Integer updateByUserIdAndMusicGroupId(@Param("studentRegistration") StudentRegistration studentRegistration);
-
-	/**
-	 * 查询学生信息
-	 *
-	 * @param userId
-	 * @return
-	 */
-	StudentInfo queryStudentInfo(Integer userId);
-
-	/**
-	 * 查询用户指定乐团的报名信息
-	 *
-	 * @param userId       用户编号
-	 * @param musicGroupId 乐团编号
-	 * @return
-	 */
-	StudentRegistration queryByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
-
-
-	/**
-	 * 查询手机是否已注册
-	 *
-	 * @param musicGroupId
-	 * @param parentsPhone
-	 * @return
-	 */
-	StudentRegistration getByPhoneAndMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("parentsPhone") String parentsPhone);
-
-	/**
-	 * 查询用户是否存在
-	 *
-	 * @param phone
-	 * @return
-	 */
-	SysUser getSysUserByPhone(String phone);
-
-	/**
-	 * 获取班级学生
-	 * @param musicGroupId
-	 * @param classGroupId
-	 * @return
-	 */
-	List<StudentRegistration> findClassGroupStu(@Param("musicGroupId") String musicGroupId, @Param("classGroupId") Integer classGroupId);
+    /**
+     * 获取乐团声部未分配的班级的学生
+     *
+     * @param musicGroupId    乐团id
+     * @param actualSubjectId 科目id
+     * @return
+     */
+    List<StudentRegistration> getNoClassStuBySubjectId(@Param("musicGroupId") String musicGroupId, @Param("actualSubjectId") String actualSubjectId);
+
+    /**
+     * 获取乐团声部未分配学生数
+     *
+     * @param musicGroupId
+     * @return
+     */
+    List<Map<Integer, Long>> getNoClassStuCountBySubjectId(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 根据乐团id和user_id 更新
+     *
+     * @param studentRegistration
+     * @return
+     */
+    Integer updateByUserIdAndMusicGroupId(@Param("studentRegistration") StudentRegistration studentRegistration);
+
+    /**
+     * 查询学生信息
+     *
+     * @param userId
+     * @return
+     */
+    StudentInfo queryStudentInfo(Integer userId);
+
+    /**
+     * 查询用户指定乐团的报名信息
+     *
+     * @param userId       用户编号
+     * @param musicGroupId 乐团编号
+     * @return
+     */
+    StudentRegistration queryByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+
+
+    /**
+     * 查询手机是否已注册
+     *
+     * @param musicGroupId
+     * @param parentsPhone
+     * @return
+     */
+    StudentRegistration getByPhoneAndMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("parentsPhone") String parentsPhone);
+
+    /**
+     * 查询用户是否存在
+     *
+     * @param phone
+     * @return
+     */
+    SysUser getSysUserByPhone(String phone);
+
+    /**
+     * 获取班级学生
+     *
+     * @param musicGroupId
+     * @param classGroupId
+     * @return
+     */
+    List<StudentRegistration> findClassGroupStu(@Param("musicGroupId") String musicGroupId, @Param("classGroupId") Integer classGroupId);
+
+    /**
+     * 查询乐团的学生
+     *
+     * @param musicGroupId
+     * @param actualSubjectId
+     * @return
+     */
+    List<StudentRegistration> findMusicGroupStudent(@Param("musicGroupId") String musicGroupId, @Param("actualSubjectId") Integer actualSubjectId);
 
 	/**
 	 * 批量调剂学生专业

+ 7 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupAdjustDto.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -29,10 +30,10 @@ public class ClassGroupAdjustDto {
     private YesOrNoEnum type;
 
     @ApiModelProperty(value = "开始时间", required = true)
-    private LocalDateTime startDate;
+    private Date startDate;
 
     @ApiModelProperty(value = "结束时间", required = true)
-    private LocalDateTime endDate;
+    private Date endDate;
 
     public String getClassGroupName() {
         return classGroupName;
@@ -50,19 +51,19 @@ public class ClassGroupAdjustDto {
         this.type = type;
     }
 
-    public LocalDateTime getStartDate() {
+    public Date getStartDate() {
         return startDate;
     }
 
-    public void setStartDate(LocalDateTime startDate) {
+    public void setStartDate(Date startDate) {
         this.startDate = startDate;
     }
 
-    public LocalDateTime getEndDate() {
+    public Date getEndDate() {
         return endDate;
     }
 
-    public void setEndDate(LocalDateTime endDate) {
+    public void setEndDate(Date endDate) {
         this.endDate = endDate;
     }
 

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 
 import io.swagger.annotations.ApiModelProperty;
@@ -58,6 +59,9 @@ public class MusicGroup {
 	
 	@ApiModelProperty(value = "课程形态",required = false)
 	private String courseForm;
+
+	@ApiModelProperty(value = "老师课酬结算方式",required = false)
+	private SalarySettlementTypeEnum settlementType;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -344,6 +348,14 @@ public class MusicGroup {
 		this.operatorUserId = operatorUserId;
 	}
 
+	public SalarySettlementTypeEnum getSettlementType() {
+		return settlementType;
+	}
+
+	public void setSettlementType(SalarySettlementTypeEnum settlementType) {
+		this.settlementType = settlementType;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TeacherLeaveRecord.java

@@ -168,4 +168,27 @@ public class TeacherLeaveRecord {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+
+	public class CoursesScheduleHistory{
+	
+	private CourseSchedule before;
+	
+	private CourseSchedule after;
+
+	public CourseSchedule getBefore() {
+		return before;
+	}
+
+	public void setBefore(CourseSchedule before) {
+		this.before = before;
+	}
+
+	public CourseSchedule getAfter() {
+		return after;
+	}
+
+	public void setAfter(CourseSchedule after) {
+		this.after = after;
+	}
+}
 }

+ 1 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -1,6 +1,5 @@
 package com.ym.mec.biz.service;
 
-import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
@@ -112,7 +111,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
      * @Date: 2019/9/23
      * 课时调整
      */
-    void classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto);
+    void classStartDateAdjust(List<CourseSchedule> newCourseSchedules);
 
     /**
      * @Author: Joburgess

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

@@ -149,4 +149,13 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 */
 	StudentPaymentOrder updateApplyOrder(StudentPaymentOrder studentPaymentOrder);
 
+	/**
+	 * 获取乐团科目的学生
+	 *
+	 * @param musicGroupId    乐团id
+	 * @param actualSubjectId 科目id
+	 * @return
+	 */
+	List<StudentRegistration> getMusicGroupStu(String musicGroupId, Integer actualSubjectId);
+
 }

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

@@ -76,6 +76,11 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
 	public static final String SIGN_OUT_MESSAGE_PUSH_MINUTE = "sign_out_message_push_minute";
 
 	/**
+	 * 教师课酬结算单位时长
+	 */
+	String TEACHER_SALARY_TIME_UNIT="teacher_salary_time_unit";
+
+	/**
 	 * @params paramName
 	 * @return com.ym.mec.biz.dal.entity.SysConfig
 	 * @describe 根据配置名称获取配置信息

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherLeaveRecordService.java

@@ -1,8 +1,26 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.common.service.BaseService;
 
 public interface TeacherLeaveRecordService extends BaseService<Long, TeacherLeaveRecord> {
 
+	/**
+	 * 请假
+	 * @param userId
+	 * @param teacherLeaveRecord
+	 * @return
+	 */
+	public boolean askForLeave(Integer userId, TeacherLeaveRecord teacherLeaveRecord);
+
+	/**
+	 * 审批
+	 * @param id 记录编号
+	 * @param userId 审批人编号
+	 * @param status 审批状态
+	 * @param remark 备注
+	 * @return
+	 */
+	public boolean approve(Long id, Integer userId, AuditStatusEnum status, String remark);
 }

+ 14 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -2,8 +2,9 @@ package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -24,6 +25,16 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
     void createVipGroup(VipGroupApplyDto vipGroup);
 
     /**
+     * @describe vip课程审核
+     * @author Joburgess
+     * @date 2019/10/22
+     * @param vipGroupId: vip课编号
+     * @param auditStatus: 审核状态
+     * @return void
+     */
+    void vipApplyAudit(Long vipGroupId,AuditStatusEnum auditStatus,String reason);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/10/3
      * @params [queryInfo]
@@ -139,7 +150,7 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      * @return void
      * @describe 支付回调接口
      */
-    void orderCallback(String callbackParams);
+    void orderCallback(StudentPaymentOrder order);
 
     /**
 	 * @Author: Joburgess
@@ -157,7 +168,7 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      * @return void
      * @describe 退课申请审核
      */
-    void applyRefundAudit(StudentApplyRefunds studentApplyRefunds);
+    void applyRefundAudit(Long id,AuditStatusEnum status,String remark);
 
     /**
      * @Author: Joburgess

+ 44 - 39
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -71,6 +71,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -189,18 +191,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public List<HighClassGroupDto> addHighClassGroup(List<HighClassGroupDto> highClassGroupList) throws Exception {
-    	
-    	Integer schoolId = null;
-    	
+
+        Integer schoolId = null;
+
         for (HighClassGroupDto highClassGroup : highClassGroupList) {
-        	
-			if (schoolId == null) {
-				MusicGroup musicGroup = musicGroupDao.get(highClassGroup.getMusicGroupId());
-				if (musicGroup != null) {
-					schoolId = musicGroup.getSchoolId();
-				}
-			}
-        	
+
+            if (schoolId == null) {
+                MusicGroup musicGroup = musicGroupDao.get(highClassGroup.getMusicGroupId());
+                if (musicGroup != null) {
+                    schoolId = musicGroup.getSchoolId();
+                }
+            }
+
             //1、插入班级信息
             Date date;
             date = new Date();
@@ -233,8 +235,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     CourseSchedule courseSchedule = new CourseSchedule();
                     Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
                     Date classDate = Date.from(instant);
-                    String startClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getStartClassTime()+":00";
-                    String endClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getEndClassTime()+":00";
+                    String startClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getStartClassTime() + ":00";
+                    String endClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getEndClassTime() + ":00";
 
                     courseSchedule.setSchoolId(schoolId);
                     courseSchedule.setClassGroupId(highClassGroup.getId());
@@ -249,7 +251,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
                     courseSchedule.setType(CourseSchedule.CourseScheduleType.HIGH);
                     Subject subject = subjectService.get(Integer.parseInt(highClassGroup.getSubjectIdList()));
-                    courseSchedule.setName(subject.getName()+"-"+CourseSchedule.CourseScheduleType.HIGH.getMsg());
+                    courseSchedule.setName(subject.getName() + "-" + CourseSchedule.CourseScheduleType.HIGH.getMsg());
 
                     courseScheduleList.add(courseSchedule);
                     times++;
@@ -275,11 +277,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = classGroupDao.queryGroupCourses(params);
-            HashMap<String,Object> param = new HashMap<>();
-            param.put("teacherId",queryInfo.getSearch());
-            param.put("attendanceStatus",YesOrNoEnum.YES);
-            dataList.forEach(e->{
-                param.put("musicGroupId",e.getMusicGroupId());
+            HashMap<String, Object> param = new HashMap<>();
+            param.put("teacherId", queryInfo.getSearch());
+            param.put("attendanceStatus", YesOrNoEnum.YES);
+            dataList.forEach(e -> {
+                param.put("musicGroupId", e.getMusicGroupId());
                 e.setAttendanceNum(teacherAttendanceDao.getTeacherPersonalAttendancesCount(param));
             });
         }
@@ -302,24 +304,24 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             params.put("offset", pageInfo.getOffset());
             dataList = vipGroupDao.getTeacherVipClass(params);
             Set<Integer> activityIds = dataList.stream().map(e -> e.getActivityId()).collect(Collectors.toSet());
-            List<Map<Integer,String>> names = vipGroupActivityDao.queryNamesById(StringUtils.join(activityIds,","));
-            Map<Integer,String> nameMap = MapUtil.convertMybatisMap(names);
+            List<Map<Integer, String>> names = vipGroupActivityDao.queryNamesById(StringUtils.join(activityIds, ","));
+            Map<Integer, String> nameMap = MapUtil.convertMybatisMap(names);
             //计算月度平均消耗值(已上课时 / 消耗月份)
             List<Long> vipGroupIds = dataList.stream().map(vipGroup -> vipGroup.getVipClassId()).collect(Collectors.toList());
             List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(vipGroupIds);
-            Map<Long,Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
+            Map<Long, Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
             dataList.forEach(vipGroup -> {
                 Integer overCourses = vipGroupOverCourseMaps.get(vipGroup.getVipClassId());
-                if(Objects.isNull(overCourses)){
-                    overCourses=0;
+                if (Objects.isNull(overCourses)) {
+                    overCourses = 0;
                 }
-                Integer totalClassTimes=vipGroup.getTotalClassTimes();
-                if(Objects.isNull(totalClassTimes)){
+                Integer totalClassTimes = vipGroup.getTotalClassTimes();
+                if (Objects.isNull(totalClassTimes)) {
                     vipGroup.setMonthAvg(Float.parseFloat("0.0"));
-                }else{
-                    BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
+                } else {
+                    BigDecimal overCoursesOfMonth = new BigDecimal(overCourses), allClassTimes = new BigDecimal(totalClassTimes);
 
-                    Float monthConsumeRate=overCoursesOfMonth.divide(overCoursesOfMonth,2,BigDecimal.ROUND_HALF_UP).floatValue();
+                    Float monthConsumeRate = overCoursesOfMonth.divide(overCoursesOfMonth, 2, BigDecimal.ROUND_HALF_UP).floatValue();
                     vipGroup.setMonthAvg(monthConsumeRate);
                 }
             });
@@ -333,8 +335,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId,String type) {
-        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId,type);
+    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId, String type) {
+        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId, type);
 
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupTeacherMapperService.findClassGroupTeachers(classGroupAndTeachersList);
 
@@ -580,7 +582,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Map<Long, Integer> musicGroupIdAndNum = MapUtil.convertMybatisMap(musicGroupIdAndNumList);
 
         List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(musicGroupIds);
-        Map<Long,Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
+        Map<Long, Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
 
         teacherMusicClassGroup.forEach(teacherClassGroupDto -> {
 
@@ -598,16 +600,16 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 }
 
                 Integer overCourses = vipGroupOverCourseMaps.get(teacherClassGroupDto.getMusicGroupId());
-                if(Objects.isNull(overCourses)){
-                    overCourses=0;
+                if (Objects.isNull(overCourses)) {
+                    overCourses = 0;
                 }
-                Integer totalClassTimes=teacherClassGroupDto.getTotalClassTimes();
-                if(Objects.isNull(totalClassTimes)||totalClassTimes==0){
+                Integer totalClassTimes = teacherClassGroupDto.getTotalClassTimes();
+                if (Objects.isNull(totalClassTimes) || totalClassTimes == 0) {
                     teacherClassGroupDto.setAvgClassTimesOfMonth(0.0);
-                }else{
-                    BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
+                } else {
+                    BigDecimal overCoursesOfMonth = new BigDecimal(overCourses), allClassTimes = new BigDecimal(totalClassTimes);
 
-                    Double monthConsumeRate=overCoursesOfMonth.divide(allClassTimes,1,BigDecimal.ROUND_HALF_UP).doubleValue();
+                    Double monthConsumeRate = overCoursesOfMonth.divide(allClassTimes, 1, BigDecimal.ROUND_HALF_UP).doubleValue();
                     teacherClassGroupDto.setAvgClassTimesOfMonth(monthConsumeRate);
                 }
 
@@ -719,6 +721,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 ClassGroupStudentMapper classStudentMapper = classGroupStudentMapperDao.query(classGroupStudentMapperDto.getClassGroupId(), classGroupStudentMapperDto.getUserId());
                 classStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
                 classGroupStudentMapperDao.update(classStudentMapper);
+            } else { //临时删除学生对应时间段的课程
+                List<CourseSchedule> courseScheduleList = courseScheduleDao.findCourseScheduleByClassGroupIdAndDate(classGroupStudentMapperDto.getClassGroupId(), classGroupAdjustDto.getStartDate(), classGroupAdjustDto.getEndDate());
+                courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(classGroupStudentMapperDto.getUserId(), courseScheduleList);
             }
             subject_id_list_ += classGroupStudentMapperDto.getUserId() + ",";
         }

+ 17 - 57
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -23,15 +23,12 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
-
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -311,74 +308,37 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 	@Transactional(rollbackFor = Exception.class)
 	@Override
-	public void classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto) {
-
-		CourseSchedule nowCourseSchedule = courseScheduleDao.get(classDateAdjustDto.getId());
-		if(DateUtils.isSameDay(nowCourseSchedule.getClassDate(),classDateAdjustDto.getClassDate())&&
-				DateUtils.isSameDay(nowCourseSchedule.getStartClassTime(),classDateAdjustDto.getStartClassTime())&&
-				DateUtils.isSameDay(nowCourseSchedule.getEndClassTime(),classDateAdjustDto.getEndClassTime())){
-			courseScheduleDao.update(classDateAdjustDto);
-			return;
-		}
-
-		//单次调整课时
-		if(null==classDateAdjustDto.getAdjustStartTime()&&null==classDateAdjustDto.getAdjustEndTime()){
+	public void classStartDateAdjust(List<CourseSchedule> newCourseSchedules) {
+		List<Long> newCourseScheduleIds = newCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
+		//获取对应未修改的课程列表
+		List<CourseSchedule> oldCourseScheduleList = courseScheduleDao.findByCourseScheduleIds(newCourseScheduleIds);
+		if(oldCourseScheduleList.size()!=newCourseSchedules.size()){
+			throw new BizException("课程信息错误");
+		}
+		Map<Long, CourseSchedule> oldCourseSchedules = oldCourseScheduleList.stream().collect(Collectors.toMap(CourseSchedule::getId,courseSchedule -> courseSchedule));
+		newCourseSchedules.forEach(newCourseSchedule -> {
+			CourseSchedule oldCourseSchedule = oldCourseSchedules.get(newCourseSchedule.getId());
 			ArrayList<Date> dates = new ArrayList<>();
-			dates.add(classDateAdjustDto.getClassDate());
-			List<CourseSchedule> coursesByDates = courseScheduleDao.findOverLapCoursesInDay(dates,classDateAdjustDto.getStartClassTime(),classDateAdjustDto.getEndClassTime());
+			dates.add(newCourseSchedule.getClassDate());
+			List<CourseSchedule> coursesByDates = courseScheduleDao.findOverLapCoursesInDay(dates,newCourseSchedule.getStartClassTime(),newCourseSchedule.getEndClassTime());
 			//判断是否存在同时间上课的班级
 			if(null==coursesByDates||coursesByDates.size()<=0){
-				courseScheduleDao.update(classDateAdjustDto);
+				courseScheduleDao.update(newCourseSchedule);
 			}else{
 				coursesByDates.forEach(courseSchedule -> {
-					if(courseSchedule.getTeacherId().equals(classDateAdjustDto.getTeacherId())){
+					if(courseSchedule.getTeacherId().equals(newCourseSchedule.getTeacherId())){
 						//存在时间重叠,需要前端重新调整
 						throw new BizException("所选教师在当天课程安排上存在重叠!");
 					}
 				});
 				List<Integer> repeatClassGroupIds = coursesByDates.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
 				checkStudentIsRepeat(repeatClassGroupIds);
-				courseScheduleDao.update(classDateAdjustDto);
+				courseScheduleDao.update(newCourseSchedule);
 			}
-		}else{
-			//根据时间段调整课时
-			List<Date> dates= DateUtil.getWeekDays(classDateAdjustDto.getAdjustStartTime(),classDateAdjustDto.getAdjustEndTime(),classDateAdjustDto.getWeekNum());
-			List<CourseSchedule> coursesByDates = courseScheduleDao.findOverLapCoursesInDay(dates,classDateAdjustDto.getStartClassTime(),classDateAdjustDto.getEndClassTime());
-			//判断是否存在同时间上课的班级
-			if(null==coursesByDates||coursesByDates.size()<=0){
-				createNewCourseByAdjust(dates,classDateAdjustDto);
-			}else{
-				//判断教师是否在时间安排上存在冲突
-				SimpleDateFormat s1=new SimpleDateFormat("yyyy-MM-dd"),
-						s2=new SimpleDateFormat("HH:mm:ss"),
-						s3=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				List<CourseSchedule> teacherCoursesInDates = courseScheduleDao.findTeacherCoursesInDates(dates, classDateAdjustDto.getTeacherId());
-				teacherCoursesInDates.forEach(courseSchedule -> {
-					Date updateStartClassTime = null,updateEndClassTime=null;
-					try {
-						updateStartClassTime=s3.parse(s1.format(courseSchedule.getClassDate())+" "+s2.format(classDateAdjustDto.getStartClassTime()));
-						updateEndClassTime=s3.parse(s1.format(courseSchedule.getClassDate())+" "+s2.format(classDateAdjustDto.getEndClassTime()));
-					} catch (ParseException e) {
-						e.printStackTrace();
-					}
-					boolean isDuplication=(courseSchedule.getStartClassTime().after(updateStartClassTime)
-							&&courseSchedule.getStartClassTime().before(updateEndClassTime))
-							||(updateStartClassTime.after(courseSchedule.getStartClassTime())
-							&&updateStartClassTime.before(courseSchedule.getEndClassTime()));
-					if(isDuplication){
-						throw new BizException("在所选时段内教师上课时间存在重复!");
-					}
+			if(oldCourseSchedule.getType()== CourseSchedule.CourseScheduleType.VIP){
 
-				});
-				//判断学生在时间安排上是否存在冲突
-				Map<Date, List<CourseSchedule>> collect = coursesByDates.stream().collect(Collectors.groupingBy(CourseSchedule::getClassDate));
-				for(Date keyDate:collect.keySet()){
-					List<Integer> repeatClassGroupIds = collect.get(keyDate).stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
-					checkStudentIsRepeat(repeatClassGroupIds);
-				}
-				createNewCourseByAdjust(dates,classDateAdjustDto);
 			}
-		}
+		});
 	}
 
 	@Transactional(rollbackFor = Exception.class)

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -19,6 +19,7 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -80,6 +81,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 	
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+	
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    
+    @Autowired
+    private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
 
 	@Autowired
 	private PayService payService;
@@ -369,6 +376,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 			amount = musicGroupStudentFee.getCourseFee();
 		}
 
+		Date date = new Date();
+		StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+		studentPaymentOrder.setUserId(userId);
+		studentPaymentOrder.setOrderNo(idGeneratorService.generatorId("RENEW") + "");
+		studentPaymentOrder.setType(OrderTypeEnum.RENEW);
+		studentPaymentOrder.setExpectAmount(amount);
+		studentPaymentOrder.setActualAmount(amount);
+		studentPaymentOrder.setStatus(DealStatusEnum.ING);
+		studentPaymentOrder.setPaymentChannel("银联");
+		studentPaymentOrder.setMusicGroupId(musicGroupId);
+		studentPaymentOrderService.insert(studentPaymentOrder);
+
+		ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
+		StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+		studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
+		studentPaymentOrderDetail.setPrice(amount);
+		studentPaymentOrderDetail.setCreateTime(date);
+		studentPaymentOrderDetail.setUpdateTime(date);
+		studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+		studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
+
+		studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+
 		try {
 			return payService.getPayMap(amount, idGeneratorService.generatorId("payment") + "", "https://pay.dayaedu.com/api/yqpay/notify",
 					"http://dev.dayaedu.com", "测试订单", "测试订单");

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

@@ -7,14 +7,12 @@ import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SysAccountService;
 import com.ym.mec.thirdparty.union.UnionPay;
 import com.ym.mec.thirdparty.union.UnionPayFeignService;
-import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Random;
 
 /**
  * 支付服务类
@@ -42,18 +40,20 @@ public class PayServiceImpl implements PayService {
      * @return
      * @throws Exception
      */
+    @Override
     public Map getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
         //支付通道决策
         SysAccount routingAccount = getRoutingAccount(amount);
         HashMap<String, Object> unionPay = new HashMap<>();
         Map payMap;
         payMap = UnionPay.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject);
-        unionPay.put("orderNo", orderNo);
+        unionPay.put("orderNo", "1017"+orderNo);
         unionPay.put("type", "UNIONPAY");
         unionPay.put("payMap", payMap);
         return unionPay;
     }
 
+    @Override
     public Map<String, Object> query(String orderNo) throws Exception {
         return new UnionPay(unionPayFeignService).query(orderNo);
     }

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

@@ -437,4 +437,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         return studentPaymentOrder;
     }
+
+    @Override
+    public List<StudentRegistration> getMusicGroupStu(String musicGroupId, Integer actualSubjectId) {
+        return studentRegistrationDao.findMusicGroupStudent(musicGroupId,actualSubjectId);
+    }
 }

+ 72 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherLeaveRecordServiceImpl.java

@@ -1,23 +1,92 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import com.ym.mec.biz.dal.dao.TeacherLeaveRecordDao;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
+import com.ym.mec.biz.dal.entity.TeacherLeaveRecord.CoursesScheduleHistory;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.TeacherLeaveRecordService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.json.JsonUtil;
 
 @Service
-public class TeacherLeaveRecordServiceImpl extends BaseServiceImpl<Long, TeacherLeaveRecord>  implements TeacherLeaveRecordService {
-	
+public class TeacherLeaveRecordServiceImpl extends BaseServiceImpl<Long, TeacherLeaveRecord> implements TeacherLeaveRecordService {
+
 	@Autowired
 	private TeacherLeaveRecordDao teacherLeaveRecordDao;
 
+	@Autowired
+	private CourseScheduleService courseScheduleService;
+
 	@Override
 	public BaseDAO<Long, TeacherLeaveRecord> getDAO() {
 		return teacherLeaveRecordDao;
 	}
-	
+
+	@Override
+	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+	public boolean askForLeave(Integer userId, TeacherLeaveRecord teacherLeaveRecord) {
+
+		Date date = new Date();
+
+		teacherLeaveRecord.setUserId(userId);
+		teacherLeaveRecord.setUpdateTime(date);
+		teacherLeaveRecord.setCreateTime(date);
+		teacherLeaveRecord.setStatus(AuditStatusEnum.ING);
+		teacherLeaveRecord.setDays(DateUtil.hoursBetween(teacherLeaveRecord.getStartTime(), teacherLeaveRecord.getEndTime()) / 8d);
+
+		teacherLeaveRecordDao.insert(teacherLeaveRecord);
+		return true;
+	}
+
+	@Override
+	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+	public boolean approve(Long id, Integer userId, AuditStatusEnum status, String remark) {
+
+		TeacherLeaveRecord teacherLeaveRecord = teacherLeaveRecordDao.get(id);
+		if (teacherLeaveRecord == null) {
+			throw new BizException("请假记录不存在");
+		}
+
+		if (teacherLeaveRecord.getStatus() != AuditStatusEnum.ING || status == AuditStatusEnum.ING) {
+			throw new BizException("审批状态不正确");
+		}
+
+		teacherLeaveRecord.setStatus(status);
+		teacherLeaveRecord.setRemark(remark);
+
+		teacherLeaveRecordDao.update(teacherLeaveRecord);
+
+		if (StringUtils.isNotBlank(teacherLeaveRecord.getCoursesScheduleJson())) {
+			List<CoursesScheduleHistory> coursesScheduleHistoryList = JsonUtil.parseArray(teacherLeaveRecord.getCoursesScheduleJson(),
+					CoursesScheduleHistory.class);
+
+			if (coursesScheduleHistoryList != null && coursesScheduleHistoryList.size() > 0) {
+
+				List<CourseSchedule> list = new ArrayList<CourseSchedule>();
+
+				for (CoursesScheduleHistory his : coursesScheduleHistoryList) {
+					list.add(his.getAfter());
+				}
+				// 课时调整
+				courseScheduleService.classStartDateAdjust(list);
+			}
+		}
+
+		return true;
+	}
 }

+ 127 - 75
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -89,6 +89,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 	@Autowired
 	private CourseScheduleRewardsRulesService courseScheduleRewardsRulesService;
+	@Autowired
+	private SysConfigService sysConfigService;
 
 	private SysUserCashAccountDetailService sysUserCashAccountDetailService;
 
@@ -136,9 +138,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		className.append("•");
 		className.append(vipGroupApplyBaseInfoDto.getName());
 		vipGroupApplyBaseInfoDto.setName(className.toString());
-		vipGroupApplyBaseInfoDto.setTotalPrice(countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
+
+		//计算课程相关费用信息
+		Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
 				vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
-				vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice()).get("totalPrice"));
+				vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
+
+		//如果默认课酬与实际课酬不匹配则需要审批
+		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())!=0||
+			costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())!=0){
+			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
+		}else{
+			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
+		}
+
+		vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
 		vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
 		vipGroupApplyBaseInfoDto.setOrganId(sysUser.getOrganId());
 		vipGroupDao.insert(vipGroupApplyBaseInfoDto);
@@ -205,6 +219,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	}
 
 	@Override
+	public void vipApplyAudit(Long vipGroupId, AuditStatusEnum auditStatus, String reason) {
+		if(Objects.isNull(vipGroupId)||Objects.isNull(auditStatus)){
+			throw new BizException("请指定vip课及审核结果");
+		}
+		VipGroup vipGroup = vipGroupDao.get(vipGroupId);
+		if(Objects.isNull(vipGroup)){
+			throw new BizException("vip课不存在");
+		}
+		if(vipGroup.getAuditStatus()!=AuditStatusEnum.ING){
+			throw new BizException("该课程已被审核");
+		}
+		if(auditStatus==AuditStatusEnum.REJECT&&StringUtils.isBlank(reason)){
+			throw new BizException("请填写拒绝原因");
+		}
+		vipGroup.setAuditStatus(auditStatus);
+		vipGroup.setStopReason(reason);
+		vipGroupDao.update(vipGroup);
+	}
+
+	@Override
 	public PageInfo findStudentVipGroupList(StudentVipGroupQueryInfo queryInfo) {
 		PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<String, Object>();
@@ -422,7 +456,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("请指定课程形式");
 		}
 
-    	TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
+		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());
+		if(Objects.isNull(vipGroupCategory)){
+			throw new BizException("未找到课程形式");
+		}
+
+		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
 				vipGroup.getVipGroupCategoryId());
 
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
@@ -439,46 +478,59 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		Map<String,BigDecimal> results=new HashMap<>(1);
 
+		BigDecimal teacherSalaryTimeUnit=new BigDecimal(sysConfigService.findByParamName(SysConfigService.TEACHER_SALARY_TIME_UNIT).getParanValue());
+		//课程时长与结算单位时长占比
+		BigDecimal classTimeDuty=new BigDecimal(vipGroupCategory.getSingleClassMinutes()).divide(teacherSalaryTimeUnit);
 		BigDecimal offlineClassNum=new BigDecimal(vipGroup.getOfflineClassesNum());
 		BigDecimal onlineClassNum=new BigDecimal(vipGroup.getOnlineClassesNum());
 		BigDecimal onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
 		BigDecimal offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
 
-		//教师课酬线上单课酬计算
-		switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
-			case TEACHER_DEFAULT:
-				if(Objects.isNull(teacherDefaultVipGroupSalary)){
-					throw new BizException("未设置教师默认课酬");
-				}
-				results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
-				break;
-			case RATIO_DISCOUNT:
-				results.put("onlineTeacherSalary",onlineClassesUnitPrice.multiply((vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())));
-				break;
-			case FIXED_SALARY:
-				results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
-				break;
-			default:
-				throw new BizException("未指定课酬结算标准!");
+		if(vipGroup.getOnlineClassesNum()>0){
+			//教师课酬线上单课酬计算
+			switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
+				case TEACHER_DEFAULT:
+					if(Objects.isNull(teacherDefaultVipGroupSalary)){
+						throw new BizException("未设置教师默认课酬");
+					}
+					results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
+					break;
+				case RATIO_DISCOUNT:
+					results.put("onlineTeacherSalary",onlineClassesUnitPrice.multiply((vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())));
+					break;
+				case FIXED_SALARY:
+					results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
+					break;
+				default:
+					throw new BizException("未指定课酬结算标准!");
+			}
+		}else{
+			results.put("onlineTeacherSalary",new BigDecimal(0));
 		}
-		//教师线下单课酬计算
-		switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
-			case TEACHER_DEFAULT:
-				if(Objects.isNull(teacherDefaultVipGroupSalary)){
-					throw new BizException("未设置教师默认课酬");
-				}
-				results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
-				break;
-			case RATIO_DISCOUNT:
-				results.put("offlineTeacherSalary",offlineClassesUnitPrice.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
-				break;
-			case FIXED_SALARY:
-				results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
-				break;
-			default:
-				throw new BizException("未指定课酬结算标准!");
+
+		if(vipGroup.getOfflineClassesNum()>0){
+			//教师线下单课酬计算
+			switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
+				case TEACHER_DEFAULT:
+					if(Objects.isNull(teacherDefaultVipGroupSalary)){
+						throw new BizException("未设置教师默认课酬");
+					}
+					results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
+					break;
+				case RATIO_DISCOUNT:
+					results.put("offlineTeacherSalary",offlineClassesUnitPrice.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
+					break;
+				case FIXED_SALARY:
+					results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
+					break;
+				default:
+					throw new BizException("未指定课酬结算标准!");
+			}
+		}else{
+			results.put("offlineTeacherSalary",new BigDecimal(0));
 		}
 
+
 		//课程购买费用计算
 		BigDecimal totalPrice;
 		switch (vipGroupActivity.getType()){
@@ -580,7 +632,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map payMap = payService.getPayMap(
 				vipGroup.getTotalPrice(),
 				orderNo,
-				"https://pay.dayaedu.com/api/yqpay/notify",
+				"http://47.99.212.176:8000/api-student/studentOrder/notify",
 				"http://dev.dayaedu.com",
 				"vip课购买",
 				vipGroup.getName());
@@ -591,13 +643,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void orderCallback(String callbackParams) {
+	public void orderCallback(StudentPaymentOrder order) {
 		/*
 		根据回调信息调整订单状态及vip课程状态等相关信息
 		 */
-		Long vipGroupId=1L;
-		Integer userId = 1;
-		boolean isOk=true;
+		Long vipGroupId=Long.parseLong(order.getMusicGroupId());
+		Integer userId = order.getUserId();
+		boolean isOk=order.getStatus().equals(DealStatusEnum.SUCCESS);
 
 		//将学生加入到班级,更新班级报名状态及人数信息
 		if(!isOk){
@@ -653,47 +705,47 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 	@Transactional(rollbackFor = Exception.class)
 	@Override
-	public void applyRefundAudit(StudentApplyRefunds studentApplyRefunds) {
-    	if(Objects.isNull(studentApplyRefunds.getId())){
-    		throw new BizException("请指定退费订单!");
-		}
+	public void applyRefundAudit(Long id, AuditStatusEnum status, String remark) {
 
-		StudentApplyRefunds oldStudentApplyRefunds=studentApplyRefundsDao.get(studentApplyRefunds.getId());
+		StudentApplyRefunds studentApplyRefunds = studentApplyRefundsDao.get(id);
+		if (studentApplyRefunds == null) {
+			throw new BizException("退课申请记录不存在");
+		}
 
-		StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(oldStudentApplyRefunds.getOrigPaymentOrderId());
-		if(null==studentPaymentOrder){
+		StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(studentApplyRefunds.getOrigPaymentOrderId());
+		if (null == studentPaymentOrder) {
 			throw new BizException("未找到原订单信息!");
 		}
 
-		oldStudentApplyRefunds.setStatus(studentApplyRefunds.getStatus());
-		if(null==studentApplyRefunds.getActualAmount()){
-			oldStudentApplyRefunds.setActualAmount(oldStudentApplyRefunds.getExpectAmount());
-		}else{
-			oldStudentApplyRefunds.setActualAmount(studentApplyRefunds.getActualAmount());
-		}
-		oldStudentApplyRefunds.setRemark(studentApplyRefunds.getRemark());
-		studentApplyRefundsDao.update(oldStudentApplyRefunds);
-		switch (studentApplyRefunds.getStatus()){
-			case PASS:
-				sysUserCashAccountService.updateBalance(oldStudentApplyRefunds.getUserId(),oldStudentApplyRefunds.getActualAmount());
-				SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
-				SysUserCashAccountDetail sysUserCashAccountDetail=new SysUserCashAccountDetail();
-				sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
-				sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
-				sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
-				sysUserCashAccountDetail.setAmount(oldStudentApplyRefunds.getActualAmount());
-				sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
-				sysUserCashAccountDetail.setAttribute(oldStudentApplyRefunds.getId().toString());
-				sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
-
-				classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(),
-						studentPaymentOrder.getUserId().longValue());
-				break;
-			case REJECT:
+		studentApplyRefunds.setStatus(status);
+		if (studentApplyRefunds.getStatus() == AuditStatusEnum.PASS) {
+			studentApplyRefunds.setActualAmount(studentApplyRefunds.getExpectAmount());
+		} else {
+			studentApplyRefunds.setActualAmount(new BigDecimal(0));
+		}
+		studentApplyRefunds.setRemark(remark);
+		studentApplyRefundsDao.update(studentApplyRefunds);
+		switch (studentApplyRefunds.getStatus()) {
+		case PASS:
+			sysUserCashAccountService.updateBalance(studentApplyRefunds.getUserId(), studentApplyRefunds.getActualAmount());
+			SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
+			SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
+			sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
+			sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
+			sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
+			sysUserCashAccountDetail.setAmount(studentApplyRefunds.getActualAmount());
+			sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
+			sysUserCashAccountDetail.setAttribute(studentApplyRefunds.getId().toString());
+			sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
 
-				break;
-			default:
-				throw new BizException("审核状态错误!");
+			classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(), studentPaymentOrder.getUserId()
+					.longValue());
+			break;
+		case REJECT:
+
+			break;
+		default:
+			throw new BizException("审核状态错误!");
 		}
 	}
 

+ 1 - 1
mec-biz/src/main/resources/config/contracts/courses.ftl

@@ -94,7 +94,7 @@
                     <span>所在声部:${studentInfo.subject.name!}</span>
                 </div>
             </div>
-        </div>
+        
             (本协议中“乙方“指学员及家长;”乙方学员“仅指参加甲方课程的学员;”乙方家长“仅指乙方学员的法定监护人。)
         </div>
         为进一步提升器乐教学质量和服务品质,保证学员学习进度,明确培训各方的权责,经甲、乙双方协商一致,特订立本协议,以便共同遵守。

+ 30 - 5
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -284,6 +284,17 @@
         GROUP BY user_id_
     </select>
 
+    <select id="findByCourseScheduleIds" resultMap="CourseSchedule">
+        SELECT
+            *
+        FROM
+            course_schedule
+        WHERE id_ IN
+        <foreach collection="courseScheduleIds" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
+
     <select id="getCourseSchedulesWithDate" resultMap="courseScheduleDto">
         SELECT
         cg.id_ seal_class_id_,
@@ -339,12 +350,14 @@
         cgsm.status_ attendance_status_,
         cs.teach_mode_
         FROM
-        course_schedule cs
+        course_schedule_student_payment cssp
+	    LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
         LEFT JOIN sys_user su ON cs.teacher_id_=su.id_
         LEFT JOIN class_group_student_mapper cgsm ON cgsm.class_group_id_ = cs.class_group_id_
         WHERE
         cs.class_date_ = DATE_FORMAT(#{classDate},'%Y%m%d')
-        AND cgsm.user_id_ = #{studentId}
+        AND cssp.user_id_ = #{studentId}
+        ORDER BY start_class_time_
     </select>
 
     <select id="getTeacherCourseSchedulesWithDate" resultMap="courseScheduleDto">
@@ -477,10 +490,10 @@
         SELECT
         cs.class_date_
         FROM
-        class_group_student_mapper cgsm
-        LEFT JOIN course_schedule cs ON cgsm.class_group_id_ = cs.class_group_id_
+        course_schedule_student_payment cssp
+        LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
         WHERE
-        cgsm.user_id_ = #{studentId}
+        cssp.user_id_ = #{studentId}
         <if test="month==null">
             AND DATE_FORMAT( NOW(), '%Y%m' ) = DATE_FORMAT( cs.class_date_, '%Y%m' )
         </if>
@@ -876,4 +889,16 @@
             </foreach>
         GROUP BY course_schedule_id_
     </select>
+
+    <!-- 获取班级某时间段的课程 -->
+    <select id="findCourseScheduleByClassGroupIdAndDate" resultMap="CourseSchedule">
+        <![CDATA[ SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId} AND class_date_ >= #{startDate} AND  class_date_ <=#{endDate} ]]>
+    </select>
+    
+    <select id="queryTeacherCourseScheduleListByTimeRangeAndType" resultMap="CourseSchedule" parameterType="map">
+        SELECT * FROM course_schedule WHERE teacher_id_=#{teacherId} and CONCAT( class_date_, ' ', start_class_time_ ) between #{startTime} and #{endTime}
+        <if test="type != null">
+        and type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        </if>
+    </select>
 </mapper>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -100,4 +100,11 @@
 			#{id}
 		</foreach>
     </select>
+
+	<delete id="deleteStudentCourseSchedule">
+		DELETE FROM course_schedule_student_payment WHERE user_id_ = #{userId} AND course_schedule_id_ IN
+		<foreach collection="courseScheduleList" item="courseSchedule" index="index" open="(" close=")" separator=",">
+			#{courseSchedule.id}
+		</foreach>
+	</delete>
 </mapper>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml

@@ -160,10 +160,10 @@
                 AND FIND_IN_SET(dg.subject_id_,#{subjectIds})
             </if>
             <if test="startTime!=null and endTime==null">
-                AND CONCAT(dgcp.course_date_,' ',dgcp.start_time_)&gt;=#{startTime}
+                AND CONCAT(dgcp.course_date_,' ',dgcp.start_time_)&gt;=DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%S')
             </if>
             <if test="startTime!=null and endTime!=null">
-                AND (CONCAT(dgcp.course_date_,' ',dgcp.start_time_) BETWEEN #{startTime} AND #{endTime})
+                AND (CONCAT(dgcp.course_date_,' ',dgcp.start_time_) BETWEEN DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%S'))
             </if>
         </where>
     </sql>

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -26,6 +26,7 @@
 		<result column="parent_meeting_time_" property="parentMeetingTime" />
 		<result column="img_" property="img" />
 		<result column="director_user_id_" property="directorUserId" />
+		<result column="settlement_type_" property="settlementType" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -119,6 +120,9 @@
 			<if test="directorUserId != null">
 				director_user_id_ = #{directorUserId},
 			</if>
+			<if test="settlementType != null">
+				settlement_type = #{settlementType},
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>

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

@@ -187,7 +187,7 @@
         FROM
         student_vip_group_payment svgp
         LEFT JOIN student_payment_order spo ON svgp.student_payment_order_id_=spo.id_
-        WHERE svgp.user_id_=#{userId} AND svgp.vip_group_id_=#{vipGroupId}
+        WHERE svgp.user_id_=#{userId} AND svgp.vip_group_id_=#{vipGroupId} AND spo.status_='ING'
     </select>
     <!-- 查询报名订单 -->
     <select id="findMusicGroupApplyOrderByStatus" resultMap="StudentPaymentOrder">

+ 22 - 9
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -30,7 +30,7 @@
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="music_group_status_" property="musicGroupStatus"/>
     </resultMap>
-    
+
     <resultMap type="com.ym.mec.biz.dal.dto.StudentInfo" id="StudentInfo">
         <result column="id_" property="id"/>
         <result column="username_" property="username"/>
@@ -198,7 +198,8 @@
     </resultMap>
     <select id="queryStudentDetailPage" resultMap="studentApplyDetail">
         SELECT sr.user_id_,sr.name_ username_,sr.parents_name_,sr.current_class_,sr.current_grade_,
-        su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_ actual_subject_name_,sr.parents_phone_,sr.payment_status_
+        su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_
+        actual_subject_name_,sr.parents_phone_,sr.payment_status_
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.subject_id_ = su.id_
         LEFT JOIN `subject` s ON sr.subject_id_ = s.id_
@@ -240,7 +241,7 @@
         SELECT sr.* FROM student_registration sr
         WHERE sr.user_id_ NOT IN (
         SELECT DISTINCT cgsm.user_id_ FROM class_group_student_mapper cgsm
-        LEFT JOIN class_group cg ON cg.id_ =  cgsm.class_group_id_
+        LEFT JOIN class_group cg ON cg.id_ = cgsm.class_group_id_
         WHERE cg.music_group_id_ = #{musicGroupId})
         AND sr.music_group_id_ = #{musicGroupId}
         <if test="actualSubjectId != null">
@@ -253,13 +254,14 @@
         SELECT COUNT(DISTINCT sr.user_id_) `value`,sr.actual_subject_id_ `key` FROM student_registration sr
         WHERE sr.user_id_ NOT IN (
         SELECT DISTINCT cgsm.user_id_ FROM class_group_student_mapper cgsm
-        LEFT JOIN class_group cg ON cg.id_ =  cgsm.class_group_id_
+        LEFT JOIN class_group cg ON cg.id_ = cgsm.class_group_id_
         WHERE cg.music_group_id_ = #{musicGroupId})
         AND sr.music_group_id_ = #{musicGroupId} GROUP BY sr.actual_subject_id_
     </select>
 
     <update id="updateByUserIdAndMusicGroupId" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration">
-        UPDATE student_registration SET class_group_id_ = #{studentRegistration.classGroupId} WHERE user_id_ = #{studentRegistration.userId} AND music_group_id_ = #{studentRegistration.musicGroupId}
+        UPDATE student_registration SET class_group_id_ = #{studentRegistration.classGroupId} WHERE user_id_ =
+        #{studentRegistration.userId} AND music_group_id_ = #{studentRegistration.musicGroupId}
     </update>
     <update id="batchUpdateSubject">
         UPDATE student_registration SET actual_subject_id_ = #{subId},update_time_ = now()
@@ -267,11 +269,12 @@
     </update>
 
     <select id="queryStudentInfo" resultMap="StudentInfo">
-        SELECT u.*,sr.name_,sr.current_class_,sr.current_grade_,sr.actual_subject_id_ FROM sys_user u left join student_registration  sr on u.id_ = sr.user_id_ where u.id_ = #{userId} order by sr.create_time_ desc limit 0,1
+        SELECT u.*,sr.name_,sr.current_class_,sr.current_grade_,sr.actual_subject_id_ FROM sys_user u left join
+        student_registration sr on u.id_ = sr.user_id_ where u.id_ = #{userId} order by sr.create_time_ desc limit 0,1
     </select>
-    
+
     <select id="queryByUserIdAndMusicGroupId" resultMap="StudentRegistration" parameterType="map">
-    	select * from student_registration where music_group_id_ = #{musicGroupId} and user_id_ = #{userId}
+        select * from student_registration where music_group_id_ = #{musicGroupId} and user_id_ = #{userId}
     </select>
 
     <!-- 根据乐团编号和手机号查询注册乐团注册信息-->
@@ -308,6 +311,16 @@
 
     <!-- 获取班级下的学生 -->
     <select id="findClassGroupStu" resultMap="StudentRegistration">
-        SELECT * FROM student_registration WHERE music_group_id_= #{musicGroupId} AND FIND_IN_SET(#{classGroupId},class_group_id_)
+        SELECT * FROM student_registration WHERE music_group_id_= #{musicGroupId} AND
+        FIND_IN_SET(#{classGroupId},class_group_id_)
+    </select>
+
+    <!-- 获取乐团的学生 -->
+    <select id="findMusicGroupStudent" resultMap="StudentRegistration">
+        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroup}
+        <if test="actualSubjectId != null and actualSubjectId !=''">
+            AND actual_subject_id_ = #{actualSubjectId}
+        </if>
+        AND payment_status_ = 1
     </select>
 </mapper>

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -251,6 +251,10 @@
 		SELECT COUNT(*) FROM vip_group
 	</select>
 
+    <select id="getLockVipGroup" resultMap="VipGroup">
+      SELECT * FROM vip_group WHERE id_=#{vipGroupId} FOR UPDATE
+    </select>
+
     <sql id="studentVipGroupQueryCondition">
         <where>
             vg.status_!=3
@@ -407,6 +411,7 @@
             LEFT JOIN teacher t ON vg.user_id_=t.id_
           LEFT JOIN sys_user su ON vg.user_id_=su.id_
         WHERE vg.id_=#{vipGroupId}
+        ORDER BY start_class_time_
     </select>
     <select id="countSurplusClassTimes" resultType="java.util.Map">
         SELECT

+ 6 - 1
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.education.controller;
 
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.education.base.BaseResponse;
@@ -17,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -80,7 +83,9 @@ public class CourseScheduleController {
         if(Objects.isNull(classDateAdjustDto.getId())){
             return BaseResponse.errorParam();
         }
-        scheduleService.classStartDateAdjust(classDateAdjustDto);
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(classDateAdjustDto);
+        scheduleService.classStartDateAdjust(courseSchedules);
         return BaseResponse.success(null);
     }
 

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -25,7 +25,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
-				.authorizeRequests().antMatchers("/v2/api-docs").permitAll().anyRequest().authenticated().and().httpBasic();
+				.authorizeRequests().antMatchers("/v2/api-docs","/studentOrder/notify").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 7 - 14
mec-student/src/main/java/com/ym/mec/student/controller/CourseController.java

@@ -1,24 +1,21 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
+import com.ym.mec.biz.service.ClassGroupService;
+import com.ym.mec.biz.service.MusicGroupService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
-
 @RequestMapping("course")
 @Api(tags = "课程服务")
 @RestController
@@ -33,7 +30,6 @@ public class CourseController extends BaseController {
 
     @ApiOperation("获取学生所购买课程列表")
     @GetMapping(value = "/queryUserMusicGroups")
-    @PreAuthorize("@pcs.hasPermissions('course/queryUserMusicGroups')")
     public Object queryCoursePage(QueryInfo queryInfo){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
@@ -44,7 +40,6 @@ public class CourseController extends BaseController {
 
     @ApiOperation("获取学员所有聊天群组")
     @GetMapping(value = "/queryUserGroups")
-    @PreAuthorize("@pcs.hasPermissions('course/queryUserGroups')")
     public Object queryUserGroups(String search){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
@@ -55,7 +50,6 @@ public class CourseController extends BaseController {
 
     @ApiOperation(value = "根据群编号,获取群组基本信息")
     @GetMapping("/findGroupById")
-    @PreAuthorize("@pcs.hasPermissions('course/findGroupById')")
     public Object findGroupById(String groupId){
         if(StringUtils.isEmpty(groupId)){
             return failed("参数校验错误");
@@ -70,7 +64,6 @@ public class CourseController extends BaseController {
 
     @ApiOperation(value = "分页获取学员购买记录")
     @PostMapping("/queryStudentPayLog")
-    @PreAuthorize("@pcs.hasPermissions('course/queryStudentPayLog')")
     public Object queryStudentPayLog(StudentPayLogQueryInfo studentPayLogQueryInfo){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null || sysUser.getId() == null){

+ 10 - 3
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -88,7 +88,7 @@ public class MusicGroupController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "subjectId", value = "声部编号", required = true, dataType = "Integer")})
     public HttpResponseResult getSubjectGoodsAndInfo(String musicGroupId, Integer subjectId) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        //SysUser sysUser = sysUserFeignService.queryUserInfo();
         MusicGroupSubjectGoodsAndInfoDto subjectGoodsAndInfo = musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId);
         return succeed(subjectGoodsAndInfo);
     }
@@ -136,9 +136,17 @@ public class MusicGroupController extends BaseController {
 		if (amount == null || amount.doubleValue() == 0) {
 			amount = musicGroupStudentFee.getCourseFee();
 		}
+
+		StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+		if (studentRegistration == null) {
+			return failed("乐团报名信息找不到");
+		}
+		MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
+				studentRegistration.getActualSubjectId());
 		ModelMap model = new ModelMap();
 		model.put("musicGroup", musicGroup);
 		model.put("amount", amount);
+		model.put("musicGroupSubjectPlan", musicGroupSubjectPlan);
 
 		return succeed(model);
 	}
@@ -229,7 +237,7 @@ public class MusicGroupController extends BaseController {
 
 
         IdWorker idWorker = new IdWorker(0, 0);
-        String orderNo = idWorker.nextId();
+        String orderNo = "1017"+idWorker.nextId();
 
         Map payMap = payService.getPayMap(orderAmount, orderNo, "https://pay.dayaedu.com/api/yqpay/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
 
@@ -303,7 +311,6 @@ public class MusicGroupController extends BaseController {
             return failed("商品价格不符");
         }
 
-
         IdWorker idWorker = new IdWorker(0, 0);
         String orderNo = idWorker.nextId();
 

+ 5 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.thirdparty.union.NotifyMsg;
 import io.swagger.annotations.Api;
 import org.slf4j.Logger;
@@ -27,6 +28,8 @@ public class StudentOrderController {
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
     private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private VipGroupService vipGroupService;
 
 
     @PostMapping("/notify")
@@ -61,6 +64,8 @@ public class StudentOrderController {
         order.setPayTime(notifyMsg.getPayTime());
         if (order.getType().equals(OrderTypeEnum.APPLY)) { //报名订单
             studentRegistrationService.updateApplyOrder(order);
+        }else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)){
+            vipGroupService.orderCallback(order);
         }
 
         return "SUCCESS";

+ 4 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -2,6 +2,7 @@ package com.ym.mec.teacher.controller;
 
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
@@ -85,7 +86,9 @@ public class TeacherCourseScheduleController extends BaseController {
         if(Objects.isNull(classDateAdjustDto.getId())){
             return failed(HttpStatus.FORBIDDEN, "请指定课程!");
         }
-        scheduleService.classStartDateAdjust(classDateAdjustDto);
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(classDateAdjustDto);
+        scheduleService.classStartDateAdjust(courseSchedules);
         return succeed();
     }
 

+ 58 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherLeaveRecordController.java

@@ -0,0 +1,58 @@
+package com.ym.mec.teacher.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+import java.util.Objects;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.service.TeacherLeaveRecordService;
+import com.ym.mec.common.controller.BaseController;
+
+@Api(tags = "老师请假服务")
+@RequestMapping("teacherLeaveRecord")
+@RestController
+public class TeacherLeaveRecordController extends BaseController {
+
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@Autowired
+	private CourseScheduleDao courseScheduleDao;
+
+	@Autowired
+	private TeacherLeaveRecordService teacherLeaveRecordService;
+
+	@ApiOperation(value = "查询vip课列表")
+	@GetMapping("/queryVipCourseScheduleList")
+	public Object queryVipCourseScheduleList(Date startTime, Date endTime) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (Objects.isNull(sysUser)) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		return succeed(courseScheduleDao.queryTeacherCourseScheduleListByTimeRangeAndType(sysUser.getId(), CourseScheduleType.VIP, startTime, endTime));
+	}
+
+	@ApiOperation(value = "请假")
+	@PostMapping("/askForLeave")
+	public Object askForLeave(TeacherLeaveRecord teacherLeaveRecord) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (Objects.isNull(sysUser)) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		teacherLeaveRecordService.askForLeave(sysUser.getId(), teacherLeaveRecord);
+		return succeed();
+	}
+}

+ 2 - 2
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/union/UnionPay.java

@@ -89,7 +89,7 @@ public class UnionPay {
         json.put("mid", h5Mid);
         json.put("tid", h5Tid);
         json.put("orderDesc", orderSubject);
-        json.put("merOrderId", orderNo);
+        json.put("merOrderId", "1017" + orderNo);
         json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
         json.put("expireTime", DateFormatUtils.format(new Date().getTime() + 300000, "yyyy-MM-dd HH:mm:ss"));
         json.put("notifyUrl", notifyUrl);
@@ -119,7 +119,7 @@ public class UnionPay {
         json.put("instMid", "H5DEFAULT");
         json.put("mid", h5Mid);
         json.put("tid", h5Tid);
-        json.put("merOrderId", orderNo);
+        json.put("merOrderId", "1017" + orderNo);
         json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
 
         String authorization = getOpenBodySig(wpAppId, wpAppKey, timestamp, nonce, json.toString(), "POST");

+ 15 - 24
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -1,28 +1,5 @@
 package com.ym.mec.web.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
@@ -38,6 +15,18 @@ import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.StudentAttendanceService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -132,7 +121,9 @@ public class CourseScheduleController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('courseSchedule/classStartDateAdjust')")
     @PostMapping(value = "/classStartDateAdjust",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Object classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto){
-        scheduleService.classStartDateAdjust(classDateAdjustDto);
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(classDateAdjustDto);
+        scheduleService.classStartDateAdjust(courseSchedules);
         return succeed();
     }
 

+ 10 - 1
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -71,7 +71,7 @@ public class StudentRegistrationController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/queryFeeDetail')")
     @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
-    public Object queryFeeDetail(String studentId,String musicGroupId) {
+    public Object queryFeeDetail(String studentId, String musicGroupId) {
         if (StringUtils.isEmpty(studentId) || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
@@ -96,4 +96,13 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentRegistrationService.findClassGroupStu(musicGroupId, classGroupId));
     }
 
+    @ApiOperation(value = "获取乐团的学生")
+    @GetMapping("/getMusicGroupStu")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStu')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = true, dataType = "int")})
+    public Object getMusicGroupStu(String musicGroupId, Integer actualSubjectId) {
+        return succeed(studentRegistrationService.getMusicGroupStu(musicGroupId, actualSubjectId));
+    }
+
 }

+ 17 - 6
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -4,8 +4,9 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
-import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.page.VipGroupAttendanceQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
@@ -13,16 +14,16 @@ import com.ym.mec.biz.dal.page.VipGroupTeachingRecordQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -94,8 +95,8 @@ public class VipGroupManageController extends BaseController {
     @ApiOperation(value = "退课申请审核")
     @PostMapping("/applyRefundAudit")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/applyRefundAudit')")
-    public Object applyRefundAudit(StudentApplyRefunds studentApplyRefunds){
-        vipGroupService.applyRefundAudit(studentApplyRefunds);
+	public Object applyRefundAudit(Long id, AuditStatusEnum status, String remark) {
+		vipGroupService.applyRefundAudit(id, status, remark);
         return succeed();
     }
 
@@ -153,7 +154,17 @@ public class VipGroupManageController extends BaseController {
         if(Objects.isNull(classDateAdjustDto.getId())){
             return failed(HttpStatus.FORBIDDEN, "请指定课程!");
         }
-        scheduleService.classStartDateAdjust(classDateAdjustDto);
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(classDateAdjustDto);
+        scheduleService.classStartDateAdjust(courseSchedules);
+        return succeed();
+    }
+
+    @ApiOperation(value = "vip课审核")
+    @PostMapping(value = "/vipApplyAudit")
+    @PreAuthorize("@pcs.hasPermissions('vipGroupManage/vipApplyAudit')")
+    public Object vipApplyAudit(Long vipGroupId, AuditStatusEnum auditStatus, String reason){
+        vipGroupService.vipApplyAudit(vipGroupId,auditStatus,reason);
         return succeed();
     }