Forráskód Böngészése

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

zouxuan 4 éve
szülő
commit
10b5cf0e9d

+ 59 - 39
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -24,11 +24,11 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     int batchInsert(List<CourseScheduleStudentPayment> courseScheduleStudentPayments);
 
     /**
+     * @param courseScheduleStudentPayments:
+     * @return int
      * @describe 批量更新
      * @author Joburgess
      * @date 2020/1/10
-     * @param courseScheduleStudentPayments:
-     * @return int
      */
     int batchUpdate(@Param("courseScheduleStudentPayments") List<CourseScheduleStudentPayment> courseScheduleStudentPayments);
 
@@ -115,15 +115,15 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
                                                                               @Param("userId") Integer userId);
 
     /**
-     * @describe 统计团体下为开始课程学生数量
-     * @author Joburgess
-     * @date 2020.09.27
      * @param groupId:
      * @param groupType:
      * @return int
+     * @describe 统计团体下为开始课程学生数量
+     * @author Joburgess
+     * @date 2020.09.27
      */
     int countNotStartCourseStudentNumWithGroup(@Param("groupId") String groupId,
-                                      @Param("groupType") GroupType groupType);
+                                               @Param("groupType") GroupType groupType);
 
     /**
      * @param vipGroupId: 小课编号
@@ -137,103 +137,110 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
                                        @Param("teachMode") String teachMode);
 
     int deleteStudentCourseScheduleByUserId(@Param("courseScheduleId") Long courseScheduleId, @Param("userIdList") List<Integer> userIdList);
-    
+
     /**
      * 根据乐团编号删除记录
+     *
      * @param musicGroupId
      * @return
      */
-    int deleteByMusicGroupId(@Param("musicGroupId")String musicGroupId, @Param("groupType")GroupType groupType);
+    int deleteByMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("groupType") GroupType groupType);
 
     /**
      * 根据乐团编号,和groupTYpe获取学员剩余课程数
+     *
      * @param musicGroupIds
      * @param userId
      * @param groupType
      * @return
      */
-    List<Map<String, Integer>> findStudentCourseNum(@Param("musicGroupIds") Set<String> musicGroupIds, @Param("userId")Integer userId, @Param("groupType")String groupType);
+    List<Map<String, Integer>> findStudentCourseNum(@Param("musicGroupIds") Set<String> musicGroupIds, @Param("userId") Integer userId, @Param("groupType") String groupType);
 
     /**
-     * @describe 统计指定乐团下学员课程数量
-     * @author Joburgess
-     * @date 2019/12/23
      * @param groupType:
      * @param groupId:
      * @return int
+     * @describe 统计指定乐团下学员课程数量
+     * @author Joburgess
+     * @date 2019/12/23
      */
     int countStudentCourseNumWithGroup(@Param("groupType") GroupType groupType,
                                        @Param("groupId") String groupId);
 
     /**
      * 根据乐团,vip状态获取编号
+     *
      * @return
      */
     Set<Integer> queryMusicStudentPer();
+
     /**
      * 根据乐团,vip状态获取编号
+     *
      * @return
      */
     Set<Integer> queryVipStudentPer();
 
     /**
+     * @param courseIds: 统计课程上的学生人数
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.Integer>>
      * @describe
      * @author Joburgess
      * @date 2020/1/8
-     * @param courseIds: 统计课程上的学生人数
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
      */
     List<Map<Integer, Integer>> countCourseStudentNum(@Param("courseIds") List<Long> courseIds);
 
     /**
-     * @describe 检测学生是否存在指定课程的缴费记录
-     * @author Joburgess
-     * @date 2020/1/10
      * @param courseScheduleId:
      * @param userId:
      * @return int
+     * @describe 检测学生是否存在指定课程的缴费记录
+     * @author Joburgess
+     * @date 2020/1/10
      */
     int checkStudentHaveCourse(@Param("courseScheduleId") Long courseScheduleId,
                                @Param("userId") Integer userId);
 
     /**
+     * @param courseScheduleId: 课程编号
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      * @describe 查询指定课程的学生缴费记录
      * @author Joburgess
      * @date 2020/1/10
-     * @param courseScheduleId: 课程编号
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      */
     List<CourseScheduleStudentPayment> findByCourseSchedule(@Param("courseScheduleId") Long courseScheduleId);
 
     /**
+     * @param groupId:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto>
      * @describe 获取小课需要调整的缴费记录
      * @author Joburgess
      * @date 2020/1/10
-     * @param groupId:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto>
      */
     List<VipGroupGiveCourseSortDto> findVipGroupSortCourseByGroup(@Param("groupId") String groupId);
 
     /**
      * 获取课程学员数量
+     *
      * @param courseScheduleId
      * @return
      */
     Integer countStudentNum(Integer courseScheduleId);
 
     /**
-     * @describe 根据团体删除班级
-     * @author Joburgess
-     * @date 2020/2/17
      * @param groupId:
      * @param groupType:
      * @return int
+     * @describe 根据团体删除班级
+     * @author Joburgess
+     * @date 2020/2/17
      */
     int deleteByGroup(@Param("groupId") String groupId,
-                      @Param("groupType")GroupType groupType);
+                      @Param("groupType") GroupType groupType);
 
     /**
      * 获取当前课程的学员列表
+     *
      * @param courseScheduleId
      * @return
      */
@@ -241,25 +248,27 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取课程的学员编号列表
+     *
      * @param courseScheduleIds
      * @return
      */
-    List<Map<Integer,String>> getStudentIdMap(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+    List<Map<Integer, String>> getStudentIdMap(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
+     * @param monday:
+     * @return java.util.List<java.lang.Integer>
      * @describe 获取在指定时间之后不存在网管课的学员编号列表
      * @author Joburgess
      * @date 2020/4/10
-     * @param monday:
-     * @return java.util.List<java.lang.Integer>
      */
-    List<Practice4ExercisesSituationDto> findNoPracticeStudentIdsOnWeek(@Param("monday")String monday,
-                                                                        @Param("sunday")String sunday);
+    List<Practice4ExercisesSituationDto> findNoPracticeStudentIdsOnWeek(@Param("monday") String monday,
+                                                                        @Param("sunday") String sunday);
 
     Integer findNoPracticeStudentTeacherId(@Param("studentId") Integer studentId);
-    
+
     /**
      * 从指定时间开始查询学的线上可数
+     *
      * @return
      */
     List<StudentCourseTimesDto> queryStudentNotStartCourseTimesOfOnline();
@@ -267,25 +276,27 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     List<StudentTeacherCourseDto> findAllStudentCourseInfo();
 
     /**
+     * @param courseScheduleIds:
+     * @return java.util.List<java.util.Map < java.lang.Long, java.math.BigDecimal>>
      * @describe 统计每节课的收款
      * @author Joburgess
      * @date 2020.05.09
-     * @param courseScheduleIds:
-     * @return java.util.List<java.util.Map<java.lang.Long,java.math.BigDecimal>>
      */
     List<Map<Long, BigDecimal>> findCoursePayment(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
      * 获取学员指定课程类型的剩余课时数
+     *
      * @param studentId
      * @param courseScheduleType
      * @return
      */
     int countStudentNotStartCourseNumWithCourseType(@Param("studentId") Integer studentId,
-                                                    @Param("courseScheduleType")CourseSchedule.CourseScheduleType courseScheduleType);
+                                                    @Param("courseScheduleType") CourseSchedule.CourseScheduleType courseScheduleType);
 
     /**
      * 批量操作节拍器状态
+     *
      * @param courseScheduleId
      * @param userId
      */
@@ -293,6 +304,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取用户的节拍器信息
+     *
      * @param userIds
      * @param courseScheduleId
      * @return
@@ -301,6 +313,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取单个用户的midi
+     *
      * @param courseScheduleId
      * @param userId
      * @return
@@ -308,18 +321,19 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     String getMidiByCourseIdAndUserId(@Param("courseScheduleId") String courseScheduleId, @Param("userId") String userId);
 
     /**
+     * @param groupType:
+     * @param groupIds:
+     * @return java.util.List<java.util.Map < java.lang.String, java.math.BigDecimal>>
      * @describe 统计课程组下的课程单价
      * @author Joburgess
      * @date 2020.06.11
-     * @param groupType:
-     * @param groupIds:
-     * @return java.util.List<java.util.Map<java.lang.String,java.math.BigDecimal>>
      */
     List<Map<String, BigDecimal>> findGroupCoursesUnitPrice(@Param("groupType") GroupType groupType,
                                                             @Param("groupIds") List<String> groupIds);
 
     /**
      * 获取未进入教室的学员列表
+     *
      * @param roomId
      * @param courseScheduleId
      * @return
@@ -327,11 +341,17 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     List<RongyunBasicUserDto> queryNoJoinStu(@Param("roomId") String roomId, @Param("courseScheduleId") String courseScheduleId);
 
     /**
+     * @param batchNo:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      * @describe 根据批次号获取学员课程缴费记录
      * @author Joburgess
      * @date 2020.10.30
-     * @param batchNo:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      */
     List<CourseScheduleStudentPayment> findByBatchNo(@Param("batchNo") String batchNo);
+
+
+    /**
+     * 获取学生班级未开始的课程
+     */
+    List<CourseScheduleStudentPayment> getClassGroupNoStartCourse(@Param("classGroupIds") List<Integer> classGroupIds);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java

@@ -74,4 +74,11 @@ public interface CourseScheduleStudentPaymentService extends BaseService<Long, C
 	 */
 	void updateForMusicGroupWithPaymentCalender(String batchNo);
 
+	/**
+	 * 获取班级未开始的的课程
+	 * @param classGroupIds
+	 * @return
+	 */
+	List<CourseScheduleStudentPayment> getClassGroupNoStartCourse(List<Integer> classGroupIds);
+
 }

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

@@ -290,4 +290,12 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @return
      */
     StudentRegistration changeStudentSubject(Integer studentId, String musicGroupId, Integer originalSubjectId, Integer changeSubjectId);
+
+
+    /**
+     * 获取班级未上课程的价值
+     * @param classGroupIds
+     * @return
+     */
+    BigDecimal getClassGroupCourseExpectPrice(List<Integer> classGroupIds);
 }

+ 15 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
 
 @Service
 public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Long, CourseScheduleStudentPayment>  implements CourseScheduleStudentPaymentService {
-	
+
 	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 	@Autowired
@@ -418,4 +418,18 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 
 		courseScheduleStudentPaymentDao.batchUpdate(updateStudentPayments);
 	}
+
+	@Override
+	public List<CourseScheduleStudentPayment> getClassGroupNoStartCourse(List<Integer> classGroupIds) {
+		List<CourseScheduleStudentPayment> noStartCourses = courseScheduleStudentPaymentDao.getClassGroupNoStartCourse(classGroupIds);
+		Set<Long> needCoursesIds = new HashSet<>();
+		List<CourseScheduleStudentPayment> needCourses = new ArrayList<>();
+		for (CourseScheduleStudentPayment noStartCourse : noStartCourses) {
+			if (needCoursesIds.contains(noStartCourse.getCourseScheduleId())) continue;
+			needCoursesIds.add(noStartCourse.getId());
+			needCourses.add(noStartCourse);
+		}
+		return needCourses;
+	}
+
 }

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

@@ -105,6 +105,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private SubjectChangeDao subjectChangeDao;
     @Autowired
     private GoodsDao goodsDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -1191,4 +1193,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         return studentRegistration;
     }
+
+    @Override
+    public BigDecimal getClassGroupCourseExpectPrice(List<Integer> classGroupIds) {
+        List<CourseScheduleStudentPayment> classGroupNoStartCourse = courseScheduleStudentPaymentService.getClassGroupNoStartCourse(classGroupIds);
+        return BigDecimal.ZERO;
+    }
 }

+ 27 - 17
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -5,7 +5,7 @@
 不要修改此文件。所有改动将在下次重新自动生成时丢失。
 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao">
-	
+
 	<resultMap type="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" id="CourseScheduleStudentPayment">
 		<result column="id_" property="id" />
         <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
@@ -21,7 +21,7 @@
 		<result column="class_group_id_" property="classGroupId" />
 		<result column="batch_no_" property="batchNo"/>
 	</resultMap>
-	
+
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentCourseTimesDto" id="studentCourseTimesDto">
 		<result column="user_id_" property="userId" />
         <result column="totalTimes" property="totalCourseTimes"/>
@@ -29,22 +29,22 @@
 		<result column="practiceTmes" property="practiceCourseTimes" />
 		<result column="freePracticeTimes" property="freePracticeCourseTimes" />
 	</resultMap>
-	
+
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="CourseScheduleStudentPayment" >
-		SELECT * FROM course_schedule_student_payment WHERE id_ = #{id} 
+		SELECT * FROM course_schedule_student_payment WHERE id_ = #{id}
 	</select>
-	
+
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseScheduleStudentPayment">
 		SELECT * FROM course_schedule_student_payment ORDER BY id_
 	</select>
-	
+
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		<selectKey resultClass="int" keyProperty="id" >
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
 		</selectKey>
 		-->
 		INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,
@@ -64,7 +64,7 @@
 
     <!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
-		UPDATE course_schedule_student_payment 
+		UPDATE course_schedule_student_payment
 		<set>
 			<if test="userId != null">
 				user_id_ = #{userId},
@@ -100,7 +100,7 @@
 				original_price_ = #{originalPrice},
 			</if>
 				update_time_ = NOW()
-		</set> WHERE id_ = #{id} 
+		</set> WHERE id_ = #{id}
 	</update>
 
 	<update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
@@ -164,19 +164,19 @@
 
     <!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
-		DELETE FROM course_schedule_student_payment WHERE id_ = #{id} 
+		DELETE FROM course_schedule_student_payment WHERE id_ = #{id}
 	</delete>
-	
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleStudentPayment" parameterType="map">
 		SELECT * FROM course_schedule_student_payment ORDER BY id_ <include refid="global.limit"/>
 	</select>
-	
+
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM course_schedule_student_payment
 	</select>
-	
+
     <select id="findByCourseScheduleIds" resultMap="CourseScheduleStudentPayment">
 		SELECT * FROM course_schedule_student_payment WHERE course_schedule_id_ IN
 		<foreach collection="ids" item="id" open="(" close=")" separator=",">
@@ -407,16 +407,16 @@
 			#{userId}
 		</foreach>
 	</delete>
-	
+
 	<delete id="deleteByMusicGroupId" parameterType="map">
 		DELETE cssp FROM course_schedule_student_payment cssp left join course_schedule cs on cssp.course_schedule_id_ = cs.id_ WHERE cssp.music_group_id_=#{musicGroupId} AND cssp.group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and cs.status_ = 'NOT_START'
 	</delete>
 	<delete id="deleteByGroup">
 		DELETE FROM course_schedule_student_payment WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</delete>
-	
+
 	<select id="queryStudentNotStartCourseTimesOfOnline" resultMap="studentCourseTimesDto">
-		SELECT cssp.`user_id_`,count(*) totalTimes, 
+		SELECT cssp.`user_id_`,count(*) totalTimes,
 		sum(CASE pg.type_ WHEN 'FREE' THEN 0 WHEN 'CHARGE' THEN 1 END) practiceTmes,
 		sum(case when (pg.type_='FREE' AND cssp.`group_type_` = 'PRACTICE' ) then 1 ELSE 0 END) freePracticeTimes
 		FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cssp.course_schedule_id_ = cs.id_
@@ -525,4 +525,14 @@
     <select id="findByBatchNo" resultMap="CourseScheduleStudentPayment">
 		SELECT * FROM course_schedule_student_payment WHERE batch_no_=#{batchNo}
 	</select>
+
+    <select id="getClassGroupNoStartCourse" resultMap="CourseScheduleStudentPayment">
+		SELECT cssp.* FROM course_schedule_student_payment cssp
+        LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
+        WHERE cssp.class_group_id_ IN
+		<foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+			#{classGroupId}
+		</foreach>
+        AND cs.status_ = 'NOT_START' ORDER BY cssp.id_ ASC
+	</select>
 </mapper>

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

@@ -159,4 +159,12 @@ public class StudentRegistrationController extends BaseController {
         }
         return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
     }
+
+    @ApiOperation(value = "获取班级课程的价值")
+    @GetMapping("/getClassGroupCourseExpectPrice")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getClassGroupCourseExpectPrice')")
+    public Object getClassGroupCourseExpect(List<Integer> classGroupIds) {
+        return succeed(studentRegistrationService.getClassGroupCourseExpectPrice(classGroupIds));
+    }
+
 }