From 1f11310ba04770a4efe4657d39872590575828f1 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期四, 10 四月 2025 17:17:24 +0800 Subject: [PATCH] 设备未知状态,新增,导出页新增统计一个月的离线数,与在线率 --- ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoDailyExp.java | 64 ++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoDailyExp.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoDailyExp.java index cc1bb92..9f73249 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoDailyExp.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/excel/VideoDailyExp.java @@ -1,7 +1,12 @@ package com.ycl.platform.domain.excel; import annotation.Excel; +import com.ycl.platform.domain.result.SYS.TMonitorResult; import lombok.Data; + +import java.lang.reflect.Field; +import java.time.LocalDate; +import java.util.List; @Data public class VideoDailyExp { @@ -12,6 +17,14 @@ /** 璁惧鍚嶇О */ @Excel(name = "璁惧鍚嶇О",width = 20) private String deviceName; + + /** 璁惧绫诲瀷 **/ + private String type; + + /** 鏀硅澶囧綋鏈堝湪绾挎儏鍐� **/ + private List<TMonitorResult> onlineStateList; + /** 鍐呴儴澶勭悊鐢� */ + private LocalDate mongoCreateTime; /** 鏍囩 */ @Excel(name = "鏍囩") @@ -145,5 +158,56 @@ @Excel(name = "31",width = 10) private String day31; + public boolean isAllOfflineByMonth() { + boolean allOffline = true; + try { + // 閬嶅巻 day1 鍒� day31 + for (int i = 1; i <= 31; i++) { + // 鏋勯�犲瓧娈靛悕 + String fieldName = "day" + i; + // 鑾峰彇瀛楁 + Field field = this.getClass().getDeclaredField(fieldName); + // 纭繚瀛楁鏄鏈夌殑鍙互璁块棶 + field.setAccessible(true); + // 鑾峰彇瀛楁鍊� + String value = (String) field.get(this); + // 妫�鏌ュ�兼槸鍚︿负 "绂荤嚎" + if (!"绂荤嚎".equals(value)) { + allOffline = false; + break; + } + } + + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return allOffline; + } + + public long getAllOnlineDayCountByMonth() { + long count = 0; + try { + + // 閬嶅巻 day1 鍒� day31 + for (int i = 1; i <= 31; i++) { + // 鏋勯�犲瓧娈靛悕 + String fieldName = "day" + i; + // 鑾峰彇瀛楁 + Field field = this.getClass().getDeclaredField(fieldName); + // 纭繚瀛楁鏄鏈夌殑鍙互璁块棶 + field.setAccessible(true); + // 鑾峰彇瀛楁鍊� + String value = (String) field.get(this); + // 妫�鏌ュ�兼槸鍚︿负 "鍦ㄧ嚎" + if ("鍦ㄧ嚎".equals(value)) { + count++; + } + } + + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return count; + } } -- Gitblit v1.8.0