This commit is contained in:
Vinjor 2025-02-11 15:30:07 +08:00
parent 4a9e99f69e
commit 026b39b061
8 changed files with 64 additions and 2 deletions

View File

@ -9,11 +9,15 @@ import cn.iocoder.yudao.module.base.vo.StudentInfoVO;
import cn.iocoder.yudao.module.course.entity.Process;
import cn.iocoder.yudao.module.course.service.ProcessService;
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.service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
@Service
@Validated
public class DataViewServiceImpl implements DataViewService {
@ -45,6 +49,8 @@ public class DataViewServiceImpl implements DataViewService {
//当前学习进度
Process process = processService.selectByUserId(id,coachId);
studentInfoVO.setProcess(process);
//查这个课程累计总训练时长
studentInfoVO.setTrainTime(processService.getAllTrainTime(id,process.getCourseId()));
//查归属教练信息
DlDriveSchoolCoachRespVO coachRespVO = coachService.getDlDriveSchoolCoachByUserId(process.getCoachId());
if(null!=coachRespVO){
@ -53,9 +59,13 @@ public class DataViewServiceImpl implements DataViewService {
studentInfoVO.setCoachInfo(coachRespVO);
}
//查该学生的培训记录
studentInfoVO.setTrainList(trainService.selectByUserIdAndCoachId(id,coachId));
List<Train> trainList = trainService.selectByUserIdAndCoachId(id,coachId);
trainList.forEach(item-> item.setShowMore(false));
studentInfoVO.setTrainList(trainList);
//查该学生的考试记录
studentInfoVO.setExamList(examBatchItemService.selectByUserIdAndCoachId(id, coachId));
List<ExamBatchItemVO> examList = examBatchItemService.selectByUserIdAndCoachId(id, coachId);
examList.forEach(item->item.setShowMore(false));
studentInfoVO.setExamList(examList);
return studentInfoVO;
}
}

View File

@ -14,6 +14,8 @@ public class StudentInfoVO {
private DlDriveSchoolStudent studentInfo;
/**学习进度*/
private Process process;
/**训练总时长*/
private Double trainTime;
/**教练信息*/
private DlDriveSchoolCoachRespVO coachInfo;
/**训练记录*/

View File

@ -54,4 +54,6 @@ public interface ProcessMapper extends BaseMapper<Process> {
* @return cn.iocoder.yudao.module.course.entity.Process
**/
Process selectNewMaxByUserId(@Param("userId") Long userId,@Param("coachId") Long coachId);
Double selectAllTrainTime(@Param("userId") Long userId,@Param("courseId") String courseId);
}

View File

@ -61,5 +61,15 @@ public interface ProcessService extends IService<Process> {
* @return java.util.Map<java.lang.String,java.lang.Integer>
**/
Map<String,Integer> selectByCoachId(Long coachId);
/**
* 查某学生某课程累计总训练时长
* @author vinjor-M
* @date 14:17 2025/2/11
* @param userId 学生ID
* @param courseId 课程ID
* @return java.lang.Double
**/
Double getAllTrainTime(Long userId,String courseId);
}

View File

@ -170,4 +170,18 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
return rtnMap;
}
/**
* 查某学生某课程累计总训练时长
*
* @param userId 学生ID
* @param courseId 课程ID
* @return java.lang.Double
* @author vinjor-M
* @date 14:17 2025/2/11
**/
@Override
public Double getAllTrainTime(Long userId, String courseId) {
return processMapper.selectAllTrainTime(userId, courseId);
}
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.exam.vo;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.Date;
@ -48,4 +49,9 @@ public class ExamBatchItemVO extends ExamBatchItem {
* 考试交通方式
*/
private String transWay;
/**
* 是否展示更多
*/
@TableField(exist = false)
private Boolean showMore;
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.train.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@ -123,4 +124,10 @@ public class Train extends TenantBaseDO {
*/
private String evaluateId;
/**
* 是否展示更多
*/
@TableField(exist = false)
private Boolean showMore;
}

View File

@ -31,4 +31,15 @@
</if>
ORDER BY dsp.`subject` DESC, dsp.create_time DESC LIMIT 1
</select>
<select id="selectAllTrainTime" resultType="java.lang.Double">
SELECT
SUM(dsp.train_time)
FROM
drive_school_process dsp
WHERE
dsp.user_id = #{userId}
AND dsp.deleted = 0
AND dsp.course_id = #{courseId}
AND (( dsp.`status` = '2' AND dsp.exam_status = '1' ) OR dsp.`status` = '1' )
</select>
</mapper>