Browse Source

fix: 删除测试代码

haha 4 years ago
parent
commit
e6d3212850

+ 0 - 15
seec-oj-server/src/main/java/cn/seecoder/ojserver/controller/JudgeController.java

@@ -5,7 +5,6 @@ import cn.seecoder.ojserver.service.JudgeService;
 import cn.seecoder.ojserver.web.Response;
 import com.nju.edu.paasMonitorClient.MonitorClient;
 import com.nju.edu.paasMonitorClient.entity.Call;
-import com.nju.edu.paasMonitorClient.entity.Error;
 import com.nju.edu.paasMonitorCommon.enums.SeecSystem;
 import org.springframework.web.bind.annotation.*;
 
@@ -43,20 +42,6 @@ public class JudgeController {
         }
     }
 
-    @PostMapping("/newcode")
-    public Response newJudgeCode(@RequestParam(value = "problemId") Integer problemId, @RequestBody CodeJudgeVO codeJudgeVO) {
-        Call call = MonitorClient.createCall(SeecSystem.CODER,"newcode","/api/judge/newcode");
-        try{
-            call.start();
-            return Response.buildSuccess(judgeService.newJudgeCode(problemId,codeJudgeVO));
-        }catch (Exception e){
-            MonitorClient.logError(SeecSystem.CODER,"newcode","/api/judge/code",e);
-            call.fail();
-            throw e;
-        }finally {
-            call.end();
-        }
-    }
 
 
 }

+ 0 - 1
seec-oj-server/src/main/java/cn/seecoder/ojserver/service/JudgeService.java

@@ -5,5 +5,4 @@ import cn.seecoder.ojserver.model.vo.CodeJudgeVO;
 
 public interface JudgeService {
     public JudgeResult judgeCode(Integer questionId, CodeJudgeVO codeJudgeVO);
-    public String newJudgeCode(Integer questionId, CodeJudgeVO codeJudgeVO);
 }

+ 0 - 40
seec-oj-server/src/main/java/cn/seecoder/ojserver/service/impl/JudgeServiceImpl.java

@@ -10,14 +10,12 @@ import cn.seecoder.ojserver.manager.QuestionManager;
 import cn.seecoder.ojserver.model.vo.CodeJudgeVO;
 import cn.seecoder.ojserver.service.JudgeService;
 
-import com.alibaba.fastjson.JSON;
 import com.nju.edu.paasMonitorClient.MonitorClient;
 import com.nju.edu.paasMonitorClient.entity.Call;
 import com.nju.edu.paasMonitorCommon.enums.SeecSystem;
 import okhttp3.*;
 import org.springframework.stereotype.Service;
 
-import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -62,43 +60,5 @@ public class JudgeServiceImpl implements JudgeService {
         }
     }
 
-    @Override
-    public String newJudgeCode(Integer questionId, CodeJudgeVO codeJudgeVO) {
-        try {
-            Call call = MonitorClient.createCall(SeecSystem.CODER, "newcode", "buildJudge");
-            call.start();
-            JudgeDTO judgeDTO = new JudgeDTO();
-            judgeDTO.setCode(codeJudgeVO.getCode());
-            judgeDTO.setLanguage(codeJudgeVO.getLanguage());
-            Problem problem = questionManager.getProblemById(questionId).get();
-            List<TestCase> testCaseList = questionManager.getTestCaseByProblemId(questionId);
-            judgeDTO.setMemoryLimit(problem.getMemoryLimit());
-            judgeDTO.setTimeLimit(problem.getTimeLimit());
-            List<String> inputList = testCaseList.stream().map(TestCase::getInput).collect(Collectors.toList());
-            List<String> outputList = testCaseList.stream().map(TestCase::getOutput).collect(Collectors.toList());
-            judgeDTO.setInputList(inputList);
-            judgeDTO.setOutputList(outputList);
-            call.end();
-
-
-            String url = "http://environment-22-200.seec.svc.cluster.local:5000/api/judge";
-            String authStr = JSON.toJSONString(judgeDTO);
-            System.out.println(authStr);
-            Request postRequest = new Request.Builder()
-                    .url(url)
-                    .post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), authStr))
-                    .build();
-            okhttp3.Call authCall = client.newCall(postRequest);
-            Response authResponse = authCall.execute();
-            String body = authResponse.body().string();
-            return body;
-        } catch (ThirdPartyServiceException exception) {
-            throw exception;
-        } catch (IOException ioException) {
-            ioException.printStackTrace();
-        }
-        return null;
-    }
-
 
 }