"src/main/java/com/git@gitlab.ruzhoukj.com:wujipeng/ops.git" did not exist on "fa5af7be81553d00ffdd9e53bb5bd615094e99a0"
Commit eca651ce authored by wujipeng's avatar wujipeng
Browse files

学员-考试中心/我的成绩-拆分

parent ffe84393
package com.platform.business.model.dto;
import lombok.Data;
/**
* 在线理论考试答案保存请求。
*
* <p>只开放实际答案字段,避免旧接口直接接收题目实体后被客户端篡改分值、正确答案、
* 考试ID或学员ID。</p>
*/
@Data
public class StudentExamAnswerDTO {
private String actualChoice;
}
package com.platform.business.model.dto;
import lombok.Data;
/**
* 学员端考试中心分页查询条件。
*
* <p>本对象不包含studentId。学员身份必须由服务端从JWT解析,禁止客户端通过查询条件
* 指定其他学员。</p>
*/
@Data
public class StudentExamCenterQueryDTO {
private int pageNum;
private int pageSize;
/** 考试名称关键字。 */
private String keyword;
/** ALL、PENDING或COMPLETED。 */
private String status;
}
package com.platform.business.model.dto;
import lombok.Data;
/** 学员端“我的成绩”分页查询条件。 */
@Data
public class StudentScoreQueryDTO {
private int pageNum;
private int pageSize;
/** 考试名称关键字。 */
private String keyword;
/** THEORY/PRACTICE,也兼容数据库中的“理论/实训”。 */
private String type;
}
package com.platform.business.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.platform.business.model.entity.ExamStudentEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/** 学员端考试中心的页面级响应模型。 */
public final class StudentExamCenterVO {
private StudentExamCenterVO() {
}
/** 考试中心列表行。 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class ListItem {
private Integer examStudentId;
private Integer examId;
private String examName;
private String type;
@JsonFormat(pattern = "MM-dd HH:mm", timezone = "GMT+8")
private Date examTime;
private Integer duration;
private String location;
private BigDecimal totalScore;
private BigDecimal passScore;
private Long startTime;
private Long endTime;
private Boolean submit;
private Boolean studentMarkFlag;
private Boolean examMarkFlag;
private Double score;
/** WAITING、IN_PROGRESS、SUBMITTED或PUBLISHED。 */
private String workflowStatus;
/** WAIT、START、RESUME、VIEW_INSTRUCTIONS或VIEW_SCORE。 */
private String action;
}
/** 进入考试前展示的考试说明。 */
@Data
public static class Instructions {
private Integer examStudentId;
private Integer examId;
private String examName;
private String type;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date examTime;
private Integer duration;
private Integer forbidMinutes;
private String location;
private BigDecimal totalScore;
private BigDecimal passScore;
private List<String> notices;
}
/**
* Mapper内部使用的应考记录聚合模型。
*
* <p>继承应考实体便于复用关系字段,新增字段均来自exam表,不直接用于持久化更新。</p>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class Attempt extends ExamStudentEntity {
private String examName;
private String examType;
private Date examTime;
private Integer examDuration;
private Integer forbidMinutes;
private String location;
private String paperId;
private BigDecimal totalScore;
private BigDecimal passScore;
private Boolean examMarkFlag;
}
/** 在线试卷及恢复作答所需的完整进度,但不包含正确答案。 */
@Data
public static class Paper {
private Integer examStudentId;
private Integer examId;
private String examName;
private Long startTime;
private Long endTime;
private Integer totalCount;
private Integer answeredCount;
private List<Question> questions;
}
/** 在线考试题目。正确答案只会出现在成绩模块,不会由本模型返回。 */
@Data
public static class Question {
private String id;
private String sequence;
private String type;
private String problem;
private String optionA;
private String optionB;
private String optionC;
private String optionD;
private String optionE;
private Double score;
private String actualChoice;
}
/** 交卷前校验结果。 */
@Data
public static class SubmitCheck {
private Integer totalCount;
private Integer answeredCount;
private Integer unansweredCount;
private Boolean submitAllowed;
private Long allowedAt;
private String message;
}
/** 交卷结果不包含未发布的分数。 */
@Data
public static class SubmitResult {
private Integer examStudentId;
private String status;
private Integer totalCount;
private Integer answeredCount;
private Integer unansweredCount;
private String duration;
}
}
package com.platform.business.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/** 学员端“我的成绩”的聚合响应模型。 */
public final class StudentScoreVO {
private StudentScoreVO() {
}
/** 页面顶部四项统计。 */
@Data
public static class Overview {
private Double averageScore;
private Double highestScore;
private Integer examCount;
private Integer classRank;
private Integer classId;
}
/** 成绩明细列表行。 */
@Data
public static class ListItem {
private Integer examStudentId;
private Integer examId;
private String examName;
private String type;
private Double score;
private Double averageScore;
private Integer rank;
private Integer classCount;
@JsonFormat(pattern = "MM-dd", timezone = "GMT+8")
private Date examTime;
}
/** 单场成绩聚合详情;理论和实训明细只会返回其中一种。 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Detail {
private Integer examStudentId;
private Integer examId;
/** 应考记录所属班级,用于限定班级均分、排名和题型分析的数据范围。 */
private Integer classId;
private String examName;
private String type;
private String className;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date examTime;
private Double score;
private BigDecimal totalScore;
private BigDecimal passScore;
private String grade;
private Boolean passed;
private Double classAverageScore;
private Double scoreDifference;
private Integer rank;
private Integer classCount;
private String duration;
private Integer totalQuestionCount;
private Integer rightCount;
private Integer wrongCount;
private Integer partiallyRightCount;
private Double correctRate;
private List<TheoryQuestion> theoryQuestions;
private List<TypeAnalysis> typeAnalysis;
private List<PracticeItem> practiceItems;
private PracticeSummary practiceSummary;
}
/** 理论题成绩明细。 */
@Data
public static class TheoryQuestion {
private String id;
private String sequence;
private String type;
private String problem;
private String optionA;
private String optionB;
private String optionC;
private String optionD;
private String optionE;
private String actualChoice;
private String answer;
private Double score;
private Double actualScore;
private Boolean result;
private Boolean partiallyRight;
private String resultDescription;
}
/** 理论题型个人得分率与班级平均得分率。 */
@Data
public static class TypeAnalysis {
private String type;
private Double personalRate;
private Double classAverageRate;
}
/** fz_grades当前协议能够稳定提供的实训步骤字段。 */
@Data
public static class PracticeItem {
private String id;
private String code;
private String level;
private String title;
private String type;
private String options;
private String text;
private String result;
private String file;
private Double score;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date submissionTime;
/** PASS、PARTIAL或FAIL,由现有result文本归一化得到。 */
private String normalizedStatus;
}
/** 基于现有实训结果文本计算的步骤数量汇总。 */
@Data
public static class PracticeSummary {
private Integer totalCount;
private Integer passedCount;
private Integer partiallyPassedCount;
private Integer failedCount;
private Double weightedPassRate;
}
}
package com.platform.business.controller; package com.platform.business.controller;
import com.platform.business.model.dto.ExamDTO; import com.platform.business.model.dto.ExamDTO;
import com.platform.business.model.dto.TheoreticalPaperStudentDetailDTO;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import com.platform.business.model.vo.ExamVO; import com.platform.business.model.vo.ExamVO;
import com.platform.business.model.vo.TheoreticalPaperStudentDetailVO;
import com.platform.business.service.ExamService; import com.platform.business.service.ExamService;
import com.platform.controller.BaseController; import com.platform.controller.BaseController;
import com.platform.model.resp.Result; import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo; import com.platform.page.TableDataInfo;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/exam") @RequestMapping("/exam")
public class ExamController extends BaseController { public class ExamController extends BaseController {
...@@ -59,94 +53,4 @@ public class ExamController extends BaseController { ...@@ -59,94 +53,4 @@ public class ExamController extends BaseController {
return getDataTable(examService.classExamScore(examDTO)); return getDataTable(examService.classExamScore(examDTO));
} }
@ApiOperation(value = "学员端-考试中心-列表")
@PostMapping("/student/list")
public Result<List<ExamVO>> unfinished(@RequestBody ExamDTO examDTO) {
startPage(examDTO.getPageNum(), examDTO.getPageSize());
return Result.data(examService.unfinished(examDTO));
}
@ApiOperation(value = "开始考试")
@PostMapping("/start")
public Result<Integer> startExam(@RequestBody ExamDTO examDTO) {
return examService.startExam(examDTO);
}
@ApiOperation(value = "试卷总览")
@GetMapping("/paper/overview/{id}")
public Result<List<TheoreticalPaperStudentDetailVO>> paperOverview(@PathVariable(name = "id") Integer id) {
return Result.data(examService.paperOverview(id));
}
@ApiOperation(value = "考卷详情")
@GetMapping("/paper/detail/{id}")
public Result<ExamStudentVO> paperDetail(@PathVariable(name = "id") Integer id) {
return Result.data(examService.paperDetail(id));
}
@ApiModelProperty(value = "考题详情")
@GetMapping("/question/detail/{id}")
public Result<TheoreticalPaperStudentDetailVO> questionDetail(@PathVariable(name = "id") String id) {
return Result.data(examService.questionDetail(id));
}
@ApiOperation(value = "考题编辑")
@PutMapping("/question/edit")
public Result<Boolean> questionEdit(@RequestBody TheoreticalPaperStudentDetailDTO theoreticalPaperStudentDetailDTO) {
return Result.data(examService.questionEdit(theoreticalPaperStudentDetailDTO));
}
@ApiOperation(value = "交卷校验")
@GetMapping("/submit/check/{id}")
public Result<Map<String,String>> submitCheck(@PathVariable(name = "id") String id) {
return Result.data(examService.submitCheck(id));
}
@ApiOperation(value = "交卷")
@GetMapping("/submit/{id}")
public Result<Boolean> submit(@PathVariable(name = "id") String id) {
return examService.submit(id);
}
@ApiModelProperty(value = "成绩-考题详情")
@GetMapping("/grades/question/detail/{id}")
public Result<TheoreticalPaperStudentDetailVO> gradesQuestionDetail(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesQuestionDetail(id));
}
@ApiOperation(value = "成绩详情")
@GetMapping("/grades/detail/{id}")
public Result<ExamStudentVO> gradesDetail(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesDetail(id));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-详情-汇总")
@GetMapping("/grades/summary/{id}")
public Result<ExamStudentVO> gradesSummary(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesSummary(id));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-详情-成绩分析")
@GetMapping("/grades/analysis/{id}")
public Result<Map<String,ExamStudentVO>> gradesAnalysis(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesAnalysis(id));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-详情-考试统计")
@GetMapping("/grades/statistics/{id}")
public Result<ExamStudentVO> gradesStatistics(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesStatistics(id));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-详情-题目导航")
@GetMapping("/grades/navigation/{id}")
public Result<List<TheoreticalPaperStudentDetailVO>> gradesNavigation(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesNavigation(id));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-详情-列表")
@GetMapping("/grades/list/{id}")
public Result<List<TheoreticalPaperStudentDetailVO>> gradesList(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesList(id));
}
} }
package com.platform.business.controller;
import com.platform.business.model.dto.ExamDetailDTO;
import com.platform.business.model.vo.ExamScoreDetailVO;
import com.platform.business.service.ExamDetailService;
import com.platform.controller.BaseController;
import com.platform.model.resp.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/score")
public class ExamDetailController extends BaseController {
@Resource
private ExamDetailService examDetailService;
@ApiOperation(value = "学生成绩详情")
@PostMapping("/detail")
public Result<ExamScoreDetailVO> queryDetail(@RequestBody ExamDetailDTO examDetailDTO){
return Result.data(examDetailService.queryQuestionList(examDetailDTO));
}
}
package com.platform.business.controller;
import com.platform.business.model.dto.ExamStudentDTO;
import com.platform.business.model.vo.ExamStudentVO;
import com.platform.business.service.ExamStudentService;
import com.platform.controller.BaseController;
import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@RequestMapping("/exam/student")
public class ExamStudentController extends BaseController {
@Resource
private ExamStudentService examStudentService;
@ApiOperation(value = "学生端-学习中心-我的成绩-成绩明细")
@PostMapping("/page")
public TableDataInfo page(@RequestBody ExamStudentDTO examStudentDTO) {
startPage(examStudentDTO.getPageNum(), examStudentDTO.getPageSize());
return getDataTable(examStudentService.page(examStudentDTO));
}
@ApiOperation(value = "学生端-学习中心-我的成绩-汇总")
@GetMapping("/summary/{studentId}")
public Result<Map<String, String>> summary(@PathVariable String studentId) {
return Result.data(examStudentService.summary(studentId));
}
@ApiOperation(value = "根据学生id查询最近的一场考试")
@GetMapping("/recent/{studentId}")
public Result<ExamStudentVO> recent(@PathVariable String studentId) {
return Result.data(examStudentService.recent(studentId));
}
}
package com.platform.business.controller;
import com.platform.business.model.dto.StudentExamAnswerDTO;
import com.platform.business.model.dto.StudentExamCenterQueryDTO;
import com.platform.business.model.entity.UserEntity;
import com.platform.business.model.vo.StudentExamCenterVO;
import com.platform.business.service.AuthenticatedUserService;
import com.platform.business.service.StudentExamCenterService;
import com.platform.controller.BaseController;
import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* 学员端“学习中心-考试中心”控制器。
*
* <p>本控制器只处理考试安排和在线作答流程;正式成绩展示由StudentScoreController负责。
* 所有入口都使用JWT中的当前学员,不接受客户端传入的userId/studentId。</p>
*/
@Api(tags = "学员端-考试中心")
@RestController
@RequestMapping("/exam/student/center")
public class StudentExamCenterController extends BaseController {
@Resource
private StudentExamCenterService studentExamCenterService;
@Resource
private AuthenticatedUserService authenticatedUserService;
@ApiOperation("考试中心分页列表")
@PostMapping("/page")
public TableDataInfo page(@RequestBody(required = false) StudentExamCenterQueryDTO query,
HttpServletRequest request) {
StudentExamCenterQueryDTO safeQuery = query == null
? new StudentExamCenterQueryDTO() : query;
normalizePage(safeQuery);
String studentId = currentStudentId(request);
startPage(safeQuery.getPageNum(), safeQuery.getPageSize());
return getDataTable(studentExamCenterService.page(safeQuery, studentId));
}
@ApiOperation("进入考试前的考试说明")
@GetMapping("/{examStudentId}/instructions")
public Result<StudentExamCenterVO.Instructions> instructions(
@PathVariable Integer examStudentId, HttpServletRequest request) {
return Result.data(studentExamCenterService.instructions(
examStudentId, currentStudentId(request)));
}
@ApiOperation("开始或恢复在线理论考试")
@PostMapping("/{examStudentId}/start")
public Result<Integer> start(@PathVariable Integer examStudentId,
HttpServletRequest request) {
return Result.data(studentExamCenterService.start(examStudentId, currentStudentId(request)));
}
@ApiOperation("在线理论考试试卷及作答进度")
@GetMapping("/attempts/{examStudentId}/paper")
public Result<StudentExamCenterVO.Paper> paper(@PathVariable Integer examStudentId,
HttpServletRequest request) {
return Result.data(studentExamCenterService.paper(examStudentId, currentStudentId(request)));
}
@ApiOperation("保存单题答案")
@PutMapping("/attempts/{examStudentId}/questions/{questionId}/answer")
public Result<Boolean> saveAnswer(@PathVariable Integer examStudentId,
@PathVariable String questionId,
@RequestBody StudentExamAnswerDTO answer,
HttpServletRequest request) {
return Result.data(studentExamCenterService.saveAnswer(
examStudentId, questionId, answer, currentStudentId(request)));
}
@ApiOperation("交卷前校验")
@GetMapping("/attempts/{examStudentId}/submit-check")
public Result<StudentExamCenterVO.SubmitCheck> submitCheck(
@PathVariable Integer examStudentId, HttpServletRequest request) {
return Result.data(studentExamCenterService.submitCheck(
examStudentId, currentStudentId(request)));
}
@ApiOperation("确认交卷")
@PostMapping("/attempts/{examStudentId}/submit")
public Result<StudentExamCenterVO.SubmitResult> submit(
@PathVariable Integer examStudentId, HttpServletRequest request) {
return Result.data(studentExamCenterService.submit(
examStudentId, currentStudentId(request)));
}
/** 统一完成JWT解析和学员角色校验,只向业务层传递可信学员ID。 */
private String currentStudentId(HttpServletRequest request) {
UserEntity student = authenticatedUserService.current(request);
authenticatedUserService.requireStudent(student);
return student.getId();
}
private void normalizePage(StudentExamCenterQueryDTO query) {
query.setPageNum(query.getPageNum() <= 0 ? 1 : query.getPageNum());
query.setPageSize(query.getPageSize() <= 0 ? 10 : Math.min(query.getPageSize(), 100));
}
}
package com.platform.business.controller;
import com.platform.business.model.dto.StudentScoreQueryDTO;
import com.platform.business.model.entity.UserEntity;
import com.platform.business.model.vo.StudentScoreVO;
import com.platform.business.service.AuthenticatedUserService;
import com.platform.business.service.StudentScoreService;
import com.platform.controller.BaseController;
import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 学员端“学习中心-我的成绩”控制器。
*
* <p>本模块只查询已经正式发布的成绩,与在线考试作答流程、后台成绩管理完全隔离。</p>
*/
@Api(tags = "学员端-我的成绩")
@RestController
@RequestMapping("/exam/student/scores")
public class StudentScoreController extends BaseController {
@Resource
private StudentScoreService studentScoreService;
@Resource
private AuthenticatedUserService authenticatedUserService;
@ApiOperation("个人正式成绩总览")
@GetMapping("/overview")
public Result<StudentScoreVO.Overview> overview(HttpServletRequest request) {
return Result.data(studentScoreService.overview(currentStudentId(request)));
}
@ApiOperation("正式成绩分页列表")
@PostMapping("/page")
public TableDataInfo page(@RequestBody(required = false) StudentScoreQueryDTO query,
HttpServletRequest request) {
StudentScoreQueryDTO safeQuery = query == null ? new StudentScoreQueryDTO() : query;
normalizePage(safeQuery);
String studentId = currentStudentId(request);
startPage(safeQuery.getPageNum(), safeQuery.getPageSize());
return getDataTable(studentScoreService.page(safeQuery, studentId));
}
@ApiOperation("单场理论或实训成绩聚合详情")
@GetMapping("/{examStudentId}")
public Result<StudentScoreVO.Detail> detail(@PathVariable Integer examStudentId,
HttpServletRequest request) {
return Result.data(studentScoreService.detail(examStudentId, currentStudentId(request)));
}
@ApiOperation("导出本人单场正式成绩CSV")
@GetMapping("/{examStudentId}/export")
public void export(@PathVariable Integer examStudentId, HttpServletRequest request,
HttpServletResponse response) {
studentScoreService.export(examStudentId, currentStudentId(request), response);
}
/** 每个入口都执行JWT解析与学员角色校验,避免通过路径参数查询其他学员成绩。 */
private String currentStudentId(HttpServletRequest request) {
UserEntity student = authenticatedUserService.current(request);
authenticatedUserService.requireStudent(student);
return student.getId();
}
private void normalizePage(StudentScoreQueryDTO query) {
query.setPageNum(query.getPageNum() <= 0 ? 1 : query.getPageNum());
query.setPageSize(query.getPageSize() <= 0 ? 10 : Math.min(query.getPageSize(), 100));
}
}
...@@ -9,7 +9,6 @@ import com.platform.business.model.vo.ExamAdminDetailVO; ...@@ -9,7 +9,6 @@ import com.platform.business.model.vo.ExamAdminDetailVO;
import com.platform.business.model.vo.ExamAdminStudentOptionVO; import com.platform.business.model.vo.ExamAdminStudentOptionVO;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import com.platform.business.model.vo.ExamVO; import com.platform.business.model.vo.ExamVO;
import com.platform.business.model.vo.TheoreticalPaperStudentDetailVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -27,22 +26,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> { ...@@ -27,22 +26,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
List<ExamVO> queryByClassId(Integer classId); List<ExamVO> queryByClassId(Integer classId);
List<ExamVO> unfinished(ExamDTO examDTO);
List<TheoreticalPaperStudentDetailVO> paperOverview(@Param("studentId") String studentId, @Param("examId") Integer examId, @Param("type") String type);
List<TheoreticalPaperStudentDetailVO> numberAndScore(@Param("studentId") String studentId, @Param("examId") Integer examId);
ExamStudentVO gradesDetail(@Param("id") String id);
TheoreticalPaperStudentDetailVO same(@Param("examId") Integer examId, @Param("studentId") String studentId, @Param("type") String type);
ExamStudentVO gradesSummary(@Param("id") String id);
ExamStudentVO gradesStatistics(@Param("id") String id);
List<ExamStudentVO> gradesAnalysis(@Param("examId") int examId, @Param("studentId") String studentId);
/* ==================== 管理员端考试管理 ==================== */ /* ==================== 管理员端考试管理 ==================== */
/** 锁定班级行,使同一班级并发创建、编辑考试时串行完成冲突校验。 */ /** 锁定班级行,使同一班级并发创建、编辑考试时串行完成冲突校验。 */
......
...@@ -3,12 +3,10 @@ package com.platform.business.mapper; ...@@ -3,12 +3,10 @@ package com.platform.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.platform.business.model.entity.ExamStudentEntity; import com.platform.business.model.entity.ExamStudentEntity;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> { public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> {
...@@ -17,17 +15,8 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> { ...@@ -17,17 +15,8 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> {
List<ExamStudentVO> queryByClassIdAndExamId(@Param("classId") Integer classId,@Param("examId") Integer examId); List<ExamStudentVO> queryByClassIdAndExamId(@Param("classId") Integer classId,@Param("examId") Integer examId);
List<ExamStudentVO> page(@Param("studentId") String studentId);
ExamStudentVO paperDetail(@Param("id") Integer id);
List<ExamStudentVO> queryOneself(@Param("userId") String userId); List<ExamStudentVO> queryOneself(@Param("userId") String userId);
List<ExamStudentVO> queryOneselfTeacher(@Param("userId")String userId); List<ExamStudentVO> queryOneselfTeacher(@Param("userId")String userId);
Map<String, String> summary(@Param("studentId") String studentId);
ExamStudentVO recent(@Param("studentId") String studentId);
List<ExamStudentVO> theSameEvent(@Param("examId") Integer examId);
} }
package com.platform.business.mapper;
import com.platform.business.model.dto.StudentExamCenterQueryDTO;
import com.platform.business.model.entity.TheoreticalPaperStudentDetailEntity;
import com.platform.business.model.vo.StudentExamCenterVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** 学员考试中心专用Mapper,所有详情查询均包含当前学员ID作为归属条件。 */
@Mapper
public interface StudentExamCenterMapper {
List<StudentExamCenterVO.ListItem> selectPage(@Param("query") StudentExamCenterQueryDTO query,
@Param("studentId") String studentId);
StudentExamCenterVO.Attempt selectAttempt(@Param("examStudentId") Integer examStudentId,
@Param("studentId") String studentId);
StudentExamCenterVO.Attempt selectAttemptForUpdate(
@Param("examStudentId") Integer examStudentId,
@Param("studentId") String studentId);
int countGeneratedQuestions(@Param("examId") Integer examId,
@Param("studentId") String studentId);
int updateAttemptStarted(@Param("examStudentId") Integer examStudentId,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime,
@Param("answerTime") String answerTime);
List<StudentExamCenterVO.Question> selectPaperQuestions(@Param("examId") Integer examId,
@Param("studentId") String studentId);
TheoreticalPaperStudentDetailEntity selectQuestionForUpdate(
@Param("questionId") String questionId,
@Param("examId") Integer examId,
@Param("studentId") String studentId);
int updateAnswer(@Param("questionId") String questionId,
@Param("actualChoice") String actualChoice);
List<TheoreticalPaperStudentDetailEntity> selectQuestionsForSubmit(
@Param("examId") Integer examId,
@Param("studentId") String studentId);
int updateQuestionResult(@Param("id") String id,
@Param("result") Boolean result,
@Param("actualScore") Double actualScore);
int updateAttemptSubmitted(@Param("examStudentId") Integer examStudentId,
@Param("score") Double score,
@Param("duration") String duration,
@Param("answerTime") String answerTime);
}
package com.platform.business.mapper;
import com.platform.business.model.dto.StudentScoreQueryDTO;
import com.platform.business.model.vo.StudentScoreVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/** 学员成绩专用Mapper,统一实现正式发布口径和MySQL 5.7兼容统计。 */
@Mapper
public interface StudentScoreMapper {
StudentScoreVO.Overview selectOverview(@Param("studentId") String studentId);
Integer selectCurrentClassId(@Param("studentId") String studentId,
@Param("today") Date today);
Integer selectClassRank(@Param("classId") Integer classId,
@Param("studentId") String studentId);
List<StudentScoreVO.ListItem> selectPage(@Param("query") StudentScoreQueryDTO query,
@Param("studentId") String studentId);
StudentScoreVO.Detail selectDetail(@Param("examStudentId") Integer examStudentId,
@Param("studentId") String studentId);
List<StudentScoreVO.TheoryQuestion> selectTheoryQuestions(
@Param("examId") Integer examId,
@Param("studentId") String studentId);
List<StudentScoreVO.TypeAnalysis> selectTheoryPersonalAnalysis(
@Param("examId") Integer examId,
@Param("studentId") String studentId);
List<StudentScoreVO.TypeAnalysis> selectTheoryClassAnalysis(
@Param("examId") Integer examId,
@Param("classId") Integer classId);
List<StudentScoreVO.PracticeItem> selectPracticeItems(
@Param("examId") Integer examId,
@Param("studentId") String studentId);
}
...@@ -2,15 +2,11 @@ package com.platform.business.service; ...@@ -2,15 +2,11 @@ package com.platform.business.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.business.model.dto.ExamDTO; import com.platform.business.model.dto.ExamDTO;
import com.platform.business.model.dto.TheoreticalPaperStudentDetailDTO;
import com.platform.business.model.entity.ExamEntity; import com.platform.business.model.entity.ExamEntity;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import com.platform.business.model.vo.ExamVO; import com.platform.business.model.vo.ExamVO;
import com.platform.business.model.vo.TheoreticalPaperStudentDetailVO;
import com.platform.model.resp.Result;
import java.util.List; import java.util.List;
import java.util.Map;
public interface ExamService extends IService<ExamEntity> { public interface ExamService extends IService<ExamEntity> {
List<ExamVO> queryList(ExamDTO examDTO); List<ExamVO> queryList(ExamDTO examDTO);
...@@ -27,34 +23,4 @@ public interface ExamService extends IService<ExamEntity> { ...@@ -27,34 +23,4 @@ public interface ExamService extends IService<ExamEntity> {
List<ExamVO> queryByClassId(Integer classId); List<ExamVO> queryByClassId(Integer classId);
List<ExamVO> unfinished(ExamDTO examDTO);
Result<Integer> startExam(ExamDTO examDTO);
List<TheoreticalPaperStudentDetailVO> paperOverview(Integer id);
ExamStudentVO paperDetail(Integer id);
TheoreticalPaperStudentDetailVO questionDetail(String id);
Boolean questionEdit(TheoreticalPaperStudentDetailDTO theoreticalPaperStudentDetailDTO);
Map<String,String> submitCheck(String id);
Result<Boolean> submit(String id);
TheoreticalPaperStudentDetailVO gradesQuestionDetail(String id);
ExamStudentVO gradesDetail(String id);
ExamStudentVO gradesSummary(String id);
Map<String,ExamStudentVO> gradesAnalysis(String id);
ExamStudentVO gradesStatistics(String id);
List<TheoreticalPaperStudentDetailVO> gradesNavigation(String id);
List<TheoreticalPaperStudentDetailVO> gradesList(String id);
} }
package com.platform.business.service; package com.platform.business.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.business.model.dto.ExamStudentDTO;
import com.platform.business.model.entity.ExamStudentEntity; import com.platform.business.model.entity.ExamStudentEntity;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import java.util.List; import java.util.List;
import java.util.Map;
public interface ExamStudentService extends IService<ExamStudentEntity> { public interface ExamStudentService extends IService<ExamStudentEntity> {
...@@ -20,16 +18,8 @@ public interface ExamStudentService extends IService<ExamStudentEntity> { ...@@ -20,16 +18,8 @@ public interface ExamStudentService extends IService<ExamStudentEntity> {
List<ExamStudentVO> queryByClassIdAndExamId( Integer classId, Integer examId); List<ExamStudentVO> queryByClassIdAndExamId( Integer classId, Integer examId);
List<ExamStudentVO> page(ExamStudentDTO examStudentDTO);
ExamStudentVO paperDetail(Integer id);
List<ExamStudentVO> queryOneself(String userId); List<ExamStudentVO> queryOneself(String userId);
List<ExamStudentVO> queryOneselfTeacher(String userId); List<ExamStudentVO> queryOneselfTeacher(String userId);
Map<String, String> summary(String studentId);
ExamStudentVO recent(String studentId);
} }
package com.platform.business.service;
import com.platform.business.model.dto.StudentExamAnswerDTO;
import com.platform.business.model.dto.StudentExamCenterQueryDTO;
import com.platform.business.model.vo.StudentExamCenterVO;
import java.util.List;
/** 学员端考试中心业务服务,与后台考试管理及学生成绩查询完全分离。 */
public interface StudentExamCenterService {
List<StudentExamCenterVO.ListItem> page(StudentExamCenterQueryDTO query, String studentId);
StudentExamCenterVO.Instructions instructions(Integer examStudentId, String studentId);
Integer start(Integer examStudentId, String studentId);
StudentExamCenterVO.Paper paper(Integer examStudentId, String studentId);
Boolean saveAnswer(Integer examStudentId, String questionId, StudentExamAnswerDTO answer,
String studentId);
StudentExamCenterVO.SubmitCheck submitCheck(Integer examStudentId, String studentId);
StudentExamCenterVO.SubmitResult submit(Integer examStudentId, String studentId);
}
package com.platform.business.service;
import com.platform.business.model.dto.StudentScoreQueryDTO;
import com.platform.business.model.vo.StudentScoreVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** 学员端“我的成绩”只读查询与单场导出服务。 */
public interface StudentScoreService {
StudentScoreVO.Overview overview(String studentId);
List<StudentScoreVO.ListItem> page(StudentScoreQueryDTO query, String studentId);
StudentScoreVO.Detail detail(Integer examStudentId, String studentId);
void export(Integer examStudentId, String studentId, HttpServletResponse response);
}
...@@ -2,24 +2,16 @@ package com.platform.business.service.impl; ...@@ -2,24 +2,16 @@ package com.platform.business.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.business.mapper.ExamStudentMapper; import com.platform.business.mapper.ExamStudentMapper;
import com.platform.business.model.dto.ExamStudentDTO;
import com.platform.business.model.entity.ExamStudentEntity; import com.platform.business.model.entity.ExamStudentEntity;
import com.platform.business.model.vo.ExamStudentVO; import com.platform.business.model.vo.ExamStudentVO;
import com.platform.business.service.ExamStudentService; import com.platform.business.service.ExamStudentService;
import com.platform.business.service.UserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamStudentEntity> implements ExamStudentService { public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamStudentEntity> implements ExamStudentService {
@Resource
private UserService userService;
@Override @Override
public List<ExamStudentVO> queryByExamId(int id) { public List<ExamStudentVO> queryByExamId(int id) {
return baseMapper.queryByExamId(id); return baseMapper.queryByExamId(id);
...@@ -31,16 +23,6 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam ...@@ -31,16 +23,6 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
return baseMapper.queryByClassIdAndExamId(classId, examId); return baseMapper.queryByClassIdAndExamId(classId, examId);
} }
@Override
public List<ExamStudentVO> page(ExamStudentDTO examStudentDTO) {
return baseMapper.page(examStudentDTO.getStudentId());
}
@Override
public ExamStudentVO paperDetail(Integer id) {
return baseMapper.paperDetail(id);
}
@Override @Override
public List<ExamStudentVO> queryOneself(String userId) { public List<ExamStudentVO> queryOneself(String userId) {
return baseMapper.queryOneself(userId); return baseMapper.queryOneself(userId);
...@@ -51,25 +33,4 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam ...@@ -51,25 +33,4 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
return baseMapper.queryOneselfTeacher(userId); return baseMapper.queryOneselfTeacher(userId);
} }
@Override
public Map<String, String> summary(String studentId) {
Map<String, String> result = new HashMap<>();
Map<String, String> summary = baseMapper.summary(studentId);
if (summary != null && !summary.isEmpty()) {
result.put("平均成绩", summary.get("overallAvgScore"));
result.put("班级排名", summary.get("classRank"));
result.put("最高分", summary.get("highestScore"));
result.put("考试次数", summary.get("examCount"));
}
return result;
}
@Override
public ExamStudentVO recent(String studentId) {
ExamStudentVO examStudentVO = baseMapper.recent(studentId);
//获取同一场考试的学生
List<ExamStudentVO> data = baseMapper.theSameEvent(examStudentVO.getExamId());
examStudentVO.setData(data);
return examStudentVO;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment