From f83279fc66a3f359c949fb8f0a541cf409567d27 Mon Sep 17 00:00:00 2001 From: Lx <935448346@qq.com> Date: Wed, 9 Apr 2025 18:01:36 +0800 Subject: [PATCH] 0409 --- .../base/constant/SchoolBaseConstants.java | 12 +++++ .../service/impl/ProcessServiceImpl.java | 17 ++++++- .../app/AppExamBatchController.java | 4 +- .../exam/service/ExamBatchItemService.java | 2 +- .../impl/ExamBatchItemServiceImpl.java | 44 +++++++++++-------- .../module/exam/vo/ExamBatchItemNewVO.java | 5 +++ 6 files changed, 62 insertions(+), 22 deletions(-) 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 62834153..1f160c11 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 @@ -109,4 +109,16 @@ public interface SchoolBaseConstants { * 驾校消息模板:学员拿出驾驶证祝福语 */ public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_DRIVER_LICENSE= "恭喜您在%s已领取驾驶证,祝您驾得愉快"; + + /** + * 驾校消息模版:学员考试成绩 + */ + public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE= "学员 %s 在 %s 的考试成绩为:%s,%s考试"; + + /** + * 驾校消息模版: 学员报名 + */ + public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_ENROLL= "学员 %s 报名 %s 课程,报名方式:%s"; + + } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java index 462b00c3..c2f189e3 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java @@ -39,6 +39,8 @@ import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; +import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr; + /** * 学员课程进度 Service 实现类 @@ -353,6 +355,7 @@ public class ProcessServiceImpl extends ServiceImpl impl .set(process.getExamTime() != null, Process::getExamTime, process.getExamTime()) .set(process.getImages() != null, Process::getImages, process.getImages())); + // 如果考试通过,则修改进度状态为已完成 if (process.getExamStatus() != null && process.getExamStatus().equals("1")) { update(Wrappers.lambdaUpdate(Process.class) .eq(Process::getUserId, process.getUserId()) @@ -361,8 +364,14 @@ public class ProcessServiceImpl extends ServiceImpl impl .eq(Process::getTenantId, process.getTenantId()) .eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO) .set(Process::getStatus, 2)); + // 发送消息给教练 + String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, process.getUserName(), "科目一", process.getExamScore(), "已通过"); + schoolNotifyMessageSendService.sendMessage(process.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, process.getTenantId()); + }else if(process.getExamStatus() != null && !process.getExamStatus().equals("0")){ + String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, process.getUserName(), "科目一", process.getExamScore(), "未通过"); + schoolNotifyMessageSendService.sendMessage(process.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, process.getTenantId()); } - + // 如果是科目一且通过考试,修改科目二状态 if (process.getSubject() == 1 && process.getExamStatus().equals("1")) { update(Wrappers.lambdaUpdate(Process.class) .eq(Process::getUserId, process.getUserId()) @@ -371,8 +380,14 @@ public class ProcessServiceImpl extends ServiceImpl impl .eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO) .set(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS)); } + // 如果是科目四且通过考试,修改学员考试通过状态 if (process.getSubject() == 4 && process.getExamStatus().equals("1")) { dlDriveSchoolStudentService.updateStudentPassAndGradTime(process.getExamTime(), process.getUserId(), process.getCourseId(), process.getTenantId()); + String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, process.getUserName(), "科目四", process.getExamScore(), "已通过"); + schoolNotifyMessageSendService.sendMessage(process.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, process.getTenantId()); + }else if(process.getSubject() == 4 && process.getExamStatus().equals("0")){ + String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, process.getUserName(), "科目四", process.getExamScore(), "未通过"); + schoolNotifyMessageSendService.sendMessage(process.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, process.getTenantId()); } } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/controller/app/AppExamBatchController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/controller/app/AppExamBatchController.java index c8e87c3c..4200e6ad 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/controller/app/AppExamBatchController.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/controller/app/AppExamBatchController.java @@ -61,8 +61,8 @@ public class AppExamBatchController { @PutMapping("/update") @Operation(summary = "录入考试成绩") @TenantIgnore - public CommonResult updateObj( @RequestBody ExamBatchItemVO examBatchVO) { - examBatchItemService.updateObj(examBatchVO); + public CommonResult updateObj( @RequestBody ExamBatchItemNewVO examBatchVO) { + examBatchItemService.updateObjNew(examBatchVO); return success(true); } } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/ExamBatchItemService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/ExamBatchItemService.java index aba21e31..3d96fe02 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/ExamBatchItemService.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/ExamBatchItemService.java @@ -75,7 +75,7 @@ public interface ExamBatchItemService extends IService { * @author vinjor-M * @date 13:48 2025/1/21 **/ - void updateObjNew(ExamBatchItemVO examBatchVO); + void updateObjNew(ExamBatchItemNewVO examBatchVO); /** * 通过批次详情id集合查询 diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchItemServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchItemServiceImpl.java index 87481727..a0990f9a 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchItemServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/service/impl/ExamBatchItemServiceImpl.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.exam.service.impl; import cn.hutool.core.collection.CollUtil; 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.entity.Process; import cn.iocoder.yudao.module.course.mapper.ProcessMapper; import cn.iocoder.yudao.module.course.service.ProcessService; @@ -45,6 +47,8 @@ public class ExamBatchItemServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper() .eq(Process::getCourseId, process.getCourseId()) .eq(Process::getUserId, process.getUserId()) - .eq(Process::getCoachId, process.getCoachId()) .eq(Process::getSubject, nextSubject) .eq(Process::getStatus, "0"); List list = processService.list(queryWrapper); @@ -281,20 +295,14 @@ public class ExamBatchItemServiceImpl extends ServiceImpl