|  | @@ -1,17 +1,23 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroup;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentMemberCourseDetail;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermStudentCourseDetail;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MusicGroupSchoolTermCourseDetailService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  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;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -20,7 +26,10 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.Date;
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class MusicGroupSchoolTermCourseDetailServiceImpl extends BaseServiceImpl<Integer, MusicGroupSchoolTermCourseDetail>  implements MusicGroupSchoolTermCourseDetailService {
 | 
	
	
		
			
				|  | @@ -39,6 +48,12 @@ public class MusicGroupSchoolTermCourseDetailServiceImpl extends BaseServiceImpl
 | 
	
		
			
				|  |  |  	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SysConfigDao sysConfigDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private TeacherDao teacherDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	public BaseDAO<Integer, MusicGroupSchoolTermCourseDetail> getDAO() {
 | 
	
	
		
			
				|  | @@ -135,6 +150,42 @@ public class MusicGroupSchoolTermCourseDetailServiceImpl extends BaseServiceImpl
 | 
	
		
			
				|  |  |  		return BaseController.succeed(courseDetail);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  | +	public HttpResponseResult musicSchoolTermPush() {
 | 
	
		
			
				|  |  | +		String remindCourseTime = sysConfigDao.findConfigValue(SysConfigService.REMIND_COURSE_TIME);
 | 
	
		
			
				|  |  | +		if(StringUtils.isEmpty(remindCourseTime)){
 | 
	
		
			
				|  |  | +			remindCourseTime = "14";
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		//获取当前学期截止前14天的乐团,并提醒教务老师排课
 | 
	
		
			
				|  |  | +		List<String> musicGroupIds = musicGroupSchoolTermCourseDetailDao.queryPushCourseTermMusicIds(remindCourseTime);
 | 
	
		
			
				|  |  | +		if(musicGroupIds.size() > 0){
 | 
	
		
			
				|  |  | +			List<MusicGroup> musicGroupList = musicGroupDao.getMusicGroupByIds(musicGroupIds);
 | 
	
		
			
				|  |  | +			List<Integer> educationIds = musicGroupList.stream().map(e -> e.getEducationalTeacherId()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +			Map<Integer, String> educationNameMap = MapUtil.convertMybatisMap(teacherDao.queryNameByIdList(educationIds));
 | 
	
		
			
				|  |  | +			for (MusicGroup musicGroup : musicGroupList) {
 | 
	
		
			
				|  |  | +				Map<Integer,String> userMap = new HashMap<>(1);
 | 
	
		
			
				|  |  | +				userMap.put(musicGroup.getEducationalTeacherId(),educationNameMap.get(musicGroup.getEducationalTeacherId()));
 | 
	
		
			
				|  |  | +				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS,
 | 
	
		
			
				|  |  | +						MessageTypeEnum.REMIND_EDUCATION_COURSE_TIME,
 | 
	
		
			
				|  |  | +						userMap,
 | 
	
		
			
				|  |  | +						null,
 | 
	
		
			
				|  |  | +						0,
 | 
	
		
			
				|  |  | +						null,
 | 
	
		
			
				|  |  | +						null,
 | 
	
		
			
				|  |  | +						musicGroup.getName());
 | 
	
		
			
				|  |  | +				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
 | 
	
		
			
				|  |  | +						MessageTypeEnum.REMIND_EDUCATION_COURSE_TIME,
 | 
	
		
			
				|  |  | +						userMap,
 | 
	
		
			
				|  |  | +						null,
 | 
	
		
			
				|  |  | +						0,
 | 
	
		
			
				|  |  | +						null,
 | 
	
		
			
				|  |  | +						"SYSTEM",
 | 
	
		
			
				|  |  | +						musicGroup.getName());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return null;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	private MusicGroupSchoolTermCourseDetail getCourseDetail(MusicGroupSchoolTermCourseDetail courseDetail){
 | 
	
		
			
				|  |  |  		Date startCourseDate = courseDetail.getStartCourseDate();
 | 
	
		
			
				|  |  |  		//一个学期默认为6个月,9月1日—2月28、29日,3月1日—8月31日
 |