|
@@ -0,0 +1,53 @@
|
|
|
+package com.ruoyi.sim.controller;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.sim.config.SimDebugConfig;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/sim/config")
|
|
|
+@Api("ConfigController")
|
|
|
+public class ConfigController {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * http://192.168.1.60:8080/sim/config/set?key=CHECK_REPLACE_EMPTY&value=false
|
|
|
+ * http://192.168.1.60:8080/sim/config/set?key=SCHEDULED_CONNECT&value=false
|
|
|
+ *
|
|
|
+ * @param key
|
|
|
+ * @param value
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/set")
|
|
|
+ @ApiOperation("set config")
|
|
|
+ public AjaxResult set(@RequestParam final String key, @RequestParam final String value) {
|
|
|
+ if (SimDebugConfig.KEY_CHECK_REPLACE_EMPTY.equals(key.toUpperCase())) {
|
|
|
+ SimDebugConfig.CHECK_REPLACE_EMPTY = Boolean.valueOf(value);
|
|
|
+ return AjaxResult.success(SimDebugConfig.CHECK_REPLACE_EMPTY);
|
|
|
+ }
|
|
|
+ if (SimDebugConfig.KEY_SCHEDULED_CONNECT.equals(key.toUpperCase())) {
|
|
|
+ SimDebugConfig.SCHEDULED_CONNECT = Boolean.valueOf(value);
|
|
|
+ return AjaxResult.success(SimDebugConfig.SCHEDULED_CONNECT);
|
|
|
+ }
|
|
|
+ return AjaxResult.error("no match key.");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * http://192.168.1.110:8080/sim/config/get?key=CHECK_REPLACE_EMPTY
|
|
|
+ * http://192.168.1.60:8080/sim/config/get?key=SCHEDULED_CONNECT
|
|
|
+ * @param key
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get")
|
|
|
+ @ApiOperation("get config")
|
|
|
+ public AjaxResult get(@RequestParam final String key) {
|
|
|
+ if (SimDebugConfig.KEY_CHECK_REPLACE_EMPTY.equals(key.toUpperCase())) {
|
|
|
+ return AjaxResult.success(SimDebugConfig.CHECK_REPLACE_EMPTY);
|
|
|
+ }
|
|
|
+ if (SimDebugConfig.KEY_SCHEDULED_CONNECT.equals(key.toUpperCase())) {
|
|
|
+ return AjaxResult.success(SimDebugConfig.SCHEDULED_CONNECT);
|
|
|
+ }
|
|
|
+ return AjaxResult.error("no match key.");
|
|
|
+ }
|
|
|
+}
|