Merge branch 'driver' of http://122.51.230.86:3000/dianliang/lanan-system into driver
This commit is contained in:
commit
15a297a465
@ -25,7 +25,7 @@ public class Process extends TenantBaseDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
|
@ -41,4 +41,5 @@ public interface ProcessService extends IService<Process> {
|
||||
* @return cn.iocoder.yudao.module.course.entity.Process
|
||||
**/
|
||||
Process getByStudentAndCourse(Integer userId,String courseId,Integer subject,Long coachId);
|
||||
|
||||
}
|
||||
|
@ -94,4 +94,5 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
List<Process> processList = this.list(queryWrapper);
|
||||
return processList.isEmpty()?null:processList.get(0);
|
||||
}
|
||||
|
||||
}
|
@ -84,8 +84,9 @@ public class ReservationCourseController {
|
||||
@Parameter(name = "id", description = "学生userId", required = true, example = "1024")
|
||||
public CommonResult<?> getReservationCourse(@RequestParam("userId") Integer userId,
|
||||
@RequestParam("courseId") String courseId,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam("subject") Integer subject) {
|
||||
return success(reservationCourseService.getUserInfoAndReservation(userId,courseId,subject));
|
||||
return success(reservationCourseService.getUserInfoAndReservation(userId,courseId,subject,type));
|
||||
}
|
||||
|
||||
}
|
@ -22,7 +22,7 @@ public class ReservationCourse extends TenantBaseDO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
|
@ -24,7 +24,7 @@ public class Train extends TenantBaseDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
@ -70,6 +70,10 @@ public class Train extends TenantBaseDO {
|
||||
* 训练地址
|
||||
*/
|
||||
private String addr;
|
||||
/**
|
||||
* 训练日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String trainDay;
|
||||
/**
|
||||
* 交通方式(字典:school_transport_way)
|
||||
*/
|
||||
|
@ -32,6 +32,6 @@ public interface ReservationCourseService extends IService<ReservationCourse> {
|
||||
* @param userId
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
Map<String,Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject);
|
||||
Map<String,Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type);
|
||||
|
||||
}
|
||||
|
@ -37,4 +37,16 @@ public interface TrainService extends IService<Train> {
|
||||
* @param trainVO TODO
|
||||
**/
|
||||
void updateObj(TrainVO trainVO);
|
||||
|
||||
/**
|
||||
* 查某个学院某个课程某个科目某天的培训记录-未签退的
|
||||
* @author vinjor-M
|
||||
* @date 10:21 2025/1/17
|
||||
* @param userId 学员用户id
|
||||
* @param courseId 课程ID
|
||||
* @param subject 科目
|
||||
* @param dayStr 日期
|
||||
* @return cn.iocoder.yudao.module.train.entity.Train
|
||||
**/
|
||||
Train getUserTrainData(Integer userId,String courseId,Integer subject,String dayStr);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
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.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -34,6 +35,8 @@ public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseM
|
||||
private ReservationCourseMapper reservationCourseMapper;
|
||||
@Autowired
|
||||
private ProcessService processService;
|
||||
@Autowired
|
||||
private TrainService trainService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@ -60,7 +63,7 @@ public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseM
|
||||
**/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject) {
|
||||
public Map<String, Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type) {
|
||||
Map<String, Object> rtnMap = new HashMap<>();
|
||||
//当前教练ID
|
||||
Long coachId = SecurityFrameworkUtils.getLoginUserId();
|
||||
@ -84,6 +87,8 @@ public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseM
|
||||
if(null==process){
|
||||
throw new Exception("该学员未报名你的课程,请向管理员核实");
|
||||
}
|
||||
//查当天训练记录--未签退的
|
||||
rtnMap.put("train",trainService.getUserTrainData(userId,courseId,subject,nowDayStr));
|
||||
rtnMap.put("process",process);
|
||||
//TODO 学员表接口对接
|
||||
rtnMap.put("userInfo",null);
|
||||
|
@ -1,15 +1,23 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
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.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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 预约练车 Service 实现类
|
||||
@ -20,6 +28,9 @@ import org.springframework.stereotype.Service;
|
||||
public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements TrainService {
|
||||
@Autowired
|
||||
private TrainMapper trainMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ProcessService processService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@ -44,6 +55,7 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
**/
|
||||
@Override
|
||||
public void createObj(TrainVO trainVO) {
|
||||
trainVO.setTrainDay(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
this.save(trainVO);
|
||||
}
|
||||
|
||||
@ -56,6 +68,37 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
**/
|
||||
@Override
|
||||
public void updateObj(TrainVO trainVO) {
|
||||
//计算累计训练时长
|
||||
Double allTrainTime = trainVO.getAllTrainTime()+trainVO.getTrainTime();
|
||||
trainVO.setAllTrainTime(allTrainTime);
|
||||
this.updateById(trainVO);
|
||||
//更新该课程学习进度的 训练时长
|
||||
Process process = new Process();
|
||||
process.setId(trainVO.getProcessId());
|
||||
process.setTrainTime(allTrainTime);
|
||||
processService.updateById(process);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某个学院某个课程某个科目某天的培训记录-未签退的
|
||||
*
|
||||
* @param userId 学员用户id
|
||||
* @param courseId 课程ID
|
||||
* @param subject 科目
|
||||
* @param dayStr 日期
|
||||
* @return cn.iocoder.yudao.module.train.entity.Train
|
||||
* @author vinjor-M
|
||||
* @date 10:21 2025/1/17
|
||||
**/
|
||||
@Override
|
||||
public Train getUserTrainData(Integer userId, String courseId, Integer subject, String dayStr) {
|
||||
LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<Train>()
|
||||
.eq(Train::getUserId,userId)
|
||||
.eq(Train::getCourseId,courseId)
|
||||
.eq(Train::getSubject,subject)
|
||||
.eq(Train::getTrainDay,dayStr)
|
||||
.isNull(Train::getEndTime);
|
||||
List<Train> list = this.list(queryWrapper);
|
||||
return list.isEmpty()?null:list.get(0);
|
||||
}
|
||||
}
|
@ -9,4 +9,8 @@ public class TrainVO extends Train {
|
||||
* 查询类型(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
/**
|
||||
* 学习课程进度表ID
|
||||
*/
|
||||
private String processId;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user