新增基础工具类
This commit is contained in:
parent
f6d3e08060
commit
157dbd6796
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.base.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 驾校基础工具类
|
||||||
|
* @Author: 86187
|
||||||
|
* @Date: 2025/04/09 10:30
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class DriveSchoolBaseUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取科目
|
||||||
|
*
|
||||||
|
* @param subject 科目数字
|
||||||
|
* @return 科目字符串
|
||||||
|
*/
|
||||||
|
public static String getSubjectStr(Integer subject) {
|
||||||
|
switch (subject) {
|
||||||
|
case 1:
|
||||||
|
return "科目一";
|
||||||
|
case 2:
|
||||||
|
return "科目二";
|
||||||
|
case 3:
|
||||||
|
return "科目三";
|
||||||
|
case 4:
|
||||||
|
return "科目四";
|
||||||
|
default:
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,8 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反馈Service业务层处理
|
* 反馈Service业务层处理
|
||||||
*
|
*
|
||||||
@ -77,7 +79,8 @@ public class SchoolFeedbackServiceImpl extends ServiceImpl<SchoolFeedBackMapper,
|
|||||||
public IPage<SchoolFeedBackVO> queryPage(Page<SchoolFeedBack> page, SchoolFeedBackVO request) {
|
public IPage<SchoolFeedBackVO> queryPage(Page<SchoolFeedBack> page, SchoolFeedBackVO request) {
|
||||||
// 1. 分页查询原始数据
|
// 1. 分页查询原始数据
|
||||||
IPage<SchoolFeedBack> pageList = this.page(page, Wrappers.lambdaQuery(SchoolFeedBack.class)
|
IPage<SchoolFeedBack> pageList = this.page(page, Wrappers.lambdaQuery(SchoolFeedBack.class)
|
||||||
.eq(ObjectUtil.isNotEmpty(request.getUserId()), SchoolFeedBack::getUserId, request.getUserId()));
|
.eq(ObjectUtil.isNotEmpty(request.getUserId()), SchoolFeedBack::getUserId, request.getUserId())
|
||||||
|
.orderByDesc(SchoolFeedBack::getCreateTime));
|
||||||
|
|
||||||
// 2. 提取训练和考试的ID集合
|
// 2. 提取训练和考试的ID集合
|
||||||
List<String> trainIds = pageList.getRecords().stream()
|
List<String> trainIds = pageList.getRecords().stream()
|
||||||
@ -111,11 +114,15 @@ public class SchoolFeedbackServiceImpl extends ServiceImpl<SchoolFeedBackMapper,
|
|||||||
List<SchoolFeedBackVO> voList = pageList.getRecords().stream().map(item -> {
|
List<SchoolFeedBackVO> voList = pageList.getRecords().stream().map(item -> {
|
||||||
SchoolFeedBackVO vo = BeanUtil.copyProperties(item, SchoolFeedBackVO.class);
|
SchoolFeedBackVO vo = BeanUtil.copyProperties(item, SchoolFeedBackVO.class);
|
||||||
if (SchoolBaseConstants.EVALUATE_TYPE_TRAIN.equals(item.getEvaluateType())) {
|
if (SchoolBaseConstants.EVALUATE_TYPE_TRAIN.equals(item.getEvaluateType())) {
|
||||||
|
// 设置标题
|
||||||
vo.setBusiName(getSubjectStr(trainMap.get(item.getBusiId()).getSubject()) + "训练");
|
vo.setBusiName(getSubjectStr(trainMap.get(item.getBusiId()).getSubject()) + "训练");
|
||||||
|
// 设置课程类型和教练名
|
||||||
vo.setCourseType(trainMap.get(item.getBusiId()).getCourseType());
|
vo.setCourseType(trainMap.get(item.getBusiId()).getCourseType());
|
||||||
vo.setCoachName(trainMap.get(item.getBusiId()).getCoachName());
|
vo.setCoachName(trainMap.get(item.getBusiId()).getCoachName());
|
||||||
} else if (SchoolBaseConstants.EVALUATE_TYPE_EXAM.equals(item.getEvaluateType())) {
|
} else if (SchoolBaseConstants.EVALUATE_TYPE_EXAM.equals(item.getEvaluateType())) {
|
||||||
|
// 设置标题
|
||||||
vo.setBusiName(getSubjectStr(examMap.get(item.getBusiId()).getSubject()) + "考试");
|
vo.setBusiName(getSubjectStr(examMap.get(item.getBusiId()).getSubject()) + "考试");
|
||||||
|
// 设置课程类型和教练名
|
||||||
vo.setCourseType(examMap.get(item.getBusiId()).getCourseType());
|
vo.setCourseType(examMap.get(item.getBusiId()).getCourseType());
|
||||||
vo.setCoachName(examMap.get(item.getBusiId()).getCoachName());
|
vo.setCoachName(examMap.get(item.getBusiId()).getCoachName());
|
||||||
}
|
}
|
||||||
@ -129,22 +136,4 @@ public class SchoolFeedbackServiceImpl extends ServiceImpl<SchoolFeedBackMapper,
|
|||||||
|
|
||||||
return resultPage;
|
return resultPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubjectStr(Integer subject) {
|
|
||||||
if (subject == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
switch (subject) {
|
|
||||||
case 1:
|
|
||||||
return "科目一";
|
|
||||||
case 2:
|
|
||||||
return "科目二";
|
|
||||||
case 3:
|
|
||||||
return "科目三";
|
|
||||||
case 4:
|
|
||||||
return "科目四";
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr;
|
import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr;
|
import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 预约练车")
|
@Tag(name = "管理后台 - 预约练车")
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr;
|
||||||
|
|
||||||
@Tag(name = "小程序 - 预约练车")
|
@Tag(name = "小程序 - 预约练车")
|
||||||
@RestController
|
@RestController
|
||||||
@ -90,27 +91,4 @@ public class AppReservationCourseController {
|
|||||||
return success(reservationCourseService.getById(id));
|
return success(reservationCourseService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取科目
|
|
||||||
*
|
|
||||||
* @param subject 科目
|
|
||||||
* @return 科目
|
|
||||||
*/
|
|
||||||
public static String getSubjectStr(Integer subject) {
|
|
||||||
switch (subject) {
|
|
||||||
case 1:
|
|
||||||
return "科目一";
|
|
||||||
case 2:
|
|
||||||
return "科目二";
|
|
||||||
case 3:
|
|
||||||
return "科目三";
|
|
||||||
case 4:
|
|
||||||
return "科目四";
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr;
|
import static cn.iocoder.yudao.module.base.utils.DriveSchoolBaseUtil.getSubjectStr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user