From fabb84e06d1753e438d832b15b7ee8d79efe16b6 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 27 四月 2023 14:11:46 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java |  610 +++++++++++++++++++++++++++---------------------------
 1 files changed, 305 insertions(+), 305 deletions(-)

diff --git a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
index 704dc6c..dd31379 100644
--- a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
+++ b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
@@ -39,216 +39,216 @@
 @Service
 public class WarningAnalyseServiceImpl implements IWarningAnalyseService {
 
-	protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-	@Resource
-	private WarningDetailMapper warningDetailMapper;
+    @Resource
+    private WarningDetailMapper warningDetailMapper;
 
-	@Resource
-	private AlertConfigMapper alertConfigMapper;
+    @Resource
+    private AlertConfigMapper alertConfigMapper;
 
-	@Resource
-	private ICommonService commonService;
+    @Resource
+    private ICommonService commonService;
 
-	@Resource
-	private SuYuanMapper suYuanMapper;
+    @Resource
+    private SuYuanMapper suYuanMapper;
 
-	@Resource
-	private DictRecordMapper dictRecordMapper;
+    @Resource
+    private DictRecordMapper dictRecordMapper;
 
-	@Resource
-	private IAsyncService asyncService;
+    @Resource
+    private IAsyncService asyncService;
 
-	private SimpleDateFormat ymdh = new SimpleDateFormat("yyyyMMddHH");
+    private SimpleDateFormat ymdh = new SimpleDateFormat("yyyyMMddHH");
 
-	private SimpleDateFormat ymdhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    private SimpleDateFormat ymdhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-	@Override
-	@Async("threadPoolTaskExecutor")
-	public void insertWarningDetails(List<WarningDetail> warning) throws Exception {
-		//鎻掑叆鏁版嵁
-		List<List<WarningDetail>> list = Lists.partition(warning, IAsyncService.BATCH_INSERT_NUMBER);
-		CountDownLatch countDownLatch = new CountDownLatch(list.size());
-		for (List<WarningDetail> corpReserveList : list) {
-			asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch);
-		}
-		countDownLatch.await();
-	}
+    @Override
+    @Async("threadPoolTaskExecutor")
+    public void insertWarningDetails(List<WarningDetail> warning) throws Exception {
+        //鎻掑叆鏁版嵁
+        List<List<WarningDetail>> list = Lists.partition(warning, IAsyncService.BATCH_INSERT_NUMBER);
+        CountDownLatch countDownLatch = new CountDownLatch(list.size());
+        for (List<WarningDetail> corpReserveList : list) {
+            asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch);
+        }
+        countDownLatch.await();
+    }
 
-	@Override
-	public List<WarningVo> getRunTimeAlarmAnalyse() {
-		List<WarningVo> result = new ArrayList<>();
-		Date nowDate = DateUtils.getNowDate();
-		//String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
-		//DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
-		//if (StringUtils.isNull(dictRecord)) {
-		//	nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
-		//}
-		//List<WarningDetail> list = alarmAnalyseOperation(nowDate);
+    @Override
+    public List<WarningVo> getRunTimeAlarmAnalyse() {
+        List<WarningVo> result = new ArrayList<>();
+        Date nowDate = DateUtils.getNowDate();
+        //String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
+        //DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
+        //if (StringUtils.isNull(dictRecord)) {
+        //	nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
+        //}
+        //List<WarningDetail> list = alarmAnalyseOperation(nowDate);
 
-		List<WarningDetail> list = new ArrayList<>();
-		Calendar calendar = getCalendar(nowDate);
-		for (int i = 0; i < 3; i++) {
-			calendar.add(Calendar.HOUR, -1);
-			List<WarningDetail> rs = alarmAnalyseOperation(calendar.getTime());
-			if (null != rs && rs.size() > 0) {
-				list.addAll(rs);
-			}
-		}
-		list.forEach(s -> {
-			result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
-		});
-		return result;
-	}
+        List<WarningDetail> list = new ArrayList<>();
+        Calendar calendar = getCalendar(nowDate);
+        for (int i = 0; i < 3; i++) {
+            calendar.add(Calendar.HOUR, -1);
+            List<WarningDetail> rs = alarmAnalyseOperation(calendar.getTime());
+            if (null != rs && rs.size() > 0) {
+                list.addAll(rs);
+            }
+        }
+        list.forEach(s -> {
+            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
+        });
+        return result;
+    }
 
-	private Calendar getCalendar(Date nowDate) {
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(nowDate);
-		calendar.add(Calendar.HOUR, 1);
+    private Calendar getCalendar(Date nowDate) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(nowDate);
+        calendar.add(Calendar.HOUR, 1);
 
-		return calendar;
-	}
+        return calendar;
+    }
 
-	@Override
-	public List<WarningVo> getRunTimeWarningAnalyse() {
-		List<WarningVo> result = new ArrayList<>();
-		Date nowDate = DateUtils.getNowDate();
-		//String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
-		//DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
-		//if (StringUtils.isNull(dictRecord)) {
-		//	nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
-		//}
-		//List<WarningDetail> list = warningAnalyseOperation(nowDate);
+    @Override
+    public List<WarningVo> getRunTimeWarningAnalyse() {
+        List<WarningVo> result = new ArrayList<>();
+        Date nowDate = DateUtils.getNowDate();
+        //String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
+        //DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
+        //if (StringUtils.isNull(dictRecord)) {
+        //	nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
+        //}
+        //List<WarningDetail> list = warningAnalyseOperation(nowDate);
 
-		List<WarningDetail> list = new ArrayList<>();
-		Calendar calendar = getCalendar(nowDate);
-		for (int i = 0; i < 3; i++) {
-			calendar.add(Calendar.HOUR, -1);
-			List<WarningDetail> rs = warningAnalyseOperation(calendar.getTime());
-			if (null != rs && rs.size() > 0) {
-				list.addAll(rs);
-			}
-		}
-		list.forEach(s -> {
-			result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
-		});
-		return result;
-	}
+        List<WarningDetail> list = new ArrayList<>();
+        Calendar calendar = getCalendar(nowDate);
+        for (int i = 0; i < 3; i++) {
+            calendar.add(Calendar.HOUR, -1);
+            List<WarningDetail> rs = warningAnalyseOperation(calendar.getTime());
+            if (null != rs && rs.size() > 0) {
+                list.addAll(rs);
+            }
+        }
+        list.forEach(s -> {
+            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
+        });
+        return result;
+    }
 
-	public List<WarningDetail> alarmAnalyseOperation(Date date) {
-		List<WarningDetail> result = new ArrayList<>();
-		String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
-		List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
-		if (ids.size() == 0) {
-			return result;
-		}
-		DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
-		if (null == dictRecord) {
-			return result;
-		}
-		String tableName = dictRecord.getTableName();
-		if (suYuanMapper.isTableExists(tableName) == 0) {
-			return result;
-		}
+    public List<WarningDetail> alarmAnalyseOperation(Date date) {
+        List<WarningDetail> result = new ArrayList<>();
+        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
+        List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
+        if (ids.size() == 0) {
+            return result;
+        }
+        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
+        if (null == dictRecord) {
+            return result;
+        }
+        String tableName = dictRecord.getTableName();
+        if (suYuanMapper.isTableExists(tableName) == 0) {
+            return result;
+        }
 
-		List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids);
-		if (null != list && list.size() > 0) {
-			for (SuYuan2d s : list) {
-				String locationName = commonService.select3dCheckPointById(s.getId()).getName();
-				result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 0, s.getValue()));
-			}
-		}
+        List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids);
+        if (null != list && list.size() > 0) {
+            for (SuYuan2d s : list) {
+                String locationName = commonService.select3dCheckPointById(s.getId()).getName();
+                result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 0, s.getValue()));
+            }
+        }
 
-		return result;
-	}
+        return result;
+    }
 
-	public List<WarningDetail> warningAnalyseOperation(Date date) {
-		List<WarningDetail> result = new ArrayList<>();
-		String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
-		List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
-		if (ids.size() == 0) {
-			return result;
-		}
-		DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
-		if (null == dictRecord) {
-			return result;
-		}
-		String tableName = dictRecord.getTableName();
-		if (suYuanMapper.isTableExists(tableName) == 0) {
-			return result;
-		}
+    public List<WarningDetail> warningAnalyseOperation(Date date) {
+        List<WarningDetail> result = new ArrayList<>();
+        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
+        List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
+        if (ids.size() == 0) {
+            return result;
+        }
+        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
+        if (null == dictRecord) {
+            return result;
+        }
+        String tableName = dictRecord.getTableName();
+        if (suYuanMapper.isTableExists(tableName) == 0) {
+            return result;
+        }
 
-		List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids);
-		if (null != list && list.size() > 0) {
-			for (SuYuan2d s : list) {
-				String locationName = commonService.select3dCheckPointById(s.getId()).getName();
-				result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 1, s.getValue()));
-			}
-		}
-		return result;
-	}
+        List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids);
+        if (null != list && list.size() > 0) {
+            for (SuYuan2d s : list) {
+                String locationName = commonService.select3dCheckPointById(s.getId()).getName();
+                result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 1, s.getValue()));
+            }
+        }
+        return result;
+    }
 
-	@Override
-	public void warningOperationStorage(Date date) {
-		List<WarningDetail> allData = new ArrayList<>();
-		List<WarningDetail> alarms = this.alarmAnalyseOperation(date);
-		if (StringUtils.isNotEmpty(alarms)) {
-			allData.addAll(alarms);
-		}
-		List<WarningDetail> warnings = this.warningAnalyseOperation(date);
-		if (StringUtils.isNotEmpty(warnings)) {
-			allData.addAll(warnings);
-		}
-		if (StringUtils.isNotEmpty(allData)) {
-			try {
-				insertWarningDetails(allData);
-			} catch (Exception e) {
-				logger.error("鎵归噺鎻掑叆鍛婅鏁版嵁鍑虹幇寮傚父锛侊紒锛�");
-				e.printStackTrace();
-			}
-		}
-	}
+    @Override
+    public void warningOperationStorage(Date date) {
+        List<WarningDetail> allData = new ArrayList<>();
+        List<WarningDetail> alarms = this.alarmAnalyseOperation(date);
+        if (StringUtils.isNotEmpty(alarms)) {
+            allData.addAll(alarms);
+        }
+        List<WarningDetail> warnings = this.warningAnalyseOperation(date);
+        if (StringUtils.isNotEmpty(warnings)) {
+            allData.addAll(warnings);
+        }
+        if (StringUtils.isNotEmpty(allData)) {
+            try {
+                insertWarningDetails(allData);
+            } catch (Exception e) {
+                logger.error("鎵归噺鎻掑叆鍛婅鏁版嵁鍑虹幇寮傚父锛侊紒锛�");
+                e.printStackTrace();
+            }
+        }
+    }
 
-	@Override
-	public Map<String, Integer> countThisMonthAlarmAndWarning() {
-		Map<String, Integer> result = new HashMap<>();
-		Map<String, Object> param = new HashMap<>();
-		param.put("type", 0);
-		param.put("startTime", DateUtils.getMonthStart());
-		param.put("endTime", DateUtils.getMonthEnd());
-		List<WarningVo> alarms = warningDetailMapper.selectWarningDetailByMap(param);
-		if (StringUtils.isNull(alarms)) {
-			alarms = new ArrayList<>();
-		}
-		result.put("alarmNumber", alarms.size());
-		param.put("type", 1);
-		List<WarningVo> warnings = warningDetailMapper.selectWarningDetailByMap(param);
-		if (StringUtils.isNull(warnings)) {
-			warnings = new ArrayList<>();
-		}
-		result.put("warningNumber", warnings.size());
-		return result;
-	}
+    @Override
+    public Map<String, Integer> countThisMonthAlarmAndWarning() {
+        Map<String, Integer> result = new HashMap<>();
+        Map<String, Object> param = new HashMap<>();
+        param.put("type", 0);
+        param.put("startTime", DateUtils.getMonthStart());
+        param.put("endTime", DateUtils.getMonthEnd());
+        List<WarningVo> alarms = warningDetailMapper.selectWarningDetailByMap(param);
+        if (StringUtils.isNull(alarms)) {
+            alarms = new ArrayList<>();
+        }
+        result.put("alarmNumber", alarms.size());
+        param.put("type", 1);
+        List<WarningVo> warnings = warningDetailMapper.selectWarningDetailByMap(param);
+        if (StringUtils.isNull(warnings)) {
+            warnings = new ArrayList<>();
+        }
+        result.put("warningNumber", warnings.size());
+        return result;
+    }
 
-	@Override
-	public Map<String, List<Map<String, Object>>> countEverydayAlarmAndWarning() {
-		Map<String, List<Map<String, Object>>> result = new HashMap<>();
-		Map<String, Object> param = new HashMap<String, Object>();
-		param.put("type", 0);
-		Date endTime = DateUtils.getNowDate();
-		//涓婂懆鐨勪粖澶�
-		param.put("startTime", DateUtils.getAPeriodOfTime(endTime, -7, Calendar.DATE));
-		param.put("endTime", endTime);
-		List<Map<String, Object>> alarmDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
-		result.put("alarmDayCount", alarmDayCount);
-		param.put("type", 1);
-		List<Map<String, Object>> warningDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
-		result.put("warningDayCount", warningDayCount);
-		return result;
-	}
+    @Override
+    public Map<String, List<Map<String, Object>>> countEverydayAlarmAndWarning() {
+        Map<String, List<Map<String, Object>>> result = new HashMap<>();
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("type", 0);
+        Date endTime = DateUtils.getNowDate();
+        //涓婂懆鐨勪粖澶�
+        param.put("startTime", DateUtils.getAPeriodOfTime(endTime, -7, Calendar.DATE));
+        param.put("endTime", endTime);
+        List<Map<String, Object>> alarmDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
+        result.put("alarmDayCount", alarmDayCount);
+        param.put("type", 1);
+        List<Map<String, Object>> warningDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
+        result.put("warningDayCount", warningDayCount);
+        return result;
+    }
 
-	@Override
-	public Map<String, List<Double>> selectEachLocationDataChange() {
+    @Override
+    public Map<String, List<Double>> selectEachLocationDataChange() {
 		/*Map<String, List<Double>> result = new LinkedHashMap<>();
 		List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
 		Date nowDate = DateUtils.getNowDate();
@@ -271,38 +271,38 @@
 		});
 		return result;*/
 
-		Map<String, List<Double>> result = new LinkedHashMap<>();
-		List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
-		Date nowDate = DateUtils.getNowDate();
-		Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate));
-		Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY)));
-		List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
+        Map<String, List<Double>> result = new LinkedHashMap<>();
+        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
+        Date nowDate = DateUtils.getNowDate();
+        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate));
+        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY)));
+        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
 
-		List<String> tableNames = new ArrayList<>();
-		for (DictRecord dr : recordList) {
-			if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
-				tableNames.add(dr.getTableName());
-			}
-		}
-		if (tableNames.isEmpty()) {
-			return result;
-		}
+        List<String> tableNames = new ArrayList<>();
+        for (DictRecord dr : recordList) {
+            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
+                tableNames.add(dr.getTableName());
+            }
+        }
+        if (tableNames.isEmpty()) {
+            return result;
+        }
 
-		for (MonitorPointPosition c : checkPoints) {
-			List<Double> values = new ArrayList<>();
-			List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId());
-			if (null != data && data.size() > 0) {
-				for (SuYuanMonitorData v : data) {
-					values.add(v.getValue());
-				}
-			}
-			result.put(c.getName(), values);
-		}
-		return result;
-	}
+        for (MonitorPointPosition c : checkPoints) {
+            List<Double> values = new ArrayList<>();
+            List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId());
+            if (null != data && data.size() > 0) {
+                for (SuYuanMonitorData v : data) {
+                    values.add(v.getValue());
+                }
+            }
+            result.put(c.getName(), values);
+        }
+        return result;
+    }
 
-	@Override
-	public List<Map<String, Object>> selectThisMonthLocationValueDataTop10() {
+    @Override
+    public List<Map<String, Object>> selectThisMonthLocationValueDataTop10() {
 		/*List<Map<String, Object>> result = new ArrayList<>();
 		List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
 		Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart()));
@@ -323,103 +323,103 @@
 		});
 		return CalculateUtils.sort(result, "value", true).subList(0, 10);*/
 
-		List<Map<String, Object>> result = new ArrayList<>();
-		List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
-		Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart()));
-		Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd()));
-		List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
+        List<Map<String, Object>> result = new ArrayList<>();
+        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
+        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart()));
+        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd()));
+        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
 
-		List<String> tableNames = new ArrayList<>();
-		for (DictRecord dr : recordList) {
-			if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
-				tableNames.add(dr.getTableName());
-			}
-		}
-		if (tableNames.isEmpty()) {
-			return result;
-		}
+        List<String> tableNames = new ArrayList<>();
+        for (DictRecord dr : recordList) {
+            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
+                tableNames.add(dr.getTableName());
+            }
+        }
+        if (tableNames.isEmpty()) {
+            return result;
+        }
 
-		for (MonitorPointPosition c : checkPoints) {
-			Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId());
-			if (null != map && map.size() > 0) {
-				String suYuanId = map.get("id").toString();
-				map.put("name", commonService.select3dCheckPointById(suYuanId).getName());
-				map.remove("id");
-			}
-			result.add(map);
-		}
+        for (MonitorPointPosition c : checkPoints) {
+            Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId());
+            if (null != map && map.size() > 0) {
+                String suYuanId = map.get("id").toString();
+                map.put("name", commonService.select3dCheckPointById(suYuanId).getName());
+                map.remove("id");
+            }
+            result.add(map);
+        }
 
-		return CalculateUtils.sort(result, "value", true).subList(0, 10);
-	}
+        return CalculateUtils.sort(result, "value", true).subList(0, 10);
+    }
 
-	@Override
-	public List<WarningVo> getAlarmAndWarnByTime(Date begin, Date end) {
-		List<WarningVo> list = new ArrayList<>();
-		List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
-		if (ids.size() == 0) {
-			return list;
-		}
-		List<DictRecord> dictList = dictRecordMapper.selectByTime(ymdhms.format(begin), ymdhms.format(end));
-		if (null == dictList || dictList.isEmpty()) {
-			return list;
-		}
-		List<String> tables = new ArrayList<>();
-		for (DictRecord dr : dictList) {
-			if(suYuanMapper.isTableExists(dr.getTableName())>0) {
-				tables.add(dr.getTableName());
-			}
-		}
-		if (tables.size()==0){
-			return list;
-		}
+    @Override
+    public List<WarningVo> getAlarmAndWarnByTime(Date begin, Date end) {
+        List<WarningVo> list = new ArrayList<>();
+        List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
+        if (ids.size() == 0) {
+            return list;
+        }
+        List<DictRecord> dictList = dictRecordMapper.selectByTime(ymdhms.format(begin), ymdhms.format(end));
+        if (null == dictList || dictList.isEmpty()) {
+            return list;
+        }
+        List<String> tables = new ArrayList<>();
+        for (DictRecord dr : dictList) {
+            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
+                tables.add(dr.getTableName());
+            }
+        }
+        if (tables.size() == 0) {
+            return list;
+        }
 
-		for (String tab : tables) {
-			List<WarningDetail> alarmList = getAlarmByTime(tab, ids);
-			for (WarningDetail s : alarmList) {
-				list.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
-			}
-		}
-		for (String tab : tables) {
-			List<WarningDetail> warnList = getWarnByTime(tab, ids);
-			for (WarningDetail s : warnList) {
-				list.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
-			}
-		}
+        for (String tab : tables) {
+            List<WarningDetail> alarmList = getAlarmByTime(tab, ids);
+            for (WarningDetail s : alarmList) {
+                list.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
+            }
+        }
+        for (String tab : tables) {
+            List<WarningDetail> warnList = getWarnByTime(tab, ids);
+            for (WarningDetail s : warnList) {
+                list.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
+            }
+        }
 
-		return list;
-	}
+        return list;
+    }
 
-	private List<WarningDetail> getAlarmByTime(String tableName, List<String> ids) {
-		List<WarningDetail> result = new ArrayList<>();
-		List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids);
-		if (null != list && list.size() > 0) {
-			Date date = getDateByTabName(tableName);
-			for (SuYuan2d s : list) {
-				String locationName = commonService.select3dCheckPointById(s.getId()).getName();
-				result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 0, s.getValue()));
-			}
-		}
-		return result;
-	}
+    private List<WarningDetail> getAlarmByTime(String tableName, List<String> ids) {
+        List<WarningDetail> result = new ArrayList<>();
+        List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids);
+        if (null != list && list.size() > 0) {
+            Date date = getDateByTabName(tableName);
+            for (SuYuan2d s : list) {
+                String locationName = commonService.select3dCheckPointById(s.getId()).getName();
+                result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 0, s.getValue()));
+            }
+        }
+        return result;
+    }
 
-	private List<WarningDetail> getWarnByTime(String tableName, List<String> ids) {
-		List<WarningDetail> result = new ArrayList<>();
-		List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids);
-		if (null != list && list.size() > 0) {
-			Date date = getDateByTabName(tableName);
-			for (SuYuan2d s : list) {
-				String locationName = commonService.select3dCheckPointById(s.getId()).getName();
-				result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 1, s.getValue()));
-			}
-		}
-		return result;
-	}
+    private List<WarningDetail> getWarnByTime(String tableName, List<String> ids) {
+        List<WarningDetail> result = new ArrayList<>();
+        List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids);
+        if (null != list && list.size() > 0) {
+            Date date = getDateByTabName(tableName);
+            for (SuYuan2d s : list) {
+                String locationName = commonService.select3dCheckPointById(s.getId()).getName();
+                result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, 1, s.getValue()));
+            }
+        }
+        return result;
+    }
 
-	private Date getDateByTabName(String tab) {
-		try {
-			return ymdh.parse(tab.replace("su_yuan_", ""));
-		} catch (Exception e) {
-			return new Date();
-		}
-	}
+    private Date getDateByTabName(String tab) {
+        try {
+            return ymdh.parse(tab.replace("su_yuan_", ""));
+        } catch (Exception e) {
+            return new Date();
+        }
+    }
 }

--
Gitblit v1.9.3