Pārlūkot izejas kodu

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

yonge 5 gadi atpakaļ
vecāks
revīzija
8303c4a0dc
24 mainītis faili ar 638 papildinājumiem un 55 dzēšanām
  1. 7 0
      mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java
  2. 6 0
      mec-education/src/main/java/com/ym/mec/education/base/PageResponse.java
  3. 0 8
      mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java
  4. 19 1
      mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java
  5. 70 0
      mec-education/src/main/java/com/ym/mec/education/controller/HomeWorkController.java
  6. 13 0
      mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java
  7. 14 0
      mec-education/src/main/java/com/ym/mec/education/enums/StudentAttendanceStatusEnum.java
  8. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/StudentCourseHomeworkMapper.java
  9. 20 0
      mec-education/src/main/java/com/ym/mec/education/req/CourseScheduleReq.java
  10. 15 0
      mec-education/src/main/java/com/ym/mec/education/req/HomeWorkReq.java
  11. 4 5
      mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java
  12. 25 4
      mec-education/src/main/java/com/ym/mec/education/resp/CourseScheduleResp.java
  13. 39 0
      mec-education/src/main/java/com/ym/mec/education/resp/HomeWrokResp.java
  14. 15 6
      mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResp.java
  15. 41 0
      mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceStatisticsResp.java
  16. 21 0
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java
  17. 5 0
      mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.java
  18. 4 1
      mec-education/src/main/java/com/ym/mec/education/service/IStudentCourseHomeworkService.java
  19. 3 0
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java
  20. 7 3
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java
  21. 97 8
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java
  22. 133 15
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java
  23. 71 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentCourseHomeworkServiceImpl.java
  24. 8 2
      mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

+ 7 - 0
mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java

@@ -37,4 +37,11 @@ public class BaseResponse<T> extends Response implements Serializable {
         baseResponse.setDataInfo(dataInfo);
         return baseResponse;
     }
+
+    public static BaseResponse errorParam(){
+        BaseResponse baseResponse = new BaseResponse();
+        baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+        baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
+        return baseResponse;
+    }
 }

+ 6 - 0
mec-education/src/main/java/com/ym/mec/education/base/PageResponse.java

@@ -175,4 +175,10 @@ public class PageResponse<T> extends Response implements Serializable {
         return pg.append(" }").toString();
     }
 
+    public static PageResponse errorParam(){
+        PageResponse pageResponse = new PageResponse();
+        pageResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+        pageResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
+        return pageResponse;
+    }
 }

+ 0 - 8
mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java

@@ -1,7 +1,6 @@
 package com.ym.mec.education.controller;
 
 import com.ym.mec.education.base.BaseResponse;
-import com.ym.mec.education.enums.ReturnCodeEnum;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.service.IClassGroupService;
 import io.swagger.annotations.Api;
@@ -12,7 +11,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import java.util.Objects;
 
 /**
  * @program: mec
@@ -32,12 +30,6 @@ public class ClassGroupController {
     @PostMapping("/info")
     @ApiOperation("班级详情")
     public BaseResponse getInfo(@RequestBody ClassGroupReq classGroupReq) {
-        if (Objects.isNull(classGroupReq.getGroupId())) {
-            BaseResponse baseResponse = new BaseResponse();
-            baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
-            baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
-            return baseResponse;
-        }
         return classGroupService.getInfo(classGroupReq);
     }
 }

+ 19 - 1
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -1,16 +1,22 @@
 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.enums.ReturnCodeEnum;
 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;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import java.util.Objects;
 
 /**
  * @program: mec
@@ -29,7 +35,19 @@ public class CourseScheduleController {
 
     @PostMapping("/list")
     @ApiOperation("课表列表")
-    public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
+    public PageResponse list(@RequestBody @Validated ClassGroupReq classGroupReq) {
         return courseScheduleService.getPage(classGroupReq);
     }
+
+    @PostMapping("/info")
+    @ApiOperation("课程计划详情")
+    public BaseResponse<CourseScheduleResp> getInfo(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return courseScheduleService.getInfo(courseScheduleReq);
+    }
+
+    @PostMapping("/statisticsInfo")
+    @ApiOperation("历史考勤统计-头信息")
+    public BaseResponse getStatisticsInfo(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return courseScheduleService.getStatisticsInfo(courseScheduleReq);
+    }
 }

+ 70 - 0
mec-education/src/main/java/com/ym/mec/education/controller/HomeWorkController.java

@@ -0,0 +1,70 @@
+package com.ym.mec.education.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.entity.StudentCourseHomework;
+import com.ym.mec.education.entity.SysUser;
+import com.ym.mec.education.req.HomeWorkReq;
+import com.ym.mec.education.req.MusicGroupReq;
+import com.ym.mec.education.resp.HomeWrokResp;
+import com.ym.mec.education.service.IStudentCourseHomeworkService;
+import com.ym.mec.education.service.ISysUserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月27日 19:31
+ */
+
+@RestController
+@RequestMapping("/api/homeWork")
+@DefaultProperties(defaultFallback = "defaultFallback")
+@Slf4j
+public class HomeWorkController {
+
+
+    @Autowired
+    private IStudentCourseHomeworkService studentCourseHomeworkService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+    /**
+     * 服务降级处理
+     *
+     * @return
+     */
+    private BaseResponse defaultFallback() {
+        BaseResponse response = new BaseResponse();
+        response.setReturnCode(500);
+        response.setMessage("太拥挤了, 请稍后再试!");
+        return response;
+    }
+
+    /**
+     *
+     * @param req
+     * @return
+     */
+    @PostMapping(value = "/workList")
+    public PageResponse workList(@RequestBody HomeWorkReq req) {
+
+        return studentCourseHomeworkService.workList(req);
+    }
+}

+ 13 - 0
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,4 +34,16 @@ public class StudentAttendanceController {
         return studentAttendanceService.getPage(classGroupReq);
     }
 
+    @PostMapping("/listByCourse")
+    @ApiOperation("根据课程计划查询考勤列表")
+    public PageResponse listByCourse(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return studentAttendanceService.getPageByCourse(courseScheduleReq);
+    }
+
+    @PostMapping("/statisticsList")
+    @ApiOperation("根据课程计划查询考勤统计列表")
+    public PageResponse statisticsList(@RequestBody CourseScheduleReq courseScheduleReq) {
+        return studentAttendanceService.statisticsList(courseScheduleReq);
+    }
+
 }

+ 14 - 0
mec-education/src/main/java/com/ym/mec/education/enums/StudentAttendanceStatusEnum.java

@@ -1,6 +1,7 @@
 package com.ym.mec.education.enums;
 
 import com.ym.mec.common.enums.BaseEnum;
+import java.util.Arrays;
 
 /**
  * 学生考勤状态
@@ -37,4 +38,17 @@ public enum StudentAttendanceStatusEnum implements BaseEnum<String,StudentAttend
     public String getCode() {
         return this.code;
     }
+
+    /**
+     * 根据枚举值获取枚举信息
+     *
+     * @param code 枚举值
+     * @return 枚举信息
+     */
+    public static String getMsgByCode(String code) {
+        return Arrays.stream(StudentAttendanceStatusEnum.values())
+                .filter(StudentAttendanceStatusEnum -> StudentAttendanceStatusEnum.getCode().equals(code))
+                .findFirst()
+                .map(StudentAttendanceStatusEnum::getMsg).orElse(null);
+    }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/StudentCourseHomeworkMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.StudentCourseHomework;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 20 - 0
mec-education/src/main/java/com/ym/mec/education/req/CourseScheduleReq.java

@@ -0,0 +1,20 @@
+package com.ym.mec.education.req;
+
+import com.ym.mec.education.base.BaseQuery;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @program: mec
+ * @description: 课程计划入参
+ * @author: xw
+ * @create: 2019-09-28 10:36
+ */
+@ApiModel("课程计划入参")
+@Data
+public class CourseScheduleReq extends BaseQuery {
+
+    @ApiModelProperty(value = "课程计划id", required = true)
+    private Integer courseScheduleId;
+}

+ 15 - 0
mec-education/src/main/java/com/ym/mec/education/req/HomeWorkReq.java

@@ -0,0 +1,15 @@
+package com.ym.mec.education.req;
+
+import com.ym.mec.education.base.BaseQuery;
+import lombok.Data;
+
+/**
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月25日 20:59
+ */
+@Data
+public class HomeWorkReq extends BaseQuery {
+
+    private String name;
+}

+ 4 - 5
mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java

@@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.ToString;
-
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
@@ -62,16 +61,16 @@ public class ClassGroupResp implements Serializable {
 
     private List<String> secdTehNameList;
 
-    @ApiModelProperty(value = "授课老师",required = true)
+    @ApiModelProperty(value = "主讲老师")
     private String teacher;
 
-    @ApiModelProperty(value = "授课老师",required = true)
+    @ApiModelProperty(value = "授课老师")
     private String assistant;
 
-    @ApiModelProperty(value = "课程进度",required = true)
+    @ApiModelProperty(value = "课程进度")
     private String courseProgress;
 
-    @ApiModelProperty(value = "班级名称",required = true)
+    @ApiModelProperty(value = "班级名称")
     private String classGroupName;
 
 }

+ 25 - 4
mec-education/src/main/java/com/ym/mec/education/resp/CourseScheduleResp.java

@@ -5,7 +5,9 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.ToString;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -20,15 +22,34 @@ import java.util.List;
 @Accessors(chain = true)
 public class CourseScheduleResp implements Serializable {
 
-    @ApiModelProperty(value = "上课日期",required = true)
+    @ApiModelProperty(value = "上课日期")
     private String classDate;
 
-    @ApiModelProperty(value = "上课时间",required = true)
+    @ApiModelProperty(value = "上课时间")
     private String classTime;
 
-    @ApiModelProperty(value = "声部名称",required = true)
+    @ApiModelProperty(value = "声部名称")
     private List<String> subjectName;
 
-    @ApiModelProperty(value = "上课老师",required = true)
+    @ApiModelProperty(value = "上课老师")
     private String teacher;
+
+    @ApiModelProperty(value = "最后提交时间")
+    @DateTimeFormat(pattern = "MM-dd HH:mm")
+    private Date lastCommitDate;
+
+    @ApiModelProperty(value = "到课比")
+    private String attendanceRate;
+
+    @ApiModelProperty(value = "请假人数")
+    private Integer leaveNum;
+
+    @ApiModelProperty(value = "已上课时")
+    private String alreadyInClass;
+
+    @ApiModelProperty(value = "学生人数")
+    private Integer studentNum;
+
+    @ApiModelProperty(value = "退团人数")
+    private Integer leagueNum;
 }

+ 39 - 0
mec-education/src/main/java/com/ym/mec/education/resp/HomeWrokResp.java

@@ -0,0 +1,39 @@
+package com.ym.mec.education.resp;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 17:44
+ */
+
+@Data
+@ToString
+public class HomeWrokResp implements Serializable {
+
+    private String name;
+
+    /**
+     * 图像
+     */
+    private String avatar;
+
+    private Integer userId;
+
+    private Integer classGroupId;
+
+    private String isReplied;
+
+    private String status;
+
+    private String remark;
+
+    private Integer score;
+
+    private String attachments;
+}

+ 15 - 6
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java → mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResp.java

@@ -16,20 +16,29 @@ import java.util.List;
 @Data
 @ApiModel(description = "考勤出参")
 @Accessors(chain = true)
-public class StudentAttendanceResq implements Serializable {
+public class StudentAttendanceResp implements Serializable {
 
-    @ApiModelProperty(value = "上课日期", required = true)
+    @ApiModelProperty(value = "上课日期")
     private String classDate;
 
-    @ApiModelProperty(value = "上课时间", required = true)
+    @ApiModelProperty(value = "上课时间")
     private String classTime;
 
-    @ApiModelProperty(value = "声部名称",required = true)
+    @ApiModelProperty(value = "声部名称")
     private List<String> subjectName;
 
-    @ApiModelProperty(value = "到课比", required = true)
+    @ApiModelProperty(value = "到课比")
     private String attendanceRate;
 
-    @ApiModelProperty(value = "请假人数", required = true)
+    @ApiModelProperty(value = "请假人数")
     private Integer leaveNum;
+
+    @ApiModelProperty(value = "学生姓名")
+    private String studentName;
+
+    @ApiModelProperty(value = "考勤状态")
+    private String status;
+
+    @ApiModelProperty(value = "上课星期")
+    private String classWeek;
 }

+ 41 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceStatisticsResp.java

@@ -0,0 +1,41 @@
+package com.ym.mec.education.resp;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @program: mec
+ * @description: 考勤统计出参
+ * @author: xw
+ * @create: 2019-09-28 23:29
+ */
+@Data
+@ApiModel(description = "考勤统计出参")
+@Accessors(chain = true)
+public class StudentAttendanceStatisticsResp implements Serializable {
+
+    @ApiModelProperty(value = "学生姓名")
+    private String studentName;
+
+    @ApiModelProperty(value = "是否连续旷课")
+    private boolean isTruant;
+
+    @ApiModelProperty(value = "声部名称")
+    private List<String> subjectName;
+
+    @ApiModelProperty(value = "到课天数")
+    private Integer normalDay;
+
+    @ApiModelProperty(value = "旷课天数")
+    private Integer truantDay;
+
+    @ApiModelProperty(value = "请假天数")
+    private Integer leaveDay;
+
+    @ApiModelProperty(value = "考勤明细列表")
+    private List<StudentAttendanceResp> list;
+}

+ 21 - 0
mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java

@@ -1,9 +1,11 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+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;
 
 /**
  * <p>
@@ -15,5 +17,24 @@ import com.ym.mec.education.req.ClassGroupReq;
  */
 public interface ICourseScheduleService extends IService<CourseSchedule> {
 
+    /**
+     * 根据参数分页查询课程计划列表
+     * @param classGroupReq
+     * @return
+     */
     PageResponse getPage(ClassGroupReq classGroupReq);
+
+    /**
+     * 根据课程计划id获取课程计划详情
+     * @param courseScheduleReq
+     * @return
+     */
+    BaseResponse getInfo(CourseScheduleReq courseScheduleReq);
+
+    /**
+     * 历史考勤统计-头信息
+     * @param courseScheduleReq
+     * @return
+     */
+    BaseResponse getStatisticsInfo(CourseScheduleReq courseScheduleReq);
 }

+ 5 - 0
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>
@@ -17,4 +18,8 @@ public interface IStudentAttendanceService extends IService<StudentAttendance> {
 
     PageResponse getPage(ClassGroupReq classGroupReq);
 
+    PageResponse getPageByCourse(CourseScheduleReq courseScheduleReq);
+
+    PageResponse statisticsList(CourseScheduleReq courseScheduleReq);
+
 }

+ 4 - 1
mec-education/src/main/java/com/ym/mec/education/service/IStudentCourseHomeworkService.java

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.StudentCourseHomework;
-import com.baomidou.mybatisplus.service.IService;
+import com.ym.mec.education.req.HomeWorkReq;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.service.IService;
  */
 public interface IStudentCourseHomeworkService extends IService<StudentCourseHomework> {
 
+    PageResponse workList(HomeWorkReq req);
 }

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java

@@ -37,6 +37,9 @@ public class ClassGroupServiceImpl extends ServiceImpl<ClassGroupMapper, ClassGr
 
     @Override
     public BaseResponse<ClassGroupResp> getInfo(ClassGroupReq classGroupReq) {
+        if (Objects.isNull(classGroupReq.getGroupId())) {
+            return BaseResponse.errorParam();
+        }
         BaseResponse<ClassGroupResp> baseResponse = new BaseResponse<>();
         ClassGroup classGroup = getById(classGroupReq.getGroupId());
         if (Objects.isNull(classGroup)) {

+ 7 - 3
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -21,6 +21,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -41,6 +42,9 @@ public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupSt
 
     @Override
     public PageResponse getPage(ClassGroupReq classGroupReq) {
+        if (Objects.isNull(classGroupReq.getGroupId())) {
+            return PageResponse.errorParam();
+        }
         Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<ClassGroupStudentMapper>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
         QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
         classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroupReq.getGroupId());
@@ -66,11 +70,11 @@ public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupSt
 
     @Override
     public List<ClassStudentResp> selectStudentPage(ClassGroupReq classGroupReq) {
-        IPage page = new Page(classGroupReq.getPageNo() ==null ? 1 : classGroupReq.getPageNo(),classGroupReq.getPageSize() == null ? 10:classGroupReq.getPageSize());
+        IPage page = new Page(classGroupReq.getPageNo() == null ? 1 : classGroupReq.getPageNo(), classGroupReq.getPageSize() == null ? 10 : classGroupReq.getPageSize());
 
-        List<ClassStudentResp> classStudentResps =  this.baseMapper.selectStudentPage(page,classGroupReq);
+        List<ClassStudentResp> classStudentResps = this.baseMapper.selectStudentPage(page, classGroupReq);
 
-        return  classStudentResps;
+        return classStudentResps;
     }
 
     @Override

+ 97 - 8
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -5,22 +5,25 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
+import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
-import com.ym.mec.education.entity.ClassGroup;
-import com.ym.mec.education.entity.ClassGroupTeacherMapper;
-import com.ym.mec.education.entity.CourseSchedule;
-import com.ym.mec.education.entity.SysUser;
+import com.ym.mec.education.entity.*;
+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;
+import org.apache.commons.lang3.StringUtils;
 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;
 
 /**
  * <p>
@@ -41,9 +44,14 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
     private ISysUserService sysUserService;
     @Autowired
     private ISubjectService subjectService;
+    @Autowired
+    private IStudentAttendanceService studentAttendanceService;
 
     @Override
     public PageResponse getPage(ClassGroupReq classGroupReq) {
+        if (Objects.isNull(classGroupReq.getGroupId())) {
+            return PageResponse.errorParam();
+        }
         Page<CourseSchedule> courseSchedulePage = new Page<CourseSchedule>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
         QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
         courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, classGroupReq.getGroupId());
@@ -54,10 +62,20 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
         ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
         courseScheduleIPage.getRecords().forEach(item -> {
             CourseScheduleResp courseScheduleResp = new CourseScheduleResp();
-            courseScheduleResp.setClassDate(DateUtil.date2String(item.getClassDate())
-                    + " " + DateUtil.date2Week(item.getClassDate()))
-                    .setClassTime(DateUtil.time2String(item.getStartClassTime()) + "-" + DateUtil.time2String(item.getEndClassTime()))
-                    .setSubjectName(subjectService.getSubjectNameList(classGroup.getSubjectIdList()));
+            if (Objects.nonNull(item.getClassDate())) {
+                courseScheduleResp.setClassDate(DateUtil.date2String(item.getClassDate())
+                        + " " + DateUtil.date2Week(item.getClassDate()));
+            }
+            if (Objects.nonNull(item.getStartClassTime()) && Objects.nonNull(item.getEndClassTime())) {
+                courseScheduleResp.setClassTime(DateUtil.time2String(item.getStartClassTime()) + "-" +
+                        DateUtil.time2String(item.getEndClassTime()));
+            }
+            if (StringUtils.isNotBlank(classGroup.getSubjectIdList())) {
+                List<String> subjectNameList = subjectService.getSubjectNameList(classGroup.getSubjectIdList());
+                if (!CollectionUtils.isEmpty(subjectNameList)) {
+                    courseScheduleResp.setSubjectName(subjectNameList);
+                }
+            }
             QueryWrapper<ClassGroupTeacherMapper> classGroupTeacherMapperQueryWrapper = new QueryWrapper<>();
             classGroupTeacherMapperQueryWrapper.lambda().eq(true, ClassGroupTeacherMapper::getClassGroupId, item.getClassGroupId())
                     .eq(true, ClassGroupTeacherMapper::getTeacherRole, TeachTypeEnum.BISHOP.getCode());
@@ -73,4 +91,75 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
         pageResult.setRecords(courseScheduleRespList);
         return PageResponse.success(pageResult);
     }
+
+    @Override
+    public BaseResponse<CourseScheduleResp> getInfo(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
+            return BaseResponse.errorParam();
+        }
+        CourseSchedule courseSchedule = getById(courseScheduleReq.getCourseScheduleId());
+        CourseScheduleResp courseScheduleResp = new CourseScheduleResp();
+        if (Objects.nonNull(courseSchedule)) {
+            if (Objects.nonNull(courseSchedule.getClassDate())) {
+                courseScheduleResp.setClassDate(DateUtil.date2String(courseSchedule.getClassDate()) + "(" +
+                        DateUtil.date2Week(courseSchedule.getClassDate()) + ")");
+            }
+            if (Objects.nonNull(courseSchedule.getStartClassTime()) &&
+                    Objects.nonNull(courseSchedule.getEndClassTime())) {
+                courseScheduleResp.setClassTime(DateUtil.time2String(courseSchedule.getStartClassTime()) + "-" +
+                        DateUtil.time2String(courseSchedule.getEndClassTime()));
+            }
+            if (Objects.nonNull(courseSchedule.getTeacherId())) {
+                Optional.of(sysUserService.getById(courseSchedule.getTeacherId())).
+                        ifPresent(sysUser -> courseScheduleResp.setTeacher(sysUser.getRealName()));
+            }
+            QueryWrapper<StudentAttendance> studentAttendanceQueryWrapper = new QueryWrapper<>();
+            studentAttendanceQueryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                    .orderByDesc(true, StudentAttendance::getCreateTime);
+            List<StudentAttendance> studentAttendanceList = studentAttendanceService.list(studentAttendanceQueryWrapper);
+            if (!CollectionUtils.isEmpty(studentAttendanceList)) {
+                studentAttendanceList.stream().findFirst().ifPresent(studentAttendance ->
+                        courseScheduleResp.setLastCommitDate(studentAttendance.getCreateTime()));
+            }
+            QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
+            QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
+            //总人数
+            Integer totalCount = count();
+            //请假
+            leaveWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                    .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.LEAVE.getCode());
+            Integer leaveCount = studentAttendanceService.count(leaveWrapper);
+            //正常
+            normalWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                    .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
+            Integer normalCount = studentAttendanceService.count(normalWrapper);
+            courseScheduleResp.setLeaveNum(leaveCount);
+            if (totalCount != 0) {
+                courseScheduleResp.setAttendanceRate(normalCount + "/" + totalCount);
+            }
+        }
+        return BaseResponse.success(courseScheduleResp);
+    }
+
+    @Override
+    public BaseResponse getStatisticsInfo(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
+            return BaseResponse.errorParam();
+        }
+        CourseSchedule courseSchedule = getById(courseScheduleReq.getCourseScheduleId());
+        CourseScheduleResp courseScheduleResp = new CourseScheduleResp();
+        if (Objects.nonNull(courseSchedule)) {
+            ClassGroup classGroup = groupService.getById(courseSchedule.getClassGroupId());
+            if (Objects.nonNull(classGroup)) {
+                if (Objects.nonNull(classGroup.getCurrentClassTimes()) && Objects.nonNull(classGroup.getTotalClassTimes())) {
+                    courseScheduleResp.setAlreadyInClass(classGroup.getCurrentClassTimes() + "/" + classGroup.getTotalClassTimes());
+                }
+                if (Objects.nonNull(classGroup.getStudentNum())) {
+                    courseScheduleResp.setStudentNum(classGroup.getStudentNum());
+                }
+            }
+            //TODO 暂缺退团人数
+        }
+        return BaseResponse.success(courseScheduleResp);
+    }
 }

+ 133 - 15
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java

@@ -5,22 +5,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.education.base.PageResponse;
-import com.ym.mec.education.entity.ClassGroup;
-import com.ym.mec.education.entity.CourseSchedule;
-import com.ym.mec.education.entity.StudentAttendance;
+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.resp.StudentAttendanceResq;
-import com.ym.mec.education.service.IClassGroupService;
-import com.ym.mec.education.service.ICourseScheduleService;
-import com.ym.mec.education.service.IStudentAttendanceService;
-import com.ym.mec.education.service.ISubjectService;
+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.*;
 import com.ym.mec.education.utils.DateUtil;
+import org.apache.commons.lang3.StringUtils;
 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;
 
@@ -41,17 +41,24 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
     private IClassGroupService groupService;
     @Autowired
     private ISubjectService subjectService;
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private IClassGroupStudentMapperService classGroupStudentMapperService;
 
     @Override
     public PageResponse getPage(ClassGroupReq classGroupReq) {
+        if (Objects.isNull(classGroupReq.getGroupId())){
+            return PageResponse.errorParam();
+        }
         Page<StudentAttendance> pageParam = new Page(classGroupReq.getPageNo(), classGroupReq.getPageSize());
         QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(Objects.nonNull(classGroupReq.getGroupId()),
                 StudentAttendance::getClassGroupId, classGroupReq.getGroupId());
         IPage<StudentAttendance> page = page(pageParam, queryWrapper);
-        IPage<StudentAttendanceResq> pageResult = new Page<>();
+        IPage<StudentAttendanceResp> pageResult = new Page<>();
         BeanUtils.copyProperties(page, pageResult);
-        List<StudentAttendanceResq> list = Lists.newArrayList();
+        List<StudentAttendanceResp> list = Lists.newArrayList();
         QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
         QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
         //总人数
@@ -65,24 +72,135 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
                 .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
         Integer normalCount = count(normalWrapper);
         page.getRecords().forEach(item -> {
-            StudentAttendanceResq studentAttendanceResq = new StudentAttendanceResq();
-            studentAttendanceResq.setLeaveNum(leaveCount).setAttendanceRate(normalCount + "/" + totalCount);
+            StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
+            studentAttendanceResp.setLeaveNum(leaveCount);
+            if (totalCount != 0) {
+                studentAttendanceResp.setAttendanceRate(normalCount + "/" + totalCount);
+            }
             QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
             courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, classGroupReq.getGroupId())
                     .eq(true, CourseSchedule::getTeacherId, item.getTeacherId());
             CourseSchedule courseSchedule = courseScheduleService.getOne(courseScheduleQueryWrapper);
             if (Objects.nonNull(courseSchedule)) {
-                studentAttendanceResq.setClassDate(DateUtil.date2String(courseSchedule.getClassDate())
+                studentAttendanceResp.setClassDate(DateUtil.date2String(courseSchedule.getClassDate())
                         + " " + DateUtil.date2Week(courseSchedule.getClassDate()))
                         .setClassTime(courseSchedule.getStartClassTime() + "-" + courseSchedule.getEndClassTime());
             }
             ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
             if (Objects.nonNull(classGroup)) {
-                studentAttendanceResq.setSubjectName(subjectService.getSubjectNameList(classGroup.getSubjectIdList()));
-                list.add(studentAttendanceResq);
+                studentAttendanceResp.setSubjectName(subjectService.getSubjectNameList(classGroup.getSubjectIdList()));
+                list.add(studentAttendanceResp);
             }
         });
         pageResult.setRecords(list);
         return PageResponse.success(pageResult);
     }
+
+    @Override
+    public PageResponse getPageByCourse(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
+            return PageResponse.errorParam();
+        }
+        Page<StudentAttendanceResp> pageResult = new Page<>();
+        Page<StudentAttendance> studentAttendancePage = new Page<>(courseScheduleReq.getPageNo(), courseScheduleReq.getPageSize());
+        QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId());
+        IPage<StudentAttendance> page = page(studentAttendancePage, queryWrapper);
+        if (!CollectionUtils.isEmpty(page.getRecords())) {
+            List<StudentAttendanceResp> list = Lists.newArrayList();
+            page.getRecords().forEach(item -> {
+                StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
+                if (Objects.nonNull(item.getUserId())) {
+                    SysUser user = userService.getById(item.getUserId());
+                    if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
+                        studentAttendanceResp.setStudentName(user.getRealName());
+                    }
+                }
+                if (StringUtils.isNotBlank(item.getStatus())) {
+                    studentAttendanceResp.setStatus(StudentAttendanceStatusEnum.getMsgByCode(item.getStatus()));
+                }
+                list.add(studentAttendanceResp);
+            });
+            pageResult.setRecords(list);
+        }
+        return PageResponse.success(pageResult);
+    }
+
+    @Override
+    public PageResponse statisticsList(CourseScheduleReq courseScheduleReq) {
+        if (Objects.isNull(courseScheduleReq.getCourseScheduleId())) {
+            PageResponse.errorParam();
+        }
+        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<>(courseScheduleReq.getPageNo(), courseScheduleReq.getPageSize());
+        Page<StudentAttendanceStatisticsResp> pageResult = new Page();
+        CourseSchedule courseSchedule = courseScheduleService.getById(courseScheduleReq.getCourseScheduleId());
+        if (Objects.nonNull(courseSchedule)) {
+            ClassGroup classGroup = groupService.getById(courseSchedule.getClassGroupId());
+            if (Objects.nonNull(classGroup)) {
+                List<String> subjectNameList = subjectService.getSubjectNameList(classGroup.getSubjectIdList());
+                QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
+                classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroup.getId())
+                        .in(true, ClassGroupStudentMapper::getStatus,
+                                ClassGroupStudentStatusEnum.NORMAL.getCode(), ClassGroupStudentStatusEnum.LEAVE.getCode());
+                IPage<ClassGroupStudentMapper> studentMapperPage = classGroupStudentMapperService.page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
+                if (!CollectionUtils.isEmpty(studentMapperPage.getRecords())) {
+                    List<StudentAttendanceStatisticsResp> studentAttendanceStatisticsRespList = Lists.newArrayList();
+                    BeanUtils.copyProperties(studentMapperPage, pageResult);
+                    studentMapperPage.getRecords().forEach(item -> {
+                        StudentAttendanceStatisticsResp resp = new StudentAttendanceStatisticsResp();
+                        SysUser user = userService.getById(item.getUserId());
+                        if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
+                            resp.setStudentName(user.getRealName());
+                        }
+                        resp.setSubjectName(subjectNameList);
+                        //TODO 暂时缺少是否连续旷课
+                        //到课天数
+                        QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
+                        normalWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                                .eq(true, StudentAttendance::getUserId, item.getUserId())
+                                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
+                        int normalDay = count(normalWrapper);
+                        //旷课天数
+                        QueryWrapper<StudentAttendance> truantWrapper = new QueryWrapper<>();
+                        truantWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                                .eq(true, StudentAttendance::getUserId, item.getUserId())
+                                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode());
+                        int truantDay = count(truantWrapper);
+                        //请假天数
+                        QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
+                        leaveWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                                .eq(true, StudentAttendance::getUserId, item.getUserId())
+                                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.LEAVE.getCode());
+                        int leaveDay = count(leaveWrapper);
+                        resp.setNormalDay(normalDay);
+                        resp.setTruantDay(truantDay);
+                        resp.setLeaveDay(leaveDay);
+                        //每个学生的考勤明细
+                        QueryWrapper<StudentAttendance> studentAttendanceQueryWrapper = new QueryWrapper<>();
+                        studentAttendanceQueryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseScheduleReq.getCourseScheduleId())
+                                .eq(true, StudentAttendance::getUserId, item.getUserId());
+                        List<StudentAttendance> studentAttendanceList = list(studentAttendanceQueryWrapper);
+                        List<StudentAttendanceResp> studentAttendanceRespList = Lists.newArrayList();
+                        if (!CollectionUtils.isEmpty(studentAttendanceList)) {
+                            studentAttendanceList.forEach(studentAttendance -> {
+                                StudentAttendanceResp studentAttendanceResp = new StudentAttendanceResp();
+                                if (Objects.nonNull(studentAttendance.getCreateTime())) {
+                                    studentAttendanceResp.setClassDate(DateUtil.date2String(studentAttendance.getCreateTime(),
+                                            DateUtil.DATE_FORMAT)).setClassWeek(DateUtil.date2Week(studentAttendance.getCreateTime()));
+                                }
+                                if (StringUtils.isNotBlank(studentAttendance.getStatus())) {
+                                    studentAttendanceResp.setStatus(StudentAttendanceStatusEnum.getMsgByCode(studentAttendance.getStatus()));
+                                }
+                                studentAttendanceRespList.add(studentAttendanceResp);
+                            });
+                        }
+                        resp.setList(studentAttendanceRespList);
+                        studentAttendanceStatisticsRespList.add(resp);
+                    });
+                    pageResult.setRecords(studentAttendanceStatisticsRespList);
+                }
+            }
+        }
+        return PageResponse.success(pageResult);
+    }
 }

+ 71 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -1,10 +1,28 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.StudentCourseHomework;
+import com.ym.mec.education.entity.SysUser;
+import com.ym.mec.education.enums.ReturnCodeEnum;
 import com.ym.mec.education.mapper.StudentCourseHomeworkMapper;
+import com.ym.mec.education.req.HomeWorkReq;
+import com.ym.mec.education.resp.HomeWrokResp;
 import com.ym.mec.education.service.IStudentCourseHomeworkService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.ym.mec.education.service.ISysUserService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +35,56 @@ import org.springframework.stereotype.Service;
 @Service("IStudentCourseHomeworkService")
 public class StudentCourseHomeworkServiceImpl extends ServiceImpl<StudentCourseHomeworkMapper, StudentCourseHomework> implements IStudentCourseHomeworkService {
 
+    @Autowired
+    private ISysUserService sysUserService;
+
+
+
+    @Override
+    public PageResponse workList(HomeWorkReq req) {
+
+        PageResponse response = new PageResponse();
+        QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
+
+        List<SysUser> userList = null;
+        if(req != null && StringUtils.isEmpty(req.getName())){
+            userQueryWrapper.like("real_name_",req.getName());
+            userList = sysUserService.list(userQueryWrapper);
+        }
+
+        List<Integer> userIds = null;
+        if(!CollectionUtils.isEmpty(userList)){
+            userIds = userList.stream().map(SysUser::getId).collect(Collectors.toList());
+        }
+        IPage ipage = new Page(req.getPageNo() == null ? 1: req.getPageNo(),req.getPageSize() == null ? 10:req.getPageSize());
+        QueryWrapper<StudentCourseHomework> queryWrapper = new QueryWrapper<>();
+        if(userIds != null && !userIds.isEmpty()){
+            queryWrapper.in("user_id_",userIds);
+        }
+        IPage<StudentCourseHomework> homeworkIPage =  this.page(ipage,queryWrapper);
+
+        List<StudentCourseHomework> courseHomeworkList = homeworkIPage.getRecords();
+
+        List<HomeWrokResp> homeWrokRespList = new ArrayList<>();
+        if(!CollectionUtils.isEmpty(courseHomeworkList)){
+            List<SysUser> finalUserList = userList;
+            courseHomeworkList.forEach(e ->{
+                HomeWrokResp homeWrokResp = new HomeWrokResp();
+                BeanUtils.copyProperties(e,homeWrokResp);
+                Optional<SysUser> optional = finalUserList.stream().filter(u -> u.getId().equals(e.getUserId())).findFirst();
+                if(optional.isPresent()){
+                    homeWrokResp.setAvatar(optional.get().getAvatar());
+                    homeWrokResp.setName(optional.get().getRealName());
+                }
+                homeWrokRespList.add(homeWrokResp);
+            });
+
+        }
+
+        response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        response.setRecords(homeWrokRespList);
+        response.setTotal(Math.toIntExact(homeworkIPage.getTotal()));
+        return response;
+    }
 }

+ 8 - 2
mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

@@ -16,8 +16,9 @@ import java.util.Date;
  */
 public class DateUtil {
 
-    private static final String DATE_FORMAT = "MM月dd日";
+    private static final String DATE_FORMAT_CHINESE = "MM月dd日";
     private static final String TIME_FORMAT = "HH:mm";
+    public static final String DATE_FORMAT = "MM-dd";
     private static ThreadLocal<DateFormat> threadLocal = new ThreadLocal<DateFormat>();
 
     public static DateFormat getDateFormat(String dateFormat) {
@@ -30,7 +31,7 @@ public class DateUtil {
     }
 
     public static String date2String(Date date) {
-        DateFormat dateFormat = getDateFormat(DATE_FORMAT);
+        DateFormat dateFormat = getDateFormat(DATE_FORMAT_CHINESE);
         String format = dateFormat.format(date);
         if (format.startsWith(BigDecimal.ZERO.toString())) {
             format = format.substring(1);
@@ -38,6 +39,11 @@ public class DateUtil {
         return format;
     }
 
+    public static String date2String(Date date, String dateFormatPattern) {
+        DateFormat dateFormat = getDateFormat(dateFormatPattern);
+        return dateFormat.format(date);
+    }
+
     public static String time2String(Time time) {
         String format = time.toLocalTime().format(DateTimeFormatter.ofPattern(TIME_FORMAT));
         return format;