13693261870
昨天 542a030a93de7dbc39e185d4ce355c5894e3cd5b
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
95
package com.terra.system.controller.sys;
 
import com.alibaba.fastjson.JSONObject;
import com.terra.common.annotation.SysLog;
import com.terra.common.controller.all.BaseController;
import com.terra.common.entity.all.ResponseMsg;
import com.terra.system.entity.sys.ResEntity;
import com.terra.system.service.all.ScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import javax.annotation.Resource;
 
import io.swagger.v3.oas.annotations.tags.Tag;
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
 */
@Tag(name = "运维管理\\控制台")
@RestController
@RequestMapping("/ctrl")
public class CtrlController extends BaseController {
    @Resource
    private ScheduleService scheduleService;
 
    @SysLog()
    @Operation(summary = "查询服务器状态")
    @GetMapping(value = "/selectServerStatus")
    public ResponseMsg<JSONObject> selectServerStatus() {
        try {
            JSONObject jsonObject = scheduleService.selectServerStatus();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @Operation(summary = "查询Cpu信息")
    @GetMapping(value = "/selectCpuInfo")
    public ResponseMsg<JSONObject> selectCpuInfo() {
        try {
            JSONObject jsonObject = scheduleService.selectCpuInfo();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @Operation(summary = "查询内存信息")
    @GetMapping(value = "/selectMemInfo")
    public ResponseMsg<JSONObject> selectMemInfo() {
        try {
            JSONObject jsonObject = scheduleService.selectMemInfo();
 
            return success(jsonObject);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @Operation(summary = "查询在线用户")
    @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()
    @Operation(summary = "查询服务资源状态")
    @GetMapping(value = "/selectResStatus")
    public ResponseMsg<List<ResEntity>> selectResStatus() {
        try {
            List<ResEntity> list = scheduleService.selectResStatus();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}