【新增】 服务器通过websocket与学生端进行考试倒计时等交互

This commit is contained in:
dlaren
2025-08-12 17:16:06 +08:00
parent 28c75d52c5
commit f805b16052
7 changed files with 270 additions and 30 deletions

View File

@@ -9,7 +9,9 @@ import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
import pc.exam.pp.module.exam.service.paper.IEducationPaperParamService;
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_SESSION_EXISTS;
/**
* 通用参数Controller
*
@@ -19,23 +21,18 @@ import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_SESS
@Tag(name = "管理后台 - 试卷通用参数")
@RestController
@RequestMapping("/exam/param")
public class EducationPaperParamController
{
public class EducationPaperParamController {
@Autowired
private IEducationPaperParamService educationPaperParamService;
/**
* 获取通用参数详细信息
*/
@Operation(summary = "获取通用参数详细信息")
@GetMapping(value = "/getInfo")
public CommonResult getInfo(@RequestParam("taskId") String taskId)
{
EducationPaperParam educationPaperParam= educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
public CommonResult getInfo(@RequestParam("taskId") String taskId) {
EducationPaperParam educationPaperParam = educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
return CommonResult.success(educationPaperParam);
}
@@ -44,8 +41,7 @@ public class EducationPaperParamController
*/
@Operation(summary = "新增通用参数")
@PostMapping
public CommonResult add(@RequestBody EducationPaperParam educationPaperParam)
{
public CommonResult add(@RequestBody EducationPaperParam educationPaperParam) {
return CommonResult.success(educationPaperParamService.insertEducationPaperParam(educationPaperParam));
}
@@ -54,8 +50,7 @@ public class EducationPaperParamController
*/
@Operation(summary = "修改通用参数")
@PutMapping
public CommonResult edit(@RequestBody EducationPaperParam educationPaperParam)
{
public CommonResult edit(@RequestBody EducationPaperParam educationPaperParam) {
return CommonResult.success(educationPaperParamService.updateEducationPaperParam(educationPaperParam));
}
@@ -64,43 +59,45 @@ public class EducationPaperParamController
*/
@Operation(summary = "删除通用参数")
@DeleteMapping("/{paramIds}")
public CommonResult remove(@PathVariable String[] paramIds)
{
public CommonResult remove(@PathVariable String[] paramIds) {
return CommonResult.success(educationPaperParamService.deleteEducationPaperParamByParamIds(paramIds));
}
/**
* 步骤条 (考场)
*
* @param taskId
* @return
*/
@Operation(summary = "步骤条 (考场)警告")
@GetMapping( "/check-can-enter-step4/{taskId}")
public CommonResult ckeckSession(@PathVariable("taskId") String taskId){
@GetMapping("/check-can-enter-step4/{taskId}")
public CommonResult ckeckSession(@PathVariable("taskId") String taskId) {
EducationPaperParam educationPaperParam = educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
if (educationPaperParam==null){
if (educationPaperParam == null) {
return CommonResult.error(DEMO03_PAPER_SESSION_EXISTS);
}
String isSession = educationPaperParam.getIsSession();
if ("1".equals(isSession)){
if ("1".equals(isSession)) {
return CommonResult.error(DEMO03_PAPER_SESSION_EXISTS);
}
return CommonResult.success("200");
return CommonResult.success("200");
}
/**
* 步骤条 (考场)
*
* @param taskId
* @return
*/
@Operation(summary = "步骤条 (考场)无警告")
@GetMapping( "/check-can-enter-step4NoMsg/{taskId}")
public CommonResult ckeckSessionNoMsg(@PathVariable("taskId") String taskId){
@GetMapping("/check-can-enter-step4NoMsg/{taskId}")
public CommonResult ckeckSessionNoMsg(@PathVariable("taskId") String taskId) {
EducationPaperParam educationPaperParam = educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
if (educationPaperParam==null){
if (educationPaperParam == null) {
return CommonResult.success("1_001_401_001");
}
String isSession = educationPaperParam.getIsSession();
if ("1".equals(isSession)){
if ("1".equals(isSession)) {
return CommonResult.success("1_001_401_001");
}
return CommonResult.success("200");