package cn.flightfeather.supervision.business.storage.item
|
|
import cn.flightfeather.supervision.business.ScoreItem
|
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
|
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.stereotype.Component
|
import tk.mybatis.mapper.entity.Example
|
import java.time.LocalDateTime
|
import java.time.ZoneId
|
import javax.annotation.PostConstruct
|
|
/**
|
* Date 2022/1/20 16:14
|
* Created by feiyu
|
* 工地
|
*/
|
@Component
|
class CsScoreItem_2:ScoreItem() {
|
|
companion object {
|
private lateinit var instance: CsScoreItem_2
|
}
|
|
@PostConstruct
|
fun init() {
|
instance = this
|
}
|
|
override var id: String = "dCQbQ8ibc6nexiJo"
|
|
override var name: String = "扬尘在线监测数据量级"
|
|
@Autowired
|
lateinit var dustDataResultMapper: DustDataResultMapper
|
|
/**
|
* 扬尘在线监测数据量级
|
* 选项如下:
|
* 1.监测数据出现单日及以上有效超标
|
* 2.监测数据月均值超区域月均值20%以上或数据明显异常
|
*/
|
override fun otherProblem(size: Int): Int? {
|
val time = info.subTask?.planstarttime
|
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
|
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
|
val et = st.plusMonths(1)
|
val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
|
createCriteria().andGreaterThanOrEqualTo("drTime", st)
|
.andLessThan("drTime", et)
|
.andEqualTo("drSceneId", info.sceneId)
|
})
|
|
var result: Int? = null
|
r.forEach {
|
if (it == null) return@forEach
|
if (it.drExceedTimes > 0) {
|
result = 0
|
}
|
if (it.drOverAvgPer > 0) {
|
result = 1
|
}
|
}
|
|
return result
|
}
|
}
|