This commit is contained in:
许允枞 2025-04-09 09:13:47 +08:00
parent 80549d2987
commit f6d3e08060
3 changed files with 26 additions and 1 deletions

View File

@ -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";
/**
* 驾校消息模板学员拿出驾驶证祝福语
*/

View File

@ -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<ExamBatchMapper, ExamBatch
@Autowired
@Lazy
private ExamBatchItemService examBatchItemService;
@Resource
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
/**
* 分页查询
@ -88,6 +96,7 @@ public class ExamBatchServiceImpl extends ServiceImpl<ExamBatchMapper, ExamBatch
* @date 23:11 2025/1/20
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void createObj(ExamBatchVO examBatchVO) {
//生成批次编号
String timestamp = DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss");
@ -106,6 +115,14 @@ public class ExamBatchServiceImpl extends ServiceImpl<ExamBatchMapper, ExamBatch
//更新每个学生对应学习进度表考试的状态设置为 已送考
List<Long> 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);
});
}
/**

View File

@ -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
<foreach collection="examIds" item="id" open="(" separator="," close=")">