Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 năm trước cách đây
mục cha
commit
3f217897b6

+ 2 - 0
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.cms.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;

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

@@ -1457,4 +1457,20 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return
      */
     List<Long> findNotStartCourseByIds(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
+    /**
+     * 获取第一节课时间
+     * @param practiceGroupId
+     * @param groupType
+     * @return
+     */
+    Date getFirstTime(@Param("practiceGroupId") Long practiceGroupId, @Param("groupType") String groupType);
+
+    /**
+     * 获取最后一节课时间
+     * @param practiceGroupId
+     * @param groupType
+     * @return
+     */
+    Date getLastTime(@Param("practiceGroupId") Long practiceGroupId, @Param("groupType") String groupType);
 }

+ 17 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -47,6 +47,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import static com.ym.mec.biz.dal.enums.GroupType.PRACTICE;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.*;
 import static com.ym.mec.biz.dal.enums.SignInStatusEnum.*;
 
@@ -2040,7 +2041,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         }
         checkNewCourseSchedules(courseSchedules, false);
         //如果是陪练课,调整时间不允许超过有效期
-        if(groupType == GroupType.PRACTICE){
+        if(groupType == PRACTICE){
             for (CourseSchedule e:courseSchedules) {
                 //已点名的不允许调整
                 List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseId(e.getId());
@@ -2658,7 +2659,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 								ts.setExpectSalary(oldTS.getExpectSalary());
 							}
 						}
-					} else if (newCourseSchedule.getGroupType() == GroupType.PRACTICE) {
+					} else if (newCourseSchedule.getGroupType() == PRACTICE) {
 						List<TeacherDefaultPracticeGroupSalary> teacherDefaultPracticeGroupSalaryList = teacherDefaultPracticeGroupSalaryDao
 								.queryByUserId(teacherId);
 						if (teacherDefaultPracticeGroupSalaryList != null && teacherDefaultPracticeGroupSalaryList.size() > 0) {
@@ -3713,7 +3714,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if(Objects.isNull(oldCourseSchedule)){
             throw new BizException("课程不存在");
         }
-        if(!oldCourseSchedule.getGroupType().equals(GroupType.PRACTICE)){
+        if(!oldCourseSchedule.getGroupType().equals(PRACTICE)){
             throw new BizException("请选择网管课");
         }
         //已点名的不允许调整
@@ -3787,6 +3788,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		courseScheduleComplaintsDao.delByCourseScheduleId(courseScheduleId);
         courseScheduleDao.update(oldCourseSchedule);
         courseScheduleModifyLogDao.insert(scheduleModifyLog);
+		if(practiceGroup.getType() == TRIAL){
+			practiceGroup.setCoursesStartDate(courseScheduleDao.getFirstTime(practiceGroup.getId(),PRACTICE.getCode()));
+			practiceGroup.setCoursesExpireDate(courseScheduleDao.getLastTime(practiceGroup.getId(),PRACTICE.getCode()));
+			practiceGroup.setUpdateTime(date);
+			practiceGroupDao.update(practiceGroup);
+		}
     }
 
     @Override
@@ -3806,7 +3813,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if(Objects.isNull(oldCourseSchedule)){
             throw new BizException("调整失败: 课程已结束");
         }
-        if(!oldCourseSchedule.getGroupType().equals(GroupType.PRACTICE)){
+        if(!oldCourseSchedule.getGroupType().equals(PRACTICE)){
             throw new BizException("请选择网管课");
         }
         if(teacherId.equals(oldCourseSchedule.getActualTeacherId())){
@@ -3876,12 +3883,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if(Objects.isNull(teacherId)){
             throw new BizException("请指定上课老师");
         }
-        List<CourseSchedule> courseSchedules = courseScheduleDao.findSurplusCourseWithGroup(GroupType.PRACTICE,practiceGroupId);
+        List<CourseSchedule> courseSchedules = courseScheduleDao.findSurplusCourseWithGroup(PRACTICE,practiceGroupId);
         if(courseSchedules != null && courseSchedules.size() > 0){
             courseSchedules = courseSchedules.stream().filter(courseSchedule -> !courseSchedule.getActualTeacherId().equals(teacherId)).collect(Collectors.toList());
         }
 		PracticeGroup practiceGroup = practiceGroupDao.get(Long.valueOf(practiceGroupId));
-		ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupId, GroupType.PRACTICE.getCode());
+		ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupId, PRACTICE.getCode());
         if(Objects.nonNull(educationalTeacherId)&&!educationalTeacherId.equals(practiceGroup.getEducationalTeacherId())){
 			if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
 				ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(practiceGroup.getEducationalTeacherId().toString())};
@@ -3903,11 +3910,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			classGroup.setName(groupName);
 			classGroup.setSubjectIdList(subjectId.toString());
 			classGroupDao.update(classGroup);
-			courseScheduleDao.updateCourseNameByGroup(practiceGroupId,GroupType.PRACTICE,groupName);
+			courseScheduleDao.updateCourseNameByGroup(practiceGroupId, PRACTICE,groupName);
 		}
 		practiceGroupDao.update(practiceGroup);
-        classGroupTeacherMapperService.updateTeacher(practiceGroupId,teacherId,GroupType.PRACTICE.getCode());
-        classGroupTeacherSalaryDao.updateTeacher(practiceGroupId,teacherId,GroupType.PRACTICE.getCode());
+        classGroupTeacherMapperService.updateTeacher(practiceGroupId,teacherId, PRACTICE.getCode());
+        classGroupTeacherSalaryDao.updateTeacher(practiceGroupId,teacherId, PRACTICE.getCode());
         practiceGroupDao.updateUserId(practiceGroupId,teacherId);
         if(courseSchedules == null || courseSchedules.size() == 0){
             return;
@@ -3941,7 +3948,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				}
 				courseScheduleTeacherSalaryDao.batchUpdateTeacher(courseScheduleIds,teacherId);
 			}else{
-				List<CourseSchedule> groupNotStartCourses = courseScheduleDao.findGroupNotStartCourses(practiceGroupId, GroupType.PRACTICE);
+				List<CourseSchedule> groupNotStartCourses = courseScheduleDao.findGroupNotStartCourses(practiceGroupId, PRACTICE);
 				if(!CollectionUtils.isEmpty(groupNotStartCourses)){
 					SysConfig practiceCourseSalaryConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_SALARY);
 					BigDecimal teacherSalary = new BigDecimal(practiceCourseSalaryConfig.getParanValue());

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -2980,5 +2980,15 @@
         </foreach>
         AND cs.status_ = 'NOT_START'
     </select>
+    <select id="getLastTime" resultType="java.util.Date">
+        SELECT MAX(CONCAT(cs.class_date_," ",cs.end_class_time_))
+        FROM course_schedule cs
+        WHERE cs.music_group_id_ = #{practiceGroupId} AND cs.del_flag_ = 0 AND cs.group_type_ = #{groupType};
+    </select>
+    <select id="getFirstTime" resultType="java.util.Date">
+        SELECT MIN(CONCAT(cs.class_date_," ",cs.end_class_time_))
+        FROM course_schedule cs
+        WHERE cs.music_group_id_ = #{practiceGroupId} AND cs.del_flag_ = 0 AND cs.group_type_ = #{groupType};
+    </select>
 
 </mapper>