| | |
| | | package com.flightfeather.monitor.analysis.dust |
| | | |
| | | import com.flightfeather.monitor.analysis.dust.exception.* |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData |
| | | import com.flightfeather.monitor.domain.ds1.repository.DustExceptionDataRep |
| | | import com.flightfeather.monitor.domain.ds1.repository.DustExceptionSettingRep |
| | |
| | | private val dustSiteStatusRep: DustSiteStatusRep, |
| | | ) { |
| | | |
| | | private var running = false |
| | | var running = false |
| | | |
| | | private val taskList = mutableListOf<BaseDustExceptionAnalysis>() |
| | | |
| | |
| | | add(ExceptionValueMutation(it)) |
| | | add(ExceptionDataLowValue(it)) |
| | | add(ExceptionDataExceed(it)) |
| | | add(ExceptionValidRate(it)) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | fun debugRun() { |
| | | val result = mutableListOf<DustExceptionData>() |
| | | val date = LocalDate.of(2023, 7, 2) |
| | | val date = LocalDate.of(2023, 11, 22) |
| | | taskList.forEach { it.init() } |
| | | // 轮询数据,计算各个异常 |
| | | val list = dustSiteDataRep.select("YZT0JS0150043", date) |
| | | val list = dustSiteDataRep.select("SHKJ0JS0150917", date) |
| | | list.takeIf { it.isNotEmpty() }?.forEach { d -> |
| | | d?.let { taskList[0].onNextData(d) } |
| | | d?.let { taskList.forEach { it.onNextData(d) } } |
| | | } |
| | | // 各个异常分析分别结束 |
| | | taskList[0].onDone() |
| | | taskList.forEach { it.onDone() } |
| | | // 存储分析结果 |
| | | taskList.forEach { result.addAll(it.resultList) } |
| | | println(result) |