1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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.151:8080/sim/config/set?key=CHECK_REPLACE_EMPTY&value=false
- * 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.");
- }
- }
|