Explorar o código

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

zouxuan %!s(int64=5) %!d(string=hai) anos
pai
achega
1e7e57aeb9

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

@@ -377,5 +377,5 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      * @param studentIds
      * @return
      */
-    List<Map<Integer, Integer>> getStudentEducationalTeachers(@Param("studentIds") List<Integer> studentIds);
+    List<StudentEduTeacherDto> getStudentEducationalTeachers(@Param("studentIds") List<Integer> studentIds);
 }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentEduTeacherDto.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dto;
+
+public class StudentEduTeacherDto {
+
+    private Integer studentId;
+
+    private Integer educationalTeacherId;
+
+    private String educationalTeacherName;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getEducationalTeacherId() {
+        return educationalTeacherId;
+    }
+
+    public void setEducationalTeacherId(Integer educationalTeacherId) {
+        this.educationalTeacherId = educationalTeacherId;
+    }
+
+    public String getEducationalTeacherName() {
+        return educationalTeacherName;
+    }
+
+    public void setEducationalTeacherName(String educationalTeacherName) {
+        this.educationalTeacherName = educationalTeacherName;
+    }
+}

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentExercisesSituationDto.java

@@ -18,6 +18,26 @@ public class StudentExercisesSituationDto extends StudentExtracurricularExercise
 
     private Integer existPracticeCourse;
 
+    private Integer educationalTeacherId;
+
+    private String educationalTeacherName;
+
+    public Integer getEducationalTeacherId() {
+        return educationalTeacherId;
+    }
+
+    public void setEducationalTeacherId(Integer educationalTeacherId) {
+        this.educationalTeacherId = educationalTeacherId;
+    }
+
+    public String getEducationalTeacherName() {
+        return educationalTeacherName;
+    }
+
+    public void setEducationalTeacherName(String educationalTeacherName) {
+        this.educationalTeacherName = educationalTeacherName;
+    }
+
     public Integer getExistPracticeCourse() {
         return existPracticeCourse;
     }

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

@@ -353,8 +353,7 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         }
 
         for (ExtendTeacherBasicDto organAndSubjectTeacher : organAndSubjectTeachers) {
-            if (!includeTeacherIds.contains(organAndSubjectTeacher.getId())
-                    && 1 == organAndSubjectTeacher.getIsSupportExtraPracticeLesson()) {
+            if (!includeTeacherIds.contains(organAndSubjectTeacher.getId())) {
                 includeTeacherIds.add(organAndSubjectTeacher.getId());
             }
         }

+ 19 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -1,9 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
-import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.StudentEduTeacherDto;
 import com.ym.mec.biz.dal.dto.StudentExercisesSituationDto;
 import com.ym.mec.biz.dal.dto.StudentServiceDetailDto;
 import com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation;
@@ -18,6 +16,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import java.time.DayOfWeek;
 import java.time.LocalDate;
@@ -37,6 +36,8 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 	private CourseScheduleDao courseScheduleDao;
 	@Autowired
 	private TeacherDao teacherDao;
+	@Autowired
+	private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 
 	@Override
 	public BaseDAO<Long, StudentExtracurricularExercisesSituation> getDAO() {
@@ -63,12 +64,21 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 
 			List<Map<Integer, Long>> studentPracticeCoursesMaps = courseScheduleDao.countStudentPayPracticeCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday());
 			Map<Integer, Long> studentPracticeCourseMap = MapUtil.convertIntegerMap(studentPracticeCoursesMaps);
+
+			List<StudentEduTeacherDto> studentEducationalTeachers = classGroupStudentMapperDao.getStudentEducationalTeachers(studentIds);
+			Map<Integer, List<StudentEduTeacherDto>> studentEduTeachersMap = studentEducationalTeachers.stream().collect(Collectors.groupingBy(StudentEduTeacherDto::getStudentId));
+
 			for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
 				Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
 				exercisesSituationDto.setExistVipCourse(Objects.isNull(vipCourses)?0:vipCourses.intValue());
 				Long practiceCourses=studentPracticeCourseMap.get(exercisesSituationDto.getStudentId());
 				exercisesSituationDto.setExistPracticeCourse(Objects.isNull(practiceCourses)?0:practiceCourses.intValue());
 				exercisesSituationDto.setExpectExercisesNum((int) until+1);
+				List<StudentEduTeacherDto> studentEduTeachers = studentEduTeachersMap.get(exercisesSituationDto.getStudentId());
+				if(!CollectionUtils.isEmpty(studentEduTeachers)){
+					exercisesSituationDto.setEducationalTeacherId(studentEduTeachers.get(0).getEducationalTeacherId());
+					exercisesSituationDto.setEducationalTeacherName(studentEduTeachers.get(0).getEducationalTeacherName());
+				}
 			}
 		}
 		if (count == 0) {
@@ -90,11 +100,14 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			dataList = studentExtracurricularExercisesSituationDao.findExercisesSituations(params);
+			Map<Integer, Long> studentVipCourseMap=new HashMap<>();
 			if(Objects.isNull(queryInfo.getExistVipCourse())){
 				List<Integer> studentIds = dataList.stream().map(StudentExtracurricularExercisesSituation::getStudentId).collect(Collectors.toList());
 				List<Map<Integer, Long>> studentVipCoursesMaps = courseScheduleDao.countStudentVipCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday(),GroupType.VIP);
-				Map<Integer, Long> studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
-				for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
+				studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
+			}
+			for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
+				if(Objects.isNull(queryInfo.getExistVipCourse())){
 					Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
 					if(Objects.isNull(vipCourses)||vipCourses<=0){
 						exercisesSituationDto.setExistVipCourse(0);

+ 45 - 13
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -454,20 +454,52 @@
             </if>
         </where>
     </select>
-    <select id="getStudentEducationalTeachers" resultType="java.util.Map">
-        SELECT t.user_id_ AS 'key',MAX(t.educational_teacher_id_) AS 'value'
-        FROM (
-        SELECT cgsm.user_id_, g.educational_teacher_id_ FROM class_group_student_mapper cgsm
-        LEFT JOIN music_group g ON cgsm.music_group_id_=g.id_
-        WHERE cgsm.group_type_='MUSIC'
+    <select id="getStudentEducationalTeachers" resultType="com.ym.mec.biz.dal.dto.StudentEduTeacherDto">
+        SELECT
+        t.user_id_ studentId,
+        t.educational_teacher_id_ educationalTeacherId,
+        su.username_ educationalTeacherName
+        FROM
+        (
+        SELECT
+        cgsm.user_id_,
+        g.educational_teacher_id_
+        FROM
+        class_group_student_mapper cgsm
+        LEFT JOIN music_group g ON cgsm.music_group_id_ = g.id_
+        WHERE
+        cgsm.group_type_ = 'MUSIC'
+        AND cgsm.user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
         UNION ALL
-        SELECT cgsm.user_id_, g.educational_teacher_id_ FROM class_group_student_mapper cgsm
-        LEFT JOIN vip_group g ON cgsm.music_group_id_=g.id_
-        WHERE cgsm.group_type_='VIP'
+        SELECT
+        cgsm.user_id_,
+        g.educational_teacher_id_
+        FROM
+        class_group_student_mapper cgsm
+        LEFT JOIN vip_group g ON cgsm.music_group_id_ = g.id_
+        WHERE
+        cgsm.group_type_ = 'VIP'
+        AND cgsm.user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
         UNION ALL
-        SELECT cgsm.user_id_, g.educational_teacher_id_ FROM class_group_student_mapper cgsm
-        LEFT JOIN practice_group g ON cgsm.music_group_id_=g.id_
-        WHERE cgsm.group_type_='PRACTICE'
-        ) t GROUP BY t.user_id_
+        SELECT
+        cgsm.user_id_,
+        g.educational_teacher_id_
+        FROM
+        class_group_student_mapper cgsm
+        LEFT JOIN practice_group g ON cgsm.music_group_id_ = g.id_
+        WHERE
+        cgsm.group_type_ = 'PRACTICE'
+        AND cgsm.user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+        ) t
+        LEFT JOIN sys_user su ON t.educational_teacher_id_=su.id_
     </select>
 </mapper>

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

@@ -220,7 +220,7 @@
 		SELECT * FROM music_group_payment_calender_detail mgpcd
 		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
 		WHERE mgpc.music_group_id_=#{musicGroupId} AND mgpcd.user_id_=#{userId} AND mgpcd.payment_status_ = 'PROCESSING'
-		ORDER BY mgpc.start_payment_date_ DESC
+		ORDER BY mgpc.start_payment_date_ DESC LIMIT 1
 	</select>
 	<select id="queryCanOpenList" resultMap="MusicGroupPaymentCalenderDetail">
 		SELECT mgpcd.*,mgpc.music_group_id_ FROM music_group_payment_calender_detail mgpcd

+ 9 - 9
mec-common/common-core/src/main/java/com/ym/mec/common/controller/BaseController.java

@@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletRequest;
 
 @ControllerAdvice
 public class BaseController {
-	
+
 	private final static Logger logger = LoggerFactory.getLogger(BaseController.class);
 
 	public static <T> HttpResponseResult<T> succeed(T object) {
@@ -30,19 +30,19 @@ public class BaseController {
 		return getResponseData(true, HttpStatus.OK, obj, "操作成功");
 	}
 
-	public static HttpResponseResult<String> warned(String message) {
+	public static <T> HttpResponseResult<T> warned(String message) {
 		return failed(HttpStatus.MULTI_STATUS, message);
 	}
 
-	public static HttpResponseResult<String> failed() {
+	public static <T> HttpResponseResult<T> failed() {
 		return failed("");
 	}
 
-	public static HttpResponseResult<String> failed(String msg) {
+	public static <T> HttpResponseResult<T> failed(String msg) {
 		return failed(HttpStatus.INTERNAL_SERVER_ERROR, msg);
 	}
 
-	public static HttpResponseResult<String> failed(HttpStatus statusCode, String msg) {
+	public static <T> HttpResponseResult<T> failed(HttpStatus statusCode, String msg) {
 		return getResponseData(false, statusCode, null, msg);
 	}
 
@@ -54,7 +54,7 @@ public class BaseController {
 		obj.setMsg(message);
 		return obj;
 	}
-	
+
 	/**
 	 * 处理一般异常
 	 * 
@@ -69,10 +69,10 @@ public class BaseController {
 			e = ex;
 		}
 		logger.error("System Error", ex);
-//		return failed(e.getMessage());
-		if(e instanceof BizException || e instanceof ThirdpartyException){
+		// return failed(e.getMessage());
+		if (e instanceof BizException || e instanceof ThirdpartyException) {
 			return failed(e.getMessage());
-		}else if(e instanceof AccessDeniedException){
+		} else if (e instanceof AccessDeniedException) {
 			return failed("禁止访问");
 		}
 		return failed("系统繁忙");