1
This commit is contained in:
parent
d20feb9fdf
commit
344262667d
@ -84,7 +84,7 @@ public class DlDriveSchoolStudentController {
|
||||
**/
|
||||
@GetMapping("/getCanExamStudentList")
|
||||
@Operation(summary = "获取可以考试的学员列表")
|
||||
public CommonResult<?> getCanExamStudentList(String courseId,Integer subject) {
|
||||
return success(schoolStudentService.getCanExamStudentList(courseId, subject));
|
||||
public CommonResult<?> getCanExamStudentList(String courseId,Integer subject,String userName) {
|
||||
return success(schoolStudentService.getCanExamStudentList(courseId, subject,userName));
|
||||
}
|
||||
}
|
@ -34,5 +34,6 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
|
||||
* @author vinjor-M
|
||||
* @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);
|
||||
}
|
@ -74,5 +74,5 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
|
||||
* @param subject 科目
|
||||
* @return List<DlDriveSchoolStudent>
|
||||
**/
|
||||
List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject);
|
||||
List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName);
|
||||
}
|
@ -99,10 +99,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
* @date 23:16 2025/1/20
|
||||
**/
|
||||
@Override
|
||||
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject) {
|
||||
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName) {
|
||||
//教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId,userId,subject);
|
||||
return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId,userId,subject,userName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,4 +29,20 @@ public interface ProcessMapper extends BaseMapper<Process> {
|
||||
@Param("courseId")String courseId,
|
||||
@Param("subject")Integer subject,
|
||||
@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);
|
||||
}
|
@ -40,4 +40,12 @@ public class ExamBatchController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "查某一批次详情")
|
||||
public CommonResult<?> getById(String id) {
|
||||
examBatchService.selectOneById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -42,6 +42,10 @@ public class ExamBatch extends TenantBaseDO {
|
||||
* 教练姓名
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 批次编号(年月日时分秒)
|
||||
*/
|
||||
private String batchName;
|
||||
/**
|
||||
* 考试开始时间
|
||||
*/
|
||||
|
@ -1,8 +1,15 @@
|
||||
package cn.iocoder.yudao.module.exam.mapper;
|
||||
|
||||
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.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
|
||||
@ -12,4 +19,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface ExamBatchItemMapper extends BaseMapper<ExamBatchItem> {
|
||||
|
||||
IPage<ExamBatchItemVO> queryListPage(@Param("entity") ExamBatchVO pageReqVO, Page<ExamBatchItemVO> page);
|
||||
|
||||
List<ExamBatchItemVO> selectByBatchId(@Param("batchId")String batchId);
|
||||
}
|
@ -18,6 +18,4 @@ public interface ExamBatchMapper extends BaseMapper<ExamBatch> {
|
||||
|
||||
IPage<ExamBatchVO> queryListPage(@Param("entity") ExamBatchVO entity, Page<ExamBatchVO> page);
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
package cn.iocoder.yudao.module.exam.service;
|
||||
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* 考试批次明细表 Service 接口
|
||||
*
|
||||
@ -10,5 +16,28 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
@ -29,4 +29,13 @@ public interface ExamBatchService extends IService<ExamBatch> {
|
||||
* @param 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);
|
||||
}
|
||||
|
@ -1,12 +1,21 @@
|
||||
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.mapper.ExamBatchItemMapper;
|
||||
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 org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试批次明细表 Service 实现类
|
||||
*
|
||||
@ -16,4 +25,52 @@ import org.springframework.stereotype.Service;
|
||||
public class ExamBatchItemServiceImpl extends ServiceImpl<ExamBatchItemMapper, ExamBatchItem> implements ExamBatchItemService {
|
||||
@Autowired
|
||||
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);
|
||||
//更新学习进度表的考试状态和结果,将学员下一个科目的状态置为进行中
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,22 @@
|
||||
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.exam.entity.ExamBatch;
|
||||
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
|
||||
import cn.iocoder.yudao.module.exam.mapper.ExamBatchMapper;
|
||||
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
|
||||
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 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.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -54,12 +58,44 @@ public class ExamBatchServiceImpl extends ServiceImpl<ExamBatchMapper, ExamBatch
|
||||
**/
|
||||
@Override
|
||||
public void createObj(ExamBatchVO examBatchVO) {
|
||||
//生成批次编号
|
||||
String timestamp = DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss");
|
||||
examBatchVO.setBatchName(timestamp);
|
||||
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());
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.exam.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.exam.entity.ExamBatch;
|
||||
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -11,5 +10,5 @@ public class ExamBatchVO extends ExamBatch {
|
||||
/**
|
||||
* 明细子表数据
|
||||
*/
|
||||
private List<ExamBatchItem> itemList;
|
||||
private List<ExamBatchItemVO> itemList;
|
||||
}
|
||||
|
@ -33,6 +33,9 @@
|
||||
AND dsp.coach_id = #{coachId}
|
||||
AND dsp.course_id = #{courseId}
|
||||
AND dsp.`subject` = #{subject}
|
||||
<if test="userName!=null and userName!=''">
|
||||
AND dsp.user_name LIKE CONCAT('%',#{userName},'%')
|
||||
</if>
|
||||
AND dsp.`status` = '1'
|
||||
AND dsp.exam_status IS NULL
|
||||
GROUP BY
|
||||
|
@ -18,4 +18,7 @@
|
||||
AND exam_status IS NULL
|
||||
AND deleted =0
|
||||
</update>
|
||||
<update id="updateProcessExamResult">
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
|
@ -4,4 +4,28 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user