Browse Source

课程统计

zouxuan 3 years ago
parent
commit
7bf0897e78

+ 3 - 3
codegen/src/main/resources/generateConfigration.xml

@@ -2,11 +2,11 @@
 <GenerateConfiguration>
 	<dbConfiguration>
 		<driverClass>com.mysql.jdbc.Driver</driverClass>
-		<url>jdbc:mysql://47.114.1.200:3306/mec_dev</url>
+		<url>jdbc:mysql://47.114.176.40:3306/mec_test</url>
 		<username>mec_dev</username>
 		<password>dayaDataOnline@2019</password>
-		<catalog>mec_dev</catalog>
-		<schema>mec_dev</schema>
+		<catalog>mec_test</catalog>
+		<schema>mec_test</schema>
 	</dbConfiguration>
 	<srcBase>/Users/chenxiaoyu/Documents/javabean</srcBase>
 	<pojoPackageName>com.ym.mec.biz.dal.entity</pojoPackageName>

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStatisticsDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.CourseScheduleStatistics;
+
+public interface CourseScheduleStatisticsDao extends BaseDAO<Long, CourseScheduleStatistics> {
+
+	
+}

+ 125 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStatistics.java

@@ -0,0 +1,125 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(course_schedule_statistics):
+ */
+public class CourseScheduleStatistics {
+
+	/**  */
+	private Long id;
+	
+	/** 课程编号 */
+	private Long courseScheduleId;
+	
+	/** 乐团编号 */
+	private String musicGroupId;
+	
+	/** 学员总数 */
+	private Integer courseStudentTotalNum;
+	
+	/** 考勤正常人数 */
+	private Integer attendanceNum;
+	
+	/** 迟到人数 */
+	private Integer lateNum;
+	
+	/** 达标人数 */
+	private Integer standardNum;
+	
+	/** 是否布置作业 */
+	private boolean homeworkFlag;
+	
+	/** 提交作业人数 */
+	private Integer homeworkCommitNum;
+	
+	/** 是否服务 */
+	private boolean serviceFlag;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setCourseScheduleId(Long courseScheduleId){
+		this.courseScheduleId = courseScheduleId;
+	}
+	
+	public Long getCourseScheduleId(){
+		return this.courseScheduleId;
+	}
+			
+	public void setMusicGroupId(String musicGroupId){
+		this.musicGroupId = musicGroupId;
+	}
+	
+	public String getMusicGroupId(){
+		return this.musicGroupId;
+	}
+			
+	public void setCourseStudentTotalNum(Integer courseStudentTotalNum){
+		this.courseStudentTotalNum = courseStudentTotalNum;
+	}
+	
+	public Integer getCourseStudentTotalNum(){
+		return this.courseStudentTotalNum;
+	}
+			
+	public void setAttendanceNum(Integer attendanceNum){
+		this.attendanceNum = attendanceNum;
+	}
+	
+	public Integer getAttendanceNum(){
+		return this.attendanceNum;
+	}
+			
+	public void setLateNum(Integer lateNum){
+		this.lateNum = lateNum;
+	}
+	
+	public Integer getLateNum(){
+		return this.lateNum;
+	}
+			
+	public void setStandardNum(Integer standardNum){
+		this.standardNum = standardNum;
+	}
+	
+	public Integer getStandardNum(){
+		return this.standardNum;
+	}
+			
+	public void setHomeworkFlag(boolean homeworkFlag){
+		this.homeworkFlag = homeworkFlag;
+	}
+	
+	public boolean isHomeworkFlag(){
+		return this.homeworkFlag;
+	}
+			
+	public void setHomeworkCommitNum(Integer homeworkCommitNum){
+		this.homeworkCommitNum = homeworkCommitNum;
+	}
+	
+	public Integer getHomeworkCommitNum(){
+		return this.homeworkCommitNum;
+	}
+			
+	public void setServiceFlag(boolean serviceFlag){
+		this.serviceFlag = serviceFlag;
+	}
+	
+	public boolean isServiceFlag(){
+		return this.serviceFlag;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStatisticsService.java

@@ -0,0 +1,25 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleStatistics;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.List;
+
+public interface CourseScheduleStatisticsService extends BaseService<Long, CourseScheduleStatistics> {
+
+    //初始化数据
+    void init(List<Long> courseScheduleIds);
+
+    //同步课程学员总数
+    void syncStudentNum(List<Long> courseScheduleIds);
+
+    //同步考勤相关数据
+    void syncAttendance(List<Long> courseScheduleIds);
+
+    //同步作业相关
+    void syncHomework(List<Long> courseScheduleIds);
+
+    //同步服务指标
+    void syncServiceTar(List<Long> courseScheduleIds);
+
+}

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

@@ -160,7 +160,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
     @Autowired
-    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    private CourseScheduleStatisticsService courseScheduleStatisticsService;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -603,7 +603,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList);
             // 检测新排课冲突
             courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
-            courseScheduleDao.batchAddCourseSchedules(courseScheduleList);
+            courseScheduleService.batchAddCourseSchedule(courseScheduleList);
         } finally {
             redisCache.releaseLocked(key, value);
         }

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

@@ -181,13 +181,13 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         organList.put("91420106333619290A", "2,武汉长乐长风乐器销售有限公司");
         organList.put("91440300326364429H", "1,深圳大雅乐盟网络教育股份有限公司");
 
-        organList.forEach((code, name) -> {
-            SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(code);
-            if (Objects.isNull(sysUserTsign)) {
-                String[] nameSplit = name.split(",");
-                addTsign(Integer.parseInt(nameSplit[0]), code, nameSplit[1], 1);
-            }
-        });
+//        organList.forEach((code, name) -> {
+//            SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(code);
+//            if (Objects.isNull(sysUserTsign)) {
+//                String[] nameSplit = name.split(",");
+//                addTsign(Integer.parseInt(nameSplit[0]), code, nameSplit[1], 1);
+//            }
+//        });
     }
 
     /**

+ 64 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStatisticsServiceImpl.java

@@ -0,0 +1,64 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.CourseScheduleStatisticsDao;
+import com.ym.mec.biz.dal.entity.CourseScheduleStatistics;
+import com.ym.mec.biz.service.CourseScheduleStatisticsService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class CourseScheduleStatisticsServiceImpl extends BaseServiceImpl<Long, CourseScheduleStatistics>  implements CourseScheduleStatisticsService {
+	
+	@Autowired
+	private CourseScheduleStatisticsDao courseScheduleStatisticsDao;
+	@Autowired
+	private RedissonClient redissonClient;
+
+	@Override
+	public BaseDAO<Long, CourseScheduleStatistics> getDAO() {
+		return courseScheduleStatisticsDao;
+	}
+
+	@Override
+	public void init(List<Long> courseScheduleIds) {
+		String bucketKey = "CourseScheduleStatistics:updateTime";
+		RBucket<String> bucket = redissonClient.getBucket(bucketKey);
+		String updateTime = bucket.get();
+		Date date = new Date();
+		if(StringUtils.isEmpty(updateTime)){
+			updateTime = DateUtil.format(DateUtil.addHours(date,1),DateUtil.EXPANDED_DATE_TIME_FORMAT);
+		}
+		//获取修改时间在指定时间之后的课程列表
+
+
+	}
+
+	@Override
+	public void syncStudentNum(List<Long> courseScheduleIds) {
+
+	}
+
+	@Override
+	public void syncAttendance(List<Long> courseScheduleIds) {
+
+	}
+
+	@Override
+	public void syncHomework(List<Long> courseScheduleIds) {
+
+	}
+
+	@Override
+	public void syncServiceTar(List<Long> courseScheduleIds) {
+
+	}
+}

+ 92 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStatisticsMapper.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.CourseScheduleStatisticsDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.CourseScheduleStatistics" id="CourseScheduleStatistics">
+		<result column="id_" property="id" />
+		<result column="course_schedule_id_" property="courseScheduleId" />
+		<result column="music_group_id_" property="musicGroupId" />
+		<result column="course_student_total_num_" property="courseStudentTotalNum" />
+		<result column="attendance_num_" property="attendanceNum" />
+		<result column="late_num_" property="lateNum" />
+		<result column="standard_num_" property="standardNum" />
+		<result column="homework_flag_" property="homeworkFlag" />
+		<result column="homework_commit_num_" property="homeworkCommitNum" />
+		<result column="service_flag_" property="serviceFlag" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="CourseScheduleStatistics" >
+		SELECT * FROM course_schedule_statistics WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="CourseScheduleStatistics">
+		SELECT * FROM course_schedule_statistics ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStatistics" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO course_schedule_statistics (id_,course_schedule_id_,music_group_id_,course_student_total_num_,attendance_num_,late_num_,standard_num_,homework_flag_,homework_commit_num_,service_flag_) VALUES(#{id},#{courseScheduleId},#{musicGroupId},#{courseStudentTotalNum},#{attendanceNum},#{lateNum},#{standardNum},#{homeworkFlag},#{homeworkCommitNum},#{serviceFlag})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStatistics">
+		UPDATE course_schedule_statistics <set>
+<if test="homeworkFlag != null">
+homework_flag_ = #{homeworkFlag},
+</if>
+<if test="attendanceNum != null">
+attendance_num_ = #{attendanceNum},
+</if>
+<if test="serviceFlag != null">
+service_flag_ = #{serviceFlag},
+</if>
+<if test="standardNum != null">
+standard_num_ = #{standardNum},
+</if>
+<if test="homeworkCommitNum != null">
+homework_commit_num_ = #{homeworkCommitNum},
+</if>
+<if test="id != null">
+id_ = #{id},
+</if>
+<if test="courseStudentTotalNum != null">
+course_student_total_num_ = #{courseStudentTotalNum},
+</if>
+<if test="courseScheduleId != null">
+course_schedule_id_ = #{courseScheduleId},
+</if>
+<if test="lateNum != null">
+late_num_ = #{lateNum},
+</if>
+<if test="musicGroupId != null">
+music_group_id_ = #{musicGroupId},
+</if>
+</set> WHERE id_ = #{id} 
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM course_schedule_statistics WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="CourseScheduleStatistics" parameterType="map">
+		SELECT * FROM course_schedule_statistics ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM course_schedule_statistics
+	</select>
+</mapper>

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

@@ -85,9 +85,9 @@
 
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
-		DELETE FROM student_basic_info WHERE user_id_ = #{userId} 
+		DELETE FROM student_basic_info WHERE user_id_ = #{userId}
 	</delete>
-	
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="StudentBasicInfo" parameterType="map">
 		SELECT * FROM student_basic_info ORDER BY user_id_ <include refid="global.limit"/>