deason 5 tahun lalu
induk
melakukan
14e6c9dbba

+ 43 - 0
src/main/java/cn/com/qmth/examcloud/app/controller/RouterController.java

@@ -0,0 +1,43 @@
+/*
+ * *************************************************
+ * Copyright (c) 2019 QMTH. All Rights Reserved.
+ * Created by Deason on 2019-08-19 10:38:43.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.app.controller;
+
+import cn.com.qmth.examcloud.app.core.router.Router;
+import cn.com.qmth.examcloud.app.model.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_KEY;
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_TOKEN;
+
+/**
+ * 路由相关接口
+ *
+ * @author: fengdesheng
+ * @since: 2019/8/19
+ */
+@RestController
+@RequestMapping("${$rmp}/")
+@Api(tags = "路由相关接口")
+public class RouterController {
+    private static Logger log = LoggerFactory.getLogger(RouterController.class);
+
+    @ApiOperation(value = "路由接口")
+    @PostMapping(value = "/router")
+    public Result router(@RequestHeader(name = PARAM_APP_KEY) String key,
+                         @RequestHeader(name = PARAM_APP_TOKEN) String token,
+                         @RequestBody Router router) {
+        //todo
+        log.info("router url:" + router.getUrl());
+        return new Result().success();
+    }
+
+}

+ 7 - 0
src/main/java/cn/com/qmth/examcloud/app/core/router/Method.java

@@ -0,0 +1,7 @@
+package cn.com.qmth.examcloud.app.core.router;
+
+public enum Method {
+
+    GET, POST, PUT, DELETE
+
+}

+ 62 - 0
src/main/java/cn/com/qmth/examcloud/app/core/router/Router.java

@@ -0,0 +1,62 @@
+package cn.com.qmth.examcloud.app.core.router;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class Router implements Serializable {
+    private Server server;
+    private String url;
+    private Method method;
+    private Map<String, Object> headers;
+    private Map<String, Object> params;
+    private String body;
+
+    public Server getServer() {
+        return server;
+    }
+
+    public void setServer(Server server) {
+        this.server = server;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public Method getMethod() {
+        return method;
+    }
+
+    public void setMethod(Method method) {
+        this.method = method;
+    }
+
+    public Map<String, Object> getHeaders() {
+        return headers;
+    }
+
+    public void setHeaders(Map<String, Object> headers) {
+        this.headers = headers;
+    }
+
+    public Map<String, Object> getParams() {
+        return params;
+    }
+
+    public void setParams(Map<String, Object> params) {
+        this.params = params;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+}

+ 40 - 0
src/main/java/cn/com/qmth/examcloud/app/core/router/Server.java

@@ -0,0 +1,40 @@
+package cn.com.qmth.examcloud.app.core.router;
+
+public enum Server {
+
+    /**
+     * 基础信息平台
+     */
+    BASIC("EC-CORE-BASIC"),
+
+    /**
+     * 考务平台
+     */
+    EXAMWORK("EC-CORE-EXAMWORK"),
+
+    /**
+     * 网考管理端平台
+     */
+    OE_ADMIN("EC-CORE-OE-ADMIN"),
+
+    /**
+     * 网考学生端平台
+     */
+    OE_STUDENT("EC-CORE-OE-STUDENT"),
+
+    /**
+     * 题库平台
+     */
+    QUESTION("EC-CORE-QUESTION");
+
+    private String instanceName;
+
+    Server(String instanceName) {
+        this.instanceName = instanceName;
+    }
+
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+}