| | |
| | | taskList.clear() |
| | | taskList.apply { |
| | | add(ExceptionDataMissing(it)) |
| | | add(ExceptionNoFluctuation(it)) |
| | | add(ExceptionApproachExceeding(it)) |
| | | add(ExceptionExceedingTimes(it)) |
| | | add(ExceptionSlideAverage(it)) |
| | | add(ExceptionValueMutation(it)) |
| | | add(ExceptionDataLowValue(it)) |
| | | add(ExceptionDataExceed(it)) |
| | | // add(ExceptionNoFluctuation(it)) |
| | | // add(ExceptionApproachExceeding(it)) |
| | | // add(ExceptionExceedingTimes(it)) |
| | | // add(ExceptionSlideAverage(it)) |
| | | // add(ExceptionValueMutation(it)) |
| | | // add(ExceptionDataLowValue(it)) |
| | | // add(ExceptionDataExceed(it)) |
| | | // add(ExceptionValidRate(it)) |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥é£é©ç»è®¡,é»è®¤ç»è®¡æ¨å¤©çé£é©å¼ |
| | | */ |
| | | fun autoRunDaily() { |
| | | val data = riskValueRep.findLatestData("day") |
| | | val yesterday = LocalDate.now().minusDays(1) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æé£é©ç»è®¡,æ ¹æ®æ¨æ¥ææ°æ°æ®æå¨æä»½,ç»è®¡è¯¥æç综åé£é©,æªè³æ¨å¤© |
| | | */ |
| | | fun autoRunMonthly() { |
| | | val data = riskValueRep.findLatestData("month") |
| | | val lastMonth = LocalDate.now().minusMonths(1).withDayOfMonth(1) |
| | | if (data == null) { |
| | | runMonthly(lastMonth) |
| | | } else { |
| | | // è·åéè¦ç»è®¡çææ°æä»½,æ¯æ¨å¤©æå¨çæä»½(å ä¸ºçæµæ°æ®æ¯ä»å¤©è·åæ¨å¤©ä¸æ´å¤©çæ°æ®) |
| | | val thisMonth = LocalDate.now().minusDays(1) |
| | | // ææ°æç»è®¡è®°å½çæ¶é´ |
| | | val date = LocalDateTime.ofInstant(data.lst.toInstant(), ZoneId.systemDefault()) |
| | | val sT = date.plusMonths(1).toLocalDate() |
| | | val du = DateUtil.findDurationMonth(sT, lastMonth) |
| | | val sT = date.toLocalDate() |
| | | val du = DateUtil.findDurationMonth(sT, thisMonth) |
| | | du.forEach { |
| | | runMonthly(it) |
| | | } |
| | |
| | | } |
| | | // ææåæç»æå
¥åº |
| | | if (taskMonthly?.resultList?.isNotEmpty() == true) { |
| | | riskValueRep.insert(taskMonthly?.resultList!!) |
| | | riskValueRep.insertOrUpdate(taskMonthly?.resultList!!) |
| | | } |
| | | running2 = false |
| | | } |
| | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | |
| | | /** |
| | | * è¿ç»ç±»åçå¼å¸¸åæåºç±» |
| | | * è¿ç»ç±»åçå¼å¸¸åæåºç±»,éç¨äºå½åæ°æ®ä¸ç¸é»æ°æ®ä¹é´æå
³èå
³ç³»çæ
åµ |
| | | */ |
| | | abstract class BaseExceptionContinuous(config: DustExceptionSetting) : BaseDustExceptionAnalysis(config) { |
| | | |
| | | // èµ·å§æ°æ®ä¸æ |
| | | private var sIndex = 0 |
| | | protected var sIndex = 0 |
| | | // èµ·å§æ°æ®å¯¹è±¡ |
| | | private var startData: DustSiteData? = null |
| | | protected var startData: DustSiteData? = null |
| | | // æ«å°¾æ°æ®ä¸æ |
| | | private var eIndex = -1 |
| | | protected var eIndex = -1 |
| | | // æ«å°¾æ°æ®å¯¹è±¡ |
| | | private var lastData: DustSiteData? = null |
| | | protected var lastData: DustSiteData? = null |
| | | // èµ·å§æ°æ®ä¸æ«å°¾æ°æ®é´é |
| | | open var durationCount = 1 |
| | | private var existException = false |
| | | protected var existException = false |
| | | |
| | | /** |
| | | * 夿æ¯å¦æ»¡è¶³å¼å¸¸æ¡ä»¶ |
| | |
| | | /** |
| | | * æ£æ¥è¿ç»å¼å¸¸ç»ææ¶ï¼æ¯å¦ç¬¦åå¼å¸¸å卿¡ä»¶ |
| | | */ |
| | | private fun checkResult() { |
| | | open fun checkResult() { |
| | | if (existException && judgeDuration(sIndex, eIndex)) { |
| | | startData?.let { |
| | | resultList.add(newResult(it, lastData)) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.analysis.dust.exception |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | |
| | | /** |
| | | * è¿ç»ç±»åçå¼å¸¸åæåºç±»,åºå«äºç¶ç±»çå°æ¹å¨äºæ¤ç§å¼å¸¸åªååä¸ªæ°æ®æ¬èº«æå
³,äºç¸é»æ°æ®æ å
³ |
| | | */ |
| | | abstract class BaseExceptionContinuousSingle(config: DustExceptionSetting) : BaseExceptionContinuous(config) { |
| | | |
| | | override fun onNextData(data: DustSiteData) { |
| | | eIndex++ |
| | | if (lastData == null) { |
| | | startData = data |
| | | } |
| | | // 夿ç¸é»æ°æ®æ¯å¦è¿ç»å¹¶ä¸æ¯å¦æ»¡è¶³å¼å¸¸å¤æ |
| | | if (!isContinuous(lastData, data)) { |
| | | checkResult() |
| | | sIndex = eIndex |
| | | startData = data |
| | | } else { |
| | | if (judgeException(lastData, data)) { |
| | | // ä¿®æ¹äºèµ·å§æ°æ®çä½ç½®,åæ´ä¸ºåºç°å¼å¸¸ç该å¼,è䏿¯åæ¥çåºç°å¼å¸¸çæ°æ®çåä¸ä¸ªå¼ |
| | | if (!existException) { |
| | | sIndex = eIndex |
| | | startData = data |
| | | } |
| | | existException = true |
| | | } else { |
| | | checkResult() |
| | | } |
| | | } |
| | | lastData = data |
| | | } |
| | | } |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | |
| | | /** |
| | | * æ°æ®è¶
æ å¼å¸¸åæ |
| | | */ |
| | | class ExceptionDataExceed(config: DustExceptionSetting) : BaseExceptionContinuous(config) { |
| | | class ExceptionDataExceed(config: DustExceptionSetting) : BaseExceptionContinuousSingle(config) { |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE2 |
| | | |
| | | override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { |
| | | return n.dustValue >= config.exceedingStandard |
| | | return n.dustValue >= config.exceedingStandard && n.flag == DataStatus.N.value |
| | | } |
| | | |
| | | override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { |
| | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | |
| | | /** |
| | | * æ°æ®è¶
ä½å¼å¸¸åæ |
| | | */ |
| | | class ExceptionDataLowValue(config: DustExceptionSetting) : BaseExceptionContinuous(config) { |
| | | class ExceptionDataLowValue(config: DustExceptionSetting) : BaseExceptionContinuousSingle(config) { |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE1 |
| | | |
| | | override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { |
| | | return n.dustValue <= config.dataLow |
| | | val b1 = n.flag == DataStatus.OUT_MIN.value |
| | | val b2 = n.dustValue <= config.dataLow && n.flag == DataStatus.N.value |
| | | val b3 = n.flag == DataStatus.Q.value |
| | | return b1 || b2 || b3 |
| | | } |
| | | |
| | | override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { |
| | | return true |
| | | } |
| | | |
| | | override fun newResult(p: DustSiteData, n: DustSiteData?): DustExceptionData { |
| | | val eType = getExceptionType() |
| | | return DustExceptionData().apply { |
| | | mnCode = p.mnCode |
| | | exception = eType.des |
| | | exceptionType = eType.value |
| | | region = config.region |
| | | beginTime = n?.lst |
| | | endTime = n?.lst |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import java.time.Duration |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | |
| | | /** |
| | | * æ°æ®ç¼ºå¤±å¼å¸¸åæ |
| | | */ |
| | | class ExceptionDataMissing(config: DustExceptionSetting) : BaseDustExceptionAnalysis(config) { |
| | | |
| | | private var lastData: DustSiteData? = null |
| | | |
| | | override fun init() { |
| | | super.init() |
| | | lastData = null |
| | | } |
| | | class ExceptionDataMissing(config: DustExceptionSetting) : BaseExceptionContinuous(config) { |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE0 |
| | | |
| | | override fun onNextData(data: DustSiteData) { |
| | | lastData?.let { |
| | | val t1 = it.lst |
| | | val t2 = data.lst |
| | | if (Duration.between(t1?.toInstant(), t2.toInstant()).toMinutes() > config.missDataMinutes) { |
| | | resultList.add(newResult(it, data)) |
| | | // override fun onNextData(data: DustSiteData) { |
| | | // lastData?.let { |
| | | // val t1 = it.lst |
| | | // val t2 = data.lst |
| | | // val b1 = Duration.between(t1?.toInstant(), t2.toInstant()).toMinutes() >= config.missDataMinutes |
| | | // if (b1) { |
| | | // resultList.add(newResult(it, data)) |
| | | // } |
| | | // } |
| | | // lastData = data |
| | | // } |
| | | |
| | | override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { |
| | | // æ°æ®ç¼ºå¤±å¼å¸¸ä¸åäºå
¶ä»å¼å¸¸çç¹å¨äºå½æ¥é¦ä¸ªæ°æ®å¦æä¸åå¨ï¼éè¦å䏿¬¡å¤æ |
| | | var pData: DustSiteData? = null |
| | | if (p == null) { |
| | | //å½é¦ä¸ªæ°æ®è¿å
¥æ¶ï¼éè¦å¤ææ¯å¦ä¸ºå½æ¥ç第ä¸ä¸ªæ°æ® |
| | | val time = LocalDateTime.ofInstant(n.lst.toInstant(), ZoneId.systemDefault()) |
| | | if (time.hour == 0 && time.minute == 0) { |
| | | return false |
| | | } |
| | | // å¦æç¼ºå¤±å½æ¥é¦ä¸ªæ°æ®ï¼åéè¦å°å½åæ°æ®nå彿¥0ç¹è¿è¡æ¯è¾ï¼è®°å½æ°æ®ç¼ºå¤±å¼å¸¸ |
| | | else { |
| | | startData = DustSiteData().apply { |
| | | mnCode = n.mnCode |
| | | lst = Date.from(time.withHour(0).withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()) |
| | | .toInstant()) |
| | | flag = DataStatus.A.value |
| | | } |
| | | pData = startData |
| | | } |
| | | } |
| | | lastData = data |
| | | if (pData == null) return false |
| | | val t1 = pData.lst |
| | | val t2 = n.lst |
| | | val b1 = Duration.between(t1?.toInstant(), t2.toInstant()).toMinutes() >= config.missDataMinutes |
| | | val b2 = n.flag == DataStatus.A.value || n.flag == DataStatus.D.value |
| | | return b1 || b2 |
| | | } |
| | | |
| | | override fun onDone() { |
| | | //do noting |
| | | override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { |
| | | return true |
| | | } |
| | | |
| | | /** |
| | | * éå¯¹æ°æ®ç¼ºå¤±å¼å¸¸, å¯¹æ°æ®çè¿ç»æ§ä¸å夿 |
| | | */ |
| | | override fun isContinuous(d1: DustSiteData?, d2: DustSiteData): Boolean { |
| | | return true |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.analysis.dust.exception |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import java.time.Duration |
| | | |
| | | /** |
| | | * æ°æ®ç¼ºå¤±å¼å¸¸åæ |
| | | */ |
| | | class ExceptionDataMissing_BackUp(config: DustExceptionSetting) : BaseDustExceptionAnalysis(config) { |
| | | |
| | | private var lastData: DustSiteData? = null |
| | | |
| | | override fun init() { |
| | | super.init() |
| | | lastData = null |
| | | } |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE0 |
| | | |
| | | override fun onNextData(data: DustSiteData) { |
| | | lastData?.let { |
| | | val t1 = it.lst |
| | | val t2 = data.lst |
| | | val b1 = Duration.between(t1?.toInstant(), t2.toInstant()).toMinutes() >= config.missDataMinutes |
| | | if (b1) { |
| | | resultList.add(newResult(it, data)) |
| | | } |
| | | } |
| | | lastData = data |
| | | } |
| | | |
| | | override fun onDone() { |
| | | //do noting |
| | | } |
| | | } |
| | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | |
| | | override fun onNextData(data: DustSiteData) { |
| | | if (startData == null) startData = data |
| | | |
| | | if (data.dustValue >= config.exceedingStandard) { |
| | | if (data.dustValue >= config.exceedingStandard && data.flag == DataStatus.N.value) { |
| | | exceedingCount++ |
| | | } |
| | | } |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | |
| | | /** |
| | |
| | | |
| | | override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { |
| | | if (p == null) return false |
| | | return p.dustValue == n.dustValue |
| | | val b1 = p.dustValue == n.dustValue |
| | | val b2 = p.flag != DataStatus.A.value && p.flag != DataStatus.D.value |
| | | val b3 = n.flag != DataStatus.A.value && n.flag != DataStatus.D.value |
| | | return b1 && b2 && b3 |
| | | } |
| | | |
| | | override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import kotlin.math.abs |
| | | |
| | |
| | | |
| | | private val historyDataList = mutableListOf<DustSiteData>() |
| | | private val tempDataList = mutableListOf<DustSiteData>() |
| | | private val avgListReverse = mutableListOf<Double>() |
| | | private val avgListReverse = mutableListOf<Pair<Double, Boolean>>() |
| | | private var startData: DustSiteData? = null |
| | | private var lastData: DustSiteData? = null |
| | | private var sIndex = 0 |
| | |
| | | */ |
| | | private fun calAvg(list: List<DustSiteData>) { |
| | | var total = .0 |
| | | var valid = true |
| | | val count = list.size |
| | | if (count == 0) return |
| | | list.forEach { total += it.dustValue } |
| | | list.forEach { |
| | | total += it.dustValue |
| | | if (it.flag != DataStatus.N.value) { |
| | | valid = false |
| | | } |
| | | } |
| | | val avg = total / count |
| | | avgListReverse.add(0, avg) |
| | | avgListReverse.add(0, Pair(avg, valid)) |
| | | } |
| | | |
| | | /** |
| | |
| | | return false |
| | | } else { |
| | | // æ»å¨å弿»¡è¶³æ°éæ¶ï¼è®¡ç®åå¼ä¹é´æ¯å¦è¿ç»è¶
è¿é宿¯ç |
| | | val rateList = mutableListOf<Double>() |
| | | val rateList = mutableListOf<Pair<Double, Boolean>>() |
| | | for (i in avgListReverse.indices) { |
| | | if (i >= config.changeTrendTimes) break |
| | | val r = calAvgChangeRate(avgListReverse[i], avgListReverse[i + config.changeTrendInterval]) |
| | | rateList.add(r) |
| | | } |
| | | for (y in rateList) { |
| | | if (y < config.changeTrendRate) { |
| | | if (!y.second || y.first < config.changeTrendRate) { |
| | | return false |
| | | } |
| | | } |
| | |
| | | /** |
| | | * è®¡ç®æ»å¨åå¼ååç |
| | | */ |
| | | private fun calAvgChangeRate(a1: Double, a2: Double): Double { |
| | | return if (a2 == .0) { |
| | | 1.0 |
| | | private fun calAvgChangeRate(a1: Pair<Double, Boolean>, a2: Pair<Double, Boolean>): Pair<Double, Boolean> { |
| | | val valid = a1.second && a2.second |
| | | return if (a2.first == .0) { |
| | | Pair(1.0, valid) |
| | | } else { |
| | | abs(a1 - a2) / a2 |
| | | Pair(abs(a1.first - a2.first) / a2.first, valid) |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.analysis.dust.exception |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | |
| | | /** |
| | | * æ°æ®ææçå¼å¸¸ |
| | | */ |
| | | class ExceptionValidRate(config: DustExceptionSetting) : BaseDustExceptionAnalysis(config) { |
| | | |
| | | private var count = 0 |
| | | private val total = 96 |
| | | private var startData: DustSiteData? = null |
| | | |
| | | override fun init() { |
| | | super.init() |
| | | count = 0 |
| | | startData = null |
| | | } |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE8 |
| | | |
| | | override fun onNextData(data: DustSiteData) { |
| | | if (startData == null) startData = data |
| | | |
| | | if (data.flag == DataStatus.N.value) { |
| | | count++ |
| | | } |
| | | } |
| | | |
| | | override fun onDone() { |
| | | val rate = count / total |
| | | if (rate < 0.9) { |
| | | startData?.let { |
| | | val eType = getExceptionType() |
| | | 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 = sT |
| | | endTime = eT |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustSiteData |
| | | import com.flightfeather.monitor.enumration.dust.DataStatus |
| | | import com.flightfeather.monitor.enumration.dust.ExceptionType |
| | | import kotlin.math.abs |
| | | |
| | |
| | | */ |
| | | class ExceptionValueMutation(config: DustExceptionSetting) : BaseExceptionContinuous(config) { |
| | | |
| | | /** |
| | | * æ¬å¼å¸¸çè¿ç»åçæ¬¡æ°ä¼æ ¹æ®å¼å¸¸çç¨åº¦åå |
| | | * å½çªåçé级è¶
è¿è®¾å®å¼1忝,è¿ç»åçæ¬¡æ°è¦æ±åå°1å |
| | | */ |
| | | private var special = false |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4 |
| | | |
| | | override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { |
| | | if (p == null) return false |
| | | return abs((p.dustValue - n.dustValue) / p.dustValue) >= config.mutationRate |
| | | val r = abs((p.dustValue - n.dustValue) / p.dustValue) |
| | | val b1 = r >= (2 * config.mutationRate) && n.flag == DataStatus.N.value |
| | | val b2 = r >= config.mutationRate && n.flag == DataStatus.N.value |
| | | val b3 = n.flag == DataStatus.OUT_MAX.value |
| | | if (b1) special = true |
| | | return b1 || b2 || b3 |
| | | } |
| | | |
| | | override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { |
| | | return (eIndex - sIndex + 1) >= config.mutationNum |
| | | val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2) |
| | | val b2 = (eIndex - sIndex) >= config.mutationNum |
| | | special = false |
| | | return b1 || b2 |
| | | } |
| | | } |
| | |
| | | private FugitiveDustService fugitiveDustService; |
| | | |
| | | |
| | | |
| | | //æ¬å° çæµç¹å岿°æ® å端å页 |
| | | @GetMapping("/history1") |
| | | public Result conditonQueryAbnormalData3(@RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20")Integer pageSize, |
| | | String siteName,String mnCode,String beginTime, String endTime,String[] scenarioType ){ |
| | | PageBean pageBean = fugitiveDustService.page(page,pageSize,siteName,mnCode, beginTime,endTime,scenarioType); |
| | | @RequestParam(defaultValue = "20") Integer pageSize, |
| | | String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType) { |
| | | PageBean pageBean = fugitiveDustService.page(page, pageSize, siteName, mnCode, beginTime, endTime, scenarioType); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | // è¿åæ¥è¯¢çææå岿°æ® |
| | | // è¿åæ¥è¯¢çææå岿°æ® |
| | | @GetMapping("/historyall") |
| | | public Result conditonQueryhistoryallData(String siteName,String mnCode,String beginTime, String endTime,String[] scenarioType ){ |
| | | List<DustSiteData> list= fugitiveDustService.conditonQueryhistoryallData(siteName,mnCode, beginTime,endTime,scenarioType); |
| | | public Result conditonQueryhistoryallData(String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType) { |
| | | List<DustSiteData> list = fugitiveDustService.conditonQueryhistoryallData(siteName, mnCode, beginTime, endTime, scenarioType); |
| | | return Result.success(list); |
| | | } |
| | | // è¿åçæµç¹æ°æ®ä¸çä¸åçåºæ¯ |
| | | |
| | | // è¿åçæµç¹æ°æ®ä¸çä¸åçåºæ¯ |
| | | @GetMapping("/scenario") |
| | | public Result conditonQueryHistoryData(){ |
| | | public Result conditonQueryHistoryData() { |
| | | List<DustSiteData> list = fugitiveDustService.scenarioData(); |
| | | return Result.success(list); |
| | | } |
| | | // è¿åææç«ç¹åå |
| | | |
| | | // è¿åææç«ç¹åå |
| | | @GetMapping("/sitename") |
| | | public Result allSiteName(){ |
| | | public Result allSiteName() { |
| | | List<DustSiteData> list = fugitiveDustService.allSiteName(); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | // æ ¹æ®ç«ç¹åååæ¶é´æ®µæ¥è¯¢åå¼å |
| | | // æ ¹æ®ç«ç¹åååæ¶é´æ®µæ¥è¯¢åå¼å |
| | | @GetMapping("/analysisdata") |
| | | public Result analysisdata( String siteName,String beginTime, String endTime,String type){ |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdata(siteName,beginTime,endTime,type); |
| | | public Result analysisdata(String siteName, String beginTime, String endTime, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdata(siteName, beginTime, endTime, type); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | // æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ å端å页 |
| | | // æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ å端å页 |
| | | @GetMapping("/analysistime") |
| | | public Result analysisByTime( @RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20")Integer pageSize,String siteName,String beginTime, String endTime){ |
| | | PageBean pageBean = fugitiveDustService.pageAnalysisTime(page,pageSize,siteName,beginTime,endTime); |
| | | return Result.success(pageBean); |
| | | } |
| | | public Result analysisByTime( |
| | | @RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20") Integer pageSize, |
| | | String siteName, |
| | | String beginTime, |
| | | String endTime, |
| | | String orderProp, |
| | | Boolean asc) { |
| | | PageBean pageBean = fugitiveDustService.pageAnalysisTime(page, pageSize, siteName, beginTime, endTime, |
| | | orderProp, asc); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | //å¨æè®¡ç®åææ°æ® ä¸å页 |
| | | @GetMapping("/analysisall") |
| | | public Result analysisAll(String siteName,String beginTime, String endTime){ |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisAll(siteName,beginTime,endTime); |
| | | public Result analysisAll(String siteName, String beginTime, String endTime) { |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisAll(siteName, beginTime, endTime); |
| | | return Result.success(list); |
| | | } |
| | | //è·å¾ä¸åçå¼å¸¸ç±»å |
| | | |
| | | //è·å¾ä¸åçå¼å¸¸ç±»å |
| | | @GetMapping("/exceptiontype") |
| | | public Result getExceptionType(){ |
| | | public Result getExceptionType() { |
| | | List<DustExceptionType> list = fugitiveDustService.getExceptionType(); |
| | | return Result.success(list); |
| | | } |
| | |
| | | //æ¡ä»¶æ¥è¯¢å¼å¸¸æ°æ® |
| | | @GetMapping("/exceptiondata") |
| | | public Result getExceptionData(@RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20")Integer pageSize,String siteName,String [] exceptionType,String beginTime, String endTime){ |
| | | PageBean pageBean = fugitiveDustService.getExceptionData(page,pageSize,siteName,exceptionType,beginTime,endTime); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | @RequestParam(defaultValue = "20") Integer pageSize, String siteName, String[] exceptionType, String beginTime, String endTime) { |
| | | PageBean pageBean = fugitiveDustService.getExceptionData(page, pageSize, siteName, exceptionType, beginTime, endTime); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | |
| | | //æ¡ä»¶æ¥è¯¢å¼å¸¸æ°æ® ä¸å页 |
| | | @GetMapping("/exceptiondata1") |
| | | public Result getExceptionAllData(String siteName,String [] exceptionType,String beginTime, String endTime){ |
| | | List<DustExceptionData> list = fugitiveDustService.getExceptionAllData(siteName,exceptionType,beginTime,endTime); |
| | | public Result getExceptionAllData(String siteName, String[] exceptionType, String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustService.getExceptionAllData(siteName, exceptionType, beginTime, endTime); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | //å¢å è¡éåè¿ç»´å æ¡ä»¶æ¥è¯¢å¼å¸¸æ°æ® |
| | | @GetMapping("/exceptiondata2") |
| | | public Result getExceptionData2(@RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20")Integer pageSize,String siteName,String [] exceptionType,String beginTime, String endTime,String [] street,String [] dutyCompany){ |
| | | PageBean pageBean = fugitiveDustService.getExceptionData2(page,pageSize,siteName,exceptionType,beginTime,endTime,street,dutyCompany); |
| | | @RequestParam(defaultValue = "20") Integer pageSize, String siteName, String[] exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany) { |
| | | PageBean pageBean = fugitiveDustService.getExceptionData2(page, pageSize, siteName, exceptionType, beginTime, endTime, street, dutyCompany); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | //æ ¹æ®ææ®µæ¶é´å
æä¸ªå¼å¸¸ç±»å,å°åï¼è¿ç»´åï¼ç¹ä½åç§° ï¼æ¥è¯¢å¯¹åºçåºéºåç§°å设å¤ç¼å· |
| | | @GetMapping("/sitenamecode") |
| | | public Result getExceptionSitenameAndCode(String exceptionType,String beginTime, String endTime,String [] street,String [] dutyCompany,String siteName){ |
| | | List<DustExceptionData> list = fugitiveDustService.getExceptionSitenameAndCode(exceptionType,beginTime,endTime,street,dutyCompany,siteName); |
| | | public Result getExceptionSitenameAndCode(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName) { |
| | | List<DustExceptionData> list = fugitiveDustService.getExceptionSitenameAndCode(exceptionType, beginTime, endTime, street, dutyCompany, siteName); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | // æ ¹æ®æ¶é´,å°åï¼è¿ç»´åï¼ç¹ä½åç§°ï¼è¿å该å¼å¸¸ç±»åçä¸ªæ° |
| | | @GetMapping("/exceptionnum") |
| | | public Result exceptionNum(String exceptionType,String beginTime,String endTime,String [] street,String [] dutyCompany,String siteName){ |
| | | Integer list = fugitiveDustService.exceptionNum( exceptionType, beginTime, endTime,street,dutyCompany,siteName); |
| | | public Result exceptionNum(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName) { |
| | | Integer list = fugitiveDustService.exceptionNum(exceptionType, beginTime, endTime, street, dutyCompany, siteName); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | |
| | | // æ¥è¯¢å岿°æ® ä¸å页 |
| | | @GetMapping("/history") |
| | | public Result conditonQueryHistoryData(String siteName,String beginTime, String endTime ){ |
| | | List<DustSiteData> list= fugitiveDustService.conditonQueryHistoryData(siteName,beginTime,endTime); |
| | | return Result.success(list); |
| | | } |
| | | // æ¥è¯¢å岿°æ® ä¸å页 |
| | | @GetMapping("/history") |
| | | public Result conditonQueryHistoryData(String siteName, String beginTime, String endTime) { |
| | | List<DustSiteData> list = fugitiveDustService.conditonQueryHistoryData(siteName, beginTime, endTime); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | // è¿åå¼å¸¸çåºéºæ»æ° |
| | | |
| | | @GetMapping("/exceptionsitenum") |
| | | public Result exceptionSiteNum(){ |
| | | public Result exceptionSiteNum() { |
| | | List<DustExceptionData> list = fugitiveDustService.exceptionSiteNum(); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | /*æ°å¢å®¡è®¡å
容*/ |
| | | @PostMapping("/audit") |
| | | public Result addAuditNotes(@RequestBody AuditInfo auditInfo){ |
| | | public Result addAuditNotes(@RequestBody AuditInfo auditInfo) { |
| | | fugitiveDustService.addAuditNotes(auditInfo); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /*è¿åå®¡æ ¸è¡¨æææ°æ®*/ |
| | | @PostMapping("/auditAllData") |
| | | public Result getAuditAllData(){ |
| | | public Result getAuditAllData() { |
| | | List<AuditInfo> list = fugitiveDustService.getAuditAllData(); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | /*æ´æ°å¼å¸¸è¡¨æ ¼*/ |
| | | @PutMapping("/auditUpdate") |
| | | public Result getAuditAllData(@RequestBody AuditInfo auditInfo){ |
| | | public Result getAuditAllData(@RequestBody AuditInfo auditInfo) { |
| | | fugitiveDustService.update(auditInfo); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /*æ ¹æ®å¼å¸¸æ¶é´è¿åæ¶é´å
å·²å®¡æ ¸çå¼å¸¸*/ |
| | | @GetMapping("/auditnum") |
| | | public Result getHasAuditedData(String beginTime, String endTime){ |
| | | List<DustExceptionData> list = fugitiveDustService.getHasAuditedData(beginTime,endTime); |
| | | public Result getHasAuditedData(String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustService.getHasAuditedData(beginTime, endTime); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | /*åå
¥ç¨æ·çå
¨å±é
ç½®*/ |
| | | @PostMapping("setting") |
| | | public Result setting(@RequestBody DustDataAccessSetting dustDataAccessSetting){ |
| | | fugitiveDustService.setting(dustDataAccessSetting); |
| | | public Result setting(@RequestBody DustDataAccessSetting dustDataAccessSetting) { |
| | | fugitiveDustService.setting(dustDataAccessSetting); |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | /*æ ¹æ®å¼å¸¸ç±»ååæ¶æ®µ è¿åç«ç¹åå*/ |
| | | @GetMapping("/exceptionsSiteName") |
| | | public Result getSiteNameByTimeAndExceptionType(String [] exceptionType, String beginTime, String endTime){ |
| | | List<DustExceptionData> list = fugitiveDustService.getSiteNameByTimeAndExceptionType(exceptionType,beginTime,endTime); |
| | | public Result getSiteNameByTimeAndExceptionType(String[] exceptionType, String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustService.getSiteNameByTimeAndExceptionType(exceptionType, beginTime, endTime); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/analysisdataByType") |
| | | public Result analysisdataByType( String month,String type){ |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdataByType(month,type); |
| | | public Result analysisdataByType(String month, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdataByType(month, type); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/analysisdataByTimeAndType") |
| | | public Result analysisdataByTimeAndType( String beginTime,String endTime,String type){ |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdataByTimeAndType(beginTime,endTime,type); |
| | | public Result analysisdataByTimeAndType(String beginTime, String endTime, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdataByTimeAndType(beginTime, endTime, type); |
| | | return Result.success(list); |
| | | } |
| | | |
| | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.DustStatisticsValue |
| | | import com.flightfeather.monitor.domain.util.MyMapper |
| | | import com.flightfeather.monitor.pojo.AnalysisDustData |
| | | import org.apache.ibatis.annotations.Mapper |
| | | import java.time.LocalDateTime |
| | | |
| | |
| | | fun dailyStatics(beginTime: LocalDateTime, endTime: LocalDateTime) |
| | | |
| | | fun monthlyStatics(beginTime: LocalDateTime, endTime: LocalDateTime, count: Int) |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶æåºæ¥è¯¢ |
| | | */ |
| | | fun selectByOrder(siteName: String, beginTime: String, endTime: String, orderProp: String?, asc: Boolean): |
| | | List<AnalysisDustData?> |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæå
¥ææ´æ°,ä»
éå䏿¥çæåä¸æçæ¹éæ°æ® |
| | | * @param list |
| | | */ |
| | | fun insertOrUpdate(list: List<RiskValue>): Int { |
| | | if (list.isEmpty()) return 0 |
| | | val newDataList = mutableListOf<RiskValue>() |
| | | val oldDataList = mutableListOf<RiskValue>() |
| | | val dataList = riskValueMapper.selectByExample(Example(RiskValue::class.java).apply { |
| | | createCriteria().andEqualTo("lst", list[0].lst) |
| | | .andEqualTo("type", list[0].type) |
| | | }) |
| | | list.forEach { l -> |
| | | val r = dataList.find { d -> |
| | | d?.mnCode == l.mnCode |
| | | } |
| | | if (r != null) { |
| | | l.id = r.id |
| | | oldDataList.add(l) |
| | | } else { |
| | | newDataList.add(l) |
| | | } |
| | | } |
| | | val r1 = riskValueMapper.insertList(newDataList) |
| | | var r2 = 0 |
| | | oldDataList.forEach { |
| | | r2 += riskValueMapper.updateByPrimaryKey(it) |
| | | } |
| | | return r1 + r2 |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ |
| | | * @param mnCode |
| | | * @param date |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.enumration.dust |
| | | |
| | | enum class DataStatus(val value: String, val des: String) { |
| | | N("N", "æ£å¸¸"), |
| | | C("C", "è®¾å¤æ ¡å"), |
| | | D("D", "è®¾å¤æå¼"), |
| | | P("P", "ä¸èµ·çµæºæ
é"), |
| | | OUT_MIN("-", "è¶
è¿æ°æ®è®¾å®èå´ä¸é"), |
| | | OUT_MAX("+", "è¶
è¿æ°æ®è®¾å®èå´ä¸é"), |
| | | Q("Q", "ä½äºå
¨å¸å½æ§ç¹PM2.5å¹³åæµåº¦äºåä¹ä¸"), |
| | | VALID(">", "é¢ç²ç©æææ°æ®å¤§äº90%"), |
| | | INVALID("<", "é¢ç²ç©æææ°æ®å°äº90%"), |
| | | R("R", "é£é大äº8m/såé¨ãéªçå¤©æ°æ¡ä»¶"), |
| | | J("J", "å¼å±è®¡éæ£å®ææ¯å¯¹æµè¯"), |
| | | A("A", "è¡¥ä¼ "), |
| | | } |
| | |
| | | package com.flightfeather.monitor.enumration.dust |
| | | |
| | | enum class ExceptionType(val value:Int, val des:String) { |
| | | TYPE0(0, "æç½ææçº¿"), |
| | | TYPE0(0, "æ°æ®ç¼ºå¤±å¼å¸¸"), |
| | | TYPE1(1, "æ°æ®è¶
ä½å¼å¸¸"), |
| | | TYPE2(2, "æ°æ®è¶
æ "), |
| | | TYPE3(3, "æ°æ®é¿æ¶æ®µæ æ³¢å¨"), |
| | |
| | | TYPE5(5, "临è¿è¶
æ å¼å¸¸"), |
| | | TYPE6(6, "忥è¶
æ æ¬¡æ°ä¸´è¿å¤ç½å¼å¸¸"), |
| | | TYPE7(7, "æ»å¨å¹³åå¼çªåå¼å¸¸"), |
| | | TYPE8(8, "ææçå¼å¸¸"), |
| | | } |
| | |
| | | private Double dayAvg; |
| | | private Double min; |
| | | private Double max; |
| | | private String dayOnline; |
| | | private String dayValid; |
| | | private String dayExceeding; |
| | | private Double dayOnline; |
| | | private Double dayValid; |
| | | private Double dayExceeding; |
| | | private String type; |
| | | } |
| | |
| | | package com.flightfeather.monitor.service; |
| | | |
| | | import com.flightfeather.monitor.pojo.*; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface FugitiveDustService { |
| | | |
| | | PageBean page(Integer page, Integer pageSize, String siteName, String mnCode, String beginTime, String endTime,String[] scenarioType); |
| | | PageBean page(Integer page, Integer pageSize, String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType); |
| | | |
| | | List<DustSiteData> scenarioData(); |
| | | |
| | | List<DustSiteData> allSiteName(); |
| | | |
| | | List<AnalysisDustData> analysisdata( String siteName,String beginTime, String endTime,String type); |
| | | List<AnalysisDustData> analysisdata(String siteName, String beginTime, String endTime, String type); |
| | | |
| | | List<AnalysisDustData> analysisByTime(String siteName, String beginTime, String endTime); |
| | | |
| | | PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, String endTime); |
| | | PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, String endTime, String orderProp, |
| | | Boolean asc); |
| | | |
| | | List<DustExceptionType> getExceptionType(); |
| | | |
| | | |
| | | PageBean getExceptionData(Integer page, Integer pageSize, String siteName, String[] exceptionType, String beginTime, String endTime); |
| | | |
| | | List<DustExceptionData> getExceptionSitenameAndCode(String exceptionType, String beginTime, String endTime,String [] street,String [] dutyCompany,String siteName); |
| | | List<DustExceptionData> getExceptionSitenameAndCode(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName); |
| | | |
| | | Integer exceptionNum(String exceptionType, String beginTime, String endTime,String [] street,String [] dutyCompany,String siteName); |
| | | Integer exceptionNum(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName); |
| | | |
| | | List<DustSiteData> conditonQueryHistoryData(String siteName, String beginTime, String endTime); |
| | | |
| | |
| | | List<AnalysisDustData> analysisAll(String siteName, String beginTime, String endTime); |
| | | |
| | | List<DustSiteData> conditonQueryhistoryallData(String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType); |
| | | |
| | | /*æ°å¢å®¡è®¡ä¿¡æ¯*/ |
| | | void addAuditNotes(AuditInfo auditInfo); |
| | | |
| | |
| | | |
| | | List<DustExceptionData> getSiteNameByTimeAndExceptionType(String[] exceptionType, String beginTime, String endTime); |
| | | |
| | | List<AnalysisDustData> analysisdataByType(String month,String type); |
| | | List<AnalysisDustData> analysisdataByType(String month, String type); |
| | | |
| | | List<AnalysisDustData> analysisdataByTimeAndType(String beginTime, String endTime, String type); |
| | | |
| | |
| | | package com.flightfeather.monitor.service.impl; |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.mapper.DustStatisticsValueMapper; |
| | | import com.flightfeather.monitor.mapper.FugitiveDustMapper; |
| | | import com.flightfeather.monitor.pojo.*; |
| | | import com.flightfeather.monitor.service.FugitiveDustService; |
| | | import com.flightfeather.monitor.utils.StringUtil; |
| | | import com.github.pagehelper.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | |
| | | @Autowired |
| | | private FugitiveDustMapper fugitiveDustMapper; |
| | | |
| | | @Autowired |
| | | private DustStatisticsValueMapper dustStatisticsValueMapper; |
| | | |
| | | @Override |
| | | public PageBean page(Integer page, Integer pageSize, String siteName, String mnCode, String beginTime, String endTime,String[] scenarioType) { |
| | | public PageBean page(Integer page, Integer pageSize, String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType) { |
| | | //设置å页忰 |
| | | PageHelper.startPage(page,pageSize); |
| | | PageHelper.startPage(page, pageSize); |
| | | //æ§è¡æ¥è¯¢ |
| | | List<DustSiteData> infoList=fugitiveDustMapper.conditonQueryDustHistoryData(siteName,mnCode,beginTime,endTime,scenarioType); |
| | | List<DustSiteData> infoList = fugitiveDustMapper.conditonQueryDustHistoryData(siteName, mnCode, beginTime, endTime, scenarioType); |
| | | //è·åæ¥è¯¢ç»æ |
| | | Page<DustSiteData> p=(Page<DustSiteData>)infoList; |
| | | Page<DustSiteData> p = (Page<DustSiteData>) infoList; |
| | | |
| | | //å°è£
PageBean对象*/ |
| | | PageBean pageBean=new PageBean(p.getTotal(),p.getResult()); |
| | | return pageBean; |
| | | PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); |
| | | return pageBean; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisdata( String siteName,String beginTime, String endTime,String type) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdata(siteName,beginTime,endTime,type); |
| | | public List<AnalysisDustData> analysisdata(String siteName, String beginTime, String endTime, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdata(siteName, beginTime, endTime, type); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisByTime(String siteName, String beginTime, String endTime) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisByTime(siteName,beginTime,endTime); |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisByTime(siteName, beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, String endTime) { |
| | | public PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, |
| | | String endTime, String orderProp, |
| | | Boolean asc) { |
| | | //设置å页忰 |
| | | PageHelper.startPage(page,pageSize); |
| | | //æ§è¡æ¥è¯¢ |
| | | List<AnalysisDustData> infoList=fugitiveDustMapper.analysisByTime(siteName,beginTime,endTime); |
| | | Page<AnalysisDustData> p = PageHelper.startPage(page, pageSize); |
| | | //è·åæ¥è¯¢ç»æ |
| | | Page<AnalysisDustData> p=(Page<AnalysisDustData>)infoList; |
| | | String prop = StringUtil.INSTANCE.camelCaseToUnderline(orderProp); |
| | | dustStatisticsValueMapper.selectByOrder(siteName, beginTime, endTime, prop, asc); |
| | | |
| | | //å°è£
PageBean对象*/ |
| | | PageBean pageBean=new PageBean(p.getTotal(),p.getResult()); |
| | | return pageBean; |
| | | //å°è£
PageBean对象 |
| | | return new PageBean(p.getTotal(), p.getResult()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public PageBean getExceptionData(Integer page, Integer pageSize, String siteName, String[] exceptionType, String beginTime, String endTime) { |
| | | //设置å页忰 |
| | | PageHelper.startPage(page,pageSize); |
| | | PageHelper.startPage(page, pageSize); |
| | | |
| | | List<DustExceptionData> infoList = fugitiveDustMapper.getExceptionData(siteName,exceptionType,beginTime,endTime); |
| | | List<DustExceptionData> infoList = fugitiveDustMapper.getExceptionData(siteName, exceptionType, beginTime, endTime); |
| | | //è·åæ¥è¯¢ç»æ |
| | | Page<DustExceptionData> p=(Page<DustExceptionData>)infoList; |
| | | Page<DustExceptionData> p = (Page<DustExceptionData>) infoList; |
| | | |
| | | //å°è£
PageBean对象*/ |
| | | PageBean pageBean=new PageBean(p.getTotal(),p.getResult()); |
| | | PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); |
| | | |
| | | return pageBean; |
| | | return pageBean; |
| | | } |
| | | |
| | | @Override |
| | | public List<DustExceptionData> getExceptionSitenameAndCode(String exceptionType, String beginTime, String endTime,String [] street,String [] dutyCompany,String siteName) { |
| | | List<DustExceptionData> list = fugitiveDustMapper.getExceptionSitenameAndCode(exceptionType,beginTime,endTime,street,dutyCompany,siteName); |
| | | public List<DustExceptionData> getExceptionSitenameAndCode(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName) { |
| | | List<DustExceptionData> list = fugitiveDustMapper.getExceptionSitenameAndCode(exceptionType, beginTime, endTime, street, dutyCompany, siteName); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Integer exceptionNum(String exceptionType, String beginTime, String endTime,String [] street,String [] dutyCompany,String siteName) { |
| | | Integer list = fugitiveDustMapper.exceptionNum(exceptionType,beginTime,endTime,street,dutyCompany,siteName); |
| | | public Integer exceptionNum(String exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany, String siteName) { |
| | | Integer list = fugitiveDustMapper.exceptionNum(exceptionType, beginTime, endTime, street, dutyCompany, siteName); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<DustSiteData> conditonQueryHistoryData(String siteName, String beginTime, String endTime) { |
| | | List<DustSiteData> list = fugitiveDustMapper.conditonQueryHistoryData(siteName,beginTime,endTime); |
| | | List<DustSiteData> list = fugitiveDustMapper.conditonQueryHistoryData(siteName, beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<DustExceptionData> getExceptionAllData(String siteName, String[] exceptionType, String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustMapper.getExceptionData(siteName,exceptionType,beginTime,endTime); |
| | | List<DustExceptionData> list = fugitiveDustMapper.getExceptionData(siteName, exceptionType, beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisAll(String siteName, String beginTime, String endTime) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisByTime(siteName,beginTime,endTime); |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisByTime(siteName, beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<DustSiteData> conditonQueryhistoryallData(String siteName, String mnCode, String beginTime, String endTime, String[] scenarioType) { |
| | | List<DustSiteData> list = fugitiveDustMapper.conditonQueryDustHistoryData(siteName,mnCode,beginTime,endTime,scenarioType); |
| | | List<DustSiteData> list = fugitiveDustMapper.conditonQueryDustHistoryData(siteName, mnCode, beginTime, endTime, scenarioType); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void addAuditNotes(AuditInfo auditInfo) { |
| | | if(auditInfo.getAuditStatus()==3){ |
| | | if (auditInfo.getAuditStatus() == 3) { |
| | | auditInfo.setUpdateTime(LocalDateTime.now()); |
| | | auditInfo.setCreateTime(LocalDateTime.now()); |
| | | }else{ |
| | | } else { |
| | | auditInfo.setCreateTime(LocalDateTime.now()); |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<DustExceptionData> getHasAuditedData(String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustMapper.getHasAuditedData(beginTime,endTime); |
| | | List<DustExceptionData> list = fugitiveDustMapper.getHasAuditedData(beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<DustExceptionData> getSiteNameByTimeAndExceptionType(String[] exceptionType, String beginTime, String endTime) { |
| | | List<DustExceptionData> list = fugitiveDustMapper.getSiteNameByTimeAndExceptionType(exceptionType,beginTime,endTime); |
| | | List<DustExceptionData> list = fugitiveDustMapper.getSiteNameByTimeAndExceptionType(exceptionType, beginTime, endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisdataByType(String month, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdataByType(month,type); |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdataByType(month, type); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisdataByTimeAndType(String beginTime, String endTime, String type) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdataByTimeAndType(beginTime,endTime,type); |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdataByTimeAndType(beginTime, endTime, type); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageBean getExceptionData2(Integer page, Integer pageSize, String siteName, String[] exceptionType, String beginTime, String endTime, String[] street, String[] dutyCompany) { |
| | | //设置å页忰 |
| | | PageHelper.startPage(page,pageSize); |
| | | PageHelper.startPage(page, pageSize); |
| | | |
| | | List<DustExceptionData> infoList = fugitiveDustMapper.getExceptionData2(siteName,exceptionType,beginTime,endTime,street,dutyCompany); |
| | | List<DustExceptionData> infoList = fugitiveDustMapper.getExceptionData2(siteName, exceptionType, beginTime, endTime, street, dutyCompany); |
| | | //è·åæ¥è¯¢ç»æ |
| | | Page<DustExceptionData> p=(Page<DustExceptionData>)infoList; |
| | | Page<DustExceptionData> p = (Page<DustExceptionData>) infoList; |
| | | |
| | | //å°è£
PageBean对象*/ |
| | | PageBean pageBean=new PageBean(p.getTotal(),p.getResult()); |
| | | PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); |
| | | |
| | | return pageBean; |
| | | return pageBean; |
| | | } |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.utils |
| | | |
| | | /** |
| | | * ææ¬å·¥å
· |
| | | */ |
| | | object StringUtil { |
| | | |
| | | /** |
| | | * 驼峰å½åæ³ææ¬è½¬ä¸åçº¿ææ¬ |
| | | * @param t |
| | | * @return |
| | | */ |
| | | fun camelCaseToUnderline(t: String?): String? { |
| | | t ?: return null |
| | | |
| | | val result = StringBuilder() |
| | | t.forEach { |
| | | if (it.isUpperCase()) { |
| | | result.append('_') |
| | | result.append(it.lowercaseChar()) |
| | | } else { |
| | | result.append(it) |
| | | } |
| | | } |
| | | return result.toString() |
| | | } |
| | | } |
| | |
| | | ds1: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # ç产ç¯å¢ |
| | | # url: jdbc:mysql://localhost:3306/fume?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&allowMultiQueries=true&useSSL=false |
| | | # username: fume |
| | | # password: fume_feiyu2023 |
| | | url: jdbc:mysql://localhost:3306/fume?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&allowMultiQueries=true&useSSL=false |
| | | username: fume |
| | | password: fume_feiyu2023 |
| | | |
| | | # url: jdbc:mysql://localhost:3306/qianduan_sql?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&allowMultiQueries=true&useSSL=false |
| | | # username: root |
| | |
| | | # username: root |
| | | # password: 123456 |
| | | |
| | | url: jdbc:mysql://114.215.109.124:3306/fume?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&allowMultiQueries=true&useSSL=false |
| | | username: fumeRemote |
| | | password: feiyu2023 |
| | | # url: jdbc:mysql://114.215.109.124:3306/fume?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&allowMultiQueries=true&useSSL=false |
| | | # username: fumeRemote |
| | | # password: feiyu2023 |
| | | |
| | | mybatis: |
| | | configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | # log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl |
| | | map-underscore-to-camel-case: true |
| | | type-aliases-package: com.flightfeather.monitor.domain.ds1.entity |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.flightfeather.monitor.domain.ds1.mapper.DustStatisticsValueMapper"> |
| | | <resultMap id="BaseResultMap" type="com.flightfeather.monitor.domain.ds1.entity.DustStatisticsValue"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="mn_code" jdbcType="VARCHAR" property="mnCode" /> |
| | | <result column="lst" jdbcType="DATE" property="lst" /> |
| | | <result column="day_avg" jdbcType="VARCHAR" property="dayAvg" /> |
| | | <result column="min" jdbcType="VARCHAR" property="min" /> |
| | | <result column="max" jdbcType="VARCHAR" property="max" /> |
| | | <result column="day_online" jdbcType="VARCHAR" property="dayOnline" /> |
| | | <result column="day_valid" jdbcType="VARCHAR" property="dayValid" /> |
| | | <result column="day_exceeding" jdbcType="VARCHAR" property="dayExceeding" /> |
| | | <result column="type" jdbcType="VARCHAR" property="type" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, mn_code, lst, day_avg, min, max, day_online, day_valid, day_exceeding, type |
| | | </sql> |
| | | <resultMap id="BaseResultMap" type="com.flightfeather.monitor.domain.ds1.entity.DustStatisticsValue"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="id" jdbcType="INTEGER" property="id"/> |
| | | <result column="mn_code" jdbcType="VARCHAR" property="mnCode"/> |
| | | <result column="lst" jdbcType="DATE" property="lst"/> |
| | | <result column="day_avg" jdbcType="VARCHAR" property="dayAvg"/> |
| | | <result column="min" jdbcType="VARCHAR" property="min"/> |
| | | <result column="max" jdbcType="VARCHAR" property="max"/> |
| | | <result column="day_online" jdbcType="VARCHAR" property="dayOnline"/> |
| | | <result column="day_valid" jdbcType="VARCHAR" property="dayValid"/> |
| | | <result column="day_exceeding" jdbcType="VARCHAR" property="dayExceeding"/> |
| | | <result column="type" jdbcType="VARCHAR" property="type"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, mn_code, lst, day_avg, min, max, day_online, day_valid, day_exceeding, type |
| | | </sql> |
| | | |
| | | <insert id="dailyStatics"> |
| | | insert into dust_statistics_value(mn_code,lst,day_avg,min,max,day_online,day_valid,day_exceeding,type) |
| | | select a.* |
| | | from (select |
| | | mn_code as mn_code, |
| | | DATE(lst) as lst, |
| | | ROUND(AVG(dust_value),3) as day_avg, |
| | | min(dust_value) as min, |
| | | max(dust_value) as max, |
| | | CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online, |
| | | CONCAT(ROUND(SUM(CASE WHEN dust_value >0 THEN 1 ELSE 0 END)/96 *100, 2), '%') as day_valid, |
| | | CONCAT(ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding, |
| | | 'day' as type |
| | | from ja_t_dust_site_data_info |
| | | where lst between #{beginTime} and #{endTime} |
| | | GROUP BY mn_code,DATE(lst) |
| | | ) as a |
| | | </insert> |
| | | <insert id="monthlyStatics"> |
| | | insert into dust_statistics_value(mn_code,lst,day_avg,min,max,day_online,day_valid,day_exceeding,type) |
| | | select a.* |
| | | from ( |
| | | SELECT |
| | | mn_code AS mn_code, |
| | | DATE_FORMAT(lst, '%Y-%m-01') AS month, |
| | | ROUND(AVG(dust_value), 3) AS month_avg, |
| | | MIN(dust_value) AS min, |
| | | MAX(dust_value) AS max, |
| | | CONCAT(ROUND(COUNT(*) / #{count} * 100, 2), '%') AS month_online, |
| | | CONCAT(ROUND(SUM(CASE WHEN flag = 'N' OR flag = 'A' THEN 1 ELSE 0 END) / #{count} * 100, 2), '%') AS month_valid, |
| | | CONCAT(ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END) / #{count} * 100, 2), '%') AS month_exceeding, |
| | | 'month' as type |
| | | FROM ja_t_dust_site_data_info |
| | | WHERE lst BETWEEN #{beginTime} and #{endTime} |
| | | GROUP BY mn_code, DATE_FORMAT(lst, '%Y-%m-01') |
| | | ) as a |
| | | </insert> |
| | | <insert id="dailyStatics"> |
| | | insert into dust_statistics_value(mn_code,lst,day_avg,min,max,day_online,day_valid,day_exceeding,type) |
| | | select a.* |
| | | from (select |
| | | mn_code as mn_code, |
| | | DATE(lst) as lst, |
| | | ROUND(AVG(dust_value),3) as day_avg, |
| | | min(dust_value) as min, |
| | | max(dust_value) as max, |
| | | ROUND(COUNT(*)/96, 4) as day_online, |
| | | ROUND(SUM(CASE WHEN dust_value >0 THEN 1 ELSE 0 END)/96, 4) as day_valid, |
| | | ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END)/96, 4) as day_exceeding, |
| | | 'day' as type |
| | | from ja_t_dust_site_data_info |
| | | where lst between #{beginTime} and #{endTime} |
| | | GROUP BY mn_code,DATE(lst) |
| | | ) as a |
| | | </insert> |
| | | <insert id="monthlyStatics"> |
| | | insert into dust_statistics_value(mn_code,lst,day_avg,min,max,day_online,day_valid,day_exceeding,type) |
| | | select a.* |
| | | from ( |
| | | SELECT |
| | | mn_code AS mn_code, |
| | | DATE_FORMAT(lst, '%Y-%m-01') AS month, |
| | | ROUND(AVG(dust_value), 3) AS month_avg, |
| | | MIN(dust_value) AS min, |
| | | MAX(dust_value) AS max, |
| | | ROUND(COUNT(*) / #{count}, 4) AS month_online, |
| | | ROUND(SUM(CASE WHEN flag = 'N' OR flag = 'A' THEN 1 ELSE 0 END) / #{count}, 4) AS month_valid, |
| | | ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END) / #{count}, 4) AS month_exceeding, |
| | | 'month' as type |
| | | FROM ja_t_dust_site_data_info |
| | | WHERE lst BETWEEN #{beginTime} and #{endTime} |
| | | GROUP BY mn_code, DATE_FORMAT(lst, '%Y-%m-01') |
| | | ) as a |
| | | </insert> |
| | | |
| | | <!-- æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ--> |
| | | <select id="selectByOrder" resultType="com.flightfeather.monitor.pojo.AnalysisDustData"> |
| | | select c.name,d.* |
| | | from dust_statistics_value as d |
| | | left join ja_t_dust_site_info as c on c.mn_code = d.mn_code |
| | | <where> |
| | | <if test="siteName != null and siteName != ''"> |
| | | and c.name = #{siteName} |
| | | </if> |
| | | <if test="beginTime != null and endTime != null"> |
| | | and d.lst between #{beginTime} and #{endTime} and d.type = 'day' |
| | | </if> |
| | | </where> |
| | | <if test="orderProp == 'lst'"> |
| | | order by d.lst |
| | | </if> |
| | | <if test="orderProp == 'day_avg'"> |
| | | order by d.day_avg |
| | | </if> |
| | | <if test="orderProp == 'min'"> |
| | | order by d.min |
| | | </if> |
| | | <if test="orderProp == 'max'"> |
| | | order by d.max |
| | | </if> |
| | | <if test="orderProp == 'day_online'"> |
| | | order by d.day_online |
| | | </if> |
| | | <if test="orderProp == 'day_valid'"> |
| | | order by d.day_valid |
| | | </if> |
| | | <if test="orderProp == 'day_exceeding'"> |
| | | order by d.day_exceeding |
| | | </if> |
| | | <if test="orderProp != null and asc"> |
| | | asc |
| | | </if> |
| | | <if test="orderProp != null and !asc"> |
| | | desc |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | @Test |
| | | fun run() { |
| | | exceptionAnalysisController.init() |
| | | var d1 = LocalDate.of(2023, 10, 26) |
| | | val d2 = LocalDate.of(2023, 10, 26) |
| | | while (Duration.between(d1.atStartOfDay(), d2.atStartOfDay()).toDays() >= 0L) { |
| | | var d1 = LocalDate.of(2023, 7, 1) |
| | | val d2 = LocalDate.of(2023, 11, 21) |
| | | while (d1.isEqual(d2) || d1.isBefore(d2)) { |
| | | exceptionAnalysisController.run(d1) |
| | | d1 = d1.plusDays(1) |
| | | } |