Browse Source

小课统计

zouxuan 3 years ago
parent
commit
3db6b882ae

+ 12 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentStatisticsDao.java

@@ -5,12 +5,21 @@ import com.ym.mec.biz.dal.entity.StudentStatistics;
 
 public interface StudentStatisticsDao extends BaseDAO<Integer, StudentStatistics> {
 
-    //获取声部班老师
-    void querySubjectTeacher();
-
     //更新乐团主管、指导老师
     void updateTeacherAndEdu();
 
     //更新总课时数、已完成、剩余课时数、最近30天课耗
     void updateCourseNum();
+
+    //更新未排课总数
+    void updateNoCourseNum();
+
+    //更新未开始价值
+    void updateNotStartCourseFee();
+
+    //更新未排课课程价值
+    void updateNoCourseFee();
+
+    //更新第一次课的时间\最近一次课时间
+    void updateFirstAndLastCourseTime();
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java

@@ -15,6 +15,7 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
     PRACTICE_GROUP_BUY("PRACTICE_GROUP_BUY", "网管课报名"),
     PRACTICE_GROUP_RENEW("PRACTICE_GROUP_RENEW", "网管课续费"),
     COURSE_GROUP_BUY("COURSE_GROUP_BUY", "课程购买"),
+    //余额充值活动
     LUCK("LUCK", "福袋活动"),
     DOUBLE_ELEVEN2020("DOUBLE_ELEVEN2020", "2020双十一活动"),
     DOUBLE_ELEVEN2021("DOUBLE_ELEVEN2021", "2021双十一活动"),
@@ -23,6 +24,7 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
     OUTORDER("OUTORDER", "导入订单"),
     REPAIR("REPAIR", "乐器维修"),
     SUBJECT_CHANGE("SUBJECT_CHANGE", "声部更换"),
+    //包含考级费用和乐理课费用,乐理课的费用在detail里面,对于的订单类型是 DEGREE_REGISTRATION
     DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名"),
     MAINTENANCE("MAINTENANCE", "乐器保养"),
     REPLACEMENT("REPLACEMENT", "乐器置换"),

+ 7 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentStatisticsServiceImpl.java

@@ -37,16 +37,12 @@ public class StudentStatisticsServiceImpl extends BaseServiceImpl<Integer, Stude
 		//更新总课时数、已完成、剩余课时数、最近30天课耗
 		studentStatisticsDao.updateCourseNum();
 		//更新未排课总数
-
-
-		//获取学员列表
-		List<StudentBasicInfo> allStudentBasicInfoList = studentBasicInfoDao.findAll(new HashMap<>());
-		//切割学员列表
-		List<List<StudentBasicInfo>> partition = Lists.partition(allStudentBasicInfoList, 2000);
-		for (List<StudentBasicInfo> studentBasicInfoList : partition) {
-			List<Integer> studentIds = studentBasicInfoList.stream().map(e -> e.getUserId()).collect(Collectors.toList());
-			//获取声部班老师
-//			studentStatisticsDao.querySubjectTeacher(studentIds);
-		}
+		studentStatisticsDao.updateNoCourseNum();
+		//更新未开始价值总和
+		studentStatisticsDao.updateNotStartCourseFee();
+		//更新未排课价值
+		studentStatisticsDao.updateNoCourseFee();
+		//更新第一次课的时间\最近一次课时间
+		studentStatisticsDao.updateFirstAndLastCourseTime();
 	}
 }

+ 87 - 81
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -24,7 +24,8 @@
 		<result column="last_visit_status_" property="lastVisitStatus" />
 		<result column="visit_reason_" property="visitReason" />
 		<result column="last_visit_time_" property="lastVisitTime" />
-		<result column="pre_fee_" property="preFee" />
+		<result column="not_start_course_fee_" property="notStartCourseFee" />
+		<result column="no_course_fee_" property="noCourseFee" />
 		<result column="first_order_time_" property="firstOrderTime" />
 		<result column="last_order_time_" property="lastOrderTime" />
 		<result column="order_num_" property="orderNum" />
@@ -43,84 +44,84 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentStatistics" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO student_statistics (id_,user_id_,teacher_id_,teacher_name_,music_director_id_,music_director_name_,total_course_num_,over_course_num_,sub_course_num_,no_schedule_num_,first_course_time_,last_course_time_,lately_course_consumer_,visit_num_,last_visit_status_,visit_reason_,last_visit_time_,pre_fee_,first_order_time_,last_order_time_,order_num_,group_type_) VALUES(#{id},#{userId},#{teacherId},#{teacherName},#{musicDirectorId},#{musicDirectorName},#{totalCourseNum},#{overCourseNum},#{subCourseNum},#{noScheduleNum},#{firstCourseTime},#{lastCourseTime},#{latelyCourseConsumer},#{visitNum},#{lastVisitStatus},#{visitReason},#{lastVisitTime},#{preFee},#{firstOrderTime},#{lastOrderTime},#{orderNum},#{groupType})
+		INSERT INTO student_statistics (id_,user_id_,teacher_id_,teacher_name_,music_director_id_,
+		music_director_name_,total_course_num_,over_course_num_,sub_course_num_,
+		no_schedule_num_,first_course_time_,last_course_time_,lately_course_consumer_,
+		visit_num_,last_visit_status_,visit_reason_,last_visit_time_,not_start_course_fee_,no_course_fee_,first_order_time_,
+		last_order_time_,order_num_,group_type_)
+		VALUES(#{id},#{userId},#{teacherId},#{teacherName},#{musicDirectorId},#{musicDirectorName},
+		       #{totalCourseNum},#{overCourseNum},#{subCourseNum},#{noScheduleNum},#{firstCourseTime},#{lastCourseTime},
+		       #{latelyCourseConsumer},#{visitNum},#{lastVisitStatus},#{visitReason},#{lastVisitTime},#{notStartCourseFee},#{noCourseFee},#{firstOrderTime},
+		       #{lastOrderTime},#{orderNum},#{groupType})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentStatistics">
 		UPDATE student_statistics <set>
-<if test="overCourseNum != null">
-over_course_num_ = #{overCourseNum},
-</if>
-<if test="latelyCourseConsumer != null">
-lately_course_consumer_ = #{latelyCourseConsumer},
-</if>
-<if test="id != null">
-id_ = #{id},
-</if>
-<if test="lastCourseTime != null">
-last_course_time_ = #{lastCourseTime},
-</if>
-<if test="totalCourseNum != null">
-total_course_num_ = #{totalCourseNum},
-</if>
-<if test="musicDirectorName != null">
-music_director_name_ = #{musicDirectorName},
-</if>
-<if test="visitNum != null">
-visit_num_ = #{visitNum},
-</if>
-<if test="teacherName != null">
-teacher_name_ = #{teacherName},
-</if>
-<if test="userId != null">
-user_id_ = #{userId},
-</if>
-<if test="subCourseNum != null">
-sub_course_num_ = #{subCourseNum},
-</if>
-<if test="lastVisitStatus != null">
-last_visit_status_ = #{lastVisitStatus},
-</if>
-<if test="lastVisitTime != null">
-last_visit_time_ = #{lastVisitTime},
-</if>
-<if test="teacherId != null">
-teacher_id_ = #{teacherId},
-</if>
-<if test="musicDirectorId != null">
-music_director_id_ = #{musicDirectorId},
-</if>
-<if test="lastOrderTime != null">
-last_order_time_ = #{lastOrderTime},
-</if>
-<if test="firstOrderTime != null">
-first_order_time_ = #{firstOrderTime},
-</if>
-<if test="orderNum != null">
-order_num_ = #{orderNum},
-</if>
-<if test="groupType != null">
-group_type_ = #{groupType},
-</if>
-<if test="visitReason != null">
-visit_reason_ = #{visitReason},
-</if>
-<if test="preFee != null">
-pre_fee_ = #{preFee},
-</if>
-<if test="noScheduleNum != null">
-no_schedule_num_ = #{noScheduleNum},
-</if>
-<if test="firstCourseTime != null">
-first_course_time_ = #{firstCourseTime},
-</if>
-</set> WHERE id_ = #{id} 
+		<if test="overCourseNum != null">
+		over_course_num_ = #{overCourseNum},
+		</if>
+		<if test="latelyCourseConsumer != null">
+		lately_course_consumer_ = #{latelyCourseConsumer},
+		</if>
+		<if test="lastCourseTime != null">
+		last_course_time_ = #{lastCourseTime},
+		</if>
+		<if test="totalCourseNum != null">
+		total_course_num_ = #{totalCourseNum},
+		</if>
+		<if test="musicDirectorName != null">
+		music_director_name_ = #{musicDirectorName},
+		</if>
+		<if test="visitNum != null">
+		visit_num_ = #{visitNum},
+		</if>
+		<if test="teacherName != null">
+		teacher_name_ = #{teacherName},
+		</if>
+		<if test="subCourseNum != null">
+		sub_course_num_ = #{subCourseNum},
+		</if>
+		<if test="lastVisitStatus != null">
+		last_visit_status_ = #{lastVisitStatus},
+		</if>
+		<if test="lastVisitTime != null">
+		last_visit_time_ = #{lastVisitTime},
+		</if>
+		<if test="teacherId != null">
+		teacher_id_ = #{teacherId},
+		</if>
+		<if test="musicDirectorId != null">
+		music_director_id_ = #{musicDirectorId},
+		</if>
+		<if test="lastOrderTime != null">
+		last_order_time_ = #{lastOrderTime},
+		</if>
+		<if test="firstOrderTime != null">
+		first_order_time_ = #{firstOrderTime},
+		</if>
+		<if test="orderNum != null">
+		order_num_ = #{orderNum},
+		</if>
+		<if test="groupType != null">
+		group_type_ = #{groupType},
+		</if>
+		<if test="visitReason != null">
+		visit_reason_ = #{visitReason},
+		</if>
+		<if test="notStartCourseFee != null">
+			not_start_course_fee_ = #{notStartCourseFee},
+		</if>
+		<if test="noCourseFee != null">
+			no_course_fee_ = #{noCourseFee},
+		</if>
+		<if test="noScheduleNum != null">
+		no_schedule_num_ = #{noScheduleNum},
+		</if>
+		<if test="firstCourseTime != null">
+		first_course_time_ = #{firstCourseTime},
+		</if>
+		</set> WHERE id_ = #{id}
 	</update>
 	<update id="updateTeacherAndEdu">
 		SELECT updateTeacherAndEdu()
@@ -128,6 +129,18 @@ first_course_time_ = #{firstCourseTime},
 	<update id="updateCourseNum">
 		SELECT updateCourseNum()
 	</update>
+	<update id="updateNoCourseNum">
+		SELECT updateNoCourseNum()
+	</update>
+	<update id="updateNotStartCourseFee">
+		SELECT updateNotStartCourseFee()
+	</update>
+	<update id="updateNoCourseFee">
+		SELECT updateNoCourseFee()
+	</update>
+	<update id="updateFirstAndLastCourseTime">
+		SELECT updateFirstAndLastCourseTime()
+	</update>
 
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
@@ -143,11 +156,4 @@ first_course_time_ = #{firstCourseTime},
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM student_statistics
 	</select>
-    <select id="querySubjectTeacher">
-		SELECT cgsm.user_id_ student_id_,cgtm.user_id_ teacher_id_ FROM class_group cg
-		LEFT JOIN class_group_student_mapper cgsm ON cgsm.class_group_id_ = cg.id_
-		LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cg.id_
-		WHERE cg.type_ = 'NORMAL' AND cgsm.status_ = 'NORMAL' AND cg.del_flag_ = 0
-		GROUP BY cgsm.user_id_
-	</select>
 </mapper>