1
This commit is contained in:
parent
b868a7cae5
commit
dc7a0a5ea8
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 驾校系统可用角色枚举
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SchoolRoleEnum {
|
||||
/**
|
||||
* 驾校业务管理员
|
||||
*/
|
||||
ADMIN("jiaxiao","驾校业务管理员"),
|
||||
/**
|
||||
* 驾校工作人员
|
||||
*/
|
||||
STAFF("school_staff","驾校工作人员"),
|
||||
/**
|
||||
* 驾校教练
|
||||
*/
|
||||
COACH("instructor","驾校教练");
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 根据角色code返回对应的枚举
|
||||
* @author vinjor-M
|
||||
* @date 14:23 2024/10/16
|
||||
* @param code 角色code
|
||||
* @return cn.iocoder.yudao.common.SystemEnum
|
||||
**/
|
||||
public static SchoolRoleEnum getRole(String code) {
|
||||
for (SchoolRoleEnum roleEnum : SchoolRoleEnum.values()) {
|
||||
if (roleEnum.getCode().equalsIgnoreCase(code)) {
|
||||
// 找到对应的枚举
|
||||
return roleEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的角色code:" + code);
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.staff.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.common.SchoolRoleEnum;
|
||||
import cn.iocoder.yudao.common.SystemEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.staff.service.ApiAppLoginService;
|
||||
@ -117,7 +118,7 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
|
||||
|
||||
} else if (SystemEnum.SCHOOL.getCode().equals(loginBody.getSysCode())) {
|
||||
//驾校业务系统
|
||||
|
||||
flag = this.checkSchoolCanLogin(user, roleCodeList,loginBody.getTypes());
|
||||
} else if (SystemEnum.RESCUE.getCode().equals(loginBody.getSysCode())) {
|
||||
//救援业务系统
|
||||
flag = (loginBody.getType().equals("0") && roleNames.contains("调度中心")) || (loginBody.getType().equals("0") && roleNames.contains("交警大队"));
|
||||
@ -177,4 +178,43 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
|
||||
user.setRoleNames(String.join(",",thisRoleNameList));
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否可以登录驾校系统
|
||||
* @author vinjor-M
|
||||
* @date 15:34 2024/10/16
|
||||
* @param user 当前用户
|
||||
* @param roleCodeList 已有的角色code
|
||||
* @return boolean
|
||||
**/
|
||||
private boolean checkSchoolCanLogin(AdminUserDO user,List<String> roleCodeList,String type){
|
||||
boolean flag = false;
|
||||
List<String> thisRoleCodeList = new ArrayList<>();
|
||||
List<String> thisRoleNameList = new ArrayList<>();
|
||||
if("2".equals(type)){
|
||||
//管理端
|
||||
if(roleCodeList.contains(SchoolRoleEnum.ADMIN.getCode())){
|
||||
//驾校业务管理员
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.ADMIN.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.ADMIN.getName());
|
||||
}else if(roleCodeList.contains(SchoolRoleEnum.STAFF.getCode())){
|
||||
//驾校工作人员
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.STAFF.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.STAFF.getName());
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
//教练端
|
||||
if(roleCodeList.contains(SchoolRoleEnum.COACH.getCode())){
|
||||
//驾校教练
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.COACH.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.COACH.getName());
|
||||
}
|
||||
}
|
||||
user.setRoleCodes(String.join(",",thisRoleCodeList));
|
||||
user.setRoleNames(String.join(",",thisRoleNameList));
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,13 @@ public class StaffLoginBody {
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
//0账号密码登录,1手机号登录 2:管理 3:教练
|
||||
/**
|
||||
* 登录类型 0账号密码登录,1手机号登录
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
*系统端类型 2:管理 3:教练
|
||||
*/
|
||||
private String types;
|
||||
private String phone;
|
||||
private String realName;
|
||||
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.course.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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 javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 学员课程进度")
|
||||
@RestController
|
||||
@RequestMapping("/process")
|
||||
@Validated
|
||||
public class ProcessController {
|
||||
|
||||
@Resource
|
||||
private ProcessService processService;
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getMyCourseAndSubject")
|
||||
@Operation(summary = "教练查自己带教的课程和科目")
|
||||
public CommonResult<?> getMyCourseAndSubject() {
|
||||
return success(processService.getMyCourseAndSubject());
|
||||
}
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getMyCourseStudentPage")
|
||||
@Operation(summary = "教练查自己带教的课程和科目在训练中的学生")
|
||||
public CommonResult<IPage<?>> getMyCourseStudentPage(Process process,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<Process> page = new Page<>(pageNo,pageSize);
|
||||
return success(processService.getMyCourseStudentPage(process,page));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.course.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 驾校-学员课程进度 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_process")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Process extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 用户(学员)ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户(学员)姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 学员手机号
|
||||
*/
|
||||
private String userMobile;
|
||||
/**
|
||||
* 教练ID
|
||||
*/
|
||||
private Integer coachId;
|
||||
/**
|
||||
* 教练姓名
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
/**
|
||||
* 考试次数(第一次考试为1,第二次为2...)
|
||||
*/
|
||||
private Integer examNum;
|
||||
/**
|
||||
* 当前状态(0-未开始;1-训练中;2-已完成)
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 考试是否合格(0未通过;1已通过;null 未考试)
|
||||
*/
|
||||
private Boolean ifPass;
|
||||
/**
|
||||
* 考试分数
|
||||
*/
|
||||
private Double examScore;
|
||||
/**
|
||||
* 图片证明材料
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 考试时间
|
||||
*/
|
||||
private Date examTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 本科目累计训练时长
|
||||
*/
|
||||
private Double trainTime;
|
||||
/**
|
||||
* 财务审核是否通过(0未通过;1通过;null待审核)
|
||||
*/
|
||||
private Boolean financePass;
|
||||
/**
|
||||
* 财务审核备注
|
||||
*/
|
||||
private String financeRemark;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.course.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 驾校-学员课程进度 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProcessMapper extends BaseMapper<Process> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.course.service;
|
||||
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学员课程进度 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface ProcessService extends IService<Process> {
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.entity.Process>
|
||||
**/
|
||||
List<Process> getMyCourseAndSubject();
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
* @author vinjor-M
|
||||
* @date 17:11 2025/1/15
|
||||
* @param process 查询对象
|
||||
**/
|
||||
IPage<Process> getMyCourseStudentPage(Process process, Page<Process> page);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.course.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 学员课程进度 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> implements ProcessService {
|
||||
@Autowired
|
||||
private ProcessMapper processMapper;
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.entity.Process>
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
**/
|
||||
@Override
|
||||
public List<Process> getMyCourseAndSubject() {
|
||||
//当前教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getCoachId,userId)
|
||||
//状态不等于2-已完成的科目
|
||||
.ne(Process::getStatus,"2")
|
||||
.groupBy(Process::getCourseId).groupBy(Process::getSubject);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
*
|
||||
* @param process
|
||||
* @param page
|
||||
* @author vinjor-M
|
||||
* @date 17:11 2025/1/15
|
||||
**/
|
||||
@Override
|
||||
public IPage<Process> getMyCourseStudentPage(Process process, Page<Process> page) {
|
||||
//当前教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getCoachId,userId)
|
||||
.eq(Process::getCourseId,process.getCourseId())
|
||||
.eq(Process::getSubject,process.getSubject());
|
||||
if(StringUtils.isNotEmpty(process.getUserName())){
|
||||
queryWrapper.like(Process::getUserName,process.getUserName());
|
||||
}
|
||||
//状态等于1-训练中的
|
||||
queryWrapper.ne(Process::getStatus,"1")
|
||||
.groupBy(Process::getUserId)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
return this.page(page,queryWrapper);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.train.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 预约练车")
|
||||
@RestController
|
||||
@RequestMapping("/reservation-course")
|
||||
@Validated
|
||||
public class ReservationCourseController {
|
||||
|
||||
@Resource
|
||||
private ReservationCourseService reservationCourseService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约练车分页")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:query')")
|
||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
||||
if("my".equals(pageReqVO.getSelectType())){
|
||||
//查自己的
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setCoachId(userId);
|
||||
}
|
||||
//查未取消的
|
||||
pageReqVO.setIfCancel(false);
|
||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "审核预约练车")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:update')")
|
||||
public CommonResult<Boolean> updateReservationCourse(@Valid @RequestBody ReservationCourseVO updateReqVO) {
|
||||
reservationCourseService.updateById(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:delete')")
|
||||
public CommonResult<Boolean> deleteReservationCourse(@RequestParam("id") String id) {
|
||||
reservationCourseService.removeById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:query')")
|
||||
public CommonResult<ReservationCourse> getReservationCourse(@RequestParam("id") String id) {
|
||||
return success(reservationCourseService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.train.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 练车记录")
|
||||
@RestController
|
||||
@RequestMapping("/train")
|
||||
@Validated
|
||||
public class TrainController {
|
||||
|
||||
@Resource
|
||||
private TrainService trainService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得练车记录分页")
|
||||
public CommonResult<IPage<?>> getPage(TrainVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<TrainVO> page = new Page<>(pageNo,pageSize);
|
||||
if("my".equals(pageReqVO.getSelectType())){
|
||||
//查自己的
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setCoachId(userId);
|
||||
}
|
||||
return success(trainService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "到场打卡")
|
||||
public CommonResult<?> createObj( @RequestBody TrainVO trainVO) {
|
||||
trainService.createObj(trainVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "离场打卡")
|
||||
public CommonResult<?> updateObj( @RequestBody TrainVO trainVO) {
|
||||
trainService.updateObj(trainVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查看练车记录详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<?> getById(@RequestParam("id") String id) {
|
||||
return success(trainService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.train.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "小程序 - 预约练车")
|
||||
@RestController
|
||||
@RequestMapping("/reservation-course")
|
||||
@Validated
|
||||
public class AppReservationCourseController {
|
||||
|
||||
@Resource
|
||||
private ReservationCourseService reservationCourseService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约练车分页")
|
||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setUserId(userId);
|
||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
@PutMapping("/create")
|
||||
@Operation(summary = "预约练车")
|
||||
public CommonResult<Boolean> createReservationCourse( @RequestBody ReservationCourse createObj) {
|
||||
reservationCourseService.save(createObj);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
@Operation(summary = "取消预约练车")
|
||||
public CommonResult<Boolean> updateReservationCourse(String id) {
|
||||
ReservationCourse updateObj = new ReservationCourse();
|
||||
updateObj.setId(id);
|
||||
updateObj.setIfCancel(true);
|
||||
reservationCourseService.updateById(updateObj);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteReservationCourse(@RequestParam("id") String id) {
|
||||
reservationCourseService.removeById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<ReservationCourse> getReservationCourse(@RequestParam("id") String id) {
|
||||
return success(reservationCourseService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.train.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 预约练车 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_reservation_course")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationCourse extends TenantBaseDO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 教练id
|
||||
*/
|
||||
private Long coachId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 教练名字
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 预约日期
|
||||
*/
|
||||
private Date reservDay;
|
||||
/**
|
||||
* 时间段(字典:school_reserv_time)
|
||||
*/
|
||||
private String reservTime;
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
/**
|
||||
* 预约类型 1:正常预约 2:立即练车
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String refuseReason;
|
||||
/**
|
||||
* 教练审核状态 0:拒绝 ;1:通过 ;null :待审核
|
||||
*/
|
||||
private Boolean status;
|
||||
/**
|
||||
* 用户是否取消(0未取消|1已取消)
|
||||
*/
|
||||
private Boolean ifCancel;
|
||||
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package cn.iocoder.yudao.module.train.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 驾校-训练记录 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_train")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Train extends TenantBaseDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 预约记录ID
|
||||
*/
|
||||
private String reservationId;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 用户(学员)ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户(学员)姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 学员手机号
|
||||
*/
|
||||
private String userMobile;
|
||||
/**
|
||||
* 教练ID
|
||||
*/
|
||||
private Long coachId;
|
||||
/**
|
||||
* 教练姓名
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 训练地址id
|
||||
*/
|
||||
private String addrId;
|
||||
/**
|
||||
* 训练地址
|
||||
*/
|
||||
private String addr;
|
||||
/**
|
||||
* 交通方式(字典:school_transport_way)
|
||||
*/
|
||||
private String transWay;
|
||||
/**
|
||||
* 预约方式(字典:school_reservation_way)
|
||||
*/
|
||||
private String reservationWay;
|
||||
/**
|
||||
* 到场时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 到场备注
|
||||
*/
|
||||
private String startRemark;
|
||||
/**
|
||||
* 到场图片
|
||||
*/
|
||||
private String startImages;
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 离场备注
|
||||
*/
|
||||
private String endRemark;
|
||||
/**
|
||||
* 离场图片
|
||||
*/
|
||||
private String endImages;
|
||||
/**
|
||||
* 本次有效训练时长(分钟)
|
||||
*/
|
||||
private Double trainTime;
|
||||
/**
|
||||
* 累计有效训练时长(分钟)到场打卡存的是本次训练前的累计时长,离场打卡后,存的是本次训练完后累计时长
|
||||
*/
|
||||
private Double allTrainTime;
|
||||
/**
|
||||
* 是否已评价(0未评价|1已评价)
|
||||
*/
|
||||
private Boolean ifEvaluate;
|
||||
/**
|
||||
* 评价ID
|
||||
*/
|
||||
private Integer evaluateId;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.train.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 预约练车 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReservationCourseMapper extends BaseMapper<ReservationCourse> {
|
||||
|
||||
IPage<ReservationCourseVO> queryListPage(@Param("entity") ReservationCourseVO entity, Page<ReservationCourseVO> page);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.train.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 练车记录 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface TrainMapper extends BaseMapper<Train> {
|
||||
|
||||
IPage<TrainVO> queryListPage(@Param("entity") TrainVO entity, Page<TrainVO> page);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 预约练车 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface ReservationCourseService extends IService<ReservationCourse> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @author vinjor-M
|
||||
* @date 15:05 2025/1/14
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
||||
**/
|
||||
IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 预约练车 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface TrainService extends IService<Train> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @author vinjor-M
|
||||
* @date 15:05 2025/1/14
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
**/
|
||||
IPage<TrainVO> queryListPage(TrainVO pageReqVO, Page<TrainVO> page);
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
* @author vinjor-M
|
||||
* @date 15:47 2025/1/14
|
||||
* @param trainVO TODO
|
||||
**/
|
||||
void createObj(TrainVO trainVO);
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
* @author vinjor-M
|
||||
* @date 15:49 2025/1/14
|
||||
* @param trainVO TODO
|
||||
**/
|
||||
void updateObj(TrainVO trainVO);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 预约练车 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseMapper, ReservationCourse> implements ReservationCourseService {
|
||||
@Autowired
|
||||
private ReservationCourseMapper reservationCourseMapper;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
||||
* @author vinjor-M
|
||||
* @date 15:03 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page) {
|
||||
IPage<ReservationCourseVO> rtnList = reservationCourseMapper.queryListPage(pageReqVO, page);
|
||||
return rtnList;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 预约练车 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements TrainService {
|
||||
@Autowired
|
||||
private TrainMapper trainMapper;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @author vinjor-M
|
||||
* @date 15:03 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public IPage<TrainVO> queryListPage(TrainVO pageReqVO, Page<TrainVO> page) {
|
||||
IPage<TrainVO> rtnList = trainMapper.queryListPage(pageReqVO, page);
|
||||
return rtnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
*
|
||||
* @param trainVO
|
||||
* @author vinjor-M
|
||||
* @date 15:47 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public void createObj(TrainVO trainVO) {
|
||||
this.save(trainVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
*
|
||||
* @param trainVO
|
||||
* @author vinjor-M
|
||||
* @date 15:49 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public void updateObj(TrainVO trainVO) {
|
||||
this.updateById(trainVO);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ReservationCourseVO extends ReservationCourse {
|
||||
/**
|
||||
* selectType(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TrainVO extends Train {
|
||||
/**
|
||||
* 查询类型(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.course.mapper.ProcessMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper">
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.ReservationCourseVO">
|
||||
SELECT
|
||||
dsrc.*
|
||||
FROM
|
||||
drive_school_reservation_course dsrc
|
||||
where
|
||||
dsrc.deleted = 0
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
and dsrc.user_id =#{entity.userId}
|
||||
</if>
|
||||
<if test="entity.coachId != null and entity.coachId != ''">
|
||||
and dsrc.coach_id =#{entity.coachId}
|
||||
</if>
|
||||
<if test="entity.courseId != null and entity.courseId != ''">
|
||||
and dsrc.course_id =#{entity.courseId}
|
||||
</if>
|
||||
<if test="entity.subject != null and entity.subject != ''">
|
||||
and dsrc.subject =#{entity.subject}
|
||||
</if>
|
||||
<if test="entity.ifCancel != null">
|
||||
and dsrc.if_cancel =#{entity.ifCancel}
|
||||
</if>
|
||||
<if test="entity.reservDay != null and entity.reservDay != ''">
|
||||
and dsrc.reserv_day LIKE CONCAT(#{entity.reservDay},'%')
|
||||
</if>
|
||||
order by dsrc.create_time desc
|
||||
</select>
|
||||
</mapper>
|
34
dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml
Normal file
34
dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper">
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.TrainVO">
|
||||
SELECT
|
||||
dsrc.*
|
||||
FROM
|
||||
drive_school_reservation_course dsrc
|
||||
where
|
||||
dsrc.deleted = 0
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
and dsrc.user_id =#{entity.userId}
|
||||
</if>
|
||||
<if test="entity.coachId != null and entity.coachId != ''">
|
||||
and dsrc.coach_id =#{entity.coachId}
|
||||
</if>
|
||||
<if test="entity.courseId != null and entity.courseId != ''">
|
||||
and dsrc.course_id =#{entity.courseId}
|
||||
</if>
|
||||
<if test="entity.subject != null and entity.subject != ''">
|
||||
and dsrc.subject =#{entity.subject}
|
||||
</if>
|
||||
<if test="entity.ifCancel != null">
|
||||
and dsrc.if_cancel =#{entity.ifCancel}
|
||||
</if>
|
||||
<if test="entity.reservDay != null and entity.reservDay != ''">
|
||||
and dsrc.reserv_day LIKE CONCAT(#{entity.reservDay},'%')
|
||||
</if>
|
||||
order by dsrc.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user