|
@@ -0,0 +1,41 @@
|
|
|
+package org.jeecg.modules.visibleClient;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.alibaba.fastjson2.TypeReference;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Api(tags="计算程序客户端调用")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/visibleClient")
|
|
|
+public class controller {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+ @ApiOperation(value="一键启动,调用计算程序同步数据并计算更新", notes="一键启动,调用计算程序同步数据并计算更新")
|
|
|
+ @GetMapping("start")
|
|
|
+ public Result<String> startSummary(){
|
|
|
+ String url = "http://127.0.0.1/dev-api/visibleServer/start";
|
|
|
+ ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
|
|
|
+ String body = forEntity.getBody();
|
|
|
+ Map<String, String> map = JSONObject.parseObject(body, new TypeReference<Map<String, String>>() {
|
|
|
+ });
|
|
|
+ String s = null;
|
|
|
+ if (map != null) {
|
|
|
+ s = map.get("msg");
|
|
|
+ }
|
|
|
+ if (s != null && s.equals("启动成功")) return Result.ok("启动成功");
|
|
|
+ if (s!=null && s.equals("请勿重复启动")) return Result.ok("请勿重复启动");
|
|
|
+ return Result.ok("启动失败");
|
|
|
+ }
|
|
|
+}
|