Browse Source

学员小课统计

zouxuan 3 years ago
parent
commit
dc86468b58

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

@@ -37,18 +37,18 @@ public interface StudentStatisticsDao extends BaseDAO<Integer, StudentStatistics
     void updateNormalGroupNum();
 
     //汇总小课数据
-    StudentStatisticsSumDto studentSmallClassStatisticsSum(String groupType);
+    StudentStatisticsSumDto studentSmallClassStatisticsSum(@Param("groupType") String groupType, @Param("organId") String organId);
 
     //统计新增人数
-    Integer countAddStudentNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    Integer countAddStudentNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("organId") String organId);
 
     //统计续费人数
-    Integer countRenewStudentNum(@Param("groupType") String groupType, @Param("endDate") String endDate);
+    Integer countRenewStudentNum(@Param("groupType") String groupType, @Param("endDate") String endDate, @Param("organId") String organId);
 
     //统计回访人数
-    Integer countVisitNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    Integer countVisitNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("organId") String organId);
 
-    Integer countLostStudentNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    Integer countLostStudentNum(@Param("groupType") String groupType, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("organId") String organId);
 
     //获取指导老师列表
     List<Integer> queryTeacherIds(@Param("groupType") String groupType);

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

@@ -21,10 +21,10 @@ public interface StudentStatisticsService extends BaseService<Integer, StudentSt
     PageInfo<StudentStatisticsDto> queryStatisticsPage(StudentStatisticsQueryInfo queryInfo);
 
     //获取小课数据统计汇总
-    StudentStatisticsSumDto studentSmallClassStatisticsSum(String groupType);
+    StudentStatisticsSumDto studentSmallClassStatisticsSum(String groupType,String organId);
 
     //按时间获取统计数据
-    StudentStatisticsSumForDateDto studentSmallClassStatisticsSumForDate(String groupType, String startDate, String endDate);
+    StudentStatisticsSumForDateDto studentSmallClassStatisticsSumForDate(String groupType, String startDate, String endDate,String organId);
 
     //获取指导老师列表
     List<Map<Integer, String>> queryTeacherList(String groupType);

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

@@ -78,21 +78,21 @@ public class StudentStatisticsServiceImpl extends BaseServiceImpl<Integer, Stude
 	}
 
     @Override
-    public StudentStatisticsSumDto studentSmallClassStatisticsSum(String groupType) {
-		return studentStatisticsDao.studentSmallClassStatisticsSum(groupType);
+    public StudentStatisticsSumDto studentSmallClassStatisticsSum(String groupType,String organId) {
+		return studentStatisticsDao.studentSmallClassStatisticsSum(groupType,organId);
     }
 
     @Override
-    public StudentStatisticsSumForDateDto studentSmallClassStatisticsSumForDate(String groupType, String startDate, String endDate) {
+    public StudentStatisticsSumForDateDto studentSmallClassStatisticsSumForDate(String groupType, String startDate, String endDate,String organId) {
 		StudentStatisticsSumForDateDto sumForDateDto = new StudentStatisticsSumForDateDto();
 		//获取流失人数
-		sumForDateDto.setLostNum(studentStatisticsDao.countLostStudentNum(groupType,startDate,endDate));
+		sumForDateDto.setLostNum(studentStatisticsDao.countLostStudentNum(groupType,startDate,endDate,organId));
 		//获取新增人数
-		sumForDateDto.setAddNum(studentStatisticsDao.countAddStudentNum(groupType,startDate,endDate));
+		sumForDateDto.setAddNum(studentStatisticsDao.countAddStudentNum(groupType,startDate,endDate,organId));
 		//获取续费人数
-		sumForDateDto.setRenewNum(studentStatisticsDao.countRenewStudentNum(groupType,endDate));
+		sumForDateDto.setRenewNum(studentStatisticsDao.countRenewStudentNum(groupType,endDate,organId));
 		//获取回访人数
-		sumForDateDto.setVisitNum(studentStatisticsDao.countVisitNum(groupType,startDate,endDate));
+		sumForDateDto.setVisitNum(studentStatisticsDao.countVisitNum(groupType,startDate,endDate,organId));
         return sumForDateDto;
     }
 

+ 13 - 0
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -268,7 +268,11 @@
 		SUM(ss.no_schedule_num_) 'noScheduleNum'
 		FROM student_statistics ss
 		LEFT JOIN sys_user_cash_account suca ON ss.user_id_ = suca.user_id_
+		LEFT JOIN student_basic_info sbi ON ss.user_id_ = sbi.user_id_
 		WHERE ss.group_type_ = #{groupType}
+		<if test="organId != null and organId != ''">
+			AND FIND_IN_SET(sbi.organ_id_,#{organId})
+		</if>
 	</select>
     <select id="countAddStudentNum" resultType="java.lang.Integer">
 		SELECT COUNT(extend_info_) FROM (
@@ -284,6 +288,9 @@
 			'STUDENT_PRACTICE_ORDER_NUM'
 		</if>
 		AND extend_info_ IS NOT NULL
+		<if test="organId != null and organId != ''">
+			AND FIND_IN_SET(organ_id_,#{organId})
+		</if>
 		GROUP BY extend_info_
 		<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
 			HAVING COUNT(CASE WHEN month_ &lt; #{startDate} THEN 1 ELSE NULL END) &lt; 1
@@ -314,6 +321,9 @@
 		<if test="groupType == 'PRACTICE'">
 			'网管课回访'
 		</if>
+		<if test="organId != null and organId != ''">
+			AND FIND_IN_SET(organ_id_,#{organId})
+		</if>
 	</select>
 	<select id="countLostStudentNum" resultType="java.lang.Integer">
 		SELECT SUM(total_num_) FROM index_base_month_data
@@ -324,6 +334,9 @@
 		<if test="endDate != null and endDate != ''">
 			AND month_ &lt;= #{startDate}
 		</if>
+		<if test="organId != null and organId != ''">
+			AND FIND_IN_SET(organ_id_,#{organId})
+		</if>
 	</select>
 	<select id="queryTeacherIds" resultType="java.lang.Integer">
 		SELECT DISTINCT teacher_id_ FROM student_statistics WHERE group_type_ = #{groupType} AND teacher_id_ IS NOT NULL

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/StudentStatisticsController.java

@@ -60,7 +60,7 @@ public class StudentStatisticsController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentStatistics/studentSmallClassStatisticsSum')")
     @ApiImplicitParam(name = "groupType", value = "VIP、THEORY、PRACTICE", required = true, dataType = "String")
     public HttpResponseResult<StudentStatisticsSumDto> studentSmallClassStatisticsSum(String groupType) {
-        return succeed(studentStatisticsService.studentSmallClassStatisticsSum(groupType));
+        return succeed(studentStatisticsService.studentSmallClassStatisticsSum(groupType,organizationService.getEmployeeOrgan(null)));
     }
 
     @ApiOperation(value = "小课学员管理按时间汇总")
@@ -72,7 +72,7 @@ public class StudentStatisticsController extends BaseController {
     })
     @PreAuthorize("@pcs.hasPermissions('studentStatistics/studentSmallClassStatisticsSumForDate')")
     public HttpResponseResult<StudentStatisticsSumForDateDto> studentSmallClassStatisticsSumForDate(String groupType, String startDate, String endDate) {
-        return succeed(studentStatisticsService.studentSmallClassStatisticsSumForDate(groupType,startDate,endDate));
+        return succeed(studentStatisticsService.studentSmallClassStatisticsSumForDate(groupType,startDate,endDate,organizationService.getEmployeeOrgan(null)));
     }
 
     @ApiOperation(value = "获取指导老师列表")