use of top.hcode.hoj.pojo.entity.judge.ToJudge in project HOJ by HimitZH.
the class JudgeController method submitProblemJudge.
@PostMapping(value = "/judge")
public CommonResult submitProblemJudge(@RequestBody ToJudge toJudge) {
if (!toJudge.getToken().equals(judgeToken)) {
return CommonResult.errorResponse("对不起!您使用的判题服务调用凭证不正确!访问受限!", CommonResult.STATUS_ACCESS_DENIED);
}
Judge judge = toJudge.getJudge();
if (judge == null || judge.getSubmitId() == null || judge.getUid() == null || judge.getPid() == null) {
return CommonResult.errorResponse("调用参数错误!请检查您的调用参数!", CommonResult.STATUS_FAIL);
}
// 标志该判题过程进入编译阶段
judge.setStatus(Constants.Judge.STATUS_COMPILING.getStatus());
// 写入当前判题服务的名字
judge.setJudger(name);
judgeService.updateById(judge);
// 进行判题操作
Problem problem = problemService.getById(judge.getPid());
Judge finalJudge = judgeService.Judge(problem, judge);
// 更新该次提交
judgeService.updateById(finalJudge);
if (finalJudge.getStatus().intValue() != Constants.Judge.STATUS_SUBMITTED_FAILED.getStatus()) {
// 更新其它表
judgeService.updateOtherTable(finalJudge.getSubmitId(), finalJudge.getStatus(), finalJudge.getCid(), finalJudge.getUid(), finalJudge.getPid(), finalJudge.getScore(), finalJudge.getTime());
}
return CommonResult.successResponse(finalJudge, "判题机评测完成!");
}