This commit is contained in:
Himit_ZH 2021-08-09 01:58:10 +08:00
parent e42de86d19
commit 1ec19420bb
5 changed files with 11 additions and 14 deletions

View File

@ -56,7 +56,7 @@ public class RemoteJudgeGetResult {
.eq("submit_id", submitId);
judgeService.update(judgeUpdateWrapper);
changePOJAccountStatus(remoteJudge, username, password);
changeAccountStatus(remoteJudge, username, password);
scheduler.shutdown();
@ -71,7 +71,7 @@ public class RemoteJudgeGetResult {
status.intValue() != Constants.Judge.STATUS_JUDGING.getStatus()) {
// 由于POJ特殊 之前获取提交ID未释放账号所以在此需要将账号变为可用
changePOJAccountStatus(remoteJudge, username, password);
changeAccountStatus(remoteJudge, username, password);
Integer time = (Integer) result.getOrDefault("time", null);
Integer memory = (Integer) result.getOrDefault("memory", null);
@ -123,14 +123,13 @@ public class RemoteJudgeGetResult {
}
public void changePOJAccountStatus(String remoteJudge, String username, String password) {
public void changeAccountStatus(String remoteJudge, String username, String password) {
// 由于POJ特殊 之前获取提交ID未释放账号所以在此需要将账号变为可用
if (remoteJudge.equals(Constants.RemoteJudge.POJ_JUDGE.getName())) {
UpdateWrapper<RemoteJudgeAccount> remoteJudgeAccountUpdateWrapper = new UpdateWrapper<>();
remoteJudgeAccountUpdateWrapper.set("status", true)
.eq("oj", remoteJudge)
.eq("username", username)
.eq("password", password);
.eq("username", username);
boolean isOk = remoteJudgeAccountService.update(remoteJudgeAccountUpdateWrapper);
if (!isOk) {
log.error("远程判题:修正账号为可用状态失败----------->{}", "username:" + username + ",password:" + password);

View File

@ -63,8 +63,7 @@ public class RemoteJudgeToSubmit {
UpdateWrapper<RemoteJudgeAccount> remoteJudgeAccountUpdateWrapper = new UpdateWrapper<>();
remoteJudgeAccountUpdateWrapper.set("status", true)
.eq("oj", remoteJudge)
.eq("username", username)
.eq("password", password);
.eq("username", username);
boolean isOk = remoteJudgeAccountService.update(remoteJudgeAccountUpdateWrapper);
if (!isOk) {
log.error("远程判题:修正账号为可用状态失败----------->{}", "username:" + username + ",password:" + password);
@ -86,13 +85,12 @@ public class RemoteJudgeToSubmit {
log.error("网络错误---------------->获取不到提交ID");
return;
}else {
// 由于POJ特殊 需要一直保持提交和获取结果时账号唯一所以需要特别过滤
if (!remoteJudge.equals(Constants.RemoteJudge.POJ_JUDGE.getName())) {
// POJ特殊 需要一直保持提交和获取结果时账号唯一所以需要特别过滤
if (!remoteJudge.equals(Constants.RemoteJudge.POJ_JUDGE.getName()) ) {
UpdateWrapper<RemoteJudgeAccount> remoteJudgeAccountUpdateWrapper = new UpdateWrapper<>();
remoteJudgeAccountUpdateWrapper.set("status", true)
.eq("oj", remoteJudge)
.eq("username", username)
.eq("password", password);
.eq("username", username);
boolean isOk = remoteJudgeAccountService.update(remoteJudgeAccountUpdateWrapper);
if (!isOk) {
log.error("远程判题:修正账号为可用状态失败----------->{}", "username:" + username + ",password:" + password);

View File

@ -90,7 +90,7 @@ public class HduJudge implements RemoteJudgeStrategy {
// 找到时
Validate.isTrue(matcher.find());
String rawStatus = matcher.group(1).replaceAll("<[\\s\\S]*?>", "").trim();
Constants.Judge statusType = statusTypeMap.get(rawStatus);
Constants.Judge statusType = statusTypeMap.getOrDefault(rawStatus, Constants.Judge.STATUS_PENDING);
if (statusType == Constants.Judge.STATUS_PENDING) {
return MapUtil.builder(new HashMap<String, Object>())
.put("status", statusType.getStatus()).build();
@ -168,6 +168,7 @@ public class HduJudge implements RemoteJudgeStrategy {
put("Wrong Answer", Constants.Judge.STATUS_WRONG_ANSWER);
put("Compilation Error", Constants.Judge.STATUS_COMPILE_ERROR);
put("Queuing", Constants.Judge.STATUS_PENDING);
put("Running", Constants.Judge.STATUS_JUDGING);
put("Compiling", Constants.Judge.STATUS_COMPILING);
put("Time Limit Exceeded", Constants.Judge.STATUS_TIME_LIMIT_EXCEEDED);
put("Presentation Error", Constants.Judge.STATUS_PRESENTATION_ERROR);

View File

@ -102,7 +102,7 @@ public class POJJudge implements RemoteJudgeStrategy {
Constants.Judge statusType = statusMap.get(statusStr);
if (statusType == null) {
return MapUtil.builder(new HashMap<String, Object>())
.put("status", Constants.Judge.STATUS_JUDGING).build();
.put("status", Constants.Judge.STATUS_PENDING).build();
}
// 返回的结果map
Map<String, Object> result = MapUtil.builder(new HashMap<String, Object>())

View File

@ -36,7 +36,6 @@ public class RemoteJudgeAccount {
@ApiModelProperty(value = "是否可用")
private Boolean status;
@Version
@TableField(fill = FieldFill.INSERT)
private Long version;