Forráskód Böngészése

feat:教师端服务学员列表搜索条件

Joburgess 4 éve
szülő
commit
a7fd4a8e6b

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
@@ -468,4 +469,14 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
                                                                             @Param("musicGroupId") String musicGroupId);
 
     List<Long> getLessThenThreeClassGroupIds(@Param("organIds") String organIds);
+
+    /**
+     * @describe 获取学员与老师所在班级
+     * @author Joburgess
+     * @date 2021/2/5 0005
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.ClassGroup>
+     */
+    List<ClassGroup> getStudentClassGroupWithTeacher(@Param("studentIds") Set<Integer> studentIds,
+                                                     @Param("teacherId") Integer teacherId);
 }

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

@@ -37,6 +37,8 @@ public interface ExtracurricularExercisesDao extends BaseDAO<Long, Extracurricul
     List<BasicUserDto> findNoExercisesStudentsInThisWeekWithTeacher(@Param("teacherId") Integer teacherId,
                                                                     @Param("startDate") String startDate,
                                                                     @Param("musicGroupId") String musicGroupId,
+                                                                    @Param("classGroupId") Long classGroupId,
+                                                                    @Param("subjectId") Integer subjectId,
                                                                     @Param("search") String search);
 
 }

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

@@ -6,12 +6,14 @@ import com.ym.mec.biz.dal.dto.Student4operating;
 import com.ym.mec.biz.dal.dto.StudentServeCourseDto;
 import com.ym.mec.biz.dal.dto.StudentServeDto;
 import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.enums.GroupType;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Student> {
 	
@@ -174,4 +176,13 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @param serviceTag
      */
     void updateServiceTag(@Param("studentIds") List<Integer> studentIds, @Param("serviceTag") Integer serviceTag);
+
+    /**
+     * @describe 获取学员声部列表
+     * @author Joburgess
+     * @date 2021/2/5 0005
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.Subject>
+     */
+    List<Subject> getStudentSubjects(@Param("studentIds") Set<Integer> studentIds);
 }

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

@@ -36,7 +36,7 @@ public interface ExtracurricularExercisesService extends BaseService<Long, Extra
      * @param search:
      * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
      */
-    List<BasicUserDto> getDontServeStudents(Integer teacherId, String search, String musicGroupId);
+    List<BasicUserDto> getDontServeStudents(Integer teacherId, String search, String musicGroupId,Long classGroupId,Integer subjectId);
 
     /**
      * @describe 应布置课外训练提醒

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

@@ -168,10 +168,10 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
-	public List<BasicUserDto> getDontServeStudents(Integer teacherId, String search, String musicGroupId) {
+	public List<BasicUserDto> getDontServeStudents(Integer teacherId, String search, String musicGroupId,Long classGroupId,Integer subjectId) {
 		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-		return extracurricularExercisesDao.findNoExercisesStudentsInThisWeekWithTeacher(teacherId, monDayDate.toString(), musicGroupId, search);
+		return extracurricularExercisesDao.findNoExercisesStudentsInThisWeekWithTeacher(teacherId, monDayDate.toString(), musicGroupId, classGroupId, subjectId, search);
 	}
 
 	@Override

+ 19 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -653,4 +653,23 @@
         HAVING
         COUNT(CASE WHEN cgsm.status_ = 'NORMAL' THEN 1 ELSE NULL END) &lt; 3
     </select>
+
+    <select id="getStudentClassGroupWithTeacher" resultType="com.ym.mec.biz.dal.entity.ClassGroup">
+        SELECT
+            cg.*
+        FROM
+            class_group_student_mapper cgsm
+            LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
+            LEFT JOIN class_group cg ON cg.id_ = cgsm.class_group_id_
+        WHERE
+            cg.del_flag_ = 0
+            AND cg.lock_flag_ =0
+            AND cgsm.user_id_ IN
+            <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+                #{studentId}
+            </foreach>
+            <if test="teacherId!=null">
+                AND cgtm.user_id_ = #{teacherId}
+            </if>
+    </select>
 </mapper>

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

@@ -172,6 +172,9 @@
 			<if test="musicGroupId!=null and musicGroupId!=''">
 				LEFT JOIN student_registration sr ON sees.student_id_=sr.user_id_
 			</if>
+			<if test="classGroupId!=null">
+				LEFT JOIN class_group_student_mapper cgsm ON sees.student_id_ = cgsm.user_id_
+			</if>
 			LEFT JOIN student stu ON stu.user_id_ = sees.student_id_
 			LEFT JOIN sys_user su ON su.id_ = sees.student_id_
 			LEFT JOIN `subject` sub ON FIND_IN_SET( sub.id_, stu.subject_id_list_ )
@@ -183,6 +186,12 @@
 			<if test="musicGroupId!=null and musicGroupId!=''">
 				AND sr.music_group_id_=#{musicGroupId}
 			</if>
+			<if test="classGroupId!=null">
+				AND cgsm.class_group_id_ = #{classGroupId}
+			</if>
+			<if test="subjectId!=null">
+				AND FIND_IN_SET(stu.subject_id_list_, #{subjectId})
+			</if>
 			<if test="search!=null">
 				AND (su.username_ LIKE CONCAT('%', #{search}, '%') OR su.phone_ LIKE CONCAT(#{search}, '%'))
 			</if>

+ 13 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -629,4 +629,17 @@
         GROUP BY s.user_id_ HAVING COUNT(CASE WHEN cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) = 0
         AND COUNT(CASE WHEN sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS' THEN 1 ELSE NULL END) = 0;
     </select>
+
+    <select id="getStudentSubjects" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
+        SELECT
+            DISTINCT sub.*
+        FROM
+            student stu
+            LEFT JOIN `subject` sub ON FIND_IN_SET( stu.subject_id_list_, sub.id_ )
+        WHERE
+            stu.user_id_ IN
+            <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+                #{studentId}
+            </foreach>
+    </select>
 </mapper>

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

@@ -2,10 +2,14 @@ package com.ym.mec.teacher.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.page.ExtraExercilseQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
 import com.ym.mec.biz.service.ExtracurricularExercisesService;
@@ -22,10 +26,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -45,6 +46,10 @@ public class ExtracurricularExercisesController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
+    @Autowired
+    private StudentDao studentDao;
 
     @ApiOperation(value = "创建课外训练")
     @PostMapping("/createExtraExercises")
@@ -81,12 +86,12 @@ public class ExtracurricularExercisesController extends BaseController {
 
     @ApiOperation(value = "获取待布置学员列表")
     @GetMapping("/getDontServeStudents")
-    public HttpResponseResult getDontServeStudents(String search, String musicGroupId){
+    public HttpResponseResult getDontServeStudents(String search, String musicGroupId, Long classGroupId, Integer subjectId){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(Objects.isNull(sysUser)){
             return failed(HttpStatus.FORBIDDEN,"请登录");
         }
-        return succeed(extracurricularExercisesService.getDontServeStudents(sysUser.getId(), search, musicGroupId));
+        return succeed(extracurricularExercisesService.getDontServeStudents(sysUser.getId(), search, musicGroupId, classGroupId, subjectId));
     }
 
     @ApiOperation(value = "获取待布置学员乐团列表")
@@ -96,7 +101,7 @@ public class ExtracurricularExercisesController extends BaseController {
         if(Objects.isNull(sysUser)){
             return failed(HttpStatus.FORBIDDEN,"请登录");
         }
-        List<BasicUserDto> dontServeStudents = extracurricularExercisesService.getDontServeStudents(sysUser.getId(), search, null);
+        List<BasicUserDto> dontServeStudents = extracurricularExercisesService.getDontServeStudents(sysUser.getId(), search, null, null,null);
         if(CollectionUtils.isEmpty(dontServeStudents)){
             return succeed(Collections.emptyList());
         }
@@ -104,4 +109,28 @@ public class ExtracurricularExercisesController extends BaseController {
         List<MusicGroup> studentNormalMusicGroups = studentRegistrationDao.getStudentNormalMusicGroups(studentIds);
         return succeed(studentNormalMusicGroups);
     }
+
+    @ApiOperation(value = "获取服务学员查询条件")
+    @GetMapping("/getDontServeStudentQueryCondition")
+    public HttpResponseResult getDontServeStudentQueryCondition(){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(sysUser)){
+            return failed(HttpStatus.FORBIDDEN,"请登录");
+        }
+        Map<String, Object> result = new HashMap<>();
+        List<BasicUserDto> dontServeStudents = extracurricularExercisesService.getDontServeStudents(sysUser.getId(), null, null);
+        if(CollectionUtils.isEmpty(dontServeStudents)){
+            return succeed(result);
+        }
+        Set<Integer> studentIds = dontServeStudents.stream().map(BasicUserDto::getUserId).collect(Collectors.toSet());
+        List<MusicGroup> studentNormalMusicGroups = studentRegistrationDao.getStudentNormalMusicGroups(studentIds);
+        result.put("musicGroups", studentNormalMusicGroups);
+
+        List<ClassGroup> classGroups = classGroupStudentMapperDao.getStudentClassGroupWithTeacher(studentIds, sysUser.getId());
+        result.put("classGroups", classGroups);
+
+        List<Subject> studentSubjects = studentDao.getStudentSubjects(studentIds);
+        result.put("subjects", studentSubjects);
+        return succeed(result);
+    }
 }