diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/constant/SchoolBaseConstants.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/constant/SchoolBaseConstants.java index 837950ad..62834153 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/constant/SchoolBaseConstants.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/constant/SchoolBaseConstants.java @@ -100,6 +100,11 @@ public interface SchoolBaseConstants { */ public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_END_ATTENDANCE= "您在%s已结束%s%s的训练,本次训练时长%s分钟,累计训练时长%s分钟"; + /** + * 驾校消息模板:学员提交考试批次 + */ + public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_BATCH= "教练给您提交了%s%s的考试,考试时间为:%s - %s,考试地址为:%s"; + /** * 驾校消息模板:学员拿出驾驶证祝福语 */ diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchServiceImpl.java index 35bf1581..5c3eb3d5 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchServiceImpl.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.exam.service.impl; import cn.hutool.core.date.DateUtil; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants; +import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService; import cn.iocoder.yudao.module.course.mapper.ProcessMapper; import cn.iocoder.yudao.module.exam.entity.ExamBatch; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; @@ -18,11 +20,15 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr; + /** * 考试批次主表 Service 实现类 @@ -38,6 +44,8 @@ public class ExamBatchServiceImpl extends ServiceImpl userIdList = examBatchVO.getItemList().stream().map(ExamBatchItem::getUserId).collect(Collectors.toList()); processMapper.updateProcessBatch(userIdList,examBatchVO.getCourseId(),examBatchVO.getSubject(),examBatchVO.getCoachId()); + + // 准备信息内容 + String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_BATCH, examBatchVO.getCourseName(), getSubjectStr(examBatchVO.getSubject()), DateUtil.format(examBatchVO.getStartTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.format(examBatchVO.getEndTime(), "yyyy-MM-dd HH:mm:ss"), examBatchVO.getAddr()); + + itemList.forEach(item->{ + // 发送消息 + schoolNotifyMessageSendService.sendMessage(item.getUserId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null); + }); } /** diff --git a/dl-module-jx/src/main/resources/mapper/exam/ExamBatchItemMapper.xml b/dl-module-jx/src/main/resources/mapper/exam/ExamBatchItemMapper.xml index 82dd763a..ad5c2409 100644 --- a/dl-module-jx/src/main/resources/mapper/exam/ExamBatchItemMapper.xml +++ b/dl-module-jx/src/main/resources/mapper/exam/ExamBatchItemMapper.xml @@ -143,10 +143,13 @@ dseb.`subject`, dseb.addr, dseb.trans_way, - dseb.coach_id + dseb.coach_id, + dseb.coach_name, + dsc.type AS courseType FROM drive_school_exam_batch_item dsebi LEFT JOIN drive_school_exam_batch dseb ON dsebi.batch_id = dseb.id + LEFT JOIN drive_school_course dsc ON dseb.course_id = dsc.id WHERE dsebi.id IN