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 index c36f542a..ae162cd9 100644 --- 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 @@ -25,7 +25,7 @@ public class Process extends TenantBaseDO { /** * id */ - @TableId(type = IdType.INPUT) + @TableId(type = IdType.ASSIGN_UUID) private String id; /** * 课程ID 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 index c3c9c4fd..6d34b3be 100644 --- 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 @@ -41,4 +41,5 @@ public interface ProcessService extends IService { * @return cn.iocoder.yudao.module.course.entity.Process **/ Process getByStudentAndCourse(Integer userId,String courseId,Integer subject,Long coachId); + } 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 index 00c1255f..87564c86 100644 --- 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 @@ -94,4 +94,5 @@ public class ProcessServiceImpl extends ServiceImpl impl List processList = this.list(queryWrapper); return processList.isEmpty()?null:processList.get(0); } + } \ 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 index ebeaf37e..af0a22c2 100644 --- 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 @@ -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)); } } \ 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 index 754374df..66a675a0 100644 --- 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 @@ -22,7 +22,7 @@ public class ReservationCourse extends TenantBaseDO { /** * 主键id */ - @TableId(type = IdType.INPUT) + @TableId(type = IdType.ASSIGN_UUID) private String id; /** * 课程ID 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 index 8664e3b6..2a15637e 100644 --- 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 @@ -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) */ 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 index 2f85189d..d3841585 100644 --- 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 @@ -32,6 +32,6 @@ public interface ReservationCourseService extends IService { * @param userId * @return java.util.Map **/ - Map getUserInfoAndReservation(Integer userId,String courseId,Integer subject); + Map getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type); } 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 index 7cfac814..9bb0e3a3 100644 --- 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 @@ -37,4 +37,16 @@ public interface TrainService extends IService { * @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); } 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 index bcbf0401..41bae294 100644 --- 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 @@ -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 getUserInfoAndReservation(Integer userId,String courseId,Integer subject) { + public Map getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type) { Map rtnMap = new HashMap<>(); //当前教练ID Long coachId = SecurityFrameworkUtils.getLoginUserId(); @@ -84,6 +87,8 @@ public class ReservationCourseServiceImpl extends ServiceImpl implements TrainService { @Autowired private TrainMapper trainMapper; + @Autowired + @Lazy + private ProcessService processService; /** * 分页查询 @@ -44,6 +55,7 @@ public class TrainServiceImpl extends ServiceImpl 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 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 queryWrapper = new LambdaQueryWrapper() + .eq(Train::getUserId,userId) + .eq(Train::getCourseId,courseId) + .eq(Train::getSubject,subject) + .eq(Train::getTrainDay,dayStr) + .isNull(Train::getEndTime); + List list = this.list(queryWrapper); + return list.isEmpty()?null:list.get(0); } } \ No newline at end of file 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 index c833761e..f1ac9327 100644 --- 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 @@ -9,4 +9,8 @@ public class TrainVO extends Train { * 查询类型(my-当前用户的|all所有的) */ private String selectType; + /** + * 学习课程进度表ID + */ + private String processId; }