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);
|
}
|
}
|
}
|