月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-06-02 c31e03f0e51214a524d3fc34d30f3459698ff625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package com.moon.server.controller.sys;
 
import com.alibaba.fastjson.JSONObject;
import com.moon.server.annotation.SysLog;
import com.moon.server.controller.all.BaseController;
import com.moon.server.entity.all.ResponseMsg;
import com.moon.server.entity.sys.ResEntity;
import com.moon.server.service.all.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * 控制台控制器
 * @author WWW
 * @date   2022-09-21
 */
@Api(tags = "运维管理\\控制台")
@RestController
@RequestMapping("/ctrl")
public class CtrlController extends BaseController {
    @Autowired
    private ScheduleService scheduleService;
 
    @SysLog()
    @ApiOperation(value = "查询服务器状态")
    @GetMapping(value = "/selectServerStatus")
    public ResponseMsg<JSONObject> selectServerStatus() {
        try {
            JSONObject jsonObject = scheduleService.selectServerStatus();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询Cpu信息")
    @GetMapping(value = "/selectCpuInfo")
    public ResponseMsg<JSONObject> selectCpuInfo() {
        try {
            JSONObject jsonObject = scheduleService.selectCpuInfo();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询内存信息")
    @GetMapping(value = "/selectMemInfo")
    public ResponseMsg<JSONObject> selectMemInfo() {
        try {
            JSONObject jsonObject = scheduleService.selectMemInfo();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询在线用户")
    @GetMapping(value = "/selectOnlineUsers")
    public ResponseMsg<List<JSONObject>> selectOnlineUsers() {
        try {
            List<JSONObject> list = scheduleService.selectOnlineUsers();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询服务资源状态")
    @GetMapping(value = "/selectResStatus")
    public ResponseMsg<List<ResEntity>> selectResStatus() {
        try {
            List<ResEntity> list = scheduleService.selectResStatus();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}