| | |
| | | |
| | | /** |
| | | * 查询服务器状态 |
| | | * |
| | | * @return |
| | | * @throws InterruptedException |
| | | */ |
| | | public JSONObject selectServerStatus() throws InterruptedException { |
| | | JSONObject json = new JSONObject(); |
| | |
| | | |
| | | /** |
| | | * 查询Cpu信息 |
| | | * |
| | | * @return |
| | | * @throws InterruptedException |
| | | */ |
| | | public JSONObject selectCpuInfo() throws InterruptedException { |
| | | SystemInfo systemInfo = new SystemInfo(); |
| | |
| | | |
| | | /** |
| | | * 查询内存信息 |
| | | * |
| | | * @return |
| | | */ |
| | | public JSONObject selectMemInfo() { |
| | | JSONObject map = new JSONObject(); |
| | |
| | | |
| | | /** |
| | | * 查询在线用户 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<JSONObject> selectOnlineUsers() { |
| | | List<JSONObject> list = new ArrayList<JSONObject>(); |
| | |
| | | Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); |
| | | for (String key : keys) { |
| | | Object obj = redisTemplate.opsForValue().get(key); |
| | | if (obj != null && obj instanceof UserEntity) { |
| | | if (obj instanceof UserEntity) { |
| | | UserEntity ue = (UserEntity) obj; |
| | | |
| | | JSONObject map = new JSONObject(); |
| | |
| | | |
| | | /** |
| | | * 查询服务资源状态 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<ResEntity> selectResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | |
| | | |
| | | /** |
| | | * 统计服务资源状态 |
| | | * |
| | | * @return |
| | | */ |
| | | public JSONObject countResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | |
| | | |
| | | /** |
| | | * 资源操作状态 |
| | | * |
| | | * @return |
| | | */ |
| | | |
| | | public JSONObject operateCount() { |
| | | List<OperateEntity> list = operateService.operateCount(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | |
| | | /** |
| | | * 用户登录状态 |
| | | * |
| | | * @return |
| | | */ |
| | | |
| | | public JSONObject userLoginCount() { |
| | | List<LoginEntity> list = loginService.selectLoginCounts(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | if (list.isEmpty()) { |
| | | if (list == null || list.isEmpty()) { |
| | | return null; |
| | | } else { |
| | | List<JSONObject> lister = new ArrayList<JSONObject>(); |
| | | for (LoginEntity key : list) { |
| | | JSONObject map = new JSONObject(); |
| | | map.put("count", key.getCount()); |
| | | map.put("optime", key.getOptime()); |
| | | lister.add(map); |
| | | } |
| | | jsonObject.put("userLoginCount", lister); |
| | | return jsonObject; |
| | | } |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<JSONObject> lister = new ArrayList<JSONObject>(); |
| | | for (LoginEntity key : list) { |
| | | JSONObject map = new JSONObject(); |
| | | map.put("count", key.getCount()); |
| | | map.put("optime", key.getOptime()); |
| | | lister.add(map); |
| | | } |
| | | jsonObject.put("userLoginCount", lister); |
| | | |
| | | return jsonObject; |
| | | } |
| | | } |