浏览代码

feat:衔接老师

Joburgess 4 年之前
父节点
当前提交
fc50bc1e4b

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java

@@ -63,6 +63,7 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
      * @date 2019/10/20
      */
     List<StudentCourseHomework> findByCourseSchedule(@Param("courseScheduleId") Long courseScheduleId,
+                                                     @Param("homeworkId") Long homeworkId,
                                                      @Param("userName") String userName);
 
     /**
@@ -165,4 +166,14 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
      * @return
      */
     int getStudentCourseHomeWorksCount(Map<String, Object> params);
+
+    /**
+     * @describe 获取作业列表-教务端
+     * @author Joburgess
+     * @date 2021/5/24 0024
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.EduHomeworkCardDto>
+     */
+    List<EduHomeworkCardDto> getEduCourseHomeworkList(Map<String, Object> params);
+    int countEduCourseHomeworkList(Map<String, Object> params);
 }

+ 90 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/EduHomeworkCardDto.java

@@ -0,0 +1,90 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/5/24 0024
+ */
+public class EduHomeworkCardDto {
+
+    private Long courseId;
+
+    private String courseName;
+
+    private Date courseStartTime;
+
+    private Integer teacherId;
+
+    private String teacherName;
+
+    private Integer exceptStudentNum;
+
+    private Integer submitStudentNum;
+
+    private Integer repliedStudentNum;
+
+    public Long getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Long courseId) {
+        this.courseId = courseId;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public Date getCourseStartTime() {
+        return courseStartTime;
+    }
+
+    public void setCourseStartTime(Date courseStartTime) {
+        this.courseStartTime = courseStartTime;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public Integer getExceptStudentNum() {
+        return exceptStudentNum;
+    }
+
+    public void setExceptStudentNum(Integer exceptStudentNum) {
+        this.exceptStudentNum = exceptStudentNum;
+    }
+
+    public Integer getSubmitStudentNum() {
+        return submitStudentNum;
+    }
+
+    public void setSubmitStudentNum(Integer submitStudentNum) {
+        this.submitStudentNum = submitStudentNum;
+    }
+
+    public Integer getRepliedStudentNum() {
+        return repliedStudentNum;
+    }
+
+    public void setRepliedStudentNum(Integer repliedStudentNum) {
+        this.repliedStudentNum = repliedStudentNum;
+    }
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentCourseHomeWorkQueryInfo.java

@@ -11,6 +11,9 @@ public class StudentCourseHomeWorkQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "学生id")
     private Long userId;
 
+    @ApiModelProperty(value = "教师编号")
+    private Integer teacherId;
+
     @ApiModelProperty(value = "开始时间")
     private Date startTime;
 
@@ -31,6 +34,14 @@ public class StudentCourseHomeWorkQueryInfo extends QueryInfo {
         this.userId = userId;
     }
 
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public Date getStartTime() {
         return startTime;
     }

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentCourseHomeworkService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.CourseHomeworkStudentDetailDto;
+import com.ym.mec.biz.dal.dto.EduHomeworkCardDto;
 import com.ym.mec.biz.dal.dto.StudentCourseHomeworkDto;
 import com.ym.mec.biz.dal.dto.StudentVisitCourseHomeWorkDto;
 import com.ym.mec.biz.dal.entity.CourseHomework;
@@ -40,7 +41,7 @@ public interface StudentCourseHomeworkService extends BaseService<Long, StudentC
      * @param userName: 用户名
      * @return java.util.List<com.ym.mec.biz.dal.entity.StudentCourseHomework>
      */
-    List<StudentCourseHomework> findStudentCourseHomeworkByCourse(Long courseSchedule,String userName);
+    List<StudentCourseHomework> findStudentCourseHomeworkByCourse(Long courseSchedule, Long homeworkId,String userName);
 
     /**
      * @describe 跟新学生作业回复状态
@@ -96,4 +97,13 @@ public interface StudentCourseHomeworkService extends BaseService<Long, StudentC
      * @return
      */
     PageInfo<StudentVisitCourseHomeWorkDto> getStudentHomeWorks(StudentCourseHomeWorkQueryInfo queryInfo);
+
+    /**
+     * @describe 教务端课后作业列表
+     * @author Joburgess
+     * @date 2021/5/24 0024
+     * @param queryInfo:
+     * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.EduHomeworkCardDto>
+     */
+    PageInfo<EduHomeworkCardDto> getEduCourseHomeworkList(StudentCourseHomeWorkQueryInfo queryInfo);
 }

+ 18 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -37,8 +38,6 @@ import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-
 @Service
 public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, StudentCourseHomework> implements StudentCourseHomeworkService {
 
@@ -277,11 +276,11 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     }
 
     @Override
-    public List<StudentCourseHomework> findStudentCourseHomeworkByCourse(Long courseSchedule, String userName) {
+    public List<StudentCourseHomework> findStudentCourseHomeworkByCourse(Long courseSchedule, Long homeworkId, String userName) {
         if (Objects.isNull(courseSchedule)) {
             throw new BizException("请指定课程");
         }
-        return studentCourseHomeworkDao.findByCourseSchedule(courseSchedule, userName);
+        return studentCourseHomeworkDao.findByCourseSchedule(courseSchedule, homeworkId, userName);
     }
 
     @Override
@@ -479,4 +478,19 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public PageInfo<EduHomeworkCardDto> getEduCourseHomeworkList(StudentCourseHomeWorkQueryInfo queryInfo) {
+        PageInfo<EduHomeworkCardDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        int count = studentCourseHomeworkDao.countEduCourseHomeworkList(params);
+        pageInfo.setTotal(count);
+        params.put("offset", pageInfo.getOffset());
+        List<EduHomeworkCardDto> dataList = studentCourseHomeworkDao.getEduCourseHomeworkList(params);
+
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

+ 51 - 1
mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml

@@ -263,7 +263,12 @@
         student_course_homework sch
         LEFT JOIN sys_user su ON sch.user_id_=su.id_
         <where>
-            sch.course_schedule_id_=#{courseScheduleId}
+            <if test="courseScheduleId!=null">
+                AND sch.course_schedule_id_=#{courseScheduleId}
+            </if>
+            <if test="homeworkId!=null">
+                AND sch.course_homework_id_=#{homeworkId}
+            </if>
             <if test="userName!=null and userName!=''">
                 AND su.username_ LIKE CONCAT('%',#{userName},'%')
             </if>
@@ -480,6 +485,51 @@
         <include refid="homeWorkCondition"/>
     </select>
 
+    <sql id="getEduCourseHomeworkListCondition">
+        <where>
+            mg.transaction_teacher_id_ = #{teacherId}
+            <if test="startTime!=null">
+                AND cs.class_date_ &gt;= #{startTime}
+            </if>
+            <if test="endTime!=null">
+                AND cs.class_date_ &lt;= #{endTime}
+            </if>
+        </where>
+    </sql>
+
+    <select id="getEduCourseHomeworkList" resultType="com.ym.mec.biz.dal.dto.EduHomeworkCardDto">
+        SELECT
+            cs.id_ courseId,
+            cs.name_ courseName,
+            CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) courseStartTime,
+            cs.actual_teacher_id_ teacherId,
+            su.real_name_ teacherName,
+            COUNT( sch.user_id_ ) exceptStudentNum,
+            SUM( sch.status_ ) submitStudentNum,
+            SUM( sch.is_replied_ ) repliedStudentNum
+        FROM
+            course_homework ch
+            LEFT JOIN music_group mg ON mg.id_ = ch.music_group_id_
+            LEFT JOIN course_schedule cs ON ch.course_schedule_id_ = cs.id_
+            LEFT JOIN sys_user su ON cs.actual_teacher_id_ = su.id_
+            LEFT JOIN student_course_homework sch ON ch.id_ = sch.course_homework_id_
+        <include refid="getEduCourseHomeworkListCondition" />
+        GROUP BY ch.id_
+        ORDER BY course_start_time_ DESC
+        <include refid="global.limit"></include>
+    </select>
+
+    <select id="countEduCourseHomeworkList" resultType="int">
+        SELECT
+            COUNT(cs.id_)
+        FROM
+            course_homework ch
+            LEFT JOIN music_group mg ON mg.id_ = ch.music_group_id_
+            LEFT JOIN course_schedule cs ON ch.course_schedule_id_ = cs.id_
+            LEFT JOIN sys_user su ON cs.actual_teacher_id_ = su.id_
+        <include refid="getEduCourseHomeworkListCondition" />
+    </select>
+
     <sql id="homeWorkCondition">
         <where>
             <if test="userId!=null">

+ 2 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/controller/CourseHomeworkController.java

@@ -64,14 +64,14 @@ public class CourseHomeworkController extends BaseController {
     @ApiOperation(value = "根据课程计划获取需要交作业的学生")
     @GetMapping("/findCourseStudents")
     public Object findCourseStudents(Long courseScheduleId,String userName){
-        return succeed(studentCourseHomeworkService.findStudentCourseHomeworkByCourse(courseScheduleId,userName));
+        return succeed(studentCourseHomeworkService.findStudentCourseHomeworkByCourse(courseScheduleId, null,userName));
     }
 
     @ApiOperation(value = "根据课程计划获取需要交作业的学生-公用")
     @GetMapping("/findCourseStudentsPublic")
     public Object findCourseStudentsPublic(Long courseScheduleId,String userName, boolean extra){
         if(!extra){
-            return succeed(studentCourseHomeworkService.findStudentCourseHomeworkByCourse(courseScheduleId,userName));
+            return succeed(studentCourseHomeworkService.findStudentCourseHomeworkByCourse(courseScheduleId, null,userName));
         }else{
             return succeed(extracurricularExercisesReplyService.findExtraExerciseStudents(courseScheduleId,userName));
         }

+ 32 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/CourseHomeworkController.java

@@ -1,5 +1,11 @@
 package com.ym.mec.web.controller.education;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.page.StudentCourseHomeWorkQueryInfo;
+import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -25,6 +31,12 @@ public class CourseHomeworkController extends BaseController {
 
     @Autowired
     private CourseHomeworkService courseHomeworkService;
+    @Autowired
+    private StudentCourseHomeworkService studentCourseHomeworkService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
 
     @ApiOperation(value = "分页查询作业列表")
     @GetMapping(value = "/queryPage")
@@ -32,4 +44,24 @@ public class CourseHomeworkController extends BaseController {
         return succeed(courseHomeworkService.queryPage(queryInfo));
     }
 
+    @ApiOperation(value = "课后作业列表")
+    @GetMapping(value = "getEduCourseHomeworkList")
+    public HttpResponseResult getEduCourseHomeworkList(StudentCourseHomeWorkQueryInfo queryInfo){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        queryInfo.setTeacherId(sysUser.getId());
+        return succeed(studentCourseHomeworkService.getEduCourseHomeworkList(queryInfo));
+    }
+
+    @ApiOperation(value = "根据课程计划获取需要交作业的学生-公用")
+    @GetMapping("/findHomeworkStudents")
+    public Object findHomeworkStudents(Long homeworkId,String userName, boolean extra){
+        if(!extra){
+            return succeed(studentCourseHomeworkService.findStudentCourseHomeworkByCourse(null, homeworkId,userName));
+        }else{
+            return succeed(extracurricularExercisesReplyService.findExtraExerciseStudents(homeworkId,userName));
+        }
+    }
 }