فهرست منبع

统计信息分装调整

Joburgess 5 سال پیش
والد
کامیت
674b45d34f

+ 1 - 4
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -9,7 +9,6 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
 /**
  * @Author Joburgess
@@ -24,8 +23,6 @@ public class CourseScheduleController extends BaseController {
     private CourseScheduleService scheduleService;
     @Autowired
     private StudentAttendanceService studentAttendanceService;
-    @Autowired
-    private RestTemplate restTemplate;
 
     @ApiOperation(value = "根据课程ID查询正在或即将开始的课程")
     @GetMapping("/getCurrentCourseDetail/{courseID}")
@@ -36,7 +33,7 @@ public class CourseScheduleController extends BaseController {
     @ApiOperation(value = "根据班级ID获取当前课程的学生")
     @GetMapping("/getCurrentCourseStudents")
     public Object getCurrentCourseStudents(@RequestBody StudentAttendanceQueryInfo queryInfo){
-        return succeed(studentAttendanceService.queryPage(queryInfo));
+        return succeed(studentAttendanceService.getCurrentCourseStudents(queryInfo));
     }
 
 }

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

@@ -33,4 +33,6 @@ public class TeacherAttendanceController extends BaseController {
         return succeed(teacherAttendanceService.queryPage(queryInfo));
     }
 
+
+
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/dal/dao/CourseScheduleDao.java

@@ -12,5 +12,5 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param teacherID
      * @return
      */
-    TeacherAttendanceDto getCurrentCourseDetail(@Param("teacherID") Long teacherID);
+    TeacherAttendanceDto getCurrentCourseDetail(@Param("courseID") Long courseID);
 }

+ 0 - 22
mec-web/src/main/java/com/ym/mec/web/dal/dto/StudentAttendancePageInfo.java

@@ -1,22 +0,0 @@
-package com.ym.mec.web.dal.utilEntity;
-
-import com.ym.mec.common.page.PageInfo;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @Author Joburgess
- * @Date 2019/9/12
- */
-public class StudentAttendancePageInfo extends PageInfo {
-
-    @ApiModelProperty(value = "请假人数",required = false)
-    private Integer numberOfLeavePeoples;
-
-    public Integer getNumberOfLeavePeoples() {
-        return numberOfLeavePeoples;
-    }
-
-    public void setNumberOfLeavePeoples(Integer numberOfLeavePeoples) {
-        this.numberOfLeavePeoples = numberOfLeavePeoples;
-    }
-}

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

@@ -11,5 +11,5 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
      * @Date: 2019/9/10
      * 根据课程ID获取当前课程的信息
      */
-    TeacherAttendanceDto getCurrentCourseDetail(Long teacherId);
+    TeacherAttendanceDto getCurrentCourseDetail(Long courseID);
 }

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/service/StudentAttendanceService.java

@@ -1,9 +1,11 @@
 package com.ym.mec.web.service;
 
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.web.dal.entity.StudentAttendance;
 
 import java.util.List;
+import java.util.Map;
 
 public interface StudentAttendanceService extends BaseService<Long, StudentAttendance> {
 
@@ -13,4 +15,11 @@ public interface StudentAttendanceService extends BaseService<Long, StudentAtten
      * 批量插入学生上课签到信息
      */
     void addStudentAttendances(List<StudentAttendance> studentAttendances);
+
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/9/16
+     * 获取当前课程的学生
+     */
+    Map<String, Object> getCurrentCourseStudents(QueryInfo queryInfo);
 }

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/service/impl/CourseScheduleServiceImpl.java

@@ -24,8 +24,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	@Override
-	public TeacherAttendanceDto getCurrentCourseDetail(Long teacherId) {
-		TeacherAttendanceDto currentCourseDetail = courseScheduleDao.getCurrentCourseDetail(teacherId);
+	public TeacherAttendanceDto getCurrentCourseDetail(Long courseID) {
+		TeacherAttendanceDto currentCourseDetail = courseScheduleDao.getCurrentCourseDetail(courseID);
 		currentCourseDetail.setCurrentTime(new Date());
 		currentCourseDetail.setTeacherAttendanceTimeGap(ParamEnum.TEACHER_ATTENDANCE_TIME_GAP);
 		return currentCourseDetail;

+ 8 - 11
mec-web/src/main/java/com/ym/mec/web/service/impl/StudentAttendanceServiceImpl.java

@@ -9,12 +9,13 @@ import com.ym.mec.web.dal.dto.StudentStatusCountUtilEntity;
 import com.ym.mec.web.dal.entity.StudentAttendance;
 import com.ym.mec.web.dal.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.web.dal.page.StudentAttendanceQueryInfo;
-import com.ym.mec.web.dal.utilEntity.StudentAttendancePageInfo;
 import com.ym.mec.web.service.StudentAttendanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentAttendance>  implements StudentAttendanceService {
@@ -37,28 +38,24 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 	}
 
 	@Override
-	public StudentAttendancePageInfo queryPage(QueryInfo queryInfo) {
+	public Map<String, Object> getCurrentCourseStudents(QueryInfo queryInfo) {
+		Map<String,Object> result=new HashMap<>();
+
 		PageInfo pageInfo = super.queryPage(queryInfo);
-		StudentAttendancePageInfo studentAttendancePageInfo = new StudentAttendancePageInfo();
 
-		studentAttendancePageInfo.setPageNo(pageInfo.getPageNo());
-		studentAttendancePageInfo.setOffset(pageInfo.getOffset());
-		studentAttendancePageInfo.setLimit(pageInfo.getLimit());
-		studentAttendancePageInfo.setTotalPage(pageInfo.getTotalPage());
-		studentAttendancePageInfo.setTotal(pageInfo.getTotal());
-		studentAttendancePageInfo.setRows(pageInfo.getRows());
+		result.put("pageInfo",pageInfo);
 
 		List<StudentStatusCountUtilEntity> stringIntegerMap = studentAttendanceDao.countStudentStatus(((StudentAttendanceQueryInfo) queryInfo).getClassId());
 
 		stringIntegerMap.forEach(studentStatusCount->{
 			switch (studentStatusCount.getStudentStatus()){
 				case LEAVE:
-					studentAttendancePageInfo.setNumberOfLeavePeoples(studentStatusCount.getNumberOfStudent());
+					result.put("numberOfLeavePeoples",studentStatusCount.getNumberOfStudent());
 					break;
 
 			}
 		});
 
-		return studentAttendancePageInfo;
+		return result;
 	}
 }

+ 1 - 3
mec-web/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -133,9 +133,7 @@
         LEFT JOIN class_group cg ON cs.class_group_id_=cg.id_
         LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
         LEFT JOIN school s ON mg.school_id_=s.id_
-        WHERE
-            DATE_FORMAT( class_date_, "%Y%m%d" ) = DATE_FORMAT( NOW(), "%Y%m%d" )
-            AND cs.id_= #{teacherID}
+        WHERE cs.id_= #{courseID}
     </select>
 
     <resultMap id="studentAttendanceViewUtilEntity" type="com.ym.mec.web.dal.dto.StudentAttendanceViewDto">