Browse Source

Merge branch 'master' of https://gitee.com/zouxuan/mec

zouxuan 5 years ago
parent
commit
db3c9871cc

+ 1 - 0
.gitignore

@@ -9,3 +9,4 @@ bin
 /manage-center/src/main/resources/config/properties/generatorConfig.xml
 /p2p-utils/.gitignore
 .idea
+*.iml

+ 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);
 }

+ 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;

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

@@ -16,10 +16,16 @@ 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.service.StudentAttendanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
-@Service
-public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentAttendance> implements StudentAttendanceService {
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
+@Service
+public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentAttendance>  implements StudentAttendanceService {
+	
 	@Autowired
 	private StudentAttendanceDao studentAttendanceDao;
 
@@ -38,30 +44,24 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 	}
 
 	@Override
-	public StudentAttendancePageInfo queryPage(QueryInfo queryInfo) {
-		PageInfo<StudentAttendance> pageInfo = super.queryPage(queryInfo);
-		StudentAttendancePageInfo studentAttendancePageInfo = new StudentAttendancePageInfo();
+	public Map<String, Object> getCurrentCourseStudents(QueryInfo queryInfo) {
+		Map<String,Object> result=new HashMap<>();
+
+		PageInfo pageInfo = super.queryPage(queryInfo);
 
-		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());
-				break;
-			default:
-				break;
+		stringIntegerMap.forEach(studentStatusCount->{
+			switch (studentStatusCount.getStudentStatus()){
+				case LEAVE:
+					result.put("numberOfLeavePeoples",studentStatusCount.getNumberOfStudent());
+					break;
 
 			}
 		});
 
-		return studentAttendancePageInfo;
+		return result;
 	}
 }

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

@@ -99,7 +99,7 @@
         <result property="classDate" column="class_date_"/>
         <result property="startClassTime" column="start_class_time_"/>
         <result property="endClassTime" column="end_class_time_"/>
-        <result property="courseStatus" column="course_status_"/>
+        <result property="courseStatus" column="course_status_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="classId" column="class_id"/>
         <result property="subjectId" column="subject_id_"/>
         <result property="className" column="class_name"/>
@@ -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">
@@ -145,7 +143,7 @@
         <result property="musicGroupId" column="music_group_id_"/>
         <result property="subjectId" column="subject_id_"/>
         <result property="subjectName" column="subject_name_"/>
-        <result property="status" column="status_"/>
+        <result property="status" column="status_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
 
     <select id="getCurrentCourseStudents" resultMap="studentAttendanceViewUtilEntity">

+ 2 - 2
mec-web/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -46,7 +46,7 @@
       INSERT INTO student_attendance ( music_group_id_, subject_id_, class_group_id_, course_schedule_id_, user_id_, teacher_id_, status_, create_time_, remark_ )
       VALUES
 	  <foreach collection="list" item="studentAttendance" separator=",">
-          (#{studentAttendance.musicGroupId},#{studentAttendance.subjectId},#{studentAttendance.classGroupId},#{studentAttendance.courseScheduleId},#{studentAttendance.userId},#{studentAttendance.teacherId},#{studentAttendance.status},now(),#{studentAttendance.remark})
+          (#{studentAttendance.musicGroupId},#{studentAttendance.subjectId},#{studentAttendance.classGroupId},#{studentAttendance.courseScheduleId},#{studentAttendance.userId},#{studentAttendance.teacherId},#{studentAttendance.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{studentAttendance.remark})
       </foreach>
     </insert>
 
@@ -94,7 +94,7 @@
         <result property="musicGroupId" column="music_group_id_"/>
         <result property="subjectId" column="subject_id_"/>
         <result property="subjectName" column="subject_name_"/>
-        <result property="status" column="status_"/>
+        <result property="status" column="status_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
 
     <!-- 分页查询 -->