Przeglądaj źródła

Merge branch 'master' of git.dayaedu.com:yonge/mec

chengpeng 5 lat temu
rodzic
commit
cf14cfcff0

+ 5 - 3
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -2,7 +2,9 @@ package com.ym.mec.education.controller;
 
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.entity.CourseSchedule;
 import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.resp.CourseScheduleResp;
 import com.ym.mec.education.service.ICourseScheduleService;
 import io.swagger.annotations.Api;
@@ -36,10 +38,10 @@ public class CourseScheduleController {
         return courseScheduleService.getPage(classGroupReq);
     }
 
-    @PostMapping("/infoByGroupId")
+    @PostMapping("/info")
     @ApiOperation("点名详情-头信息")
-    public BaseResponse<CourseScheduleResp> getInfoByGroupId(@RequestBody ClassGroupReq courseScheduleReq) {
-        return courseScheduleService.getInfoByGroupId(courseScheduleReq);
+    public BaseResponse<CourseScheduleResp> getInfo(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return courseScheduleService.getInfo(courseScheduleReq);
     }
 
     @PostMapping("/statisticsInfo")

+ 4 - 3
mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java

@@ -2,6 +2,7 @@ package com.ym.mec.education.controller;
 
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.service.IStudentAttendanceService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -33,10 +34,10 @@ public class StudentAttendanceController {
         return studentAttendanceService.getPage(classGroupReq);
     }
 
-    @PostMapping("/listRollCall")
+    @PostMapping("/listByCourse")
     @ApiOperation("点名详情-考勤列表")
-    public PageResponse listRollCall(@RequestBody ClassGroupReq classGroupReq) {
-        return studentAttendanceService.getPageRollCall(classGroupReq);
+    public PageResponse listByCourse(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return studentAttendanceService.getPageByCourse(courseScheduleReq);
     }
 
     @PostMapping("/statisticsList")

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResp.java

@@ -41,4 +41,7 @@ public class StudentAttendanceResp implements Serializable {
 
     @ApiModelProperty(value = "上课星期")
     private String classWeek;
+
+    @ApiModelProperty(value = "课程计划id")
+    private Long courseScheduleId;
 }

+ 2 - 9
mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java

@@ -26,10 +26,10 @@ public interface ICourseScheduleService extends IService<CourseSchedule> {
 
     /**
      * 根据课程计划id获取课程计划详情
-     * @param classGroupReq
+     * @param courseScheduleReq
      * @return
      */
-    BaseResponse getInfoByGroupId(ClassGroupReq classGroupReq);
+    BaseResponse getInfo(CourseScheduleReq courseScheduleReq);
 
     /**
      * 历史考勤统计-头信息
@@ -37,11 +37,4 @@ public interface ICourseScheduleService extends IService<CourseSchedule> {
      * @return
      */
     BaseResponse getStatisticsInfo(ClassGroupReq classGroupReq);
-
-    /**
-     * 根据班级id获取最新你的课程计划
-     * @param classGroupId
-     * @return
-     */
-    CourseSchedule getLastCourseSchedule(Integer classGroupId);
 }

+ 3 - 2
mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.StudentAttendance;
 import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.req.CourseScheduleReq;
 
 /**
  * <p>
@@ -20,10 +21,10 @@ public interface IStudentAttendanceService extends IService<StudentAttendance> {
     /**
      * 点名详情-最新学生考勤列表
      *
-     * @param classGroupReq
+     * @param courseScheduleReq
      * @return
      */
-    PageResponse getPageRollCall(ClassGroupReq classGroupReq);
+    PageResponse getPageByCourse(CourseScheduleReq courseScheduleReq);
 
     /**
      * 历史考勤统计-列表

+ 4 - 24
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -12,6 +12,7 @@ import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
 import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.resp.CourseScheduleResp;
 import com.ym.mec.education.service.*;
 import com.ym.mec.education.utils.DateUtil;
@@ -20,7 +21,6 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
-
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
@@ -95,12 +95,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
     }
 
     @Override
-    public BaseResponse<CourseScheduleResp> getInfoByGroupId(ClassGroupReq classGroupReq) {
-        if (Objects.isNull(classGroupReq.getGroupId())) {
+    public BaseResponse<CourseScheduleResp> getInfo(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
             return BaseResponse.errorParam();
         }
         CourseScheduleResp courseScheduleResp = new CourseScheduleResp();
-        CourseSchedule courseSchedule = getLastCourseSchedule(classGroupReq.getGroupId());
+        CourseSchedule courseSchedule = getById(courseScheduleReq.getCourseScheduleId());
         if (Objects.nonNull(courseSchedule)) {
             if (Objects.nonNull(courseSchedule.getClassDate())) {
                 courseScheduleResp.setClassDate(DateUtil.date2String(courseSchedule.getClassDate()) + "(" +
@@ -165,24 +165,4 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
         }
         return BaseResponse.success(courseScheduleResp);
     }
-
-    /**
-     * 获取最新的课表记录
-     * @param classGroupId
-     * @return
-     */
-    @Override
-    public CourseSchedule getLastCourseSchedule(Integer classGroupId) {
-        QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
-        courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, classGroupId)
-                .orderByDesc(true, CourseSchedule::getCreateTime);
-        List<CourseSchedule> courseScheduleList = list(courseScheduleQueryWrapper);
-        if (!CollectionUtils.isEmpty(courseScheduleList)) {
-            Optional<CourseSchedule> first = courseScheduleList.stream().findFirst();
-            if (first.isPresent()) {
-                return first.get();
-            }
-        }
-        return null;
-    }
 }

+ 7 - 6
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java

@@ -11,6 +11,7 @@ import com.ym.mec.education.entity.*;
 import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.StudentAttendanceMapper;
 import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.resp.StudentAttendanceResp;
 import com.ym.mec.education.resp.StudentAttendanceStatisticsResp;
 import com.ym.mec.education.service.*;
@@ -20,7 +21,6 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
-
 import java.util.List;
 import java.util.Objects;
 
@@ -75,6 +75,7 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
         Integer normalCount = count(normalWrapper);
         page.getRecords().forEach(item -> {
             StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
+            studentAttendanceResp.setCourseScheduleId(item.getCourseScheduleId());
             studentAttendanceResp.setLeaveNum(leaveCount);
             if (totalCount != 0) {
                 studentAttendanceResp.setAttendanceRate(normalCount + "/" + totalCount);
@@ -99,16 +100,16 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
     }
 
     @Override
-    public PageResponse getPageRollCall(ClassGroupReq classGroupReq) {
-        if (Objects.isNull(classGroupReq.getGroupId())) {
+    public PageResponse getPageByCourse(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
             return PageResponse.errorParam();
         }
-        CourseSchedule courseSchedule = courseScheduleService.getLastCourseSchedule(classGroupReq.getGroupId());
+        CourseSchedule courseSchedule = courseScheduleService.getById(courseScheduleReq.getCourseScheduleId());
         Page<StudentAttendanceResp> pageResult = new Page<>();
         if (Objects.nonNull(courseSchedule)) {
-            Page<StudentAttendance> studentAttendancePage = new Page<StudentAttendance>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+            Page<StudentAttendance> studentAttendancePage = new Page<StudentAttendance>(courseScheduleReq.getPageNo(), courseScheduleReq.getPageSize());
             QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(true, StudentAttendance::getClassGroupId, classGroupReq.getGroupId())
+            queryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
                     .eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId());
             IPage<StudentAttendance> page = page(studentAttendancePage, queryWrapper);
             if (!CollectionUtils.isEmpty(page.getRecords())) {