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 {
|
/** 设备编号 */
|
@Excel(name = "设备编号",width = 20)
|
private String serialNumber;
|
|
/** 设备名称 */
|
@Excel(name = "设备名称",width = 20)
|
private String deviceName;
|
|
/** 设备类型 **/
|
private String type;
|
|
/** 改设备当月在线情况 **/
|
private List<TMonitorResult> onlineStateList;
|
/** 内部处理用 */
|
private LocalDate mongoCreateTime;
|
|
/** 标签 */
|
@Excel(name = "标签")
|
private String tag;
|
|
/** 区域 */
|
@Excel(name = "区域")
|
private String area;
|
|
/** 日期 */
|
@Excel(name = "1",width = 10)
|
private String day1;
|
|
/** 日期 */
|
@Excel(name = "2",width = 10)
|
private String day2;
|
|
/** 日期 */
|
@Excel(name = "3",width = 10)
|
private String day3;
|
|
/** 日期 */
|
@Excel(name = "4",width = 10)
|
private String day4;
|
|
/** 日期 */
|
@Excel(name = "5",width = 10)
|
private String day5;
|
|
/** 日期 */
|
@Excel(name = "6",width = 10)
|
private String day6;
|
|
/** 日期 */
|
@Excel(name = "7",width = 10)
|
private String day7;
|
|
/** 日期 */
|
@Excel(name = "8",width = 10)
|
private String day8;
|
|
/** 日期 */
|
@Excel(name = "9",width = 10)
|
private String day9;
|
|
/** 日期 */
|
@Excel(name = "10",width = 10)
|
private String day10;
|
|
/** 日期 */
|
@Excel(name = "11",width = 10)
|
private String day11;
|
|
/** 日期 */
|
@Excel(name = "12",width = 10)
|
private String day12;
|
|
/** 日期 */
|
@Excel(name = "13",width = 10)
|
private String day13;
|
|
/** 日期 */
|
@Excel(name = "14",width = 10)
|
private String day14;
|
|
/** 日期 */
|
@Excel(name = "15",width = 10)
|
private String day15;
|
|
/** 日期 */
|
@Excel(name = "16",width = 10)
|
private String day16;
|
|
/** 日期 */
|
@Excel(name = "17",width = 10)
|
private String day17;
|
|
/** 日期 */
|
@Excel(name = "18",width = 10)
|
private String day18;
|
|
/** 日期 */
|
@Excel(name = "19",width = 10)
|
private String day19;
|
|
/** 日期 */
|
@Excel(name = "20",width = 10)
|
private String day20;
|
|
/** 日期 */
|
@Excel(name = "21",width = 10)
|
private String day21;
|
|
/** 日期 */
|
@Excel(name = "22",width = 10)
|
private String day22;
|
|
/** 日期 */
|
@Excel(name = "23",width = 10)
|
private String day23;
|
|
/** 日期 */
|
@Excel(name = "24",width = 10)
|
private String day24;
|
|
/** 日期 */
|
@Excel(name = "25",width = 10)
|
private String day25;
|
|
/** 日期 */
|
@Excel(name = "26",width = 10)
|
private String day26;
|
|
/** 日期 */
|
@Excel(name = "27",width = 10)
|
private String day27;
|
|
/** 日期 */
|
@Excel(name = "28",width = 10)
|
private String day28;
|
|
/** 日期 */
|
@Excel(name = "29",width = 10)
|
private String day29;
|
|
/** 日期 */
|
@Excel(name = "30",width = 10)
|
private String day30;
|
|
/** 日期 */
|
@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;
|
}
|
|
}
|