diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/SchoolRoleEnum.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/SchoolRoleEnum.java new file mode 100644 index 00000000..13aa8058 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/SchoolRoleEnum.java @@ -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); + } + +} diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java index b985b054..2d30ff8e 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java @@ -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 roleCodeList,String type){ + boolean flag = false; + List thisRoleCodeList = new ArrayList<>(); + List 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; + } } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/StaffLoginBody.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/StaffLoginBody.java index 4d4b2bad..2a4732d2 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/StaffLoginBody.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/StaffLoginBody.java @@ -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; diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/controller/admin/ProcessController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/controller/admin/ProcessController.java new file mode 100644 index 00000000..56f8e5d3 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/controller/admin/ProcessController.java @@ -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> getMyCourseStudentPage(Process process, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo,pageSize); + return success(processService.getMyCourseStudentPage(process,page)); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/entity/Process.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/entity/Process.java new file mode 100644 index 00000000..c36f542a --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/entity/Process.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java new file mode 100644 index 00000000..a1f3615f --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java @@ -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 { + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java new file mode 100644 index 00000000..b4b1d939 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java @@ -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 { + + /** + * 教练查自己带教的课程和科目 + * @author vinjor-M + * @date 11:05 2025/1/15 + * @return java.util.List + **/ + List getMyCourseAndSubject(); + + /** + * 教练查自己带教的课程和科目在训练中的学生 + * @author vinjor-M + * @date 17:11 2025/1/15 + * @param process 查询对象 + **/ + IPage getMyCourseStudentPage(Process process, Page page); +} 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 new file mode 100644 index 00000000..574baeca --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java @@ -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 implements ProcessService { + @Autowired + private ProcessMapper processMapper; + + /** + * 教练查自己带教的课程和科目 + * + * @return java.util.List + * @author vinjor-M + * @date 11:05 2025/1/15 + **/ + @Override + public List getMyCourseAndSubject() { + //当前教练ID + Long userId = SecurityFrameworkUtils.getLoginUserId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .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 getMyCourseStudentPage(Process process, Page page) { + //当前教练ID + Long userId = SecurityFrameworkUtils.getLoginUserId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .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); + } +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/ReservationCourseController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/ReservationCourseController.java new file mode 100644 index 00000000..7edaa715 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/ReservationCourseController.java @@ -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> getPage(ReservationCourseVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page 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 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 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 getReservationCourse(@RequestParam("id") String id) { + return success(reservationCourseService.getById(id)); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/TrainController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/TrainController.java new file mode 100644 index 00000000..c78dace4 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/admin/TrainController.java @@ -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> getPage(TrainVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page 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)); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/app/AppReservationCourseController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/app/AppReservationCourseController.java new file mode 100644 index 00000000..fbd714cd --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/controller/app/AppReservationCourseController.java @@ -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> getPage(ReservationCourseVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo,pageSize); + Long userId = SecurityFrameworkUtils.getLoginUserId(); + pageReqVO.setUserId(userId); + return success(reservationCourseService.queryListPage(pageReqVO,page)); + } + + @PutMapping("/create") + @Operation(summary = "预约练车") + public CommonResult createReservationCourse( @RequestBody ReservationCourse createObj) { + reservationCourseService.save(createObj); + return success(true); + } + + @PutMapping("/cancel") + @Operation(summary = "取消预约练车") + public CommonResult 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 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 getReservationCourse(@RequestParam("id") String id) { + return success(reservationCourseService.getById(id)); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/ReservationCourse.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/ReservationCourse.java new file mode 100644 index 00000000..fb857656 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/ReservationCourse.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java new file mode 100644 index 00000000..4c48dd89 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/ReservationCourseMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/ReservationCourseMapper.java new file mode 100644 index 00000000..26647f25 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/ReservationCourseMapper.java @@ -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 { + + IPage queryListPage(@Param("entity") ReservationCourseVO entity, Page page); + + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/TrainMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/TrainMapper.java new file mode 100644 index 00000000..ed895f6e --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/mapper/TrainMapper.java @@ -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 { + + IPage queryListPage(@Param("entity") TrainVO entity, Page page); + + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/ReservationCourseService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/ReservationCourseService.java new file mode 100644 index 00000000..7f49e12f --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/ReservationCourseService.java @@ -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 { + + /** + * 分页查询 + * @author vinjor-M + * @date 15:05 2025/1/14 + * @param pageReqVO TODO + * @param page TODO + * @return com.baomidou.mybatisplus.core.metadata.IPage + **/ + IPage queryListPage(ReservationCourseVO pageReqVO, Page page); + +} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/TrainService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/TrainService.java new file mode 100644 index 00000000..7cfac814 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/TrainService.java @@ -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 { + + /** + * 分页查询 + * @author vinjor-M + * @date 15:05 2025/1/14 + * @param pageReqVO TODO + * @param page TODO + **/ + IPage queryListPage(TrainVO pageReqVO, Page 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); +} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/ReservationCourseServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/ReservationCourseServiceImpl.java new file mode 100644 index 00000000..747d3631 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/ReservationCourseServiceImpl.java @@ -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 implements ReservationCourseService { + @Autowired + private ReservationCourseMapper reservationCourseMapper; + + /** + * 分页查询 + * + * @param pageReqVO TODO + * @param page TODO + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author vinjor-M + * @date 15:03 2025/1/14 + **/ + @Override + public IPage queryListPage(ReservationCourseVO pageReqVO, Page page) { + IPage rtnList = reservationCourseMapper.queryListPage(pageReqVO, page); + return rtnList; + } +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/TrainServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/TrainServiceImpl.java new file mode 100644 index 00000000..55c8c4dd --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/service/impl/TrainServiceImpl.java @@ -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 implements TrainService { + @Autowired + private TrainMapper trainMapper; + + /** + * 分页查询 + * + * @param pageReqVO TODO + * @param page TODO + * @author vinjor-M + * @date 15:03 2025/1/14 + **/ + @Override + public IPage queryListPage(TrainVO pageReqVO, Page page) { + IPage 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); + } +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/ReservationCourseVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/ReservationCourseVO.java new file mode 100644 index 00000000..204e834d --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/ReservationCourseVO.java @@ -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; +} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/TrainVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/TrainVO.java new file mode 100644 index 00000000..c833761e --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/vo/TrainVO.java @@ -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; +} diff --git a/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml b/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml new file mode 100644 index 00000000..df6fa254 --- /dev/null +++ b/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/dl-module-jx/src/main/resources/mapper/train/ReservationCourseMapper.xml b/dl-module-jx/src/main/resources/mapper/train/ReservationCourseMapper.xml new file mode 100644 index 00000000..e3ca6c29 --- /dev/null +++ b/dl-module-jx/src/main/resources/mapper/train/ReservationCourseMapper.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml b/dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml new file mode 100644 index 00000000..dd3c0b27 --- /dev/null +++ b/dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml @@ -0,0 +1,34 @@ + + + + + +