From 70a7d1ec98064e1acb3130e56e16c45af52ade6c Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 24 十月 2023 12:03:49 +0800 Subject: [PATCH] 新增数据分析模块完成 --- src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt b/src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt index a1b2496..6d2729f 100644 --- a/src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt +++ b/src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt @@ -16,6 +16,12 @@ private var exceedingCount = 0 private var startData: DustSiteData? = null + override fun init() { + super.init() + exceedingCount = 0 + startData = null + } + override fun getExceptionType(): ExceptionType = ExceptionType.TYPE6 override fun onNextData(data: DustSiteData) { @@ -30,16 +36,18 @@ if (exceedingCount >= config.dayExceedBorderlineLowNum && exceedingCount < config.dayExceedBorderlineHighNum) { startData?.let { val eType = getExceptionType() - val t = LocalDateTime.ofInstant(it.lst.toInstant(), ZoneId.systemDefault()) - t.withHour(0) - val sT = + val t = LocalDateTime.ofInstant(it.lst.toInstant(), ZoneId.systemDefault()).withHour(0).withMinute(0).withSecond(0) + val sT = Date.from(t.atZone(ZoneId.systemDefault()).toInstant()) + val n = t.plusDays(1).minusSeconds(1) + val eT = Date.from(n.atZone(ZoneId.systemDefault()).toInstant()) + resultList.add(DustExceptionData().apply { mnCode = it.mnCode exception = eType.des exceptionType = eType.value region = config.region -// beginTime = if (p == null) n.lst else p.lst -// endTime = n.lst + beginTime = sT + endTime = eT }) } } -- Gitblit v1.9.3