|
|
@@ -33,33 +33,33 @@ public class RabbitMQConsumer {
|
|
|
@RabbitListener(queuesToDeclare = @Queue("notice_queue"),concurrency = "30")
|
|
|
public void process(CodeJudgeDTO codeJudgeDTO) {
|
|
|
JudgeResult judgeResult = judgeService.judgeCode(codeJudgeDTO.getProblemId(), codeJudgeDTO.getCodeJudgeVO());
|
|
|
- CodeJudgeResultType message = CodeJudgeResultType.values()[JudgeResultType.ACCEPT.ordinal()];
|
|
|
- for (JudgeResult.Item item : judgeResult.getResultList()) {
|
|
|
- if (item.getResult() != JudgeResultType.ACCEPT) {
|
|
|
- message = CodeJudgeResultType.values()[item.getResult().ordinal()];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int acNum = 0;
|
|
|
- for (JudgeResult.Item item : judgeResult.getResultList()) {
|
|
|
- if (item.getResult() == JudgeResultType.ACCEPT) {
|
|
|
- acNum++;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int score = (acNum / judgeResult.getResultList().size())*100;
|
|
|
-
|
|
|
- Optional<Commit> optionalCommit = commitDAO.findById(codeJudgeDTO.getCommitId());
|
|
|
- if(optionalCommit.isPresent()){
|
|
|
- Commit commit = optionalCommit.get();
|
|
|
- commit.setResult(message.name());
|
|
|
- commit.setScore(score);
|
|
|
- commit.setJudgeTime(new Date());
|
|
|
- commitDAO.save(commit);
|
|
|
- }else{
|
|
|
- throw new CodeJudgeException("找不到commit",103);
|
|
|
- }
|
|
|
+// CodeJudgeResultType message = CodeJudgeResultType.values()[JudgeResultType.ACCEPT.ordinal()];
|
|
|
+// for (JudgeResult.Item item : judgeResult.getResultList()) {
|
|
|
+// if (item.getResult() != JudgeResultType.ACCEPT) {
|
|
|
+// message = CodeJudgeResultType.values()[item.getResult().ordinal()];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// int acNum = 0;
|
|
|
+// for (JudgeResult.Item item : judgeResult.getResultList()) {
|
|
|
+// if (item.getResult() == JudgeResultType.ACCEPT) {
|
|
|
+// acNum++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// int score = (acNum / judgeResult.getResultList().size())*100;
|
|
|
+//
|
|
|
+// Optional<Commit> optionalCommit = commitDAO.findById(codeJudgeDTO.getCommitId());
|
|
|
+// if(optionalCommit.isPresent()){
|
|
|
+// Commit commit = optionalCommit.get();
|
|
|
+// commit.setResult(message.name());
|
|
|
+// commit.setScore(score);
|
|
|
+// commit.setJudgeTime(new Date());
|
|
|
+// commitDAO.save(commit);
|
|
|
+// }else{
|
|
|
+// throw new CodeJudgeException("找不到commit",103);
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
}
|