소스 검색

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

zouxuan 5 년 전
부모
커밋
0e1f3ed2ef

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.common.dal.BaseDAO;
@@ -33,8 +34,8 @@ public interface ExtracurricularExercisesDao extends BaseDAO<Long, Extracurricul
      * @param search:
      * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
      */
-    List<SimpleUserDto> findNoExercisesStudentsInThisWeekWithTeacher(@Param("teacherId") Integer teacherId,
-                                                                     @Param("startDate") String startDate,
-                                                                     @Param("search") String search);
+    List<BasicUserDto> findNoExercisesStudentsInThisWeekWithTeacher(@Param("teacherId") Integer teacherId,
+                                                                    @Param("startDate") String startDate,
+                                                                    @Param("search") String search);
 
 }

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.page.ExtraExercilseQueryInfo;
@@ -35,6 +36,6 @@ public interface ExtracurricularExercisesService extends BaseService<Long, Extra
      * @param search:
      * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
      */
-    List<SimpleUserDto> getDontServeStudents(Integer teacherId, String search);
+    List<BasicUserDto> getDontServeStudents(Integer teacherId, String search);
 
 }

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

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.ExtracurricularExercisesDao;
 import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
@@ -160,7 +161,7 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
-	public List<SimpleUserDto> getDontServeStudents(Integer teacherId, String search) {
+	public List<BasicUserDto> getDontServeStudents(Integer teacherId, String search) {
 		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
 		return extracurricularExercisesDao.findNoExercisesStudentsInThisWeekWithTeacher(teacherId, monDayDate.toString(), search);

+ 19 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -74,11 +74,12 @@ public class StudentServeServiceImpl implements StudentServeService {
         //本周无课学员编号集合
         Set<Integer> noClassStudentIds=new HashSet<>();
         for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
-            if(CollectionUtils.isEmpty(studentCoursesEntry.getValue())){
+            List<StudentServeDto> haveCourseStudents = studentCoursesEntry.getValue().stream().filter(e -> Objects.nonNull(e.getCourseStartTime())).collect(Collectors.toList());
+            if(CollectionUtils.isEmpty(haveCourseStudents)){
                 noClassStudentIds.add(studentCoursesEntry.getKey());
                 continue;
             }
-            StudentServeDto studentServeDto = studentCoursesEntry.getValue().stream().min(Comparator.comparing(StudentServeDto::getCourseStartTime)).get();
+            StudentServeDto studentServeDto = haveCourseStudents.stream().min(Comparator.comparing(StudentServeDto::getCourseStartTime)).get();
             if(Objects.isNull(studentServeDto.getCourseStartTime())){
                 noClassStudentIds.add(studentCoursesEntry.getKey());
                 continue;
@@ -87,8 +88,10 @@ public class StudentServeServiceImpl implements StudentServeService {
                 dontServeInCurrentWeekStudentIds.add(studentCoursesEntry.getKey());
                 continue;
             }
-            if(GroupType.PRACTICE.equals(studentServeDto.getGroupType())||
-                    (GroupType.MUSIC.equals(studentServeDto.getGroupType())&&TeachModeEnum.OFFLINE.equals(studentServeDto.getTeachMode()))){
+            long count = haveCourseStudents.stream().filter(e -> (GroupType.PRACTICE.equals(e.getGroupType()) ||
+                    (GroupType.MUSIC.equals(e.getGroupType()) && TeachModeEnum.OFFLINE.equals(e.getTeachMode())))
+                    &&nextMonday.after(e.getCourseStartTime())).count();
+            if(count>0){
                 haveClassStudentIds.add(studentCoursesEntry.getKey());
             }else{
                 noClassStudentIds.add(studentCoursesEntry.getKey());
@@ -109,23 +112,23 @@ public class StudentServeServiceImpl implements StudentServeService {
         }
 
         List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
-        for (StudentServeDto serviceStudent : serviceStudents) {
+        for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 
-            if(dontServeInCurrentWeekStudentIds.contains(serviceStudent.getUserId())){
+            if(dontServeInCurrentWeekStudentIds.contains(studentCoursesEntry.getKey())){
                 continue;
             }
 
             StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation();
-            studentExtracurricularExercisesSituation.setStudentId(serviceStudent.getUserId());
-            studentExtracurricularExercisesSituation.setTeacherId(serviceStudent.getTeacherId());
+            studentExtracurricularExercisesSituation.setStudentId(studentCoursesEntry.getKey());
+            studentExtracurricularExercisesSituation.setTeacherId(studentCoursesEntry.getValue().get(0).getTeacherId());
             studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
             studentExtracurricularExercisesSituation.setWeekOfYear(nowDate.get(DateUtil.weekFields.weekOfYear()));
             studentExtracurricularExercisesSituation.setMonday(DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"));
             studentExtracurricularExercisesSituation.setSunday(DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"));
 
-            if(haveClassStudentIds.contains(serviceStudent.getUserId())){
+            if(haveClassStudentIds.contains(studentCoursesEntry.getKey())){
                 studentExtracurricularExercisesSituation.setServeType("HOMEWORK");
-                List<StudentServeCourseHomeworkDto> studentHomeworks = studentHomeworkMap.get(serviceStudent.getUserId());
+                List<StudentServeCourseHomeworkDto> studentHomeworks = studentHomeworkMap.get(studentCoursesEntry.getKey());
                 if(CollectionUtils.isEmpty(studentHomeworks)){
                     studentExtracurricularExercisesSituation.setActualExercisesNum(0);
                     studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
@@ -144,10 +147,10 @@ public class StudentServeServiceImpl implements StudentServeService {
                     int exercisesMessageNum=0;
                     int exercisesMessageTimelyNum=0;
                     for (StudentServeCourseHomeworkDto studentHomework : studentHomeworks) {
-                        if(!new Integer(1).equals(studentHomework.getStatus())){
+                        if(!YesOrNoEnum.YES.equals(studentHomework.getStatus())){
                             continue;
                         }
-                        if(!new Integer(1).equals(studentHomework.getIsReplied())){
+                        if(!YesOrNoEnum.YES.equals(studentHomework.getIsReplied())){
                             continue;
                         }
                         exercisesMessageNum+=1;
@@ -161,9 +164,9 @@ public class StudentServeServiceImpl implements StudentServeService {
                 }
             }
 
-            if(noClassStudentIds.contains(serviceStudent.getUserId())){
+            if(noClassStudentIds.contains(studentCoursesEntry.getKey())){
                 studentExtracurricularExercisesSituation.setServeType("EXERCISE");
-                List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(serviceStudent.getUserId());
+                List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(studentCoursesEntry.getKey());
                 if(CollectionUtils.isEmpty(studentExercises)){
                     studentExtracurricularExercisesSituation.setActualExercisesNum(0);
                     studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
@@ -182,10 +185,10 @@ public class StudentServeServiceImpl implements StudentServeService {
                 int exercisesMessageNum=0;
                 int exercisesMessageTimelyNum=0;
                 for (ExtracurricularExercisesReply studentHomework : studentExercises) {
-                    if(!new Integer(1).equals(studentHomework.getStatus())){
+                    if(!YesOrNoEnum.YES.equals(studentHomework.getStatus())){
                         continue;
                     }
-                    if(!new Integer(1).equals(studentHomework.getIsReplied())){
+                    if(!YesOrNoEnum.YES.equals(studentHomework.getIsReplied())){
                         continue;
                     }
                     exercisesMessageNum+=1;

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

@@ -164,9 +164,9 @@
             resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
 		SELECT
 			su.id_ userId,
-			su.username_ userName,
-			su.avatar_ avatar,
-			GROUP_CONCAT(sub.name_) subjectNames
+			su.username_ name,
+			su.avatar_ headUrl,
+			GROUP_CONCAT(sub.name_) subjectName
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			LEFT JOIN extracurricular_exercises_reply eer ON sees.student_id_ = eer.user_id_

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -411,7 +411,7 @@
 			ee.teacher_id_,
 			tea.real_name_ teacher_name_,
 			NULL group_id_,
-			NULL group_type,
+			NULL group_type_,
 			NULL group_name_,
 			NULL course_start_time_,
 			NULL course_end_time_,
@@ -436,7 +436,7 @@
 			cs.actual_teacher_id_,
 			tea.real_name_ teacher_name_,
 			cs.music_group_id_ group_id_,
-			cs.group_type_ group_type,
+			cs.group_type_,
 			cs.name_ group_name_,
 			CONCAT(cs.class_date_, ' ', cs.start_class_time_) course_start_time_,
 			CONCAT(cs.class_date_, ' ', cs.end_class_time_) course_end_time_,
@@ -453,7 +453,7 @@
 		LEFT JOIN course_schedule cs ON cs.id_=ch.course_schedule_id_
 		LEFT JOIN sys_user tea ON cs.actual_teacher_id_=tea.id_
 		WHERE
-			sch.user_id_=#{studentId} AND DATE_FORMAT( sch.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday})
+			sch.user_id_=#{studentId} AND cs.class_date_ BETWEEN #{monday} AND #{sunday})
 		ORDER BY homework_create_time_ DESC
 		<include refid="global.limit"/>
 	</select>
@@ -471,8 +471,9 @@
 				sch.id_
 			FROM
 				student_course_homework sch
+				LEFT JOIN course_schedule cs ON cs.id_=sch.course_schedule_id_
 			WHERE
-				sch.user_id_=#{studentId} AND DATE_FORMAT( sch.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday})
+				sch.user_id_=#{studentId} AND cs.class_date_ BETWEEN #{monday} AND #{sunday})
 		) t
 	</select>
 	<select id="getStudentExercisesWithTimeZone" resultMap="ExtracurricularExercisesReply">

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -101,10 +101,10 @@
 				sunday_ = #{sunday},
 			</if>
 			<if test="lastSubmitTime!=null">
-				last_submit_time_=#{lastSubmitTime}
+				last_submit_time_=#{lastSubmitTime},
 			</if>
 			<if test="serveType!=null">
-				serve_type_=#{serveType}
+				serve_type_=#{serveType},
 			</if>
 			update_time_ = #{updateTime}
 		</set> WHERE id_ = #{id}
@@ -147,6 +147,7 @@
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
+			LEFT JOIN teacher t ON t.id_=sees.teacher_id_
 			LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
 			LEFT JOIN organization o ON stu.organ_id_=o.id_
 		WHERE
@@ -159,7 +160,7 @@
 				AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
 			</if>
 			<if test="organIdList != null">
-				AND FIND_IN_SET(stu.organ_id_,#{organIdList})
+				AND FIND_IN_SET(t.organ_id_,#{organIdList})
 			</if>
 			<if test="existVipCourse!=null and existVipCourse==1">
 				AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
@@ -213,6 +214,7 @@
 			FROM
 				student_extracurricular_exercises_situation_ sees
 				LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
+		LEFT JOIN teacher t ON t.id_=sees.teacher_id_
 				LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
 				LEFT JOIN organization o ON stu.organ_id_=o.id_
 			WHERE
@@ -225,7 +227,7 @@
 				AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
 			</if>
 			<if test="organIdList != null">
-				AND FIND_IN_SET(stu.organ_id_, #{organIdList})
+				AND FIND_IN_SET(t.organ_id_, #{organIdList})
 			</if>
 			<if test="existVipCourse!=null and existVipCourse==1">
 				AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})

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

@@ -355,7 +355,7 @@
 
     <resultMap id="StudentServeDto" type="com.ym.mec.biz.dal.dto.StudentServeDto" extends="Student">
         <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <result column="teachMode" property="teach_mode_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="teach_mode_" property="teachMode" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="courseStartTime" column="course_start_time_"/>
     </resultMap>
     <select id="getBeServiceStudents" resultMap="StudentServeDto">