718
This commit is contained in:
parent
0f1c34683c
commit
e7fb211566
@ -54,8 +54,8 @@ 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.service.impl.ServiceImpl;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
//import com.deepoove.poi.data.PictureRenderData;
|
||||
//import com.deepoove.poi.data.PictureType;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import cn.iocoder.yudao.module.inspection.entity.*;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.AppInspectionPartnerMapper;
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
|
||||
import cn.iocoder.yudao.module.base.vo.*;
|
||||
@ -367,5 +368,14 @@ public class DlDriveSchoolCoachController {
|
||||
ExcelUtils.write(response, fileName + ".xlsx", "业务经理招生记录", BusinessRecordExportVO.class, exportData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录教练的详细信息
|
||||
*/
|
||||
@GetMapping("getLoginCoachInfo")
|
||||
public CommonResult<DlDriveSchoolCoach> getLoginCoachInfo() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(dlDriveSchoolCoachService.getLoginCoachInfo(userId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ public interface DlDriveSchoolCoachService extends IService<DlDriveSchoolCoach>
|
||||
**/
|
||||
void saveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO createReqVO);
|
||||
|
||||
String getCoachCarNos(String id);
|
||||
void removeCarFromCoach(String coachId, String carNo);
|
||||
/**
|
||||
* 跟新教练员车辆信息
|
||||
*
|
||||
@ -172,5 +174,10 @@ public interface DlDriveSchoolCoachService extends IService<DlDriveSchoolCoach>
|
||||
List<BusinessRecordExportVO> getAllBusinessRecordList(BusinessRecordExportVO exportVO);
|
||||
List<BusinessRecordExportVO> getBusinessRecordListByRange(BusinessRecordExportVO exportVO);
|
||||
|
||||
/**
|
||||
* 获取当前登录教练的详细信息
|
||||
*/
|
||||
DlDriveSchoolCoach getLoginCoachInfo(Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,9 @@ import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
|
||||
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
|
||||
import cn.iocoder.yudao.module.train.service.IDriveSchoolCoachClockService;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainCarCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -69,6 +71,8 @@ public class DataViewServiceImpl implements DataViewService {
|
||||
@Resource
|
||||
private SchoolCourseSchemeService schoolCourseSchemeService;
|
||||
|
||||
@Resource
|
||||
private IDriveSchoolCoachClockService coachClockService;
|
||||
/**
|
||||
* 查询学员详情
|
||||
*
|
||||
@ -409,10 +413,19 @@ public class DataViewServiceImpl implements DataViewService {
|
||||
allUserSet.add(trainVO.getUserId());
|
||||
}
|
||||
}
|
||||
TrainCarCountVO trainCarCountVO = new TrainCarCountVO();
|
||||
trainCarCountVO.setUserId(coachId);
|
||||
trainCarCountVO.setTimeType(timeType);
|
||||
trainCarCountVO.setTrainDayStartTime(startTimeStr);
|
||||
trainCarCountVO.setTrainDayEndTime(endTimeStr);
|
||||
TrainCarCountVO trainCarCount = coachClockService.countTrainCar(trainCarCountVO);
|
||||
Map<String, Object> trainInfoMap = new HashMap<>();
|
||||
trainInfoMap.put("allCarNum", allCarSet.size());
|
||||
trainInfoMap.put("allCarNum", trainCarCount.getTotalCount());
|
||||
trainInfoMap.put("subject2CarNum", trainCarCount.getSubject2Count());
|
||||
trainInfoMap.put("subject3CarNum", trainCarCount.getSubject3Count());
|
||||
/*trainInfoMap.put("allCarNum", allCarSet.size());
|
||||
trainInfoMap.put("subject2CarNum", subject2CarSet.size());
|
||||
trainInfoMap.put("subject3CarNum", subject3CarSet.size());
|
||||
trainInfoMap.put("subject3CarNum", subject3CarSet.size());*/
|
||||
trainInfoMap.put("allUserNum", allUserSet.size());
|
||||
trainInfoMap.put("subject2UserNum", subject2UserSet.size());
|
||||
trainInfoMap.put("subject3UserNum", subject3UserSet.size());
|
||||
|
||||
@ -277,6 +277,31 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
|
||||
saveOrUpdate(dlDriveSchoolCoach);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCoachCarNos(String id) {
|
||||
DlDriveSchoolCoach schoolCoach = getById(id);
|
||||
return schoolCoach != null ? schoolCoach.getCarId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCarFromCoach(String coachId, String carNo) {
|
||||
DlDriveSchoolCoach coach = getById(coachId);
|
||||
if (coach == null || StringUtils.isEmpty(coach.getCarId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> carList = new ArrayList<>(Arrays.asList(coach.getCarId().split(";")));
|
||||
carList.remove(carNo);
|
||||
|
||||
// 如果移除后为空,设置为null,否则拼接剩余车牌
|
||||
String updatedCarIds = carList.isEmpty() ? null : String.join(";", carList);
|
||||
|
||||
DlDriveSchoolCoach updateCoach = new DlDriveSchoolCoach();
|
||||
updateCoach.setId(coachId);
|
||||
updateCoach.setCarId(updatedCarIds);
|
||||
updateById(updateCoach);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跟新教练员车辆信息
|
||||
*
|
||||
@ -1327,4 +1352,27 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoac
|
||||
return allData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录教练的详细信息
|
||||
*/
|
||||
@Override
|
||||
public DlDriveSchoolCoach getLoginCoachInfo(Long userId) {
|
||||
if (userId == null) {
|
||||
throw new IllegalArgumentException("用户ID不能为空");
|
||||
}
|
||||
|
||||
List<DlDriveSchoolCoach> coaches = dlDriveSchoolCoachMapper.selectList(
|
||||
new LambdaQueryWrapper<DlDriveSchoolCoach>()
|
||||
.eq(DlDriveSchoolCoach::getUserId, userId)
|
||||
.eq(DlDriveSchoolCoach::getDeleted, 0)
|
||||
.orderByDesc(DlDriveSchoolCoach::getCreateTime)
|
||||
);
|
||||
|
||||
if (coaches.isEmpty()) {
|
||||
throw new RuntimeException("未找到该用户的教练信息");
|
||||
}
|
||||
|
||||
return coaches.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
||||
import cn.iocoder.yudao.module.course.vo.*;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolDeduct;
|
||||
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDeductService;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -144,6 +145,15 @@ public class ProcessController {
|
||||
return success(processAndBatch);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过uniqueCode查询学员进度课程
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getByStudentAndCourseByUniqueCode")
|
||||
public CommonResult<List<Process>> getByStudentAndCourseByUniqueCode(@RequestParam("uniqueCode") String uniqueCode){
|
||||
return success(processService.getByStudentAndCourseByUniqueCode(uniqueCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 财务审核
|
||||
*
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import cn.iocoder.yudao.module.course.vo.ProcessNewVO;
|
||||
import cn.iocoder.yudao.module.course.vo.ProcessVO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -29,6 +30,9 @@ public class ProcessSmallProgramController {
|
||||
@Resource
|
||||
private ProcessService processService;
|
||||
|
||||
@Resource
|
||||
private DictDataService dictDataService;
|
||||
|
||||
|
||||
/**
|
||||
* 学员课程进度分页查询
|
||||
@ -86,6 +90,15 @@ public class ProcessSmallProgramController {
|
||||
return success(processService.getExamListByUserIdTest(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userId查询考试列表
|
||||
*/
|
||||
@GetMapping("/getExamListByUserIdNew")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getExamListByUserIdNew(Long userId) {
|
||||
return success(processService.getExamListByUserIdTestNew(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学员id和课程id查询学员课程进度
|
||||
*
|
||||
@ -110,5 +123,14 @@ public class ProcessSmallProgramController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打卡开关值
|
||||
*/
|
||||
@GetMapping("/getClockSwitchValue")
|
||||
public CommonResult<String> getClockSwitchValue(String type, String label) {
|
||||
return success(dictDataService.getValueByTypeAndLabel(type, label));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -50,6 +50,8 @@ public interface ProcessService extends IService<Process> {
|
||||
**/
|
||||
Process getByStudentAndCourse(Long userId, String courseId, Integer subject, Long coachId, String examStatus);
|
||||
|
||||
List<Process> getByStudentAndCourseByUniqueCode(String uniqueCode);
|
||||
|
||||
/**
|
||||
* 查学生当下正在学习中的学习进度
|
||||
*
|
||||
@ -129,6 +131,7 @@ public interface ProcessService extends IService<Process> {
|
||||
*/
|
||||
List<ProcessVO> getExamListByUserId(Long userId);
|
||||
List<ExamVO> getExamListByUserIdTest(Long userId);
|
||||
List<ExamVO> getExamListByUserIdTestNew(Long userId);
|
||||
|
||||
/**
|
||||
* 教练自招自动分配教练
|
||||
|
||||
@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseDeductService;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||
@ -39,6 +40,7 @@ import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
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.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -105,6 +107,9 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
@Resource
|
||||
private RoleApi roleApi;
|
||||
|
||||
@Resource
|
||||
private DictDataService dictDataService;
|
||||
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
@ -153,9 +158,20 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
queryWrapper.like(Process::getUserName, process.getUserName());
|
||||
}
|
||||
//状态等于1-训练中的
|
||||
queryWrapper.eq(Process::getStatus, "1")
|
||||
/*if(dictDataService.getValueByTypeAndLabel("check_in_switch", "科二科三同时打卡开关").equals("0")){
|
||||
// 开关为0时,只查询状态为1的记录
|
||||
queryWrapper.eq(Process::getStatus, "1").groupBy(Process::getUserId);;
|
||||
} else {
|
||||
// 开关为1时,查询状态为0或1的记录
|
||||
queryWrapper.in(Process::getStatus, Arrays.asList("0", "1"));
|
||||
}
|
||||
|
||||
// 其他查询条件
|
||||
queryWrapper.and(wrapper -> wrapper.isNull(Process::getExamStatus).or().eq(Process::getExamStatus, "0"))
|
||||
.orderByDesc(BaseDO::getCreateTime);*/
|
||||
queryWrapper.in(Process::getStatus, Arrays.asList("0", "1"))
|
||||
.and(wrapper -> wrapper.isNull(Process::getExamStatus).or().eq(Process::getExamStatus, "0"))
|
||||
.groupBy(Process::getUserId)
|
||||
// .groupBy(Process::getUserId)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
return this.page(page, queryWrapper);
|
||||
}
|
||||
@ -178,7 +194,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
.eq(Process::getCoachId, coachId)
|
||||
.eq(Process::getCourseId, courseId)
|
||||
.eq(Process::getSubject, subject)
|
||||
.eq(Process::getStatus, "1");
|
||||
.in(Process::getStatus, Arrays.asList("0", "1"));
|
||||
if (null != examStatus) {
|
||||
queryWrapper.eq(Process::getExamStatus, examStatus);
|
||||
}
|
||||
@ -187,6 +203,32 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
return processList.isEmpty() ? null : processList.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Process> getByStudentAndCourseByUniqueCode(String uniqueCode) {
|
||||
DlDriveSchoolStudentVO dlDriveSchoolStudentVO = dlDriveSchoolStudentService.queryStudentByUniqueCode(uniqueCode);
|
||||
if(dlDriveSchoolStudentVO != null){
|
||||
Long coachId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getUserId, dlDriveSchoolStudentVO.getUserId())
|
||||
.eq(Process::getCoachId, coachId)
|
||||
.in(Process::getSubject, Arrays.asList(2, 3))
|
||||
.in(Process::getStatus, Arrays.asList("0", "1"));
|
||||
|
||||
/*if("0".equals(dictDataService.getValueByTypeAndLabel("check_in_switch", "科二科三同时打卡开关"))){
|
||||
// 开关为0时,只查询状态为1的记录
|
||||
queryWrapper.eq(Process::getStatus, "1");
|
||||
}else{
|
||||
// 开关为1时,查询状态为0或1的记录
|
||||
queryWrapper.in(Process::getStatus, Arrays.asList("0", "1"));
|
||||
}*/
|
||||
|
||||
queryWrapper.orderByDesc(BaseDO::getCreateTime);
|
||||
return this.list(queryWrapper);
|
||||
}else{
|
||||
throw new RuntimeException("未查询到该学员信息,请向管理员核实");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查学生当下正在学习中的学习进度
|
||||
*
|
||||
@ -677,6 +719,27 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamVO> getExamListByUserIdTestNew(Long userId) {
|
||||
if (userId == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Process> processList = processMapper.selectList(
|
||||
Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getUserId, userId)
|
||||
.in(Process::getStatus, Arrays.asList("1", "2"))
|
||||
.in(Process::getSubject, Arrays.asList(1, 4))
|
||||
.isNotNull(Process::getExamScore)
|
||||
.orderByDesc(Process::getExamTime)
|
||||
);
|
||||
List<ExamVO> examBatchItemNew = examBatchItemMapper.selectExamByUserIdAndCoachIdNew(userId, null);
|
||||
|
||||
List<ExamVO> result = new ArrayList<>();
|
||||
result.addAll(BeanUtil.copyToList(processList, ExamVO.class));
|
||||
result.addAll(examBatchItemNew);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void verify(List<Process> processes) {
|
||||
for (Process process : processes) {
|
||||
// 校验状态
|
||||
@ -842,6 +905,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
String cashierConfirm = null;
|
||||
String orderRemark = null;
|
||||
String cashierConfirmRemark = null;
|
||||
LocalDateTime createTime = null;
|
||||
if (!courseByInfo.isEmpty()) {
|
||||
studentPay = courseByInfo.get(0).getReserveMoney() != null ?
|
||||
courseByInfo.get(0).getReserveMoney() : BigDecimal.ZERO;
|
||||
@ -859,6 +923,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
courseByInfo.get(0).getActualPayment() : BigDecimal.ZERO;
|
||||
cashierConfirmRemark = courseByInfo.get(0).getCashierConfirmRemark()!= null?
|
||||
courseByInfo.get(0).getCashierConfirmRemark() : null;
|
||||
createTime = courseByInfo.get(0).getCreateTime();
|
||||
}
|
||||
processVO.setCoachCommission(deduct);
|
||||
processVO.setStudentPay(studentPay);
|
||||
@ -869,6 +934,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
processVO.setCashierConfirm(cashierConfirm);
|
||||
processVO.setOrderRemark(orderRemark);
|
||||
processVO.setCashierConfirmRemark(cashierConfirmRemark);
|
||||
processVO.setCreateTime(createTime);
|
||||
|
||||
DlDriveSchoolStudent studentByUserId = dlDriveSchoolStudentService.getStudentByUserId(userId);
|
||||
if(studentByUserId != null){
|
||||
|
||||
@ -80,6 +80,7 @@ public class SchoolFeedbackServiceImpl extends ServiceImpl<SchoolFeedBackMapper,
|
||||
// 1. 分页查询原始数据
|
||||
IPage<SchoolFeedBack> pageList = this.page(page, Wrappers.lambdaQuery(SchoolFeedBack.class)
|
||||
.eq(ObjectUtil.isNotEmpty(request.getUserId()), SchoolFeedBack::getUserId, request.getUserId())
|
||||
.eq(ObjectUtil.isNotEmpty(request.getEvaluateType()), SchoolFeedBack::getEvaluateType, request.getEvaluateType())
|
||||
.orderByDesc(SchoolFeedBack::getCreateTime));
|
||||
|
||||
// 2. 提取训练和考试的ID集合
|
||||
|
||||
@ -30,6 +30,7 @@ public interface ExamBatchItemMapper extends BaseMapper<ExamBatchItem> {
|
||||
List<ExamBatchItemVO> selectByCoachId(@Param("coachId") Long coachId, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
List<ExamVO> selectExamByUserIdAndCoachId(@Param("userId") Long userId, @Param("coachId") Long coachId);
|
||||
List<ExamVO> selectExamByUserIdAndCoachIdNew(@Param("userId") Long userId, @Param("coachId") Long coachId);
|
||||
|
||||
List<ExamBatchItemVO> listJoinBatchByIds(@Param("examIds") List<String> examIds);
|
||||
IPage<ExamBatchVO> batchItemListByCoach(@Param("entity") ExamBatchVO examBatchVO, Page<ExamBatchVO> page);
|
||||
|
||||
@ -115,4 +115,13 @@ public class DriveSchoolCarController extends BaseController
|
||||
String message = driveSchoolCarService.importCars(carsList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据教练用户id获取车牌号码列表
|
||||
*/
|
||||
@GetMapping("/getCarNoByCoachUserId")
|
||||
public CommonResult getCarNoByCoachUserId(){
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(driveSchoolCarService.getCarNoByCoachUserId(userId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,36 +120,4 @@ public class DriveSchoolCar extends TenantBaseDO
|
||||
/** 车龄 */
|
||||
@TableField(exist = false)
|
||||
private Long carOld;
|
||||
|
||||
private String userNum;
|
||||
|
||||
/**
|
||||
* 训练开始时间
|
||||
*/
|
||||
private Date earliestStartTime;
|
||||
|
||||
/**
|
||||
* 训练结束时间
|
||||
*/
|
||||
private Date latestEndTime;
|
||||
|
||||
/**
|
||||
* 累计训练时间
|
||||
*/
|
||||
private String totalTrainTime;
|
||||
|
||||
/**
|
||||
* 科目二训练时间
|
||||
*/
|
||||
private String subject2TrainTime;
|
||||
|
||||
/**
|
||||
* 科目三训练时间
|
||||
*/
|
||||
private String subject3TrainTime;
|
||||
|
||||
/**
|
||||
* 学员姓名及科目
|
||||
*/
|
||||
private List<Train> studentList;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.jx.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
|
||||
import cn.iocoder.yudao.module.jx.vo.DriveSchoolCarVO;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -55,9 +56,9 @@ public interface DriveSchoolCarMapper extends BaseMapper<DriveSchoolCar>
|
||||
* @param endTime 截止时间
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DriveSchoolCar>
|
||||
**/
|
||||
IPage<DriveSchoolCar> selectTrainCar(@Param("coachId")Long coachId, @Param("subject") Integer subject, @Param("startTime") String startTime,
|
||||
IPage<DriveSchoolCarVO> selectTrainCar(@Param("coachId")Long coachId, @Param("subject") Integer subject, @Param("startTime") String startTime,
|
||||
@Param("endTime")String endTime, @Param("searchValue")String searchValue,
|
||||
@Param("courseType")String courseType, Page<DriveSchoolCar> page);
|
||||
@Param("courseType")String courseType, Page<DriveSchoolCarVO> page);
|
||||
|
||||
List<Train> selectTrainStudentList(@Param("coachId")Long coachId, @Param("subject") Integer subject, @Param("startTime") String startTime,
|
||||
@Param("endTime")String endTime, @Param("searchValue")String searchValue,
|
||||
|
||||
@ -67,4 +67,9 @@ public interface IDriveSchoolCarService extends IService<DriveSchoolCar>
|
||||
String importCars(List<DriveSchoolCar> carsList, boolean updateSupport, String operName) throws Exception;
|
||||
|
||||
DriveSchoolCar selectByCoachId(Long coachId);
|
||||
|
||||
/**
|
||||
* 根据教练用户id获取车牌号码列表
|
||||
*/
|
||||
List<DriveSchoolCar> getCarNoByCoachUserId(Long userId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.jx.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCarMapper;
|
||||
@ -17,7 +18,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -79,18 +81,95 @@ public class DriveSchoolCarServiceImpl extends ServiceImpl<DriveSchoolCarMapper,
|
||||
throw new RuntimeException("该车牌的车辆已存在!");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(driveSchoolCar.getCoachId())){
|
||||
// 获取教练当前关联的所有车牌
|
||||
String coachCarNos = coachService.getCoachCarNos(driveSchoolCar.getCoachId());
|
||||
// 教练与车牌关联
|
||||
if (StringUtils.isEmpty(coachCarNos)) {
|
||||
// 如果教练当前没有关联车辆,直接设置新车牌
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), driveSchoolCar.getCarNo());
|
||||
} else {
|
||||
// 检查车牌是否已关联
|
||||
List<String> carNoList = Arrays.asList(coachCarNos.split(";"));
|
||||
if (!carNoList.contains(driveSchoolCar.getCarNo())) {
|
||||
// 不重复则追加新车牌
|
||||
String updatedCarNos = coachCarNos + ";" + driveSchoolCar.getCarNo();
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), updatedCarNos);
|
||||
}
|
||||
// 如果已存在则不处理
|
||||
}
|
||||
}
|
||||
return driveSchoolCarMapper.insert(driveSchoolCar);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆信息(支持教练多车关联)
|
||||
*
|
||||
* @param driveSchoolCar 车辆信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDriveSchoolCar(DriveSchoolCar driveSchoolCar) {
|
||||
// 获取车辆原始信息 检查教练变更
|
||||
DriveSchoolCar originalCar = driveSchoolCarMapper.selectById(driveSchoolCar.getId());
|
||||
if (originalCar == null) {
|
||||
throw new RuntimeException("车辆不存在");
|
||||
}
|
||||
|
||||
// 处理教练关联逻辑
|
||||
if (StringUtils.isNotEmpty(driveSchoolCar.getCoachId())) {
|
||||
// 获取教练当前关联的所有车牌
|
||||
String currentCarNos = coachService.getCoachCarNos(driveSchoolCar.getCoachId());
|
||||
|
||||
// 如果教练有变更,需要从原教练中移除,添加到新教练
|
||||
if (!StringUtils.equals(originalCar.getCoachId(), driveSchoolCar.getCoachId())) {
|
||||
// 从原教练中移除当前车牌 如果原教练存在
|
||||
if (StringUtils.isNotEmpty(originalCar.getCoachId())) {
|
||||
coachService.removeCarFromCoach(originalCar.getCoachId(), originalCar.getCarNo());
|
||||
}
|
||||
|
||||
// 添加到新教练 不重复添加
|
||||
if (StringUtils.isEmpty(currentCarNos)) {
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), driveSchoolCar.getCarNo());
|
||||
} else {
|
||||
List<String> carNoList = Arrays.asList(currentCarNos.split(";"));
|
||||
if (!carNoList.contains(driveSchoolCar.getCarNo())) {
|
||||
String updatedCarNos = currentCarNos + ";" + driveSchoolCar.getCarNo();
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), updatedCarNos);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 教练未变更,只检查车牌号是否变更
|
||||
if (!StringUtils.equals(originalCar.getCarNo(), driveSchoolCar.getCarNo())) {
|
||||
// 车牌号变更,需要更新教练关联的车牌号
|
||||
if (StringUtils.isNotEmpty(currentCarNos)) {
|
||||
List<String> carNoList = new ArrayList<>(Arrays.asList(currentCarNos.split(";")));
|
||||
// 移除旧车牌
|
||||
carNoList.remove(originalCar.getCarNo());
|
||||
// 添加新车牌(如果不重复)
|
||||
if (!carNoList.contains(driveSchoolCar.getCarNo())) {
|
||||
carNoList.add(driveSchoolCar.getCarNo());
|
||||
}
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), String.join(";", carNoList));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.isNotEmpty(originalCar.getCoachId())) {
|
||||
// 新教练ID为空,但原教练ID不为空,需要从原教练中移除
|
||||
coachService.removeCarFromCoach(originalCar.getCoachId(), originalCar.getCarNo());
|
||||
}
|
||||
|
||||
// 更新车辆信息
|
||||
return driveSchoolCarMapper.updateById(driveSchoolCar);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆信息
|
||||
*
|
||||
* @param driveSchoolCar 车辆信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
/*@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDriveSchoolCar(DriveSchoolCar driveSchoolCar)
|
||||
{
|
||||
@ -98,7 +177,7 @@ public class DriveSchoolCarServiceImpl extends ServiceImpl<DriveSchoolCarMapper,
|
||||
coachService.updateSchoolCoachCarId(driveSchoolCar.getCoachId(), driveSchoolCar.getCarNo());
|
||||
}
|
||||
return driveSchoolCarMapper.updateById(driveSchoolCar);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 批量删除车辆信息
|
||||
@ -106,9 +185,62 @@ public class DriveSchoolCarServiceImpl extends ServiceImpl<DriveSchoolCarMapper,
|
||||
* @param ids 需要删除的车辆信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
/*@Override
|
||||
public int deleteDriveSchoolCarByIds(Long[] ids)
|
||||
{
|
||||
return driveSchoolCarMapper.deleteDriveSchoolCarByIds(ids);
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public int deleteDriveSchoolCarByIds(Long[] ids) {
|
||||
// 检查所有ID对应的车辆是否存在且未被删除
|
||||
List<DriveSchoolCar> carsToDelete = driveSchoolCarMapper.selectList(
|
||||
new LambdaQueryWrapper<DriveSchoolCar>()
|
||||
.in(DriveSchoolCar::getId, Arrays.asList(ids))
|
||||
.eq(DriveSchoolCar::getDeleted, 0)
|
||||
);
|
||||
if (carsToDelete.size() != ids.length) {
|
||||
throw new RuntimeException("部分车辆不存在或已被删除");
|
||||
}
|
||||
|
||||
Map<String, List<String>> coachCarMap = carsToDelete.stream()
|
||||
.filter(car -> StringUtils.isNotEmpty(car.getCoachId()))
|
||||
.collect(Collectors.groupingBy(
|
||||
DriveSchoolCar::getCoachId,
|
||||
Collectors.mapping(DriveSchoolCar::getCarNo, Collectors.toList())
|
||||
));
|
||||
|
||||
coachCarMap.forEach((coachId, carNos) -> {
|
||||
DlDriveSchoolCoach coach = coachService.getById(coachId);
|
||||
if (coach != null && StringUtils.isNotEmpty(coach.getCarId())) {
|
||||
List<String> remainingCars = Arrays.stream(coach.getCarId().split(";"))
|
||||
.filter(carNo -> !carNos.contains(carNo))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
String updatedCarIds = remainingCars.isEmpty() ? null : String.join(";", remainingCars);
|
||||
|
||||
DlDriveSchoolCoach updateCoach = new DlDriveSchoolCoach();
|
||||
updateCoach.setId(coachId);
|
||||
updateCoach.setCarId(updatedCarIds);
|
||||
coachService.updateById(updateCoach);
|
||||
}
|
||||
});
|
||||
|
||||
return driveSchoolCarMapper.deleteDriveSchoolCarByIds(ids);
|
||||
}*/
|
||||
@Override
|
||||
public int deleteDriveSchoolCarByIds(Long[] ids) {
|
||||
List<DriveSchoolCar> carsToDelete = driveSchoolCarMapper.selectBatchIds(Arrays.asList(ids));
|
||||
if (carsToDelete.size() != ids.length) {
|
||||
throw new RuntimeException("部分车辆不存在或已被删除");
|
||||
}
|
||||
|
||||
for (DriveSchoolCar car : carsToDelete) {
|
||||
if (StringUtils.isNotEmpty(car.getCoachId())) {
|
||||
coachService.removeCarFromCoach(car.getCoachId(), car.getCarNo());
|
||||
}
|
||||
}
|
||||
|
||||
return driveSchoolCarMapper.deleteDriveSchoolCarByIds(ids);
|
||||
}
|
||||
|
||||
@ -121,6 +253,18 @@ public class DriveSchoolCarServiceImpl extends ServiceImpl<DriveSchoolCarMapper,
|
||||
@Override
|
||||
public int deleteDriveSchoolCarById(Long id)
|
||||
{
|
||||
// 获取要删除的车辆信息
|
||||
DriveSchoolCar carToDelete = driveSchoolCarMapper.selectById(id);
|
||||
if (carToDelete == null) {
|
||||
throw new RuntimeException("车辆不存在或已被删除");
|
||||
}
|
||||
|
||||
// 如果车辆有关联教练,从教练的关联车牌中移除该车牌
|
||||
if (StringUtils.isNotEmpty(carToDelete.getCoachId())) {
|
||||
coachService.removeCarFromCoach(carToDelete.getCoachId(), carToDelete.getCarNo());
|
||||
}
|
||||
|
||||
// 删除车辆
|
||||
return driveSchoolCarMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@ -151,4 +295,17 @@ public class DriveSchoolCarServiceImpl extends ServiceImpl<DriveSchoolCarMapper,
|
||||
List<DriveSchoolCar> list = this.list(queryWrapper);
|
||||
return list.isEmpty()?null:list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据教练用户id获取车牌号码列表
|
||||
*/
|
||||
@Override
|
||||
public List<DriveSchoolCar> getCarNoByCoachUserId(Long userId) {
|
||||
return driveSchoolCarMapper.selectList(
|
||||
new LambdaQueryWrapper<DriveSchoolCar>()
|
||||
.eq(DriveSchoolCar::getUserId, userId)
|
||||
.eq(DriveSchoolCar::getDeleted, 0)
|
||||
.orderByDesc(DriveSchoolCar::getCreateTime)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class StudentScoreInputServiceImpl implements StudentScoreInputService {
|
||||
studentIdCard = studentByUserId.getIdCard();
|
||||
}
|
||||
if (allStaffList != null && !allStaffList.isEmpty()) {
|
||||
String officeMessage = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_AUDIT_WAIT, studentScoreInput.getUserName(), studentIdCard, studentScoreInput.getCoachName(), studentScoreInput.getSubject());
|
||||
String officeMessage = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_AUDIT_WAIT, studentScoreInput.getUserName(), studentIdCard, studentScoreInput.getCourseName(), studentScoreInput.getSubject());
|
||||
for (UserDTO staff : allStaffList) {
|
||||
schoolNotifyMessageSendService.sendMessage(staff.getId(), officeMessage, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, null);
|
||||
}
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.jx.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DriveSchoolCarVO extends DriveSchoolCar {
|
||||
|
||||
/**
|
||||
* 学员数量
|
||||
*/
|
||||
private String userNum;
|
||||
|
||||
/**
|
||||
* 训练开始时间
|
||||
*/
|
||||
private Date earliestStartTime;
|
||||
|
||||
/**
|
||||
* 训练结束时间
|
||||
*/
|
||||
private Date latestEndTime;
|
||||
|
||||
/**
|
||||
* 累计训练时间
|
||||
*/
|
||||
private String totalTrainTime;
|
||||
|
||||
/**
|
||||
* 科目二训练时间
|
||||
*/
|
||||
private String subject2TrainTime;
|
||||
|
||||
/**
|
||||
* 科目三训练时间
|
||||
*/
|
||||
private String subject3TrainTime;
|
||||
|
||||
/**
|
||||
* 学员姓名及科目
|
||||
*/
|
||||
private List<Train> studentList;
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
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.DriveSchoolCoachClock;
|
||||
import cn.iocoder.yudao.module.train.service.IDriveSchoolCoachClockService;
|
||||
import cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainCarCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainDetailsByCarVO;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 教练打卡表
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-07-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/drive-school-coach-clock")
|
||||
public class DriveSchoolCoachClockController {
|
||||
|
||||
@Resource
|
||||
private IDriveSchoolCoachClockService coachClockService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得教练打卡记录分页")
|
||||
public CommonResult<IPage<?>> getPage(DriveSchoolCoachClockVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DriveSchoolCoachClockVO> page = new Page<>(pageNo,pageSize);
|
||||
return success(coachClockService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
@GetMapping("selectTodayClockRecord")
|
||||
public CommonResult<DriveSchoolCoachClock> selectTodayClockRecord() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
DriveSchoolCoachClock driveSchoolCoachClock = coachClockService.selectTodayClockRecord(userId);
|
||||
return success(driveSchoolCoachClock);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "教练到场打卡")
|
||||
public CommonResult<String> createObj( @RequestBody DriveSchoolCoachClockVO coachClockVO) {
|
||||
return success(coachClockService.createObj(coachClockVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "教练离场打卡")
|
||||
public CommonResult<?> updateObj( @RequestBody DriveSchoolCoachClockVO coachClockVO) {
|
||||
coachClockService.updateObj(coachClockVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取打卡详情
|
||||
*/
|
||||
@GetMapping("/getDetailById")
|
||||
public CommonResult<DriveSchoolCoachClock> getDetailById(String id) {
|
||||
DriveSchoolCoachClock driveSchoolCoachClock = coachClockService.getById(id);
|
||||
return success(driveSchoolCoachClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计训练车辆台次
|
||||
*/
|
||||
@GetMapping("/countTrainCar")
|
||||
public CommonResult<TrainCarCountVO> countTrainCar(TrainCarCountVO trainCarCountVO) {
|
||||
return success(coachClockService.countTrainCar(trainCarCountVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆打卡数据列表
|
||||
* @param trainCarCountVO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/trainClockByCar")
|
||||
public CommonResult<List<TrainCarCountVO>> trainClockByCar(TrainCarCountVO trainCarCountVO) {
|
||||
return success(coachClockService.trainClockByCar(trainCarCountVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆打卡训练详细信息,包含打卡基本信息和学员信息
|
||||
*/
|
||||
@GetMapping("/trainClockByCarDetail")
|
||||
public CommonResult<List<TrainDetailsByCarVO>> trainClockByCarDetail(TrainDetailsByCarVO trainDetailsByCarVO) {
|
||||
return success(coachClockService.trainClockByCarDetail(trainDetailsByCarVO));
|
||||
}
|
||||
}
|
||||
@ -10,8 +10,10 @@ import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCarMapper;
|
||||
import cn.iocoder.yudao.module.jx.vo.DriveSchoolCarVO;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -133,9 +135,9 @@ public class TrainController {
|
||||
return success(studentPage);
|
||||
}else{
|
||||
//训练车辆
|
||||
Page<DriveSchoolCar> page = new Page<>(pageNo,pageSize);
|
||||
IPage<DriveSchoolCar> driveSchoolCarIPage = carMapper.selectTrainCar(coachId, subject, startTimeStr, endTimeStr, searchValue, courseType, page);
|
||||
for (DriveSchoolCar record : driveSchoolCarIPage.getRecords()) {
|
||||
Page<DriveSchoolCarVO> page = new Page<>(pageNo,pageSize);
|
||||
IPage<DriveSchoolCarVO> driveSchoolCarIPage = carMapper.selectTrainCar(coachId, subject, startTimeStr, endTimeStr, searchValue, courseType, page);
|
||||
for (DriveSchoolCarVO record : driveSchoolCarIPage.getRecords()) {
|
||||
List<Train> trainList = carMapper.selectTrainStudentList(Long.parseLong(record.getUserId()), subject, startTimeStr, endTimeStr, searchValue, courseType);
|
||||
record.setStudentList(trainList);
|
||||
}
|
||||
@ -191,4 +193,10 @@ public class TrainController {
|
||||
public void noClockInRemind() {
|
||||
trainService.noClockInRemind();
|
||||
}
|
||||
|
||||
@GetMapping("noClockInRemindByUserId")
|
||||
public CommonResult<NoClockInRemindVO>noClockInRemindByUserId(){
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(trainService.noClockInRemindByUserId(userId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCar;
|
||||
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCarMapper;
|
||||
import cn.iocoder.yudao.module.jx.vo.DriveSchoolCarVO;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -129,7 +130,7 @@ public class AppTrainController {
|
||||
return success(studentPage);
|
||||
}else{
|
||||
//训练车辆
|
||||
Page<DriveSchoolCar> page = new Page<>(pageNo,pageSize);
|
||||
Page<DriveSchoolCarVO> page = new Page<>(pageNo,pageSize);
|
||||
return success(carMapper.selectTrainCar(coachId,subject,startTimeStr,endTimeStr,searchValue,courseType,page));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
package cn.iocoder.yudao.module.train.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 教练打卡表
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-07-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("drive_school_coach_clock")
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DriveSchoolCoachClock extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
|
||||
/**
|
||||
* 教练ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 教练姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String userMobile;
|
||||
|
||||
/**
|
||||
* 车辆id
|
||||
*/
|
||||
private String carId;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carNo;
|
||||
|
||||
/**
|
||||
* 训练地址id
|
||||
*/
|
||||
private String addrId;
|
||||
|
||||
/**
|
||||
* 训练地址
|
||||
*/
|
||||
private String addr;
|
||||
|
||||
/**
|
||||
* 训练日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String trainDay;
|
||||
|
||||
/**
|
||||
* 到场时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 到场备注
|
||||
*/
|
||||
private String startRemark;
|
||||
|
||||
/**
|
||||
* 到场图片
|
||||
*/
|
||||
private String startImages;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 离场备注
|
||||
*/
|
||||
private String endRemark;
|
||||
|
||||
/**
|
||||
* 离场图片
|
||||
*/
|
||||
private String endImages;
|
||||
|
||||
/**
|
||||
* 本次有效训练时长(分钟)
|
||||
*/
|
||||
private Double trainTime;
|
||||
|
||||
/**
|
||||
* 累计有效训练时长(分钟)到场打卡存的是本次训练前的累计时长,离场打卡后,存的是本次训练完后累计时长
|
||||
*/
|
||||
private Double allTrainTime;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -75,6 +75,18 @@ public class Train extends TenantBaseDO {
|
||||
* 训练日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String trainDay;
|
||||
/**
|
||||
* 教练打卡id
|
||||
*/
|
||||
private String coachClockId;
|
||||
/**
|
||||
* 车辆id
|
||||
*/
|
||||
private String carId;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carNo;
|
||||
/**
|
||||
* 交通方式(字典:school_transport_way)
|
||||
*/
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.train.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock;
|
||||
import cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainCarCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainDetailsByCarVO;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教练打卡表 Mapper 接口
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-07-16
|
||||
*/
|
||||
@Mapper
|
||||
public interface DriveSchoolCoachClockMapper extends BaseMapper<DriveSchoolCoachClock> {
|
||||
|
||||
IPage<DriveSchoolCoachClockVO> queryListPage(@Param("entity") DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page);
|
||||
|
||||
/**
|
||||
* 统计训练车辆台次
|
||||
*/
|
||||
TrainCarCountVO countTrainCar(@Param("entity") TrainCarCountVO trainCarCountVO);
|
||||
|
||||
List<TrainCarCountVO> trainClockByCar(@Param("entity") TrainCarCountVO trainCarCountVO);
|
||||
|
||||
List<DriveSchoolCoachClock> selectCoachClockIdsByCarId(@Param("entity") TrainDetailsByCarVO trainDetailsByCarVO);
|
||||
}
|
||||
@ -28,4 +28,10 @@ public interface TrainMapper extends BaseMapper<Train> {
|
||||
List<TrainVO> listJoinBatchByIds(@Param("trainIds") List<String> trainIds);
|
||||
|
||||
List<NoClockInRemindVO> noClockInRemind();
|
||||
NoClockInRemindVO noClockInRemindByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据教练打卡id获取对应学员信息
|
||||
*/
|
||||
List<Train> selectStudentByCoachClockId(String coachClockId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock;
|
||||
import cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainCarCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainDetailsByCarVO;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 教练打卡表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-07-16
|
||||
*/
|
||||
public interface IDriveSchoolCoachClockService extends IService<DriveSchoolCoachClock> {
|
||||
|
||||
/**
|
||||
* 获得教练打卡记录分页
|
||||
* @param pageReqVO
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<DriveSchoolCoachClockVO> queryListPage(DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page);
|
||||
|
||||
/**
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
DriveSchoolCoachClock selectTodayClockRecord(Long userId);
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
**/
|
||||
String createObj(DriveSchoolCoachClockVO coachClockVO);
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
**/
|
||||
void updateObj(DriveSchoolCoachClockVO coachClockVO);
|
||||
|
||||
/**
|
||||
* 统计训练车辆台次
|
||||
*/
|
||||
TrainCarCountVO countTrainCar(TrainCarCountVO trainCarCountVO);
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
* @param trainCarCountVO
|
||||
* @return
|
||||
*/
|
||||
List<TrainCarCountVO> trainClockByCar(TrainCarCountVO trainCarCountVO);
|
||||
|
||||
/**
|
||||
* 车辆打卡训练详细信息,包含打卡基本信息和学员信息
|
||||
*/
|
||||
List<TrainDetailsByCarVO> trainClockByCarDetail(TrainDetailsByCarVO trainDetailsByCarVO);
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -89,4 +90,6 @@ public interface TrainService extends IService<Train> {
|
||||
* 提醒教练未打卡学员信息
|
||||
*/
|
||||
void noClockInRemind();
|
||||
|
||||
NoClockInRemindVO noClockInRemindByUserId(Long userId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,244 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.mapper.DriveSchoolCoachClockMapper;
|
||||
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
|
||||
import cn.iocoder.yudao.module.train.service.IDriveSchoolCoachClockService;
|
||||
import cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainCarCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainDetailsByCarVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
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 javax.annotation.Resource;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教练打卡表 服务实现类
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-07-16
|
||||
*/
|
||||
@Service
|
||||
public class DriveSchoolCoachClockServiceImpl extends ServiceImpl<DriveSchoolCoachClockMapper, DriveSchoolCoachClock> implements IDriveSchoolCoachClockService {
|
||||
|
||||
@Resource
|
||||
private DriveSchoolCoachClockMapper driveSchoolCoachClockMapper;
|
||||
|
||||
@Resource
|
||||
private TrainMapper trainMapper;
|
||||
|
||||
/**
|
||||
* 获得教练打卡记录分页
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<DriveSchoolCoachClockVO> queryListPage(DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page) {
|
||||
String startTime = "";
|
||||
String endTime = "";
|
||||
if ("more".equals(pageReqVO.getTimeType())) {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(pageReqVO.getStartTimeStr())) {
|
||||
startTime = pageReqVO.getStartTimeStr();
|
||||
}
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(pageReqVO.getEndTimeStr())) {
|
||||
endTime = pageReqVO.getEndTimeStr();
|
||||
}
|
||||
} else if ("month".equals(pageReqVO.getTimeType())) {
|
||||
//当月
|
||||
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
} else if ("day".equals(pageReqVO.getTimeType())) {
|
||||
//当天
|
||||
startTime = DateUtil.formatDate(DateUtil.date());
|
||||
endTime = DateUtil.formatDate(DateUtil.date());
|
||||
}
|
||||
pageReqVO.setStartTimeStr(startTime);
|
||||
pageReqVO.setEndTimeStr(endTime);
|
||||
return driveSchoolCoachClockMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
@Override
|
||||
public DriveSchoolCoachClock selectTodayClockRecord(Long userId) {
|
||||
if (userId == null) {
|
||||
throw new IllegalArgumentException("用户ID不能为空");
|
||||
}
|
||||
List<DriveSchoolCoachClock> clockRecord = driveSchoolCoachClockMapper.selectList(
|
||||
new LambdaQueryWrapper<DriveSchoolCoachClock>()
|
||||
.eq(DriveSchoolCoachClock::getUserId, userId)
|
||||
.eq(DriveSchoolCoachClock::getTrainDay, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.isNull(DriveSchoolCoachClock::getEndTime)
|
||||
.eq(DriveSchoolCoachClock::getDeleted, 0)
|
||||
.orderByDesc(DriveSchoolCoachClock::getCreateTime)
|
||||
);
|
||||
if (!clockRecord.isEmpty()) {
|
||||
return clockRecord.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
**/
|
||||
@Override
|
||||
public String createObj(DriveSchoolCoachClockVO coachClockVO) {
|
||||
coachClockVO.setTrainDay(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
this.save(coachClockVO);
|
||||
return coachClockVO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
**/
|
||||
@Override
|
||||
public void updateObj(DriveSchoolCoachClockVO coachClockVO) {
|
||||
// 如果同时存在开始和结束时间,计算时长
|
||||
/*LocalDateTime startTime = coachClockVO.getStartTime();
|
||||
LocalDateTime endTime = coachClockVO.getEndTime();
|
||||
|
||||
if (startTime != null && endTime != null && endTime.isAfter(startTime)) {
|
||||
// 计算时间差,单位为分钟
|
||||
long minutes = Duration.between(startTime, endTime).toMinutes();
|
||||
coachClockVO.setTrainTime((double) minutes);
|
||||
}*/
|
||||
this.updateById(coachClockVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计训练车辆台次
|
||||
*/
|
||||
@Override
|
||||
public TrainCarCountVO countTrainCar(TrainCarCountVO trainCarCountVO) {
|
||||
String startTime = "";
|
||||
String endTime = "";
|
||||
if ("more".equals(trainCarCountVO.getTimeType())) {
|
||||
if (StringUtils.isNotEmpty(trainCarCountVO.getTrainDayStartTime())) {
|
||||
startTime = trainCarCountVO.getTrainDayStartTime();
|
||||
}
|
||||
if (StringUtils.isNotEmpty(trainCarCountVO.getTrainDayEndTime())) {
|
||||
endTime = trainCarCountVO.getTrainDayEndTime();
|
||||
}
|
||||
} else if ("month".equals(trainCarCountVO.getTimeType())) {
|
||||
//当月
|
||||
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
} else if ("day".equals(trainCarCountVO.getTimeType())) {
|
||||
//当天
|
||||
startTime = DateUtil.formatDate(DateUtil.date());
|
||||
endTime = DateUtil.formatDate(DateUtil.date());
|
||||
}
|
||||
trainCarCountVO.setTrainDayStartTime(startTime);
|
||||
trainCarCountVO.setTrainDayEndTime(endTime);
|
||||
|
||||
return driveSchoolCoachClockMapper.countTrainCar(trainCarCountVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
* @param trainCarCountVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCarCountVO> trainClockByCar(TrainCarCountVO trainCarCountVO) {
|
||||
String startTime = "";
|
||||
String endTime = "";
|
||||
if ("more".equals(trainCarCountVO.getTimeType())) {
|
||||
if (StringUtils.isNotEmpty(trainCarCountVO.getTrainDayStartTime())) {
|
||||
startTime = trainCarCountVO.getTrainDayStartTime();
|
||||
}
|
||||
if (StringUtils.isNotEmpty(trainCarCountVO.getTrainDayEndTime())) {
|
||||
endTime = trainCarCountVO.getTrainDayEndTime();
|
||||
}
|
||||
} else if ("month".equals(trainCarCountVO.getTimeType())) {
|
||||
//当月
|
||||
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
} else if ("day".equals(trainCarCountVO.getTimeType())) {
|
||||
//当天
|
||||
startTime = DateUtil.formatDate(DateUtil.date());
|
||||
endTime = DateUtil.formatDate(DateUtil.date());
|
||||
}
|
||||
trainCarCountVO.setTrainDayStartTime(startTime);
|
||||
trainCarCountVO.setTrainDayEndTime(endTime);
|
||||
|
||||
return driveSchoolCoachClockMapper.trainClockByCar(trainCarCountVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆打卡训练详细信息,包含打卡基本信息和学员信息
|
||||
*/
|
||||
@Override
|
||||
public List<TrainDetailsByCarVO> trainClockByCarDetail(TrainDetailsByCarVO trainDetailsByCarVO) {
|
||||
String startTime = "";
|
||||
String endTime = "";
|
||||
if ("more".equals(trainDetailsByCarVO.getTimeType())) {
|
||||
if (StringUtils.isNotEmpty(trainDetailsByCarVO.getTrainDayStartTime())) {
|
||||
startTime = trainDetailsByCarVO.getTrainDayStartTime();
|
||||
}
|
||||
if (StringUtils.isNotEmpty(trainDetailsByCarVO.getTrainDayEndTime())) {
|
||||
endTime = trainDetailsByCarVO.getTrainDayEndTime();
|
||||
}
|
||||
} else if ("month".equals(trainDetailsByCarVO.getTimeType())) {
|
||||
//当月
|
||||
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd");
|
||||
} else if ("day".equals(trainDetailsByCarVO.getTimeType())) {
|
||||
//当天
|
||||
startTime = DateUtil.formatDate(DateUtil.date());
|
||||
endTime = DateUtil.formatDate(DateUtil.date());
|
||||
}
|
||||
trainDetailsByCarVO.setTrainDayStartTime(startTime);
|
||||
trainDetailsByCarVO.setTrainDayEndTime(endTime);
|
||||
List<DriveSchoolCoachClock> coachClockList = driveSchoolCoachClockMapper.selectCoachClockIdsByCarId(trainDetailsByCarVO);
|
||||
if (CollectionUtils.isEmpty(coachClockList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<TrainDetailsByCarVO> trainDetailsByCarVOList = new ArrayList<>();
|
||||
for (DriveSchoolCoachClock driveSchoolCoachClock : coachClockList) {
|
||||
TrainDetailsByCarVO trainDetailsByCarVOAll = new TrainDetailsByCarVO();
|
||||
trainDetailsByCarVOAll.setCarId(driveSchoolCoachClock.getCarId());
|
||||
trainDetailsByCarVOAll.setCarNo(driveSchoolCoachClock.getCarNo());
|
||||
trainDetailsByCarVOAll.setTrainDay(driveSchoolCoachClock.getTrainDay());
|
||||
trainDetailsByCarVOAll.setUserId(driveSchoolCoachClock.getUserId());
|
||||
trainDetailsByCarVOAll.setUserName(driveSchoolCoachClock.getUserName());
|
||||
trainDetailsByCarVOAll.setSubject(driveSchoolCoachClock.getSubject());
|
||||
trainDetailsByCarVOAll.setStartTime(driveSchoolCoachClock.getStartTime());
|
||||
trainDetailsByCarVOAll.setEndTime(driveSchoolCoachClock.getEndTime());
|
||||
|
||||
List<Train> trains = trainMapper.selectStudentByCoachClockId(driveSchoolCoachClock.getId());
|
||||
for (Train train : trains) {
|
||||
List<Train> trainVOList = new ArrayList<>();
|
||||
trainVOList.add(train);
|
||||
trainDetailsByCarVOAll.setTrainVOList(trainVOList);
|
||||
}
|
||||
trainDetailsByCarVOList.add(trainDetailsByCarVOAll);
|
||||
}
|
||||
|
||||
return trainDetailsByCarVOList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseM
|
||||
//查该学员,该科目进度
|
||||
Process process = processService.getByStudentAndCourse(userId,courseId,subject,coachId,null);
|
||||
if(null==process){
|
||||
throw new RuntimeException("该学员未报名你的课程,请向管理员核实");
|
||||
throw new RuntimeException("暂未查询到该学员信息,请向管理员核实");
|
||||
}
|
||||
//查当天训练记录--未签退的
|
||||
rtnMap.put("train",trainService.getUserTrainData(userId,courseId,subject,nowDayStr));
|
||||
|
||||
@ -183,5 +183,10 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoClockInRemindVO noClockInRemindByUserId(Long userId){
|
||||
return trainMapper.noClockInRemindByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DriveSchoolCoachClockVO extends DriveSchoolCoachClock {
|
||||
/**
|
||||
* 查询类型(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
|
||||
/**
|
||||
* 时间查询类型
|
||||
*/
|
||||
private String timeType;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startTimeStr;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String endTimeStr;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TrainCarCountVO {
|
||||
|
||||
/** 总台次 */
|
||||
private String totalCount;
|
||||
|
||||
/** 科目二台次 */
|
||||
private String subject2Count;
|
||||
|
||||
/** 科目三台次 */
|
||||
private String subject3Count;
|
||||
|
||||
/** 查询的时间类型 */
|
||||
private String timeType;
|
||||
|
||||
/** 教练id */
|
||||
private Long userId;
|
||||
|
||||
/** 查询的开始时间 */
|
||||
private String trainDayStartTime;
|
||||
|
||||
/** 查询的结束时间 */
|
||||
private String trainDayEndTime;
|
||||
|
||||
/** 车辆的id */
|
||||
private String carId;
|
||||
|
||||
/** 车牌号 */
|
||||
private String carNo;
|
||||
|
||||
/** 教练姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 打卡的科目 */
|
||||
private Integer subject;
|
||||
|
||||
/** 课程类型 */
|
||||
private String courseType;
|
||||
|
||||
/** 训练总时长 */
|
||||
private String trainTimeCount;
|
||||
|
||||
/** 总学员数 */
|
||||
private String studentCount;
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TrainDetailsByCarVO {
|
||||
|
||||
private String timeType;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String trainDayStartTime;
|
||||
|
||||
private String trainDayEndTime;
|
||||
|
||||
private String trainDay;
|
||||
|
||||
private LocalDateTime startTime;
|
||||
|
||||
private LocalDateTime endTime;
|
||||
|
||||
private String carId;
|
||||
|
||||
private String carNo;
|
||||
|
||||
private String userName;
|
||||
|
||||
private Integer subject;
|
||||
|
||||
private String courseType;
|
||||
|
||||
private List<Train> trainVOList;
|
||||
}
|
||||
@ -177,6 +177,8 @@
|
||||
) temp
|
||||
GROUP BY
|
||||
temp.orderId
|
||||
ORDER BY
|
||||
temp.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectByBusinessId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
|
||||
@ -136,6 +136,38 @@
|
||||
ORDER BY
|
||||
dseb.start_time DESC;-->
|
||||
</select>
|
||||
|
||||
<select id="selectExamByUserIdAndCoachIdNew" resultType="cn.iocoder.yudao.module.exam.vo.ExamVO">
|
||||
|
||||
SELECT
|
||||
dseb.*,
|
||||
dseb.start_time AS examStartTime,
|
||||
|
||||
dsp.course_type AS courseType,
|
||||
CASE
|
||||
WHEN dsebi.fraction IS NULL AND dsebi.if_pass IS NULL
|
||||
THEN dsp.exam_status
|
||||
ELSE NULL
|
||||
END AS ifPassStatus,
|
||||
|
||||
dsebi.batch_id,
|
||||
dsebi.user_name,
|
||||
dsebi.fraction,
|
||||
dsebi.fraction AS examScore,
|
||||
dsebi.if_pass,
|
||||
dsebi.if_pass AS examStatus,
|
||||
dsebi.if_evaluate,
|
||||
dsebi.evaluate_id,
|
||||
dsebi.id AS batchItemId
|
||||
FROM drive_school_exam_batch dseb
|
||||
LEFT JOIN drive_school_exam_batch_item dsebi ON dseb.id = dsebi.batch_id AND dsebi.if_evaluate = 0
|
||||
LEFT JOIN drive_school_process dsp ON dseb.course_id = dsp.course_id AND dseb.subject = dsp.subject AND dsebi.user_id = dsp.user_id
|
||||
WHERE
|
||||
dsebi.user_id = #{userId}
|
||||
AND (dseb.deleted = 0 OR dseb.deleted IS NULL)
|
||||
AND (dsebi.deleted = 0 OR dsebi.deleted IS NULL)
|
||||
order by dseb.start_time DESC;
|
||||
</select>
|
||||
<select id="listJoinBatchByIds" resultType="cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO">
|
||||
SELECT
|
||||
dsebi.*,
|
||||
|
||||
@ -89,18 +89,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
|
||||
<delete id="deleteDriveSchoolCarByIds" parameterType="String">
|
||||
<!--<delete id="deleteDriveSchoolCarByIds" parameterType="String">
|
||||
delete from drive_school_car where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>-->
|
||||
|
||||
<delete id="deleteDriveSchoolCarByIds" parameterType="String">
|
||||
update drive_school_car set deleted = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectByCarNo" parameterType="String" resultMap="DriveSchoolCarResult">
|
||||
<include refid="selectDriveSchoolCarVo"/>
|
||||
where deleted = 0 and car_no = #{carNo}
|
||||
</select>
|
||||
<select id="selectTrainCar" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCar">
|
||||
<select id="selectTrainCar" resultType="cn.iocoder.yudao.module.jx.vo.DriveSchoolCarVO">
|
||||
SELECT
|
||||
dscc.*,
|
||||
COUNT(DISTINCT dst.user_id) AS userNum,
|
||||
|
||||
@ -0,0 +1,123 @@
|
||||
<?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.DriveSchoolCoachClockMapper">
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO">
|
||||
SELECT
|
||||
dscc.*
|
||||
FROM
|
||||
drive_school_coach_clock dscc
|
||||
where
|
||||
dscc.deleted = 0
|
||||
<if test="entity.userId!= null and entity.userId!= ''">
|
||||
and dscc.user_id = #{entity.userId}
|
||||
</if>
|
||||
<if test="entity.carNo!= null and entity.carNo!= ''">
|
||||
and dscc.car_no like concat('%', #{entity.carNo},'%')
|
||||
</if>
|
||||
<if test="entity.subject!= null and entity.subject!= ''">
|
||||
and dscc.subject = #{entity.subject}
|
||||
</if>
|
||||
<if test="entity.id!= null and entity.id!= ''">
|
||||
and dscc.id = #{entity.id}
|
||||
</if>
|
||||
<if test="entity.startTimeStr != null and entity.startTimeStr != ''">
|
||||
AND dscc.train_day >= #{entity.startTimeStr}
|
||||
</if>
|
||||
<if test="entity.endTimeStr != null and entity.endTimeStr != ''">
|
||||
AND dscc.train_day <= #{entity.endTimeStr}
|
||||
</if>
|
||||
ORDER BY dscc.train_day DESC
|
||||
</select>
|
||||
|
||||
<select id="countTrainCar" resultType="cn.iocoder.yudao.module.train.vo.TrainCarCountVO">
|
||||
SELECT
|
||||
COALESCE(SUM(CASE WHEN subject = 2 THEN 1 ELSE 0 END), 0) AS subject2Count,
|
||||
COALESCE(SUM(CASE WHEN subject = 3 THEN 1 ELSE 0 END), 0) AS subject3Count,
|
||||
COALESCE(COUNT(*), 0) AS totalCount
|
||||
FROM
|
||||
drive_school_coach_clock
|
||||
WHERE
|
||||
deleted = 0
|
||||
AND subject IN (2, 3)
|
||||
<if test="entity.userId != null">
|
||||
AND user_id = #{entity.userId}
|
||||
</if>
|
||||
<if test="entity.trainDayStartTime != null and entity.trainDayStartTime != '' ">
|
||||
AND train_day >= #{entity.trainDayStartTime}
|
||||
</if>
|
||||
<if test="entity.trainDayEndTime != null and entity.trainDayEndTime != '' ">
|
||||
AND train_day <= #{entity.trainDayEndTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="trainClockByCar" resultType="cn.iocoder.yudao.module.train.vo.TrainCarCountVO">
|
||||
SELECT
|
||||
dscc.user_name,
|
||||
dscc.car_id,
|
||||
dscc.car_no,
|
||||
COUNT(*) AS totalCount,
|
||||
SUM(CASE WHEN dscc.subject = 2 THEN 1 ELSE 0 END) AS subject2Count,
|
||||
SUM(CASE WHEN dscc.subject = 3 THEN 1 ELSE 0 END) AS subject3Count,
|
||||
SUM(dscc.train_time) AS trainTimeCount,
|
||||
COUNT(dst.coach_clock_id) AS studentCount
|
||||
FROM
|
||||
drive_school_coach_clock dscc
|
||||
LEFT JOIN
|
||||
drive_school_car car ON dscc.car_id = car.id AND car.deleted = 0
|
||||
LEFT JOIN
|
||||
drive_school_train dst ON dst.coach_clock_id = dscc.id AND dst.deleted = 0
|
||||
WHERE
|
||||
dscc.deleted = 0
|
||||
AND dscc.subject IN (2, 3)
|
||||
<if test="entity.userId != null">
|
||||
AND dscc.user_id = #{entity.userId}
|
||||
</if>
|
||||
<if test="entity.carNo != null and entity.carNo != '' ">
|
||||
AND dscc.car_no = #{entity.carNo}
|
||||
</if>
|
||||
<if test="entity.subject != null">
|
||||
AND dscc.subject = #{entity.subject}
|
||||
</if>
|
||||
<if test="entity.courseType != null and entity.courseType != '' ">
|
||||
AND car.course_type = #{entity.courseType}
|
||||
</if>
|
||||
<if test="entity.trainDayStartTime != null and entity.trainDayStartTime != '' ">
|
||||
AND dscc.train_day >= #{entity.trainDayStartTime}
|
||||
</if>
|
||||
<if test="entity.trainDayEndTime != null and entity.trainDayEndTime != '' ">
|
||||
AND dscc.train_day <= #{entity.trainDayEndTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
dscc.car_no, dscc.car_id, dscc.user_name
|
||||
ORDER BY
|
||||
totalCount DESC
|
||||
</select>
|
||||
|
||||
<select id="selectCoachClockIdsByCarId" resultType="cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock">
|
||||
SELECT
|
||||
id,
|
||||
subject,
|
||||
user_id,
|
||||
user_name,
|
||||
train_day,
|
||||
start_time,
|
||||
end_time,
|
||||
car_id,
|
||||
car_no
|
||||
FROM drive_school_coach_clock
|
||||
WHERE
|
||||
car_id = #{entity.carId}
|
||||
AND deleted = 0
|
||||
<if test="entity.subject != null">
|
||||
AND subject = #{entity.subject}
|
||||
</if>
|
||||
<if test="entity.trainDayStartTime != null and entity.trainDayStartTime != '' ">
|
||||
AND train_day >= #{entity.trainDayStartTime}
|
||||
</if>
|
||||
<if test="entity.trainDayEndTime != null and entity.trainDayEndTime != '' ">
|
||||
AND train_day <= #{entity.trainDayEndTime}
|
||||
</if>
|
||||
ORDER BY train_day DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@ -70,6 +70,9 @@
|
||||
<if test="entity.isEnd != null and entity.isEnd != ''">
|
||||
and dst.end_time IS NOT NULL
|
||||
</if>
|
||||
<if test="entity.ifEvaluate != null ">
|
||||
and dst.if_evaluate = #{entity.ifEvaluate}
|
||||
</if>
|
||||
order by dst.create_time desc
|
||||
</select>
|
||||
<select id="listJoinBatchByIds" resultType="cn.iocoder.yudao.module.train.vo.TrainVO">
|
||||
@ -102,4 +105,34 @@
|
||||
GROUP BY coach_id, coach_name
|
||||
</select>
|
||||
|
||||
<select id="noClockInRemindByUserId" resultType="cn.iocoder.yudao.module.train.vo.NoClockInRemindVO">
|
||||
SELECT
|
||||
coach_id,
|
||||
coach_name,
|
||||
COUNT(DISTINCT user_id) AS student_count,
|
||||
GROUP_CONCAT(DISTINCT user_name SEPARATOR ';') AS student_names,
|
||||
tenant_id
|
||||
FROM drive_school_train
|
||||
WHERE
|
||||
coach_id = #{userId}
|
||||
AND DATE(create_time) = CURDATE()
|
||||
AND DATE(start_time) = CURDATE()
|
||||
AND end_time IS NULL
|
||||
AND deleted = 0
|
||||
GROUP BY coach_id, coach_name
|
||||
</select>
|
||||
|
||||
<select id="selectStudentByCoachClockId" resultType="cn.iocoder.yudao.module.train.entity.Train">
|
||||
SELECT
|
||||
subject,
|
||||
user_name,
|
||||
train_time
|
||||
FROM drive_school_train
|
||||
WHERE
|
||||
deleted = 0
|
||||
<if test="coachClockId != null and coachClockId != '' ">
|
||||
AND coach_clock_id = #{coachClockId}
|
||||
</if>
|
||||
ORDER BY train_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -256,7 +256,6 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
//获取当前司机的经纬度
|
||||
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
|
||||
//所在顶级机构
|
||||
|
||||
String driverKey = Redis_Driver_Key + user.getTenantId() + ":" + info.getDriverId();
|
||||
if (redisCache2.hasKey(driverKey)) {
|
||||
try {
|
||||
|
||||
@ -332,7 +332,8 @@
|
||||
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
|
||||
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
|
||||
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
|
||||
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum
|
||||
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum,
|
||||
IFNULL(sum(ri.is_wei_xiu = '1'), 0) as zwxNum
|
||||
FROM rescue_info ri
|
||||
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
||||
where ri.user_id = #{userId}
|
||||
@ -342,7 +343,8 @@
|
||||
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
|
||||
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
|
||||
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
|
||||
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum
|
||||
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum,
|
||||
IFNULL(sum(ri.is_wei_xiu = '1'), 0) as zwxNum
|
||||
FROM rescue_info ri
|
||||
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
||||
where 1 = 1
|
||||
|
||||
@ -112,4 +112,28 @@ public class DictDataController {
|
||||
CommonStatusEnum.ENABLE.getStatus(), type);
|
||||
return success(BeanUtils.toBean(list, AppDictDataRespVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询 value
|
||||
* 开关相关
|
||||
*/
|
||||
@GetMapping("/getValueByTypeAndLabel")
|
||||
public CommonResult<String> getValueByTypeAndLabel(@RequestParam("type") String type,
|
||||
@RequestParam("label") String label) {
|
||||
return success(dictDataService.getValueByTypeAndLabel(type, label));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开和关闭开关
|
||||
* @param type
|
||||
* @param label
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/updateValueByTypeAndLabel")
|
||||
public CommonResult<Boolean> updateValueByTypeAndLabel(@RequestParam("type") String type,
|
||||
@RequestParam("label") String label,
|
||||
@RequestParam("value") String value) {
|
||||
return success(dictDataService.updateValueByTypeAndLabel(type, label, value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,4 +124,8 @@ public interface DictDataService {
|
||||
List<DictDataDO> getDictDataListById(List<Long> dataIds);
|
||||
|
||||
void deleteDictDataBatch(List<Long> dictIds);
|
||||
|
||||
String getValueByTypeAndLabel(String type, String label);
|
||||
|
||||
boolean updateValueByTypeAndLabel(String type, String label, String value);
|
||||
}
|
||||
|
||||
@ -208,4 +208,24 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
dictDataMapper.deleteByIds(dictIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueByTypeAndLabel(String type, String label) {
|
||||
DictDataDO dictDataDO = dictDataMapper.selectByDictTypeAndLabel(type, label);
|
||||
if (dictDataDO != null) {
|
||||
return dictDataDO.getValue();
|
||||
}else {
|
||||
throw new RuntimeException("系统错误!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateValueByTypeAndLabel(String type, String label, String value) {
|
||||
DictDataDO dictDataDO = dictDataMapper.selectByDictTypeAndLabel(type, label);
|
||||
if (dictDataDO == null) {
|
||||
return false;
|
||||
}
|
||||
dictDataDO.setValue(value);
|
||||
return dictDataMapper.updateById(dictDataDO) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user