This commit is contained in:
Vinjor 2025-01-21 14:46:26 +08:00
parent d20feb9fdf
commit 344262667d
19 changed files with 283 additions and 11 deletions

View File

@ -84,7 +84,7 @@ public class DlDriveSchoolStudentController {
**/ **/
@GetMapping("/getCanExamStudentList") @GetMapping("/getCanExamStudentList")
@Operation(summary = "获取可以考试的学员列表") @Operation(summary = "获取可以考试的学员列表")
public CommonResult<?> getCanExamStudentList(String courseId,Integer subject) { public CommonResult<?> getCanExamStudentList(String courseId,Integer subject,String userName) {
return success(schoolStudentService.getCanExamStudentList(courseId, subject)); return success(schoolStudentService.getCanExamStudentList(courseId, subject,userName));
} }
} }

View File

@ -34,5 +34,6 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @author vinjor-M * @author vinjor-M
* @date 23:19 2025/1/20 * @date 23:19 2025/1/20
**/ **/
List<DlDriveSchoolStudent> selectCanExamStudentList(@Param("courseId")String courseId,@Param("coachId")Long coachId,@Param("subject")Integer subject); List<DlDriveSchoolStudent> selectCanExamStudentList(@Param("courseId")String courseId,@Param("coachId")Long coachId
,@Param("subject")Integer subject,@Param("userName")String userName);
} }

View File

@ -74,5 +74,5 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
* @param subject 科目 * @param subject 科目
* @return List<DlDriveSchoolStudent> * @return List<DlDriveSchoolStudent>
**/ **/
List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject); List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName);
} }

View File

@ -99,10 +99,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
* @date 23:16 2025/1/20 * @date 23:16 2025/1/20
**/ **/
@Override @Override
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject) { public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName) {
//教练ID //教练ID
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId,userId,subject); return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId,userId,subject,userName);
} }

View File

@ -29,4 +29,20 @@ public interface ProcessMapper extends BaseMapper<Process> {
@Param("courseId")String courseId, @Param("courseId")String courseId,
@Param("subject")Integer subject, @Param("subject")Integer subject,
@Param("coachId")Long coachId); @Param("coachId")Long coachId);
/**
* 更新考试结果及学习进度
* @author vinjor-M
* @date 13:55 2025/1/21
* @return int
**/
int updateProcessExamResult(@Param("courseId")String courseId,
@Param("subject")Integer subject,
@Param("coachId")Long coachId,
@Param("userId")Long userId,
@Param("status")String status,
@Param("examStatus")String examStatus,
@Param("examScore")Double examScore,
@Param("images")String images,
@Param("examTime")String examTime);
} }

View File

@ -40,4 +40,12 @@ public class ExamBatchController {
return success(true); return success(true);
} }
@GetMapping("/getById")
@Operation(summary = "查某一批次详情")
public CommonResult<?> getById(String id) {
examBatchService.selectOneById(id);
return success(true);
}
} }

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.exam.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 考试批次子表")
@RestController
@RequestMapping("/examBatchItem")
@Validated
public class ExamBatchItemController {
@Resource
private ExamBatchItemService examBatchItemService;
/**
* 获得所有待录入成绩的学员列表
* @author vinjor-M
* @date 11:09 2025/1/21
**/
@GetMapping("/page")
@Operation(summary = "获得所有待录入成绩的学员列表")
public CommonResult<IPage<?>> getPage(ExamBatchVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<ExamBatchItemVO> page = new Page<>(pageNo,pageSize);
return success(examBatchItemService.queryListPage(pageReqVO,page));
}
@PutMapping("/update")
@Operation(summary = "录入考试成绩")
public CommonResult<?> updateObj( @RequestBody ExamBatchItemVO examBatchVO) {
examBatchItemService.updateObj(examBatchVO);
return success(true);
}
}

View File

@ -42,6 +42,10 @@ public class ExamBatch extends TenantBaseDO {
* 教练姓名 * 教练姓名
*/ */
private String coachName; private String coachName;
/**
* 批次编号年月日时分秒
*/
private String batchName;
/** /**
* 考试开始时间 * 考试开始时间
*/ */

View File

@ -1,8 +1,15 @@
package cn.iocoder.yudao.module.exam.mapper; package cn.iocoder.yudao.module.exam.mapper;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 考试批次明细表 Mapper * 考试批次明细表 Mapper
@ -12,4 +19,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ExamBatchItemMapper extends BaseMapper<ExamBatchItem> { public interface ExamBatchItemMapper extends BaseMapper<ExamBatchItem> {
IPage<ExamBatchItemVO> queryListPage(@Param("entity") ExamBatchVO pageReqVO, Page<ExamBatchItemVO> page);
List<ExamBatchItemVO> selectByBatchId(@Param("batchId")String batchId);
} }

View File

@ -18,6 +18,4 @@ public interface ExamBatchMapper extends BaseMapper<ExamBatch> {
IPage<ExamBatchVO> queryListPage(@Param("entity") ExamBatchVO entity, Page<ExamBatchVO> page); IPage<ExamBatchVO> queryListPage(@Param("entity") ExamBatchVO entity, Page<ExamBatchVO> page);
} }

View File

@ -1,8 +1,14 @@
package cn.iocoder.yudao.module.exam.service; package cn.iocoder.yudao.module.exam.service;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* 考试批次明细表 Service 接口 * 考试批次明细表 Service 接口
* *
@ -10,5 +16,28 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface ExamBatchItemService extends IService<ExamBatchItem> { public interface ExamBatchItemService extends IService<ExamBatchItem> {
/**
* 分页查询
* @author vinjor-M
* @date 15:05 2025/1/14
* @param pageReqVO TODO
* @param page TODO
**/
IPage<ExamBatchItemVO> queryListPage(ExamBatchVO pageReqVO, Page<ExamBatchItemVO> page);
/**
* 根据批次ID查所有子表记录
* @author vinjor-M
* @date 13:40 2025/1/21
* @param batchId 批次ID
* @return java.util.List<cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO>
**/
List<ExamBatchItemVO> selectListByBatchId(String batchId);
/**
* 录入学生考试成绩
* @author vinjor-M
* @date 13:48 2025/1/21
**/
void updateObj(ExamBatchItemVO examBatchVO);
} }

View File

@ -29,4 +29,13 @@ public interface ExamBatchService extends IService<ExamBatch> {
* @param examBatchVO * @param examBatchVO
**/ **/
void createObj(ExamBatchVO examBatchVO); void createObj(ExamBatchVO examBatchVO);
/**
* 查某一批次考试详情
* @author vinjor-M
* @date 13:37 2025/1/21
* @param id 批次ID
* @return cn.iocoder.yudao.module.exam.vo.ExamBatchVO
**/
ExamBatchVO selectOneById(String id);
} }

View File

@ -1,12 +1,21 @@
package cn.iocoder.yudao.module.exam.service.impl; package cn.iocoder.yudao.module.exam.service.impl;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.mapper.ExamBatchItemMapper; import cn.iocoder.yudao.module.exam.mapper.ExamBatchItemMapper;
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService; import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 考试批次明细表 Service 实现类 * 考试批次明细表 Service 实现类
* *
@ -16,4 +25,52 @@ import org.springframework.stereotype.Service;
public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, ExamBatchItem> implements ExamBatchItemService { public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, ExamBatchItem> implements ExamBatchItemService {
@Autowired @Autowired
private ExamBatchItemMapper examBatchItemMapper; private ExamBatchItemMapper examBatchItemMapper;
@Autowired
private ProcessMapper processMapper;
/**
* 分页查询
*
* @param pageReqVO TODO
* @param page TODO
* @author vinjor-M
* @date 15:05 2025/1/14
**/
@Override
public IPage<ExamBatchItemVO> queryListPage(ExamBatchVO pageReqVO, Page<ExamBatchItemVO> page) {
IPage<ExamBatchItemVO> rtnList = examBatchItemMapper.queryListPage(pageReqVO, page);
return rtnList;
}
/**
* 根据批次ID查所有子表记录
*
* @param batchId 批次ID
* @return java.util.List<cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO>
* @author vinjor-M
* @date 13:40 2025/1/21
**/
@Override
public List<ExamBatchItemVO> selectListByBatchId(String batchId) {
return examBatchItemMapper.selectByBatchId(batchId);
}
/**
* 录入学生考试成绩
*
* @param examBatchVO
* @author vinjor-M
* @date 13:48 2025/1/21
*/
@Override
public void updateObj(ExamBatchItemVO examBatchVO) {
//教练ID
Long userId = SecurityFrameworkUtils.getLoginUserId();
ExamBatchItem updateItem = new ExamBatchItem();
BeanUtils.copyProperties(examBatchVO,updateItem);
//更新子表考试结果
this.updateById(updateItem);
//更新学习进度表的考试状态和结果将学员下一个科目的状态置为进行中
}
} }

View File

@ -1,18 +1,22 @@
package cn.iocoder.yudao.module.exam.service.impl; package cn.iocoder.yudao.module.exam.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.module.course.mapper.ProcessMapper; import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
import cn.iocoder.yudao.module.exam.entity.ExamBatch; import cn.iocoder.yudao.module.exam.entity.ExamBatch;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.mapper.ExamBatchMapper; import cn.iocoder.yudao.module.exam.mapper.ExamBatchMapper;
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService; import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
import cn.iocoder.yudao.module.exam.service.ExamBatchService; import cn.iocoder.yudao.module.exam.service.ExamBatchService;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO; import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,12 +58,44 @@ public class ExamBatchServiceImpl extends ServiceImpl<ExamBatchMapper, ExamBatch
**/ **/
@Override @Override
public void createObj(ExamBatchVO examBatchVO) { public void createObj(ExamBatchVO examBatchVO) {
//生成批次编号
String timestamp = DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss");
examBatchVO.setBatchName(timestamp);
this.save(examBatchVO); this.save(examBatchVO);
//处理子表数据
List<ExamBatchItem> itemList = new ArrayList<>();
examBatchVO.getItemList().forEach(item->{
ExamBatchItem batchItem = new ExamBatchItem();
batchItem.setBatchId(examBatchVO.getId());
BeanUtils.copyProperties(item,batchItem);
itemList.add(batchItem);
});
//存子表数据 //存子表数据
examBatchItemService.saveBatch(examBatchVO.getItemList()); examBatchItemService.saveBatch(itemList);
//更新每个学生对应学习进度表考试的状态设置为 已送考 //更新每个学生对应学习进度表考试的状态设置为 已送考
List<Long> userIdList = examBatchVO.getItemList().stream().map(ExamBatchItem::getUserId).collect(Collectors.toList()); List<Long> userIdList = examBatchVO.getItemList().stream().map(ExamBatchItem::getUserId).collect(Collectors.toList());
processMapper.updateProcessBatch(userIdList,examBatchVO.getCourseId(),examBatchVO.getSubject(),examBatchVO.getCoachId()); processMapper.updateProcessBatch(userIdList,examBatchVO.getCourseId(),examBatchVO.getSubject(),examBatchVO.getCoachId());
} }
/**
* 查某一批次考试详情
*
* @param id 批次ID
* @return cn.iocoder.yudao.module.exam.vo.ExamBatchVO
* @author vinjor-M
* @date 13:37 2025/1/21
**/
@Override
public ExamBatchVO selectOneById(String id) {
ExamBatch examBatch = this.getById(id);
ExamBatchVO examBatchVO = new ExamBatchVO();
BeanUtils.copyProperties(examBatch,examBatchVO);
//查子表数据
List<ExamBatchItemVO> itemVOList = examBatchItemService.selectListByBatchId(id);
if(null!=itemVOList){
examBatchVO.setItemList(itemVOList);
}
return examBatchVO;
}
} }

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.exam.vo;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import lombok.Data;
@Data
public class ExamBatchItemVO extends ExamBatchItem {
/**
* 考试课程名称
*/
private String courseName;
/**
* 考试课程id
*/
private String courseId;
/**
* 考试科目
*/
private Integer subject;
/**
* 学生电话
*/
private String userMobile;
}

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.exam.vo; package cn.iocoder.yudao.module.exam.vo;
import cn.iocoder.yudao.module.exam.entity.ExamBatch; import cn.iocoder.yudao.module.exam.entity.ExamBatch;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -11,5 +10,5 @@ public class ExamBatchVO extends ExamBatch {
/** /**
* 明细子表数据 * 明细子表数据
*/ */
private List<ExamBatchItem> itemList; private List<ExamBatchItemVO> itemList;
} }

View File

@ -33,6 +33,9 @@
AND dsp.coach_id = #{coachId} AND dsp.coach_id = #{coachId}
AND dsp.course_id = #{courseId} AND dsp.course_id = #{courseId}
AND dsp.`subject` = #{subject} AND dsp.`subject` = #{subject}
<if test="userName!=null and userName!=''">
AND dsp.user_name LIKE CONCAT('%',#{userName},'%')
</if>
AND dsp.`status` = '1' AND dsp.`status` = '1'
AND dsp.exam_status IS NULL AND dsp.exam_status IS NULL
GROUP BY GROUP BY

View File

@ -18,4 +18,7 @@
AND exam_status IS NULL AND exam_status IS NULL
AND deleted =0 AND deleted =0
</update> </update>
<update id="updateProcessExamResult">
</update>
</mapper> </mapper>

View File

@ -4,4 +4,28 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.exam.mapper.ExamBatchItemMapper"> <mapper namespace="cn.iocoder.yudao.module.exam.mapper.ExamBatchItemMapper">
<select id="queryListPage" resultType="cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO">
SELECT
dsebi.*,dseb.course_id,dseb.course_name,dss.phone AS userMobile
FROM
drive_school_exam_batch_item dsebi
LEFT JOIN drive_school_exam_batch dseb ON dsebi.batch_id = dseb.id
LEFT JOIN drive_school_student dss ON dsebi.user_id = dss.user_id
AND dss.deleted = 0
WHERE
dseb.deleted = 0
AND dseb.course_id = #{entity.courseId}
AND dseb.coach_id = #{entity.coachId}
AND dseb.`subject` = #{entity.subject}
AND dsebi.fraction IS NULL
</select>
<select id="selectByBatchId" resultType="cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO">
SELECT
*
FROM
drive_school_exam_batch_item
WHERE
deleted = 0
AND batch_id = #{batchId}
</select>
</mapper> </mapper>