更新
This commit is contained in:
parent
faf46d49c7
commit
13bfeabaa9
@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.base.constant;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 驾校常量
|
||||||
|
* @Author: 86187
|
||||||
|
* @Date: 2025/04/01 14:02
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface SchoolBaseConstants {
|
||||||
|
|
||||||
|
// ======================== 通用常量 ========================
|
||||||
|
/**
|
||||||
|
* 通用状态(布尔):是
|
||||||
|
*/
|
||||||
|
public static final Boolean COMMON_YES = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用状态(布尔):否
|
||||||
|
*/
|
||||||
|
public static final Boolean COMMON_NO = false;
|
||||||
|
|
||||||
|
|
||||||
|
// ======================== 驾校课程报名订单 ========================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校课程报名订单-未分配教练
|
||||||
|
*/
|
||||||
|
public static final Integer SCHOOL_COURSE_ORDER_IS_ASSIGN_COACH = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校课程报名订单-已分配教练
|
||||||
|
*/
|
||||||
|
public static final Integer SCHOOL_COURSE_ORDER_IS_NOT_ASSIGN_COACH = 1;
|
||||||
|
|
||||||
|
// ======================== 学员课程进度 ========================
|
||||||
|
/**
|
||||||
|
* 学员课程进度状态:未开始
|
||||||
|
*/
|
||||||
|
public static final String PROCESS_STATUS_NOT_START = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学员课程进度状态:进行中
|
||||||
|
*/
|
||||||
|
public static final String PROCESS_STATUS_IN_PROGRESS = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学员课程进度状态:已完成
|
||||||
|
*/
|
||||||
|
public static final String PROCESS_STATUS_COMPLETE = "2";
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package cn.iocoder.yudao.module.base.controller.admin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachCourseService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 教练与课程绑定
|
||||||
|
* @Author: 86187
|
||||||
|
* @Date: 2025/04/01 9:56
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Tag(name = "教练与课程绑定")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/base/dl-drive-school-coach-course")
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DlDriveSchoolCoachCourseController {
|
||||||
|
|
||||||
|
private final DlDriveSchoolCoachCourseService coachCourseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据课程id获取教练信息
|
||||||
|
* @param courseId 课程id
|
||||||
|
* @return 教练信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getCoachByCourseId")
|
||||||
|
@Operation(summary = "根据课程id获取教练信息")
|
||||||
|
public CommonResult<?> getCoachByCourseId(@RequestParam("courseId") String courseId) {
|
||||||
|
return success(coachCourseService.queryByCourseId(courseId));
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.course.entity.Process;
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||||
|
import cn.iocoder.yudao.module.course.vo.ProcessAddVO;
|
||||||
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -16,6 +17,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 学员课程进度")
|
@Tag(name = "管理后台 - 学员课程进度")
|
||||||
@ -106,4 +109,17 @@ public class ProcessController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存学员课程进度
|
||||||
|
*
|
||||||
|
* @param request {@link ProcessAddVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveProcess")
|
||||||
|
@Operation(summary = "保存学员课程进度")
|
||||||
|
public CommonResult<Boolean> saveProcess(@RequestBody ProcessAddVO request) {
|
||||||
|
processService.saveProcess(request);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -76,7 +76,23 @@ public class SchoolCourseOrderController {
|
|||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
Page<SchoolCommissionVO> page = new Page<>(pageNo, pageSize);
|
Page<SchoolCommissionVO> page = new Page<>(pageNo, pageSize);
|
||||||
return success(schoolCourseOrderService.queryPage(page,pageReqVO));
|
return success(schoolCourseOrderService.queryPage(page, pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止订单
|
||||||
|
*
|
||||||
|
* @param pageReqVO {@link SchoolCourseOrderVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||||
|
*/
|
||||||
|
@PutMapping("/endOrder")
|
||||||
|
public CommonResult<?> endOrder(@RequestBody SchoolCourseOrderVO pageReqVO) {
|
||||||
|
// 校验订单号和结束时间
|
||||||
|
if (pageReqVO.getOrderNo() == null || pageReqVO.getEndReason() == null || pageReqVO.getEndTime() == null) {
|
||||||
|
throw new RuntimeException("订单号和结束时间不能为空");
|
||||||
|
}
|
||||||
|
schoolCourseOrderService.endOrder(pageReqVO.getOrderNo(), pageReqVO.getEndReason(), pageReqVO.getEndTime());
|
||||||
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -104,6 +104,10 @@ public class SchoolCourseOrder extends TenantBaseDO {
|
|||||||
* 支付类型 1:定金 2:全款
|
* 支付类型 1:定金 2:全款
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private String payType;
|
||||||
|
/**
|
||||||
|
* 是否分配教练 0:否 1:是
|
||||||
|
*/
|
||||||
|
private Integer ifAssignmentCoach;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.course.service;
|
package cn.iocoder.yudao.module.course.service;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.course.entity.Process;
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
|
import cn.iocoder.yudao.module.course.vo.ProcessAddVO;
|
||||||
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -98,4 +99,11 @@ public interface ProcessService extends IService<Process> {
|
|||||||
* @date 15:24 2025/2/18
|
* @date 15:24 2025/2/18
|
||||||
**/
|
**/
|
||||||
void checkProcess(Process process);
|
void checkProcess(Process process);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存学员课程进度
|
||||||
|
*
|
||||||
|
* @param processes {@link Process}
|
||||||
|
*/
|
||||||
|
void saveProcess(ProcessAddVO request);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驾照报名订单 Service 接口
|
* 驾照报名订单 Service 接口
|
||||||
@ -59,4 +60,12 @@ public interface SchoolCourseOrderService extends IService<SchoolCourseOrder> {
|
|||||||
* @date 10:10 2025/2/25
|
* @date 10:10 2025/2/25
|
||||||
**/
|
**/
|
||||||
IPage<SchoolCourseOrderVO> queryPage(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO);
|
IPage<SchoolCourseOrderVO> queryPage(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止订单
|
||||||
|
* @param orderNo 订单号
|
||||||
|
* @param endReason 终止原因
|
||||||
|
* @param endTime 终止时间
|
||||||
|
*/
|
||||||
|
void endOrder(String orderNo, String endReason, LocalDateTime endTime);
|
||||||
}
|
}
|
@ -1,13 +1,19 @@
|
|||||||
package cn.iocoder.yudao.module.course.service.impl;
|
package cn.iocoder.yudao.module.course.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||||
import cn.iocoder.yudao.module.course.entity.Process;
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
|
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
|
||||||
|
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||||
import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
|
import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
|
||||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||||
import cn.iocoder.yudao.module.course.service.SchoolCommissionService;
|
import cn.iocoder.yudao.module.course.service.SchoolCommissionService;
|
||||||
|
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
||||||
|
import cn.iocoder.yudao.module.course.vo.ProcessAddVO;
|
||||||
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
||||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
||||||
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDeductService;
|
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDeductService;
|
||||||
@ -16,6 +22,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -44,6 +51,9 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
@Resource
|
@Resource
|
||||||
private SchoolCommissionService schoolCommissionService;
|
private SchoolCommissionService schoolCommissionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchoolCourseOrderService schoolCourseOrderService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 教练查自己带教的课程和科目
|
* 教练查自己带教的课程和科目
|
||||||
@ -57,9 +67,9 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
//当前教练ID
|
//当前教练ID
|
||||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||||
.eq(Process::getCoachId,userId)
|
.eq(Process::getCoachId, userId)
|
||||||
//状态不等于2-已完成的科目
|
//状态不等于2-已完成的科目
|
||||||
.ne(Process::getStatus,"2")
|
.ne(Process::getStatus, "2")
|
||||||
.groupBy(Process::getCourseId).groupBy(Process::getSubject);
|
.groupBy(Process::getCourseId).groupBy(Process::getSubject);
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
@ -77,18 +87,18 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
//当前教练ID
|
//当前教练ID
|
||||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||||
.eq(Process::getCoachId,userId)
|
.eq(Process::getCoachId, userId)
|
||||||
.eq(Process::getCourseId,process.getCourseId())
|
.eq(Process::getCourseId, process.getCourseId())
|
||||||
.eq(Process::getSubject,process.getSubject());
|
.eq(Process::getSubject, process.getSubject());
|
||||||
if(StringUtils.isNotEmpty(process.getUserName())){
|
if (StringUtils.isNotEmpty(process.getUserName())) {
|
||||||
queryWrapper.like(Process::getUserName,process.getUserName());
|
queryWrapper.like(Process::getUserName, process.getUserName());
|
||||||
}
|
}
|
||||||
//状态等于1-训练中的
|
//状态等于1-训练中的
|
||||||
queryWrapper.eq(Process::getStatus,"1")
|
queryWrapper.eq(Process::getStatus, "1")
|
||||||
.isNull(Process::getExamStatus)
|
.isNull(Process::getExamStatus)
|
||||||
.groupBy(Process::getUserId)
|
.groupBy(Process::getUserId)
|
||||||
.orderByDesc(BaseDO::getCreateTime);
|
.orderByDesc(BaseDO::getCreateTime);
|
||||||
return this.page(page,queryWrapper);
|
return this.page(page, queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,19 +113,19 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
* @date 18:39 2025/1/16
|
* @date 18:39 2025/1/16
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public Process getByStudentAndCourse(Long userId, String courseId, Integer subject, Long coachId,String examStatus) {
|
public Process getByStudentAndCourse(Long userId, String courseId, Integer subject, Long coachId, String examStatus) {
|
||||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||||
.eq(Process::getUserId,userId)
|
.eq(Process::getUserId, userId)
|
||||||
.eq(Process::getCoachId,coachId)
|
.eq(Process::getCoachId, coachId)
|
||||||
.eq(Process::getCourseId,courseId)
|
.eq(Process::getCourseId, courseId)
|
||||||
.eq(Process::getSubject,subject)
|
.eq(Process::getSubject, subject)
|
||||||
.eq(Process::getStatus,"1");
|
.eq(Process::getStatus, "1");
|
||||||
if(null!=examStatus){
|
if (null != examStatus) {
|
||||||
queryWrapper.eq(Process::getExamStatus,examStatus);
|
queryWrapper.eq(Process::getExamStatus, examStatus);
|
||||||
}
|
}
|
||||||
queryWrapper.orderByDesc(BaseDO::getCreateTime);
|
queryWrapper.orderByDesc(BaseDO::getCreateTime);
|
||||||
List<Process> processList = this.list(queryWrapper);
|
List<Process> processList = this.list(queryWrapper);
|
||||||
return processList.isEmpty()?null:processList.get(0);
|
return processList.isEmpty() ? null : processList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,8 +137,8 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
* @date 15:18 2025/2/8
|
* @date 15:18 2025/2/8
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public Process selectByUserId(Long userId,Long coachId) {
|
public Process selectByUserId(Long userId, Long coachId) {
|
||||||
return processMapper.selectNewMaxByUserId(userId,coachId);
|
return processMapper.selectNewMaxByUserId(userId, coachId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,24 +152,24 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Integer> selectByCoachId(Long coachId) {
|
public Map<String, Integer> selectByCoachId(Long coachId) {
|
||||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||||
.eq(Process::getCoachId,coachId);
|
.eq(Process::getCoachId, coachId);
|
||||||
List<Process> allList = this.list(queryWrapper);
|
List<Process> allList = this.list(queryWrapper);
|
||||||
//所有科目二的记录
|
//所有科目二的记录
|
||||||
List<Process> subject2List = allList.stream().filter(item->2==item.getSubject()).collect(Collectors.toList());
|
List<Process> subject2List = allList.stream().filter(item -> 2 == item.getSubject()).collect(Collectors.toList());
|
||||||
//所有科目三的记录
|
//所有科目三的记录
|
||||||
List<Process> subject3List = allList.stream().filter(item->3==item.getSubject()).collect(Collectors.toList());
|
List<Process> subject3List = allList.stream().filter(item -> 3 == item.getSubject()).collect(Collectors.toList());
|
||||||
//科目二未毕业学员id
|
//科目二未毕业学员id
|
||||||
Set<Long> subject2No = new HashSet<>();
|
Set<Long> subject2No = new HashSet<>();
|
||||||
//科目二已毕业学员id
|
//科目二已毕业学员id
|
||||||
Set<Long> subject2Over = new HashSet<>();
|
Set<Long> subject2Over = new HashSet<>();
|
||||||
for (Process item:subject2List){
|
for (Process item : subject2List) {
|
||||||
if("2".equals(item.getStatus())){
|
if ("2".equals(item.getStatus())) {
|
||||||
//已完成
|
//已完成
|
||||||
if("1".equals(item.getExamStatus())){
|
if ("1".equals(item.getExamStatus())) {
|
||||||
//已通过考试
|
//已通过考试
|
||||||
subject2Over.add(item.getUserId());
|
subject2Over.add(item.getUserId());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
//未完成
|
//未完成
|
||||||
subject2No.add(item.getUserId());
|
subject2No.add(item.getUserId());
|
||||||
}
|
}
|
||||||
@ -168,23 +178,23 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
Set<Long> subject3No = new HashSet<>();
|
Set<Long> subject3No = new HashSet<>();
|
||||||
//科目三已毕业学员id
|
//科目三已毕业学员id
|
||||||
Set<Long> subject3Over = new HashSet<>();
|
Set<Long> subject3Over = new HashSet<>();
|
||||||
for (Process item:subject3List){
|
for (Process item : subject3List) {
|
||||||
if("2".equals(item.getStatus())){
|
if ("2".equals(item.getStatus())) {
|
||||||
//已完成
|
//已完成
|
||||||
if("1".equals(item.getExamStatus())){
|
if ("1".equals(item.getExamStatus())) {
|
||||||
//已通过考试
|
//已通过考试
|
||||||
subject3Over.add(item.getUserId());
|
subject3Over.add(item.getUserId());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
//未完成
|
//未完成
|
||||||
subject3No.add(item.getUserId());
|
subject3No.add(item.getUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Integer> rtnMap= new HashMap<>();
|
Map<String, Integer> rtnMap = new HashMap<>();
|
||||||
rtnMap.put("subject2No",subject2No.size());
|
rtnMap.put("subject2No", subject2No.size());
|
||||||
rtnMap.put("subject2Over",subject2Over.size());
|
rtnMap.put("subject2Over", subject2Over.size());
|
||||||
rtnMap.put("subject3No",subject3No.size());
|
rtnMap.put("subject3No", subject3No.size());
|
||||||
rtnMap.put("subject3Over",subject3Over.size());
|
rtnMap.put("subject3Over", subject3Over.size());
|
||||||
return rtnMap;
|
return rtnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +223,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public IPage<ProcessVO> pageProcess(Page<ProcessVO> page, ProcessVO pageReqVO) {
|
public IPage<ProcessVO> pageProcess(Page<ProcessVO> page, ProcessVO pageReqVO) {
|
||||||
return processMapper.pageProcess(pageReqVO,page);
|
return processMapper.pageProcess(pageReqVO, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,7 +244,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
//如果是通过审核,需要保存考试记录
|
//如果是通过审核,需要保存考试记录
|
||||||
if (process.getFinancePass()) {
|
if (process.getFinancePass()) {
|
||||||
//根据科目查询规则
|
//根据科目查询规则
|
||||||
if (null != process.getSubject()){
|
if (null != process.getSubject()) {
|
||||||
DriveSchoolDeduct deduct = deductService.queryBySubject(process.getSubject().toString());
|
DriveSchoolDeduct deduct = deductService.queryBySubject(process.getSubject().toString());
|
||||||
//如果存在提成规则则生成提成记录
|
//如果存在提成规则则生成提成记录
|
||||||
if (null != deduct) {
|
if (null != deduct) {
|
||||||
@ -264,4 +274,58 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
updateById(process);
|
updateById(process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存学员课程进度
|
||||||
|
*
|
||||||
|
* @param request {@link ProcessAddVO}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void saveProcess(ProcessAddVO request) {
|
||||||
|
List<Process> processes = BeanUtil.copyToList(request.getProcessList(), Process.class);
|
||||||
|
// 校验详细信息
|
||||||
|
verify(processes);
|
||||||
|
// 保存信息
|
||||||
|
this.saveBatch(processes);
|
||||||
|
|
||||||
|
// 修改订单信息中的是否分配教练状态
|
||||||
|
schoolCourseOrderService.update(Wrappers.lambdaUpdate(SchoolCourseOrder.class)
|
||||||
|
.eq(SchoolCourseOrder::getId, request.getOrderId())
|
||||||
|
.set(SchoolCourseOrder::getIfAssignmentCoach, SchoolBaseConstants.SCHOOL_COURSE_ORDER_IS_NOT_ASSIGN_COACH));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void verify(List<Process> processes) {
|
||||||
|
for (Process process : processes) {
|
||||||
|
// 校验状态
|
||||||
|
if (StrUtil.isBlank(process.getStatus())) {
|
||||||
|
throw new RuntimeException("状态不能为空");
|
||||||
|
}
|
||||||
|
// 校验科目
|
||||||
|
if (null == process.getSubject()) {
|
||||||
|
throw new RuntimeException("科目不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(process.getCourseId())) {
|
||||||
|
throw new RuntimeException("课程ID不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(process.getCourseName())) {
|
||||||
|
throw new RuntimeException("课程名称不能为空");
|
||||||
|
}
|
||||||
|
if (null == process.getUserId()) {
|
||||||
|
throw new RuntimeException("用户ID不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(process.getUserName())) {
|
||||||
|
throw new RuntimeException("用户名称不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(process.getUserMobile())) {
|
||||||
|
throw new RuntimeException("用户手机号不能为空");
|
||||||
|
}
|
||||||
|
if (null == process.getCoachId()) {
|
||||||
|
throw new RuntimeException("教练ID不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(process.getCoachName())) {
|
||||||
|
throw new RuntimeException("教练名称不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,18 +2,24 @@ package cn.iocoder.yudao.module.course.service.impl;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||||
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||||
import cn.iocoder.yudao.module.course.mapper.SchoolCourseOrderMapper;
|
import cn.iocoder.yudao.module.course.mapper.SchoolCourseOrderMapper;
|
||||||
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||||
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
||||||
import cn.iocoder.yudao.module.course.vo.SchoolCommissionVO;
|
import cn.iocoder.yudao.module.course.vo.SchoolCommissionVO;
|
||||||
import cn.iocoder.yudao.module.course.vo.SchoolCourseOrderVO;
|
import cn.iocoder.yudao.module.course.vo.SchoolCourseOrderVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驾照报名订单 Service 实现类
|
* 驾照报名订单 Service 实现类
|
||||||
@ -27,6 +33,9 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
|||||||
@Resource
|
@Resource
|
||||||
private SchoolCourseOrderMapper schoolCourseOrderMapper;
|
private SchoolCourseOrderMapper schoolCourseOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProcessService processService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createSchoolCourseOrder(SchoolCourseOrderVO createReqVO) {
|
public String createSchoolCourseOrder(SchoolCourseOrderVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -70,4 +79,35 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
|||||||
return schoolCourseOrderMapper.queryPage(pageReqVO,page);
|
return schoolCourseOrderMapper.queryPage(pageReqVO,page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止订单
|
||||||
|
*
|
||||||
|
* @param orderNo 订单号
|
||||||
|
* @param endReason 终止原因
|
||||||
|
* @param endTime 终止时间
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void endOrder(String orderNo, String endReason, LocalDateTime endTime) {
|
||||||
|
// 修改订单表
|
||||||
|
baseMapper.update(Wrappers.lambdaUpdate(SchoolCourseOrder.class)
|
||||||
|
.eq(SchoolCourseOrder::getOrderNo, orderNo)
|
||||||
|
.set(SchoolCourseOrder::getEndReason, endReason)
|
||||||
|
.set(SchoolCourseOrder::getEndTime, endTime)
|
||||||
|
.set(SchoolCourseOrder::getIfEnd, SchoolBaseConstants.COMMON_YES));
|
||||||
|
|
||||||
|
// 查询学员信息
|
||||||
|
SchoolCourseOrder schoolCourseOrder = baseMapper.selectOne(Wrappers.lambdaQuery(SchoolCourseOrder.class)
|
||||||
|
.eq(SchoolCourseOrder::getOrderNo, orderNo));
|
||||||
|
|
||||||
|
// 删除学员未开始和训练中的科目
|
||||||
|
processService.remove(Wrappers.lambdaQuery(Process.class)
|
||||||
|
.eq(Process::getUserId, schoolCourseOrder.getUserId())
|
||||||
|
.and(q -> q.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_NOT_START)
|
||||||
|
.or()
|
||||||
|
.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS))
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.module.course.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 保存学生进度vo
|
||||||
|
* @Author: 86187
|
||||||
|
* @Date: 2025/04/01 15:15
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProcessAddVO {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
/**
|
||||||
|
* 进度信息
|
||||||
|
*/
|
||||||
|
private List<ProcessVO> processList;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.yudao.module.exam.controller.app;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.exam.service.ExamBatchService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 小程序-考试批次
|
||||||
|
* @Author: 86187
|
||||||
|
* @Date: 2025/03/31 10:54
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Tag(name = "小程序 - 考试批次")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/examBatch")
|
||||||
|
@Validated
|
||||||
|
public class AppExamBatchController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExamBatchService examBatchService;
|
||||||
|
}
|
@ -78,10 +78,9 @@ public class AppDriveSchoolReservationCourseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增预约练车
|
* 新增预约练车
|
||||||
*/
|
*/
|
||||||
//@Log(title = "预约练车", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CommonResult add(@RequestBody DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception {
|
public CommonResult add(@RequestBody DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception {
|
||||||
return CommonResult.success(driveSchoolReservationCourseService.insertDriveSchoolReservationCourse(driveSchoolReservationCourse));
|
return CommonResult.success(driveSchoolReservationCourseService.insertAppReservationCourse(driveSchoolReservationCourse));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,13 +119,27 @@ public class DriveSchoolReservationCourse extends TenantBaDO {
|
|||||||
//课程名字
|
//课程名字
|
||||||
private String courseName;
|
private String courseName;
|
||||||
|
|
||||||
|
//课程id
|
||||||
|
private String courseId;
|
||||||
|
|
||||||
//预约类型 1:正常预约 2:立即练车
|
//预约类型 1:正常预约 2:立即练车
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
//练车时长
|
//练车时长
|
||||||
private double driveTime;
|
private double driveTime;
|
||||||
|
|
||||||
|
//预约日期
|
||||||
|
private String reservDay;
|
||||||
|
|
||||||
|
//预约时间段
|
||||||
|
private String reservTime;
|
||||||
|
|
||||||
private String currentDate;
|
private String currentDate;
|
||||||
|
// 科目
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
// 是否取消预约
|
||||||
|
private boolean ifCancel;
|
||||||
//练车总时长
|
//练车总时长
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private double allDriveTime;
|
private double allDriveTime;
|
||||||
|
@ -40,6 +40,13 @@ public interface IDriveSchoolReservationCourseService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertDriveSchoolReservationCourse(DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception;
|
public int insertDriveSchoolReservationCourse(DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception;
|
||||||
|
/**
|
||||||
|
* 小程序新增预约练车
|
||||||
|
*
|
||||||
|
* @param driveSchoolReservationCourse 预约练车
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppReservationCourse(DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改预约练车
|
* 修改预约练车
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.jx.service.impl;
|
package cn.iocoder.yudao.module.jx.service.impl;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
|
||||||
|
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
|
||||||
import cn.iocoder.yudao.module.jx.domain.*;
|
import cn.iocoder.yudao.module.jx.domain.*;
|
||||||
import cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay;
|
import cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay;
|
||||||
import cn.iocoder.yudao.module.jx.payment.mapper.DrivePayMapper;
|
import cn.iocoder.yudao.module.jx.payment.mapper.DrivePayMapper;
|
||||||
@ -17,6 +19,7 @@ import cn.iocoder.yudao.module.jx.vo.StatisticsVo;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.thoughtworks.xstream.core.SecurityUtils;
|
import com.thoughtworks.xstream.core.SecurityUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@ -66,6 +69,9 @@ public class DriveSchoolReservationCourseServiceImpl implements IDriveSchoolRese
|
|||||||
@Resource
|
@Resource
|
||||||
private DriveSchoolInfoMapper driveSchoolInfoMapper;
|
private DriveSchoolInfoMapper driveSchoolInfoMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExamBatchItemService examBatchItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询预约练车
|
* 查询预约练车
|
||||||
*
|
*
|
||||||
@ -253,6 +259,38 @@ public class DriveSchoolReservationCourseServiceImpl implements IDriveSchoolRese
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序新增预约练车
|
||||||
|
*
|
||||||
|
* @param driveSchoolReservationCourse 预约练车
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertAppReservationCourse(DriveSchoolReservationCourse driveSchoolReservationCourse) throws Exception {
|
||||||
|
// 查询科目一是否合格
|
||||||
|
ExamBatchItem one = examBatchItemService.getOne(Wrappers.<ExamBatchItem>lambdaQuery()
|
||||||
|
.eq(ExamBatchItem::getUserId, driveSchoolReservationCourse.getUserId())
|
||||||
|
.eq(ExamBatchItem::getIfPass, true)
|
||||||
|
.last("limit 1"));
|
||||||
|
if (ObjectUtils.isNotEmpty(one)) {
|
||||||
|
throw new Exception("科目一未通过,无法预约");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加预约记录
|
||||||
|
DriveSchoolReservationCourse records = new DriveSchoolReservationCourse();
|
||||||
|
records.setUserId(driveSchoolReservationCourse.getUserId()); // 学员id
|
||||||
|
records.setUserName(driveSchoolReservationCourse.getUserName()); // 学员姓名
|
||||||
|
records.setCoachId(driveSchoolReservationCourse.getCoachId()); // 教练id
|
||||||
|
records.setCoachName(driveSchoolReservationCourse.getCoachName()); // 教练姓名
|
||||||
|
records.setCourseId(driveSchoolReservationCourse.getCourseId()); // 课程id
|
||||||
|
records.setCourseName(driveSchoolReservationCourse.getCourseName()); // 课程名称
|
||||||
|
records.setTenantId(driveSchoolReservationCourse.getTenantId()); // 手动设置租户id
|
||||||
|
records.setReservDay(driveSchoolReservationCourse.getReservDay()); // 预约日期
|
||||||
|
records.setReservTime(driveSchoolReservationCourse.getReservTime()); // 预约时间段
|
||||||
|
records.setSubject(driveSchoolReservationCourse.getSubject()); // 科目类型
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改预约练车
|
* 修改预约练车
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user