Browse Source

Merge branch 'feature_HW_20230331' into master_saas

liujunchi 2 years ago
parent
commit
a9224faf3c
32 changed files with 509 additions and 66 deletions
  1. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesDao.java
  3. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesReplyDao.java
  4. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java
  5. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentLessonExaminationDao.java
  6. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkWrapper.java
  7. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentLessonTrainingDetailWrapper.java
  8. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/EHomeWorkStatus.java
  9. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ELessonTrainingType.java
  10. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseHomeworkService.java
  11. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentCourseHomeworkService.java
  12. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentExtracurricularExercisesSituationService.java
  13. 10 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentLessonTrainingDetailService.java
  14. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseHomeworkServiceImpl.java
  15. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesServiceImpl.java
  16. 70 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java
  17. 100 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java
  18. 15 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentLessonTrainingDetailServiceImpl.java
  19. 28 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java
  20. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  21. 1 1
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  22. 9 3
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  23. 81 0
      mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesMapper.xml
  24. 7 1
      mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml
  25. 31 1
      mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml
  26. 3 1
      mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml
  27. 8 0
      mec-biz/src/main/resources/config/mybatis/StudentLessonExaminationMapper.xml
  28. 3 0
      mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml
  29. 13 1
      mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseHomeworkController.java
  30. 7 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/CourseHomeworkController.java
  31. 2 2
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ExtracurricularExercisesController.java
  32. 35 0
      mec-web/src/main/java/com/ym/mec/web/controller/TeacherController.java

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

@@ -1990,5 +1990,5 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return
      */
     List<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherServeHomeworkDetailV2(@Param(
-        "param") CourseHomeworkWrapper.CourseHomeworkQuery queryInfo, @Param("courseIds") List<Long> courseIds);
+        "param") Map<String, Object> param, @Param("courseIds") List<Long> courseIds);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesDao.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.CourseHomeworkWrapper;
 import com.ym.mec.biz.dal.dto.ExtracurricularExercisesHomeworkListDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.dto.TeacherHomeworkListDto;
@@ -65,4 +66,8 @@ public interface ExtracurricularExercisesDao extends BaseDAO<Long, Extracurricul
      * @return
      */
     List<TeacherHomeworkListDto> findByIdList(@Param("exercisesIdList") List<Integer> exercisesIdList);
+
+    int countTeacherExtraHomeworkDetailV2(Map<String, Object> params);
+
+    List<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherExtraHomeworkDetailV2(Map<String, Object> params);
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesReplyDao.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.dto.EduHomeworkCardDto;
 import com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto;
 import com.ym.mec.biz.dal.dto.StudentServiceDetailDto;
+import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
 import com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto;
 import com.ym.mec.common.dal.BaseDAO;
@@ -133,4 +134,6 @@ public interface ExtracurricularExercisesReplyDao extends BaseDAO<Long, Extracur
     List<EduHomeworkCardDto> countEduHomeworkSubjectStudentNumWithMusicGroup(@Param("groupId") String groupId,
                                                                              @Param("startTime") Date startTime,
                                                                              @Param("endTime") Date endTime);
+
+    ExtracurricularExercisesReply getByExtraIdAndUserId(@Param("extraId") Long extraId, @Param("userId") Long userId);
 }

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

@@ -209,4 +209,8 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
         @Param("studentIds") List<Integer> studentIds,
         @Param("courseHomeworkId") Long courseHomeworkId,
         @Param("type") ELessonTrainingType type);
+
+    List<StudentCourseHomework> findStudentCourseHomeworkByCourse(@Param("query") StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query);
+
+    int queryNotSuccessHomeworkList(Integer userId);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentLessonExaminationDao.java

@@ -24,5 +24,12 @@ public interface StudentLessonExaminationDao extends BaseMapper<StudentLessonExa
     int findCount(Map<String, Object> params);
 
     List<StudentLessonExaminationDto1> queryStudentPage(@Param("lessonExaminationId") Long lessonExaminationId);
+
+    /**
+     * 查询未完成的考试
+     *
+     * @param userId 用户id
+     */
+    int queryNotSuccessExaminationList(Integer userId);
 }
 

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkWrapper.java

@@ -47,9 +47,9 @@ public class CourseHomeworkWrapper {
         private String courseType;
 
         @ApiModelProperty(value = "乐团id")
-        private Integer musicGroupId;
+        private String musicGroupId;
 
-        @ApiModelProperty(value = "班级类型  NORMAL:声部班,MIX:合奏班")
+        @ApiModelProperty(value = "班级类型  SINGLE:声部班,MIX:合奏班")
         private String classType;
 
         @ApiModelProperty(value = "作业练习状态 UNASSIGNED:未布置,ASSIGNED:已布置,DEADLINE:已截止")
@@ -123,6 +123,9 @@ public class CourseHomeworkWrapper {
         @ApiModelProperty("截止时间")
         private Date expiryDate;
 
+        @ApiModelProperty("完成状态 false 未完成 true 已完成")
+        private Boolean finishStatus;
+
         @ApiModelProperty(value = "作业类型 来源(HOMEWORK,EXTRACURRICULAR,EXTRA)",required = true)
         private ELessonTrainingType type;
 

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentLessonTrainingDetailWrapper.java

@@ -82,7 +82,7 @@ public class StudentLessonTrainingDetailWrapper {
 
 
     @Data
-    @ApiModel(" StudentLessonTrainingQuery-学生练习内容查询对象")
+    @ApiModel(" StudentLessonTrainingQuery-学生列表")
     public static class StudentLessonTrainingQuery {
 
 
@@ -97,7 +97,7 @@ public class StudentLessonTrainingDetailWrapper {
         @NotNull(message = "作业类型不能为空")
         private ELessonTrainingType type;
 
-        @ApiModelProperty(value = "声部id",hidden = true)
+        @ApiModelProperty(value = "声部id")
         private Integer subjectId;
 
         @ApiModelProperty(value = "true:完成 false未完成",hidden = true)

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/EHomeWorkStatus.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.enums;
 
 import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.ym.mec.common.enums.BaseEnum;
 import lombok.Getter;
 
 /**
@@ -10,7 +11,7 @@ import lombok.Getter;
  * @date 2023-04-03
  */
 @Getter
-public enum EHomeWorkStatus {
+public enum EHomeWorkStatus implements BaseEnum<String, EHomeWorkStatus> {
 
     /**
      * 未布置

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ELessonTrainingType.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.enums;
 
 import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.ym.mec.common.enums.BaseEnum;
 import lombok.Getter;
 
 /**
@@ -10,7 +11,7 @@ import lombok.Getter;
  * @date 2023-04-04
  */
 @Getter
-public enum ELessonTrainingType {
+public enum ELessonTrainingType implements BaseEnum<String, ELessonTrainingType> {
 
     /**
      * 课后练习

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseHomeworkService.java

@@ -63,4 +63,11 @@ public interface CourseHomeworkService extends BaseService<Long, CourseHomework>
      * @param courseScheduleId 课程id
      */
     CourseHomeworkWrapper.CourseHomeworkList findCourseHomeworkDetail(Integer courseScheduleId);
+
+    /**
+     * 课外作业详情
+     *
+     * @param extraId 作业id
+     */
+    CourseHomeworkWrapper.CourseHomeworkList findCourseExtraHomeworkDetail(Integer extraId);
 }

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

@@ -122,8 +122,9 @@ public interface StudentCourseHomeworkService extends BaseService<Long, StudentC
     /**
      * 学生端查看练习详情
      *
+     * @return
      */
-    CourseHomeworkWrapper.StudentCourseHomeworkDetail findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query);
+    CourseHomeworkWrapper.CourseHomeworkList findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query);
 
     /**
      * 添加学生作业练习记录

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentExtracurricularExercisesSituationService.java

@@ -77,4 +77,10 @@ public interface StudentExtracurricularExercisesSituationService extends BaseSer
      *
      */
     PageInfo<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherServeHomeworkDetailV2(CourseHomeworkWrapper.CourseHomeworkQuery queryInfo);
+
+    /**
+     * 老师课外作业列表
+     *
+     */
+    PageInfo<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherExtraHomeworkDetailV2(CourseHomeworkWrapper.CourseHomeworkQuery queryInfo);
 }

+ 10 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentLessonTrainingDetailService.java

@@ -41,7 +41,7 @@ public interface StudentLessonTrainingDetailService extends IService<StudentLess
      * @param studentLessonTrainingDetails 作业标准
      * @param userIdList 学生ID
      */
-    List<StudentLessonTrainingDetail> homeWorkDetail(List<StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail> studentLessonTrainingDetails, List<Integer> userIdList,Long homeworkId);
+    List<StudentLessonTrainingDetail> homeWorkDetail(List<StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail> studentLessonTrainingDetails, List<Integer> userIdList,Long homeworkId,ELessonTrainingType type);
 
     /**
      * 查询布置的作业详情
@@ -50,4 +50,13 @@ public interface StudentLessonTrainingDetailService extends IService<StudentLess
      * @param type 作业类型
      */
     List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> getBaseLessonTrainingDetail(Long courseHomeworkId, ELessonTrainingType type);
+
+    /**
+     * 学生端查询作业详情
+     *
+     * @param courseHomeworkId 作业ID
+     * @param type 作业类型
+     * @param userId 学生ID
+     */
+    List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> getBaseLessonTrainingDetail(Long courseHomeworkId, ELessonTrainingType type, Long userId);
 }

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseHomeworkServiceImpl.java

@@ -274,4 +274,36 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
         return courseHomeworkList;
 
     }
+
+    /**
+     * 课外作业详情
+     *
+     * @param extraId 作业id
+     */
+    @Override
+    public CourseHomeworkWrapper.CourseHomeworkList findCourseExtraHomeworkDetail(Integer extraId) {
+
+        CourseHomeworkWrapper.CourseHomeworkQuery query = new CourseHomeworkWrapper.CourseHomeworkQuery();
+        query.setCourseScheduleId(extraId);
+        query.setPage(1);
+        query.setRows(1);
+        PageInfo<CourseHomeworkWrapper.CourseHomeworkList> courseHomeworkListPageInfo = studentExtracurricularExercisesSituationService.queryTeacherExtraHomeworkDetailV2(
+            query);
+        List<CourseHomeworkWrapper.CourseHomeworkList> rows = courseHomeworkListPageInfo.getRows();
+        if (CollectionUtils.isEmpty(rows)) {
+            throw new BizException("作业不存在");
+        }
+        CourseHomeworkWrapper.CourseHomeworkList courseHomeworkList = rows.get(0);
+
+        // 设置作业信息
+        if (courseHomeworkList.getCourseHomeworkId() == null) {
+            return courseHomeworkList;
+        }
+
+        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> baseLessonTrainingDetail = studentLessonTrainingDetailService.getBaseLessonTrainingDetail(
+            courseHomeworkList.getCourseHomeworkId(),courseHomeworkList.getType());
+
+        courseHomeworkList.setTrainingDetailList(baseLessonTrainingDetail);
+        return courseHomeworkList;
+    }
 }

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesServiceImpl.java

@@ -13,6 +13,7 @@ import com.ym.mec.biz.dal.entity.StudentCourseHomework;
 import com.ym.mec.biz.dal.entity.StudentLessonTrainingDetail;
 import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ELessonTrainingType;
 import com.ym.mec.biz.dal.enums.ImSendTypeEnum;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -152,7 +153,8 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
                 }
                 // 作业详情
                 studentLessonTrainingDetailList.addAll(studentLessonTrainingDetailService
-                                   .homeWorkDetail(musicScoreSubjectDto.getStudentLessonTrainingDetails(), musicScoreSubjectDto.getUserIdList(),exercises.getId()));
+                                   .homeWorkDetail(musicScoreSubjectDto.getStudentLessonTrainingDetails(), musicScoreSubjectDto.getUserIdList(), exercises.getId(),
+                                                   ELessonTrainingType.valueOf(exercises.getGroupType())));
 
             }
         } else {
@@ -162,7 +164,8 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
             }
             // 作业详情
             studentLessonTrainingDetailList.addAll(studentLessonTrainingDetailService
-                                                       .homeWorkDetail(exercises.getStudentLessonTrainingDetails(), studentIds,exercises.getId()));
+                                                       .homeWorkDetail(exercises.getStudentLessonTrainingDetails(), studentIds,exercises.getId(),
+                                                       ELessonTrainingType.valueOf(exercises.getGroupType())));
         }
         extracurricularExercisesReplyDao.batchInsert(extracurricularExercisesReplies);
         studentLessonTrainingDetailService.saveBatch(studentLessonTrainingDetailList);

+ 70 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -26,8 +26,9 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.ELessonTrainingType;
 import com.ym.mec.biz.dal.enums.StandardEnum;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.biz.service.ExtracurricularExercisesService;
 import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.StudentLessonTrainingDetailService;
 import org.apache.commons.lang3.StringUtils;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -122,6 +123,12 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     @Autowired
     private MusicGroupService musicGroupService;
 
+    @Autowired
+    private ExtracurricularExercisesService  extracurricularExercisesService;
+
+    @Autowired
+    private StudentLessonTrainingDetailService studentLessonTrainingDetailService;
+
     @Override
     public BaseDAO<Long, StudentCourseHomework> getDAO() {
         return studentCourseHomeworkDao;
@@ -743,8 +750,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 
     @Override
     public List<StudentCourseHomework> findStudentCourseHomeworkByCourseV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query) {
-        List<StudentCourseHomework> studentCourseHomeworkByCourse = findStudentCourseHomeworkByCourse(
-            query.getCourseScheduleId().longValue(), null, null);
+        List<StudentCourseHomework> studentCourseHomeworkByCourse = studentCourseHomeworkDao.findStudentCourseHomeworkByCourse(query);
         for (StudentCourseHomework studentCourseHomework : studentCourseHomeworkByCourse) {
             studentCourseHomework.setType(ELessonTrainingType.HOMEWORK);
         }
@@ -804,6 +810,9 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 
         // 设置完成状态
         for (StudentCourseHomework studentCourseHomework : studentCourseHomeworkByCourse) {
+            if (studentCourseHomework.getStandardFlag() == null) {
+                studentCourseHomework.setFinishFlag(false);
+            } else
             if( studentCourseHomework.getStandardFlag().equals(StandardEnum.STANDARD) || studentCourseHomework.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
                 studentCourseHomework.setFinishFlag(true);
             } else {
@@ -839,6 +848,11 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     public List<StudentCourseHomework> findExtraExerciseStudentsV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query) {
         List<StudentCourseHomework> extraExerciseStudents = extracurricularExercisesReplyService.findExtraExerciseStudents(
             query.getCourseScheduleId().longValue(), null);
+        if (query.getSubjectId() != null) {
+            extraExerciseStudents = extraExerciseStudents.stream()
+                                                         .filter(o -> o.getSubjectId().equals(query.getSubjectId()))
+                                                         .collect(Collectors.toList());
+        }
         for (StudentCourseHomework studentCourseHomework : extraExerciseStudents) {
             studentCourseHomework.setType(ELessonTrainingType.EXTRACURRICULAR);
         }
@@ -849,10 +863,34 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
      * 学生端查看练习详情
      *
      * @param query
+     * @return
      */
     @Override
-    public CourseHomeworkWrapper.StudentCourseHomeworkDetail findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query) {
-        return null;
+    public CourseHomeworkWrapper.CourseHomeworkList findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query) {
+        CourseHomeworkWrapper.CourseHomeworkList courseHomeworkDetail = null;
+        if (ELessonTrainingType.HOMEWORK.equals(query)) {
+            courseHomeworkDetail= courseHomeworkService.findCourseHomeworkDetail(
+                query.getCourseScheduleId());
+        } else {
+            courseHomeworkDetail = courseHomeworkService.findCourseExtraHomeworkDetail(query.getCourseScheduleId());
+        }
+        if (courseHomeworkDetail == null) {
+            throw new BizException("作业不存在");
+        }
+
+        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> detailList = studentLessonTrainingDetailService.getBaseLessonTrainingDetail(
+            courseHomeworkDetail.getCourseHomeworkId(), query.getType(), query.getUserId());
+
+        long count = detailList.stream().filter(o -> o.getTrainingTimes() < o.getTimes()).count();
+        if (count >0) {
+            courseHomeworkDetail.setFinishStatus(false);
+        } else {
+            courseHomeworkDetail.setFinishStatus(true);
+        }
+        courseHomeworkDetail.setTrainingDetailList(detailList);
+
+        return courseHomeworkDetail;
+
     }
 
     /**
@@ -886,6 +924,9 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         studentLessonTraining.setStandardFlag(courseHomeworkStudentDetail.getStandardFlag());
 
         // 作业完成情况
+        if (courseHomeworkStudentDetail.getStandardFlag() == null) {
+            studentLessonTraining.setFinishFlag(false);
+        } else
         if( courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.STANDARD) || courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
             studentLessonTraining.setFinishFlag(true);
         } else {
@@ -903,13 +944,33 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 
     @Override
     public StudentLessonTrainingDetailWrapper.StudentLessonTraining findExtracurricularExercisesDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
-        StudentLessonTrainingDetailWrapper.StudentLessonTraining userInfo = getUserInfo(userId);
+        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
+
+
+        // 作业信息
+        ExtracurricularExercisesReply exercisesReply = extracurricularExercisesReplyDao.getByExtraIdAndUserId(
+            courseScheduleId, userId);
+        if (exercisesReply == null) {
+            throw new BizException("作业不存在");
+        }
+        studentLessonTraining.setStandardFlag(exercisesReply.getStandardFlag());
+
+        // 作业完成情况
+        if (exercisesReply.getStandardFlag() == null) {
+            studentLessonTraining.setFinishFlag(false);
+        } else if( exercisesReply.getStandardFlag().equals(StandardEnum.STANDARD) || exercisesReply.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
+            studentLessonTraining.setFinishFlag(true);
+        } else {
+            studentLessonTraining.setFinishFlag(false);
+        }
 
-        // extracurricularExercisesReplyDao.findExtraExerciseStudentDetail(courseScheduleId, userId);
+        // 练习内容
+        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
+            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), exercisesReply.getExtracurricularExercisesId(),type);
 
-        // 作业完成情况 TODO
+        studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails);
+        return studentLessonTraining;
 
-        return userInfo;
     }
 
     @NotNull

+ 100 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -84,6 +84,9 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
     @Autowired
     private StudentCourseHomeworkService studentCourseHomeworkService;
 
+    @Autowired
+    private ExtracurricularExercisesDao extracurricularExercisesDao;
+
 	@Override
 	public BaseDAO<Long, StudentExtracurricularExercisesSituation> getDAO() {
 		return studentExtracurricularExercisesSituationDao;
@@ -664,23 +667,25 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
     public PageInfo<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherServeHomeworkDetailV2(CourseHomeworkWrapper.CourseHomeworkQuery queryInfo) {
         PageInfo<CourseHomeworkWrapper.CourseHomeworkList> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         //获取时间段内有服务指标的课程(课后作业)
-        Date firstDayOfMonth;
-        Date lastDayOfMonth;
-        if(Objects.isNull(queryInfo.getStartTime())){
-            firstDayOfMonth = DateUtil.getFirstDayOfMonth(queryInfo.getMonth());
-            lastDayOfMonth = DateUtil.getLastDayOfMonth(queryInfo.getMonth());
-        }else {
-            firstDayOfMonth = queryInfo.getStartTime();
-            lastDayOfMonth = queryInfo.getEndTime();
+
+        Date firstDayOfMonth = queryInfo.getStartTime();
+        Date lastDayOfMonth = queryInfo.getEndTime();
+        List<Long> courseIds = new ArrayList<>();
+        if (queryInfo.getCourseScheduleId() != null) {
+            courseIds.add(queryInfo.getCourseScheduleId().longValue());
+        } else {
+            courseIds = studentExtracurricularExercisesSituationDao.queryCourseIdByClassDate(firstDayOfMonth,
+                                                    lastDayOfMonth, queryInfo.getTeacherId());
         }
-        List<Long> courseIds = studentExtracurricularExercisesSituationDao.queryCourseIdByClassDate(firstDayOfMonth,lastDayOfMonth,queryInfo.getTeacherId());
         if(courseIds == null || courseIds.size() == 0){
             return pageInfo;
         }
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
 
         // 查出课程列表
         List<CourseHomeworkWrapper.CourseHomeworkList> courseHomeworkLists = courseScheduleDao.queryTeacherServeHomeworkDetailV2(
-            queryInfo, courseIds);
+            params, courseIds);
         if (CollectionUtils.isEmpty(courseHomeworkLists)) {
             return pageInfo;
         }
@@ -699,17 +704,6 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
         List<ClassGroup> classGroups = classGroupService.queryByIds(classIds);
         Map<Integer, ClassGroup> classGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, Function.identity()));
 
-        // 布置人员 和完成人员
-
-        List<Integer> courseScheduleIds = courseHomeworkLists.stream().filter(e -> !e.getHomeWorkStatus().equals(
-            EHomeWorkStatus.UNASSIGNED)).map(e -> e.getCourseScheduleId()).collect(Collectors.toList());
-
-        List<StudentCourseHomework> studentCourseHomeworks = studentCourseHomeworkService.queryByCourseScheduleIds(
-            courseScheduleIds);
-
-        Map<Long, List<StudentCourseHomework>> studentCourseHomeworkMap = studentCourseHomeworks.stream().collect(Collectors.groupingBy(StudentCourseHomework::getCourseScheduleId));
-
-
         for (CourseHomeworkWrapper.CourseHomeworkList courseHomeworkList : courseHomeworkLists) {
 
             courseHomeworkList.setType(ELessonTrainingType.HOMEWORK);
@@ -725,18 +719,96 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
             if (Objects.nonNull(classGroup)) {
                 courseHomeworkList.setClassGroupName(classGroup.getName());
             }
+        }
+
+
+        pageInfo.setRows(courseHomeworkLists);
+        return pageInfo;
+    }
+
+    /**
+     * 老师课外作业列表
+     *
+     * @param queryInfo
+     */
+    @Override
+    public PageInfo<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherExtraHomeworkDetailV2(CourseHomeworkWrapper.CourseHomeworkQuery queryInfo) {
+
+        // 获取时间段内有服务指标的乐团(课外作业)
+        List<String> subjectIds = new ArrayList<>();
+        if (queryInfo.getCourseScheduleId() == null) {
+            if (queryInfo.getType() == null || queryInfo.getType().equals(ELessonTrainingType.EXTRACURRICULAR)) {
+                if (queryInfo.getHomeWorkStatus() == null || queryInfo.getHomeWorkStatus().equals(EHomeWorkStatus.UNASSIGNED)) {
+                    StudentExerciseMusicGroupQueryInfo query = new StudentExerciseMusicGroupQueryInfo();
+                    query.setMondayDate(DateUtil.dateToString(queryInfo.getStartTime()));
+                    query.setSundayDate(DateUtil.dateToString(queryInfo.getEndTime()));
+                    query.setTeacherId(queryInfo.getTeacherId());
+                    query.setPage(1);
+                    query.setRows(10000);
+                    PageInfo<MusicGroupExtracurricularSummaryDto> groupList = queryStudentExerciseMusicGroupList(query);
+
+                    if (!CollectionUtils.isEmpty(groupList.getRows())) {
+                        subjectIds = groupList.getRows().stream().map(o -> o.getMusicGroupId()).collect(Collectors.toList());
+                    }
+                }
+            }
+        }
+        PageInfo<CourseHomeworkWrapper.CourseHomeworkList> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        params.put("subjectIds", subjectIds);
+
+        int count = extracurricularExercisesDao.countTeacherExtraHomeworkDetailV2(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            List<CourseHomeworkWrapper.CourseHomeworkList> courseHomeworkLists  = extracurricularExercisesDao.queryTeacherExtraHomeworkDetailV2(params);
+
 
-            // 布置人员 和完成人员
-            List<StudentCourseHomework> studentCourseHomeworkList = studentCourseHomeworkMap.get(courseHomeworkList.getCourseScheduleId());
-            if (!CollectionUtils.isEmpty(studentCourseHomeworkList)) {
-                courseHomeworkList.setStudentNum(studentCourseHomeworkList.size());
-                courseHomeworkList.setFinishNum(studentCourseHomeworkList.stream().filter(e -> e.getStandardFlag().equals(StandardEnum.STANDARD) || e.getStandardFlag().equals(StandardEnum.EXCELLENT)).collect(
-                    Collectors.toList()).size());
+            // 乐团信息
+            List<String> musicGroupIds = courseHomeworkLists.stream().map(e -> e.getMusicGroupId())
+                                                            .filter(Objects::nonNull)
+                                                            .collect(Collectors.toList());
+            Map<String, MusicGroup> musicGroupMap = new HashMap<>();
+            if (!CollectionUtils.isEmpty(musicGroupIds)) {
+                List<MusicGroup> musicGroups = musicGroupService.queryListByIds(new HashSet<>(musicGroupIds));
+                musicGroupMap = musicGroups.stream()
+                                                                   .collect(Collectors.toMap(MusicGroup::getId, Function.identity()));
+            }
+
+
+            // 班级名称
+
+            List<Integer> classIds = courseHomeworkLists.stream().map(e -> e.getClassGroupId())
+                                                        .filter(Objects::nonNull)
+                                                        .collect(Collectors.toList());
+            Map<Integer, ClassGroup> classGroupMap = new HashMap<>();
+            List<ClassGroup> classGroups = classGroupService.queryByIds(classIds);
+            if (!CollectionUtils.isEmpty(classGroups)) {
+                classGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, Function.identity()));
+            }
+            for (CourseHomeworkWrapper.CourseHomeworkList courseHomeworkList : courseHomeworkLists) {
+
+                courseHomeworkList.setType(ELessonTrainingType.HOMEWORK);
+                // 乐团信息
+                MusicGroup musicGroup = musicGroupMap.get(courseHomeworkList.getMusicGroupId());
+                if (Objects.nonNull(musicGroup)) {
+                    courseHomeworkList.setMusicGroupName(musicGroup.getName());
+                    courseHomeworkList.setMusicGroupImg(musicGroup.getImg());
+                }
+
+                // 班级信息
+                ClassGroup classGroup = classGroupMap.get(courseHomeworkList.getClassGroupId());
+                if (Objects.nonNull(classGroup)) {
+                    courseHomeworkList.setClassGroupName(classGroup.getName());
+                }
             }
+
+            pageInfo.setRows(courseHomeworkLists);
         }
 
 
-        pageInfo.setRows(courseHomeworkLists);
         return pageInfo;
     }
 

+ 15 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentLessonTrainingDetailServiceImpl.java

@@ -64,7 +64,7 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
      * @param userIdList                   学生ID
      */
     @Override
-    public List<StudentLessonTrainingDetail> homeWorkDetail(List<StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail> detailList, List<Integer> userIdList,Long homeworkId) {
+    public List<StudentLessonTrainingDetail> homeWorkDetail(List<StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail> detailList, List<Integer> userIdList,Long homeworkId,ELessonTrainingType type) {
         // 保存作业标准
         if (CollectionUtils.isEmpty(detailList) || CollectionUtils.isEmpty(userIdList)) {
             return new ArrayList<>();
@@ -93,6 +93,7 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
             studentLessonTrainingDetail.setTrainingStatus(StandardEnum.NOT_START);
             studentLessonTrainingDetail.setCreateTime(new Date());
             studentLessonTrainingDetail.setUpdateTime(new Date());
+            studentLessonTrainingDetail.setType(type);
 
         }
         return result;
@@ -106,11 +107,24 @@ public class StudentLessonTrainingDetailServiceImpl extends ServiceImpl<StudentL
      */
     @Override
     public List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> getBaseLessonTrainingDetail(Long courseHomeworkId, ELessonTrainingType type) {
+        return getBaseLessonTrainingDetail(courseHomeworkId, type, null);
+    }
+
+    /**
+     * 学生端查询作业详情
+     *
+     * @param courseHomeworkId 作业ID
+     * @param type             作业类型
+     * @param userId           学生ID
+     */
+    @Override
+    public List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> getBaseLessonTrainingDetail(Long courseHomeworkId, ELessonTrainingType type, Long userId) {
         List<StudentLessonTrainingDetail> list = this.lambdaQuery()
                                                      .eq(StudentLessonTrainingDetail::getCourseHomeworkId,
                                                          courseHomeworkId)
                                                      .isNull(StudentLessonTrainingDetail::getUserId)
                                                      .eq(StudentLessonTrainingDetail::getType, type)
+                                                     .eq(userId != null, StudentLessonTrainingDetail::getUserId, userId)
                                                      .list();
         if (CollectionUtils.isEmpty(list)) {
             return new ArrayList<>();

+ 28 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
+import com.ym.mec.biz.service.StudentLessonExaminationService;
 import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysTenantConfigService;
@@ -58,6 +59,9 @@ public class StudentServeServiceImpl implements StudentServeService {
     private MusicGroupDao musicGroupDao;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
+
+    @Autowired
+    private StudentLessonExaminationDao studentLessonExaminationDao;
     
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -832,8 +836,30 @@ public class StudentServeServiceImpl implements StudentServeService {
         List<HomeworkStat> homeworkStatList = new ArrayList<>();
 
         // 作业按钮红点
-        // studentCourseHomeworkDao.queryNotSuccessHomeworkList(userId);
+        int num = studentCourseHomeworkDao.queryNotSuccessHomeworkList(userId);
+
+        HomeworkStat homeworkStat = new HomeworkStat();
+        homeworkStat.setType("HOMEWORK");
+        homeworkStatList.add(homeworkStat);
+        if (num > 0) {
+            homeworkStat.setShow(true);
+        } else {
+            homeworkStat.setShow(false);
+        }
+
+        // 评测按钮红点
+        num = studentLessonExaminationDao.queryNotSuccessExaminationList(userId);
+
+
+        HomeworkStat homeworkStat2 = new HomeworkStat();
+        homeworkStat2.setType("EXAMINATION");
+        homeworkStatList.add(homeworkStat2);
+        if (num > 0) {
+            homeworkStat2.setShow(true);
+        } else {
+            homeworkStat2.setShow(false);
+        }
 
-        return null;
+        return homeworkStatList;
     }
 }

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -270,6 +270,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 				result.put("status",2);
 				return result;
 			}
+            teacherAttendance.setSignInAttachments(teacherSignOutDto.getTeacherAttendanceInfo().getSignInAttachments());
 			teacherAttendance.setSignInDeviceNo(teacherSignOutDto.getTeacherAttendanceInfo().getDeviceNum());
 			if(Objects.nonNull(teacherAttendance.getId())){
 				teacherAttendanceDao.update(teacherAttendance);
@@ -369,7 +370,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 
 
                             studentLessonTrainingDetails.addAll(studentLessonTrainingDetailService
-                                                                    .homeWorkDetail(scoreSubjectDto.getStudentLessonTrainingDetails(), userIdList,courseHomework.getId()));
+                                                                    .homeWorkDetail(scoreSubjectDto.getStudentLessonTrainingDetails(), userIdList,courseHomework.getId(),ELessonTrainingType.HOMEWORK));
 
 						}
 					}else {
@@ -383,7 +384,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
                                                                       .map(StudentCourseHomework::getUserId)
                                                                       .collect(Collectors.toList());
                         studentLessonTrainingDetails.addAll(studentLessonTrainingDetailService
-                                                                .homeWorkDetail(courseHomeworkInfo.getStudentLessonTrainingDetails(), userIdList,courseHomework.getId()));
+                                                                .homeWorkDetail(courseHomeworkInfo.getStudentLessonTrainingDetails(), userIdList,courseHomework.getId(),ELessonTrainingType.HOMEWORK));
 
 					}
 					if(CollectionUtils.isEmpty(studentCourseHomeworks)){

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

@@ -1646,7 +1646,7 @@
 
     <select id="queryByIds" resultType="com.ym.mec.biz.dal.entity.ClassGroup">
         select * from class_group where id_ in
-        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+        <foreach collection="classIds" item="id" open="(" close=")" separator=",">
             #{id}
         </foreach>
 

+ 9 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -4138,12 +4138,16 @@
         cs.class_date_ as classDate,
         cs.start_class_time_ as startTime,
         cs.end_class_time_ as endTime,
-        if(ch.id_ is null,'UNASSIGNED',if(ch.expiry_date_ &lt; now(),'ASSIGNED','DEADLINE')) as homeWorkStatus,
+        if(ch.id_ is null,'UNASSIGNED',if(ch.expiry_date_ &lt; now(),'DEADLINE','ASSIGNED')) as homeWorkStatus,
         cs.teacher_id_ as teacherId,
         cs.music_group_id_ as musicGroupId,
         cs.type_ as classType,
         cs.teach_mode_ as teachMode,
-        cs.class_group_id_ as classGroupId
+        cs.class_group_id_ as classGroupId,
+        ch.create_time_ as assignTime,
+        ch.expiry_date_ as expiryDate,
+        ch.completed_num_ as finishNum,
+        ch.expect_num_ as studentNum
         from course_schedule cs
         left join course_homework ch on cs.id_ = ch.course_schedule_id_
 
@@ -4175,6 +4179,8 @@
                 and cs.id_ = #{param.courseScheduleId}
             </if>
         </where>
-        limit (#{param.rows} - 1) * #{param.page},#{param.rows}
+        <if test="param.offset != null">
+            limit #{param.offset},#{param.rows}
+        </if>
     </select>
 </mapper>

+ 81 - 0
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesMapper.xml

@@ -330,4 +330,85 @@
 			#{item}
 		</foreach>
 	</select>
+
+	<sql id="extraHomeworkDetailV2">
+		<if test="startTime != null and endTime != null">
+            create_time_ BETWEEN #{startTime} AND #{endTime}
+        </if>
+        <if test="homeWorkStatus != null">
+            <if test="homeWorkStatus.code == 'UNASSIGNED'">
+                AND id_ = -1
+            </if>
+            <if test="homeWorkStatus.code == 'ASSIGNED'">
+                AND expire_date_ &gt;= NOW()
+            </if>
+            <if test="homeWorkStatus.code == 'DEADLINE'">
+                AND expire_date_ &lt; NOW()
+            </if>
+            <if test="courseScheduleId != null">
+                AND id_ = #{courseScheduleId}
+            </if>
+        </if>
+        <if test="type != null">
+            and group_type_ = #{type}
+        </if>
+	</sql>
+	<select id="countTeacherExtraHomeworkDetailV2" resultType="int">
+        select count(1) from (
+        select 1 from extracurricular_exercises
+        <where>
+        <include refid="extraHomeworkDetailV2"/>
+        </where>
+        <if test="subjectIds != null and subjectIds.size() != 0">
+            union all
+            select 1 from music_group
+            where id_ in
+            <foreach collection="subjectIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>) t
+    </select>
+
+	<select id="queryTeacherExtraHomeworkDetailV2"
+            resultType="com.ym.mec.biz.dal.dto.CourseHomeworkWrapper$CourseHomeworkList">
+
+        <if test="subjectIds != null and subjectIds.size() != 0">
+            (select
+            id_ as musicGroupId,
+            'UNASSIGNED' as homeWorkStatus,
+            'EXTRACURRICULAR' as `type`,
+            null as courseScheduleId,
+            null as courseHomeworkId,
+            null as classGroupId,
+            null as studentNum,
+            null as finishNum,
+            null as assignTime,
+            null as expiryDate
+            from music_group
+            where id_ in
+            <foreach collection="subjectIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+            )
+            union all
+        </if>
+        (select
+        music_group_id_ as musicGroupId,
+        if(expire_date_ &gt; NOW(), 'ASSIGNED', 'DEADLINE') as homeWorkStatus,
+        group_type_ as `type`,
+        id_ as courseScheduleId,
+        id_ as courseHomeworkId,
+        class_group_id_ as classGroupId,
+        expect_num_ as studentNum,
+        completed_num_ as finishNum,
+        create_time_ as assignTime,
+        expire_date_ as expiryDate
+        from extracurricular_exercises
+        <where>
+
+            <include refid="extraHomeworkDetailV2"/>
+        </where>
+        )
+        <include refid="global.limit"/>
+    </select>
 </mapper>

+ 7 - 1
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -45,6 +45,7 @@
 		<result column="musicGroupId" property="musicGroupId" />
 		<result column="type" property="type" />
 		<result column="classGroupId" property="classGroupId" />
+		<result column="subjectId" property="subjectId" />
 	</resultMap>
 
 	<sql id="queryPageCondition">
@@ -196,10 +197,12 @@
 			eer.*,
 			su.username_ student_name_,
 		    su.avatar_,
-		    su.phone_
+		    su.phone_,
+        s.subject_id_list_ as subjectId
 		FROM
 			extracurricular_exercises_reply eer
 			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
+        left join student s on s.user_id_ = su.id_
 		WHERE eer.extracurricular_exercises_id_= #{extraExerciseId}
 		<if test="studentName != null">
 			AND su.username_ LIKE CONCAT('%',#{studentName},'%')
@@ -629,4 +632,7 @@
 		GROUP BY sr.actual_subject_id_
 	</select>
 
+	<select id="getByExtraIdAndUserId">
+        SELECT * from  extracurricular_exercises_reply where extracurricular_exercises_id_ = #{extraId} and user_id_ = #{userId}
+    </select>
 </mapper>

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

@@ -668,7 +668,7 @@
         </where>
     </sql>
 
-    <select id="findByCourseScheduleIds" resultType="com.ym.mec.biz.dal.entity.StudentCourseHomework">
+    <select id="findByCourseScheduleIds" resultMap="StudentCourseHomework">
         select *
         from student_course_homework
         where course_schedule_id_ in
@@ -690,4 +690,34 @@
 
         order by s.id_
     </select>
+
+    <select id="findStudentCourseHomeworkByCourse" resultMap="StudentCourseHomework">
+        SELECT
+        sch.*,
+        su.username_,
+        su.avatar_,
+        su.phone_
+        FROM
+        student_course_homework sch
+        LEFT JOIN sys_user su ON sch.user_id_=su.id_
+        left join student s on s.user_id_ = su.id_
+        <where>
+            sch.course_schedule_id_=#{query.courseScheduleId}
+            <if test="query.subjectId != null">
+                and s.subject_id_list_ = #{query.subjectId}
+            </if>
+        </where>
+    </select>
+
+    <select id="queryNotSuccessHomeworkList" resultType="int">
+        SELECT
+            count(sch.id_)
+        FROM
+            student_course_homework sch
+        left join course_homework ch on ch.id_ = sch.course_homework_id_
+        WHERE
+            sch.user_id_ = #{userId}
+                AND sch.standard_flag_ not in ('STANDARD','EXCELLENT')
+        and ch.expiry_date_ &gt;= #{now}
+    </select>
 </mapper>

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -836,7 +836,9 @@
                  LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
                  LEFT JOIN student_extracurricular_exercises_situation_ se ON se.teacher_id_ = csts.user_id_
         WHERE csts.user_id_ = #{teacherId}
-          AND cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
+        <if test="firstDayOfMonth != null and lastDayOfMonth != null">
+            AND cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
+        </if>
           AND FIND_IN_SET(cs.id_, se.course_ids_)
           AND se.serve_type_ = 'HOMEWORK'
     </select>

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentLessonExaminationMapper.xml

@@ -86,4 +86,12 @@
         ORDER BY sle.training_score_ DESC
     </select>
 
+    <select id="queryNotSuccessExaminationList" resultType="int">
+        select sle.lesson_examination_id_
+        from student_lesson_examination sle
+        left join lesson_examination le on sle.lesson_examination_id_ = le.id_
+        where sle.user_id_ = #{userId}
+          AND sle.standard_flag_ = 0
+        and le.expire_date_ &gt; NOW()
+    </select>
 </mapper>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -110,6 +110,9 @@
             <if test="signInStatus != null">
                 sign_in_status_ = #{signInStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
+            <if test="signInAttachments != null">
+                sign_in_attachments_ = #{signInAttachments},
+            </if>
             <if test="currentScheduleId != null">
                 current_schedule_id_ = #{currentScheduleId},
             </if>

+ 13 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseHomeworkController.java

@@ -5,10 +5,12 @@ import com.ym.mec.biz.dal.dto.HomeworkStat;
 import com.ym.mec.biz.dal.dto.StudentHomeworkRecordDto;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
 import com.ym.mec.biz.dal.entity.StudentCourseHomework;
+import com.ym.mec.biz.dal.entity.StudentLessonTrainingDetail;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
 import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.StudentLessonTrainingDetailService;
 import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
@@ -43,6 +45,9 @@ public class StudentCourseHomeworkController extends BaseController {
     @Autowired
     private StudentServeService studentServeService;
 
+    @Autowired
+    private StudentLessonTrainingDetailService studentLessonTrainingDetailService;
+
     @ApiOperation(value = "提交作业")
     @PostMapping(value = "/add",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @AuditLogAnnotation(operateName = "提交作业")
@@ -106,7 +111,7 @@ public class StudentCourseHomeworkController extends BaseController {
 
     @ApiOperation(value = "获取学生作业详情")
     @GetMapping(value = "/findStudentHomeworkRecordDetail")
-    public HttpResponseResult<CourseHomeworkWrapper.StudentCourseHomeworkDetail>
+    public HttpResponseResult<CourseHomeworkWrapper.CourseHomeworkList>
             findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query){
         query.setUserId(sysUserService.getUserId().longValue());
         return succeed(studentCourseHomeworkService.findStudentHomeworkRecordDetail(query));
@@ -165,4 +170,11 @@ public class StudentCourseHomeworkController extends BaseController {
         return succeed(studentServeService.homeworkStat(userId));
     }
 
+    @ApiOperation(value = "课后训练的作业详情")
+    @GetMapping("/homeworkDetail")
+    public HttpResponseResult<StudentLessonTrainingDetail> homeworkStat(Integer id) {
+
+        return succeed(studentLessonTrainingDetailService.getById(id));
+    }
+
 }

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

@@ -145,8 +145,12 @@ public class CourseHomeworkController extends BaseController {
     @ApiOperation(value = "获取作业详情")
     @GetMapping(value = "/findCourseHomeworkDetail")
     public HttpResponseResult<CourseHomeworkWrapper.CourseHomeworkList> findCourseHomeworkDetail(Integer courseScheduleId,ELessonTrainingType type){
+        if (ELessonTrainingType.HOMEWORK.equals(type)) {
 
-        return succeed(courseHomeworkService.findCourseHomeworkDetail(courseScheduleId));
+            return succeed(courseHomeworkService.findCourseHomeworkDetail(courseScheduleId));
+        } else {
+            return succeed(courseHomeworkService.findCourseExtraHomeworkDetail(courseScheduleId));
+        }
     }
 
 
@@ -155,7 +159,7 @@ public class CourseHomeworkController extends BaseController {
     @ApiOperation(value = "根据课程计划获取需要交作业的学生-公用")
     @PostMapping("/findCourseStudentsPublic/v2")
     public HttpResponseResult<List<StudentCourseHomework>> findCourseStudentsPublicV2(@Validated @RequestBody StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query){
-        if(!ELessonTrainingType.HOMEWORK.equals(query.getType())){
+        if(ELessonTrainingType.HOMEWORK.equals(query.getType())){
             if (Objects.isNull(query.getCourseScheduleId())) {
                 throw new BizException("请指定课程");
             }
@@ -170,7 +174,7 @@ public class CourseHomeworkController extends BaseController {
     @ApiOperation(value = "查询单个学生的训练")
     @GetMapping("/findCourseHomeworkStudentDetailPublic/v2")
     public HttpResponseResult<StudentLessonTrainingDetailWrapper.StudentLessonTraining> findCourseHomeworkStudentDetailPublicV2(@RequestParam Long courseScheduleId, @RequestParam Long userId, @RequestParam ELessonTrainingType type){
-        if(!ELessonTrainingType.HOMEWORK.equals(type)){
+        if(ELessonTrainingType.HOMEWORK.equals(type)){
 
             // 获取学生作业界面详细信息
             return succeed(studentCourseHomeworkService.findCourseHomeworkStudentDetailPublicV2(courseScheduleId, userId,type));

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

@@ -79,7 +79,7 @@ public class ExtracurricularExercisesController extends BaseController {
         return succeed(studentExtracurricularExercisesSituationService.queryTeacherServeHomeworkDetailV2(queryInfo));
     }
 
-    @ApiOperation(value = "获取教师有服务指标的课程列表")
+    @ApiOperation(value = "获取教师课外作业列表")
     @GetMapping("/queryTeacherExtraHomeworkDetail/v2")
     public HttpResponseResult<PageInfo<CourseHomeworkWrapper.CourseHomeworkList>> queryTeacherExtraHomeworkDetailV2(CourseHomeworkWrapper.CourseHomeworkQuery queryInfo) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
@@ -87,7 +87,7 @@ public class ExtracurricularExercisesController extends BaseController {
             return failed("用户信息获取失败");
         }
         queryInfo.setTeacherId(sysUser.getId());
-        return succeed(studentExtracurricularExercisesSituationService.queryTeacherServeHomeworkDetailV2(queryInfo));
+        return succeed(studentExtracurricularExercisesSituationService.queryTeacherExtraHomeworkDetailV2(queryInfo));
     }
 
 

+ 35 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TeacherController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.CourseHomework;
 import com.ym.mec.biz.dal.entity.StudentCourseHomework;
+import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.ELessonTrainingType;
 import com.ym.mec.biz.dal.page.*;
@@ -10,6 +11,7 @@ import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.CourseHomeworkService;
 import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -20,6 +22,7 @@ import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.CollectionUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -28,8 +31,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 @RequestMapping("teacher")
 @Api(tags = "教师服务")
@@ -47,6 +52,9 @@ public class TeacherController extends BaseController {
     private CourseHomeworkService courseHomeworkService;
 
     @Autowired
+    private SubjectService subjectService;
+
+    @Autowired
     private StudentCourseHomeworkService studentCourseHomeworkService;
 
     @ApiOperation(value = "获取老师列表(基本信息)")
@@ -229,4 +237,31 @@ public class TeacherController extends BaseController {
             return succeed(studentCourseHomeworkService.findExtraExerciseStudentsV2(query));
         }
     }
+
+
+
+    @ApiOperation(value = "根据课程计划获取需要交作业的学生声部-公用")
+    @PostMapping("/findCourseStudentsSubjectPublic/v2")
+    public HttpResponseResult<List<Subject>> findCourseStudentsSubjectPublicV2(@Validated @RequestBody StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query){
+        List<StudentCourseHomework> studentCourseHomeworkByCourseV2;
+        if(!ELessonTrainingType.HOMEWORK.equals(query.getType())){
+            if (Objects.isNull(query.getCourseScheduleId())) {
+                throw new BizException("请指定课程");
+            }
+            studentCourseHomeworkByCourseV2 = studentCourseHomeworkService.findStudentCourseHomeworkByCourseV2(
+                query);
+        }else{
+            studentCourseHomeworkByCourseV2 = studentCourseHomeworkService.findExtraExerciseStudentsV2(query);
+        }
+
+        if (CollectionUtils.isEmpty(studentCourseHomeworkByCourseV2)) {
+            return succeed(new ArrayList<>());
+        }
+        // 获取声部
+        List<Integer> collect = studentCourseHomeworkByCourseV2.stream().map(StudentCourseHomework::getSubjectId).collect(
+            Collectors.toList());
+
+        return succeed(subjectService.findBySubjectByIdList(collect));
+
+    }
 }