0409
This commit is contained in:
parent
4456567f76
commit
f83279fc66
@ -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";
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<ProcessMapper, Process> 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<ProcessMapper, Process> 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<ProcessMapper, Process> 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public interface ExamBatchItemService extends IService<ExamBatchItem> {
|
||||
* @author vinjor-M
|
||||
* @date 13:48 2025/1/21
|
||||
**/
|
||||
void updateObjNew(ExamBatchItemVO examBatchVO);
|
||||
void updateObjNew(ExamBatchItemNewVO examBatchVO);
|
||||
|
||||
/**
|
||||
* 通过批次详情id集合查询
|
||||
|
@ -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<ExamBatchItemMapper, E
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ExamBatchService examBatchService;
|
||||
@Autowired
|
||||
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@ -221,7 +225,13 @@ public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, E
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateObjNew(ExamBatchItemVO examBatchVO) {
|
||||
public void updateObjNew(ExamBatchItemNewVO examBatchVO) {
|
||||
String subject = "";
|
||||
if(examBatchVO.getSubject() == 2){
|
||||
subject = "科目二";
|
||||
}else if(examBatchVO.getSubject() == 4){
|
||||
subject = "科目四";
|
||||
}
|
||||
//教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
ExamBatchItem updateItem = this.getById(examBatchVO.getId());
|
||||
@ -239,14 +249,19 @@ public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, E
|
||||
process.setExamScore(examBatchVO.getFraction());
|
||||
process.setImages(examBatchVO.getImages());
|
||||
process.setExamTime(examBatch.getStartTime());
|
||||
process.setRemark(examBatch.getRemark());
|
||||
process.setRemark(examBatchVO.getRemark());
|
||||
//已完成
|
||||
process.setStatus("2");
|
||||
|
||||
process.setExamStatus(examBatchVO.getIfPass() ? "1" : "0");
|
||||
processService.updateById(process);
|
||||
//更新考试批次的通过率
|
||||
this.updateBatchPassRate(examBatch.getId());
|
||||
if (examBatchVO.getIfPass()) {
|
||||
process.setStatus("2");
|
||||
processService.updateById(process);
|
||||
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, examBatchVO.getUserName(), subject, examBatchVO.getFraction(), "已通过");
|
||||
schoolNotifyMessageSendService.sendMessage(examBatchVO.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, examBatchVO.getTenantId());
|
||||
|
||||
//考试通过
|
||||
if (process.getSubject() < 3) {
|
||||
//科目一、二插入一条,需要查出下一个的学习进度(如果不存在,手动插入一个)
|
||||
@ -254,7 +269,6 @@ public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, E
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getCourseId, process.getCourseId())
|
||||
.eq(Process::getUserId, process.getUserId())
|
||||
.eq(Process::getCoachId, process.getCoachId())
|
||||
.eq(Process::getSubject, nextSubject)
|
||||
.eq(Process::getStatus, "0");
|
||||
List<Process> list = processService.list(queryWrapper);
|
||||
@ -281,20 +295,14 @@ public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, E
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//考试不通过,重新插入一条本科目的学习记录-并改为进行中
|
||||
Process thisProcess = new Process();
|
||||
thisProcess.setCourseId(process.getCourseId());
|
||||
thisProcess.setCourseName(process.getCourseName());
|
||||
thisProcess.setUserId(process.getUserId());
|
||||
thisProcess.setUserName(process.getUserName());
|
||||
thisProcess.setUserMobile(process.getUserMobile());
|
||||
thisProcess.setCoachId(process.getCoachId());
|
||||
thisProcess.setCoachName(process.getCoachName());
|
||||
thisProcess.setSubject(process.getSubject());
|
||||
thisProcess.setExamNum(process.getExamNum() + 1);
|
||||
thisProcess.setStatus("1");
|
||||
thisProcess.setTrainTime(process.getTrainTime());
|
||||
processService.save(thisProcess);
|
||||
//考试不通过
|
||||
process.setStatus("1");
|
||||
process.setExamStatus(null);
|
||||
processService.updateById(process);
|
||||
// 发送消息给教练
|
||||
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_EXAM_SCORE, examBatchVO.getUserName(), subject, examBatchVO.getFraction(), "未通过");
|
||||
schoolNotifyMessageSendService.sendMessage(examBatchVO.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, examBatchVO.getTenantId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,11 @@ public class ExamBatchItemNewVO extends ExamBatchItem {
|
||||
*/
|
||||
private String courseType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 教练Id
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user