|
|
@@ -4,8 +4,14 @@ import cn.seecoder.ojserver.model.vo.ProblemVO;
|
|
|
import cn.seecoder.ojserver.model.vo.TestCaseVO;
|
|
|
import cn.seecoder.ojserver.service.ProblemService;
|
|
|
import cn.seecoder.ojserver.web.Response;
|
|
|
+import com.nju.edu.paasMonitorClient.MonitorClient;
|
|
|
+import com.nju.edu.paasMonitorClient.entity.Call;
|
|
|
+import com.nju.edu.paasMonitorCommon.enums.SeecSystem;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.net.Inet4Address;
|
|
|
+import java.net.InetAddress;
|
|
|
+import java.net.UnknownHostException;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@@ -29,9 +35,30 @@ public class ProblemController {
|
|
|
|
|
|
@GetMapping("")
|
|
|
public Response getAll(){
|
|
|
- return Response.buildSuccess(this.problemService.getAllProblemsBasic());
|
|
|
+ Call call = MonitorClient.createCall(SeecSystem.PAAS,"problem","getAll");
|
|
|
+ try{
|
|
|
+ call.start();
|
|
|
+ return Response.buildSuccess(this.problemService.getAllProblemsBasic());
|
|
|
+ }catch (Exception e){
|
|
|
+ call.fail();
|
|
|
+ }finally {
|
|
|
+ call.end();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/ip")
|
|
|
+ public Response getIp() throws UnknownHostException {
|
|
|
+ try {
|
|
|
+ InetAddress ip4 = Inet4Address.getLocalHost();
|
|
|
+ return Response.buildSuccess(ip4.getHostAddress());
|
|
|
+ } catch (UnknownHostException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/{problemId:\\d+}")
|
|
|
public Response getProblemById(@PathVariable int problemId){
|
|
|
return Response.buildSuccess(this.problemService.getProblemById(problemId));
|