Browse Source

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

zouxuan 5 years ago
parent
commit
eb78fd3b9f

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

@@ -1046,4 +1046,17 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.CourseScheduleDto>
      */
     List<CourseScheduleDto> findStudentPracticeCourses(@Param("userId") Integer userId);
+
+    /**
+     * @describe 获取教师课程中包含指定时间区间的课程
+     * @author Joburgess
+     * @date 2020/2/4
+     * @param userId:
+     * @param startTime:
+     * @param endTime:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
+     */
+    List<CourseSchedule> findTeacherCoursesWithIncludeDateRange(@Param("userId") Integer userId,
+                                                                @Param("startTime") Date startTime,
+                                                                @Param("endTime") Date endTime);
 }

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

@@ -430,8 +430,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
 
-        params.put("musicGroupStatus", MusicGroupStatusEnum.PROGRESS);
-        params.put("vipGroupStatus", VipGroupStatusEnum.PROGRESS);
+        params.put("musicGroupStatus", null);
+        params.put("vipGroupStatus", null);
         List<Group> groups = groupDao.searchGroups(params);
         if(!CollectionUtils.isEmpty(groups)){
             params.put("groups", groups);

+ 32 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -9,10 +9,12 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.PracticeGroupService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -60,6 +62,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private TeacherDao teacherDao;
+    @Autowired
+    private SysMessageService sysMessageService;
 
     @Override
     public BaseDAO<Long, PracticeGroup> getDAO() {
@@ -118,15 +122,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             boolean enableCreateSecondCourse=true;
             for (int i=0;i<teacherCourses.size()-1;i++) {
                 CourseSchedule preCourseSchedule = teacherCourses.get(i);
-                CourseSchedule backCourseSchedule = teacherCourses.get(i+1);
 
                 if(practiceGroup.getFirstCourseTime().before(preCourseSchedule.getEndClassTime())
-                        &&firstClassEndTime.after(backCourseSchedule.getStartClassTime())){
+                        &&firstClassEndTime.after(preCourseSchedule.getStartClassTime())){
                     enableCreateFirstCourse=false;
                 }
 
                 if(practiceGroup.getSecondCourseTime().before(preCourseSchedule.getEndClassTime())
-                        &&secondClassEndTime.after(backCourseSchedule.getStartClassTime())){
+                        &&secondClassEndTime.after(preCourseSchedule.getStartClassTime())){
                     enableCreateSecondCourse=false;
                 }
             }
@@ -512,6 +515,32 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             studentDao.update(student);
         }
 
+        //推送
+        List<CourseSchedule> courseSchedules1=courseScheduleDao.findTeacherCoursesWithIncludeDateRange(teacherId,allCourseDates.get(2),DateUtil.addMinutes(allCourseDates.get(2),practiceCourseMinutes));
+        List<CourseSchedule> courseSchedules2=courseScheduleDao.findTeacherCoursesWithIncludeDateRange(teacherId,allCourseDates.get(3),DateUtil.addMinutes(allCourseDates.get(3),practiceCourseMinutes));
+        if(!CollectionUtils.isEmpty(courseSchedules1)||!CollectionUtils.isEmpty(courseSchedules2)){
+            if(courseSchedules1 == null){
+                courseSchedules1=new ArrayList<>();
+            }
+            if(courseSchedules2 == null){
+                courseSchedules2=new ArrayList<>();
+            }
+            courseSchedules1.addAll(courseSchedules2);
+            SysUser sysUser = sysUserFeignService.queryUserById(practiceGroup.getStudentId());
+            String[] courseDates=new String[courseSchedules1.size()];
+            String[] courseNames=new String[courseSchedules1.size()];
+            for (int i=0;i<courseSchedules1.size();i++) {
+                courseDates[i]=DateUtil.dateToString(courseSchedules1.get(i).getStartClassTime(),"yyyy-MM-dd HH:mm:ss");
+                courseNames[i]=courseSchedules1.get(i).getName();
+            }
+            String courseDatesStr=StringUtils.join(courseDates,"、");
+            String courseNamesStr=StringUtils.join(courseNames,"、");
+            Map<Integer,String> teacherMap=new HashMap<>();
+            teacherMap.put(teacherId,teacherId.toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,MessageTypeEnum.PUSH_TEACHER_COURSE_COLLIDE,
+                    teacherMap,null,0,null,"TEACHER",Objects.isNull(sysUser.getUsername())?sysUser.getPhone():sysUser.getUsername(),courseDatesStr,courseNamesStr,courseNamesStr);
+        }
+
         Map result = new HashMap();
         result.put("teacherName", teacher.getRealName());
         result.put("enableApply", applyTimes < 1 ? 1 : 0);

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

@@ -2125,4 +2125,32 @@
         WHERE cs.group_type_='PRACTICE'
           AND cssp.user_id_=#{userId}
     </select>
+    <select id="findTeacherCoursesWithIncludeDateRange" resultMap="CourseSchedule">
+        SELECT
+            cs.id_,
+            cs.class_group_id_,
+            cs.status_,
+            cs.subsidy_,
+            cs.class_date_,
+            CONCAT(cs.class_date_,' ',cs.start_class_time_) start_class_time_,
+            CONCAT(cs.class_date_,' ',cs.end_class_time_) end_class_time_,
+            cs.start_class_time_ start_class_time_str_,
+            cs.end_class_time_ end_class_time_str_,
+            cs.teacher_id_,
+            cs.actual_teacher_id_,
+            cs.create_time_,
+            cs.update_time_,
+            cs.teach_mode_,
+            cs.type_,
+            cs.name_,
+            cs.student_num_,
+            cs.leave_student_num_,
+            cs.schoole_id_
+        FROM
+            course_schedule_teacher_salary csts
+            LEFT JOIN course_schedule cs ON csts.course_schedule_id_ = cs.id_
+        WHERE
+            csts.user_id_ = #{userId}
+            AND #{startTime} &lt; CONCAT( cs.class_date_, ' ', cs.end_class_time_ ) AND #{endTime} &gt; CONCAT( cs.class_date_, ' ', cs.start_class_time_ );
+    </select>
 </mapper>

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

@@ -301,7 +301,7 @@
             LEFT JOIN sys_user su ON t.id_ = su.id_
         WHERE
             FIND_IN_SET(#{subjectId},t.subject_id_)
-            AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{subjectId},t.flow_organ_range_))
+            AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{organId},t.flow_organ_range_))
     </select>
     <select id="findTeacherByOrganAndSubject" resultMap="TeacherBasicDto">
         SELECT