|
@@ -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);
|