|  | @@ -1,16 +1,23 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.ExtracurricularExercisesDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.ExtracurricularExercisesMessageDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.TeacherDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.StudentCourseHomeworkCommentDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.ExtracurricularExercisesMessage;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.StudentCourseHomeworkReplyQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.ExtracurricularExercisesMessageService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  | +import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -26,6 +33,12 @@ public class ExtracurricularExercisesMessageServiceImpl extends BaseServiceImpl<
 | 
	
		
			
				|  |  |  	private ExtracurricularExercisesMessageDao extracurricularExercisesMessageDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private ExtracurricularExercisesReplyDao extracurricularExercisesReplyDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private ExtracurricularExercisesDao extracurricularExercisesDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private TeacherDao teacherDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	public BaseDAO<Long, ExtracurricularExercisesMessage> getDAO() {
 | 
	
	
		
			
				|  | @@ -46,9 +59,32 @@ public class ExtracurricularExercisesMessageServiceImpl extends BaseServiceImpl<
 | 
	
		
			
				|  |  |  		if(Objects.isNull(extracurricularExercisesReply)){
 | 
	
		
			
				|  |  |  			throw new BizException("课外训练不存在");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | +		ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(extracurricularExercisesReply.getExtracurricularExercisesId());
 | 
	
		
			
				|  |  |  		if("TEACHER".equals(extracurricularExercisesMessage.getRole())&&Objects.nonNull(extracurricularExercisesReply.getAttachments())){
 | 
	
		
			
				|  |  |  			extracurricularExercisesReply.setIsReplied(1);
 | 
	
		
			
				|  |  |  			extracurricularExercisesReplyDao.update(extracurricularExercisesReply);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			Map<Integer, String> userMap = new HashMap<>();
 | 
	
		
			
				|  |  | +			userMap.put(extracurricularExercisesReply.getUserId(),extracurricularExercisesReply.getUserId().toString());
 | 
	
		
			
				|  |  | +			String notifyUrl = "3?courseScheduleID=" + extracurricularExercisesReply.getId() + "&studentCourseHomeworkId=" + extracurricularExercisesReply.getId();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			sysMessageService.batchSendImMessage(MessageTypeEnum.EXTRA_TEACHER_REPLY_IM,extracurricularExercises.getTeacherId().toString(),
 | 
	
		
			
				|  |  | +					new String[]{extracurricularExercisesReply.getUserId().toString()},
 | 
	
		
			
				|  |  | +					null, extracurricularExercises.getTitle(), extracurricularExercisesMessage.getContent());
 | 
	
		
			
				|  |  | +			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.EXTRA_TEACHER_REPLY_PUSH,
 | 
	
		
			
				|  |  | +					userMap, null, 0, notifyUrl, "STUDENT", extracurricularExercises.getTitle());
 | 
	
		
			
				|  |  | +		}else{
 | 
	
		
			
				|  |  | +			Map<Integer, String> userMap = new HashMap<>();
 | 
	
		
			
				|  |  | +			userMap.put(extracurricularExercises.getTeacherId(), extracurricularExercises.getTeacherId().toString());
 | 
	
		
			
				|  |  | +			SysUser user = teacherDao.getUser(extracurricularExercisesReply.getUserId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			String notifyUrl = "9?courseScheduleID=" + extracurricularExercisesReply.getId() +
 | 
	
		
			
				|  |  | +					"&userId=" + extracurricularExercisesReply.getUserId() + "&studentCourseHomeworkId=" + extracurricularExercisesReply.getId();
 | 
	
		
			
				|  |  | +			sysMessageService.batchSendImMessage(MessageTypeEnum.EXTRA_STUDENT_REPLY_IM,extracurricularExercisesReply.getUserId().toString(),
 | 
	
		
			
				|  |  | +					new String[]{extracurricularExercises.getTeacherId().toString()},
 | 
	
		
			
				|  |  | +					null,extracurricularExercises.getTitle(), extracurricularExercisesMessage.getContent());
 | 
	
		
			
				|  |  | +			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.EXTRA_REMIND_PUSH,
 | 
	
		
			
				|  |  | +					userMap, null, 0, notifyUrl, "TEACHER", extracurricularExercises.getTitle(), user.getUsername());
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 |