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; @Api(tags = "运维管理\\控制台") @RestController @SuppressWarnings("ALL") @RequestMapping("/ctrl") public class CtrlController extends BaseController { @Autowired private ScheduleService scheduleService; @SysLog() @ApiOperation(value = "查询服务器状态") @GetMapping(value = "/selectServerStatus") public ResponseMsg 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 selectCpuInfo() { try { JSONObject jsonObject = scheduleService.selectCpuInfo(); return success(jsonObject); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @ApiOperation(value = "查询内存信息") @GetMapping(value = "/selectMemInfo") public ResponseMsg selectMemInfo() { try { JSONObject jsonObject = scheduleService.selectMemInfo(); return success(jsonObject); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @ApiOperation(value = "查询在线用户") @GetMapping(value = "/selectOnlineUsers") public ResponseMsg> selectOnlineUsers() { try { List list = scheduleService.selectOnlineUsers(); return success(list); } catch (Exception ex) { return fail(ex, null); } } @SysLog() @ApiOperation(value = "查询服务资源状态") @GetMapping(value = "/selectResStatus") public ResponseMsg> selectResStatus() { try { List list = scheduleService.selectResStatus(); return success(list); } catch (Exception ex) { return fail(ex, null); } } }