驾校新增消息通知
This commit is contained in:
parent
b6ea15e44b
commit
12bc14b955
@ -59,4 +59,19 @@ public interface SchoolBaseConstants {
|
||||
* 驾校评价类型:考试
|
||||
*/
|
||||
public static final String EVALUATE_TYPE_EXAM = "1";
|
||||
// ========================= 驾校消息 ========================
|
||||
/**
|
||||
* 驾校消息类型:管理员
|
||||
*/
|
||||
public static final String SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN= "admin";
|
||||
|
||||
/**
|
||||
* 驾校消息类型:学员
|
||||
*/
|
||||
public static final String SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER= "member";
|
||||
|
||||
/**
|
||||
* 驾校消息模板:分配教练通知
|
||||
*/
|
||||
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_ASSIGN_COACH= "已为您分配教练,科目一教练:%s,科目二教练:%s,科目三教练:%s,科目四教练:%s";
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
/**
|
||||
* @Description: 驾校站内信发送服务
|
||||
* @Author: 86187
|
||||
* @Date: 2025/04/07 17:02
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface SchoolNotifyMessageSendService {
|
||||
|
||||
/**
|
||||
* 发送站内信
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param message 消息内容
|
||||
* @param type admin为管理员 member为会员
|
||||
*/
|
||||
void sendMessage(Long userId, String message, String type);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.common.BaseConstants;
|
||||
import cn.iocoder.yudao.common.SystemEnum;
|
||||
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.module.base.constant.SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN;
|
||||
import static cn.iocoder.yudao.module.base.constant.SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER;
|
||||
|
||||
/**
|
||||
* @Description: 驾校站内信发送
|
||||
* @Author: 86187
|
||||
* @Date: 2025/04/07 17:02
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SchoolNotifyMessageSendServiceImpl implements SchoolNotifyMessageSendService {
|
||||
|
||||
private final NotifyMessageSendApi sendApi;
|
||||
|
||||
/**
|
||||
* 发送站内信
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param message 消息内容
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(Long userId, String message, String type) {
|
||||
NotifySendSingleToUserReqDTO dto = new NotifySendSingleToUserReqDTO();
|
||||
dto.setUserId(userId);
|
||||
dto.setTemplateCode(SystemEnum.SCHOOL.getCode());
|
||||
dto.setTemplateCode(BaseConstants.TICKET_EMPLOY);
|
||||
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 发送模版内容
|
||||
templateParams.put("text", message);
|
||||
dto.setTemplateParams(templateParams);
|
||||
|
||||
// 发送消息
|
||||
if (SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN.equals(type)) {
|
||||
sendApi.sendSingleMessageToAdmin(dto);
|
||||
} else if (SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER.equals(type)) {
|
||||
sendApi.sendSingleMessageToMember(dto);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||
@ -63,6 +64,9 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
@Autowired
|
||||
private ExamBatchItemMapper examBatchItemMapper;
|
||||
|
||||
@Autowired
|
||||
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
@ -320,6 +324,16 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
.eq(SchoolCourseOrder::getId, request.getOrderId())
|
||||
.set(SchoolCourseOrder::getIfAssignmentCoach, SchoolBaseConstants.SCHOOL_COURSE_ORDER_IS_ASSIGN_COACH));
|
||||
|
||||
// 发送通知内容
|
||||
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_ASSIGN_COACH,
|
||||
processes.get(0).getCoachName(),
|
||||
processes.get(1).getCoachName(),
|
||||
processes.get(2).getCoachName(),
|
||||
processes.get(3).getCoachName());
|
||||
|
||||
// 发送消息给学员
|
||||
schoolNotifyMessageSendService.sendMessage(userId, message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user