use of top.hcode.hoj.remoteJudge.task.RemoteJudgeStrategy in project HOJ by HimitZH.
the class RemoteJudgeContext method judge.
@Async
public void judge(ToJudge toJudge) {
String[] source = toJudge.getRemoteJudgeProblem().split("-");
String remoteOj = source[0];
String remoteProblemId = source[1];
RemoteJudgeDTO remoteJudgeDTO = RemoteJudgeDTO.builder().judgeId(toJudge.getJudge().getSubmitId()).uid(toJudge.getJudge().getUid()).cid(toJudge.getJudge().getCid()).pid(toJudge.getJudge().getPid()).username(toJudge.getUsername()).password(toJudge.getPassword()).oj(remoteOj).completeProblemId(remoteProblemId).userCode(toJudge.getJudge().getCode()).language(toJudge.getJudge().getLanguage()).serverIp(toJudge.getJudgeServerIp()).serverPort(toJudge.getJudgeServerPort()).submitId(toJudge.getJudge().getVjudgeSubmitId()).build();
initProblemId(remoteJudgeDTO);
Boolean isHasSubmitIdRemoteReJudge = toJudge.getIsHasSubmitIdRemoteReJudge();
RemoteJudgeStrategy remoteJudgeStrategy = buildJudgeStrategy(remoteJudgeDTO);
if (remoteJudgeStrategy != null) {
if (isHasSubmitIdRemoteReJudge != null && isHasSubmitIdRemoteReJudge) {
// 拥有远程oj的submitId远程判题的重判
remoteJudgeGetResult.process(remoteJudgeStrategy);
} else {
// 调用远程判题
boolean isSubmitOk = remoteJudgeToSubmit.process(remoteJudgeStrategy);
if (isSubmitOk) {
remoteJudgeGetResult.process(remoteJudgeStrategy);
}
}
}
}
use of top.hcode.hoj.remoteJudge.task.RemoteJudgeStrategy in project HOJ by HimitZH.
the class RemoteJudgeContext method buildJudgeStrategy.
private RemoteJudgeStrategy buildJudgeStrategy(RemoteJudgeDTO remoteJudgeDTO) {
RemoteJudgeStrategy remoteJudgeStrategy = RemoteJudgeFactory.selectJudge(remoteJudgeDTO.getOj());
if (remoteJudgeStrategy == null) {
// 更新此次提交状态为系统失败!
UpdateWrapper<Judge> judgeUpdateWrapper = new UpdateWrapper<>();
judgeUpdateWrapper.set("status", Constants.Judge.STATUS_SYSTEM_ERROR.getStatus()).set("error_message", "The judge server does not support this oj:" + remoteJudgeDTO.getOj()).eq("submit_id", remoteJudgeDTO.getJudgeId());
judgeEntityService.update(judgeUpdateWrapper);
return null;
}
remoteJudgeStrategy.setRemoteJudgeDTO(remoteJudgeDTO);
return remoteJudgeStrategy;
}
use of top.hcode.hoj.remoteJudge.task.RemoteJudgeStrategy in project HOJ by HimitZH.
the class RemoteJudgeContext method judge.
@Async
public void judge(ToJudgeDTO toJudgeDTO) {
String[] source = toJudgeDTO.getRemoteJudgeProblem().split("-");
String remoteOj = source[0];
String remoteProblemId = source[1];
RemoteJudgeDTO remoteJudgeDTO = RemoteJudgeDTO.builder().judgeId(toJudgeDTO.getJudge().getSubmitId()).uid(toJudgeDTO.getJudge().getUid()).cid(toJudgeDTO.getJudge().getCid()).pid(toJudgeDTO.getJudge().getPid()).gid(toJudgeDTO.getJudge().getGid()).username(toJudgeDTO.getUsername()).password(toJudgeDTO.getPassword()).oj(remoteOj).completeProblemId(remoteProblemId).userCode(toJudgeDTO.getJudge().getCode()).language(toJudgeDTO.getJudge().getLanguage()).serverIp(toJudgeDTO.getJudgeServerIp()).serverPort(toJudgeDTO.getJudgeServerPort()).submitId(toJudgeDTO.getJudge().getVjudgeSubmitId()).build();
initProblemId(remoteJudgeDTO);
Boolean isHasSubmitIdRemoteReJudge = toJudgeDTO.getIsHasSubmitIdRemoteReJudge();
RemoteJudgeStrategy remoteJudgeStrategy = buildJudgeStrategy(remoteJudgeDTO);
if (remoteJudgeStrategy != null) {
if (isHasSubmitIdRemoteReJudge != null && isHasSubmitIdRemoteReJudge) {
// 拥有远程oj的submitId远程判题的重判
remoteJudgeGetResult.process(remoteJudgeStrategy);
} else {
// 调用远程判题
boolean isSubmitOk = remoteJudgeToSubmit.process(remoteJudgeStrategy);
if (isSubmitOk) {
remoteJudgeGetResult.process(remoteJudgeStrategy);
}
}
}
}
Aggregations