package com.terra.system.controller.sys; import com.alibaba.fastjson.JSONObject; import com.terra.system.annotation.SysLog; import com.terra.system.controller.all.BaseController; import com.terra.system.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 io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; 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 org.springframework.web.bind.annotation.*; 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 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 selectCpuInfo() { try { JSONObject jsonObject = scheduleService.selectCpuInfo(); return success(jsonObject); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @Operation(summary = "查询内存信息") @GetMapping(value = "/selectMemInfo") public ResponseMsg selectMemInfo() { try { JSONObject jsonObject = scheduleService.selectMemInfo(); return success(jsonObject); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @Operation(summary = "查询在线用户") @GetMapping(value = "/selectOnlineUsers") public ResponseMsg> selectOnlineUsers() { try { List list = scheduleService.selectOnlineUsers(); return success(list); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @Operation(summary = "查询服务资源状态") @GetMapping(value = "/selectResStatus") public ResponseMsg> selectResStatus() { try { List list = scheduleService.selectResStatus(); return success(list); } catch (Exception ex) { return fail(ex, null); } } }