From 8ea6bcb91b4a8b50dfac568b0d0b52cd543b9f8c Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期四, 12 十二月 2024 11:39:05 +0800 Subject: [PATCH] 电源历史告警 --- src/main/java/com/whyc/util/SubTablePageInfoUtil.java | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java index 3ed199d..82a70d7 100644 --- a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java +++ b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java @@ -4,6 +4,8 @@ import com.whyc.factory.ThreadPoolExecutorFactory; import com.whyc.mapper.CommonMapper; import com.whyc.pojo.db_alarm.BattAlarmHistory; +import com.whyc.pojo.db_power_alarm.PowerAlarm; +import com.whyc.pojo.db_power_alarm.PowerAlarmHistory; import com.whyc.service.SubTableService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -32,24 +34,17 @@ Date startTime,Date endTime, String dbName,String tablePrefix, Object pojo) throws ParseException { - Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesDesc(startTime, endTime); + Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesDescWithOutDefault(startTime, endTime); //鏌ヨ鍒嗚〃鏄惁瀛樺湪,瀛樺湪鍒欐煡璇㈢粨鏋� Map<String,Integer> queryCountMap = new LinkedHashMap<>(); Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); for (String tableYear : tableYearKeySet) { List<Date> queryTime = queryTimeForSubTables.get(tableYear); - String tableName; - if(!tableYear.equals("default")){ - //鏁板�� - tableName = tablePrefix+"_"+tableYear; - String existTableName = commonMapper.existTable(dbName, tableName); - if(existTableName == null){ - continue; - } - }else{ - //涓嶅瓨鍦╠efault - //tableName = tablePrefix; + //鏁板�� + String tableName = tablePrefix+"_"+tableYear; + String existTableName = commonMapper.existTable(dbName, tableName); + if(existTableName == null){ continue; } //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== @@ -60,6 +55,15 @@ battAlarmHistory.setAlmEndTime(queryTime.get(1)); battAlarmHistory.setRecordYear(tableName); int currentCount = service.getBattHisCount(battAlarmHistory); + queryCountMap.put(tableYear, currentCount); + } + else if(pojo instanceof PowerAlarmHistory) { + PowerAlarmHistory powerAlarmHistory = new PowerAlarmHistory(); + BeanUtils.copyProperties(pojo, powerAlarmHistory); + powerAlarmHistory.setAlmStartTime(queryTime.get(0)); + powerAlarmHistory.setAlmEndTime(queryTime.get(1)); + powerAlarmHistory.setRecordYear(tableName); + int currentCount = service.getPowerHisCount(powerAlarmHistory); queryCountMap.put(tableYear, currentCount); } @@ -92,7 +96,7 @@ for (String key : keySet) { List<Date> queryTime = queryTimeForSubTables.get(key); //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== - String recordYear = key.equals("default") ? tablePrefix : tablePrefix + "_" + key; + String recordYear = tablePrefix + "_" + key; if(pojo instanceof BattAlarmHistory) { BattAlarmHistory battAlarmHistory = new BattAlarmHistory(); BeanUtils.copyProperties(pojo, battAlarmHistory); @@ -105,6 +109,18 @@ List<BattAlarmHistory> list = service.getBattHisList(battAlarmHistory); dataList.addAll(list); } + else if(pojo instanceof PowerAlarmHistory) { + PowerAlarmHistory powerAlarmHistory = new PowerAlarmHistory(); + BeanUtils.copyProperties(pojo, powerAlarmHistory); + powerAlarmHistory.setAlmStartTime(queryTime.get(0)); + powerAlarmHistory.setAlmEndTime(queryTime.get(1)); + powerAlarmHistory.setRecordYear(recordYear); + List<Integer> limitList = tableAndLimitMap.get(key); + powerAlarmHistory.setLimitStart(limitList.get(0)); + powerAlarmHistory.setLimitEnd(limitList.get(1)); + List<PowerAlarmHistory> list = service.getPowerHisList(powerAlarmHistory); + dataList.addAll(list); + } } pageInfo.setList(dataList); return pageInfo; -- Gitblit v1.9.1