package cn.flightfeather.supervision.business.fume.item
|
|
import cn.flightfeather.supervision.business.ScoreItem
|
import cn.flightfeather.supervision.domain.ds2.entity.Punishment
|
import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.stereotype.Component
|
import tk.mybatis.mapper.entity.Example
|
import java.time.LocalDate
|
import java.time.ZoneId
|
import java.util.*
|
import javax.annotation.PostConstruct
|
|
@Component
|
class ScoreItem_10: ScoreItem() {
|
companion object {
|
private lateinit var instance: ScoreItem_10
|
}
|
|
@PostConstruct
|
fun init() {
|
instance = this
|
}
|
|
@Autowired
|
lateinit var punishmentMapper: PunishmentMapper
|
|
override var id: String = "dlALSsoF63Z2FOz0"
|
|
override var name: String = "行政处罚"
|
|
/**
|
* 季度内行政处罚记录规格化导入
|
* 选项如下:
|
* 1.无责令整改、执法意见和行政处罚
|
* 2.收到责令改正决定书
|
* 3.收到执法意见书
|
* 4.有环境违法行为且受到行政处罚
|
*/
|
override fun otherProblem(size: Int): Int? {
|
val s = Date.from(info.sTime?.atZone(ZoneId.systemDefault())?.toInstant())
|
val e = Date.from(info.eTime?.atZone(ZoneId.systemDefault())?.toInstant())
|
|
var i = 1
|
when {
|
condition3(s, e) -> {
|
i = 3
|
if (i > size - 1) i = size - 1
|
return i
|
}
|
condition2(s, e) -> {
|
i = 2
|
if (i > size - 1) i = size - 1
|
return i
|
}
|
condition1(s, e) -> {
|
i = 1
|
if (i > size - 1) i = size - 1
|
return i
|
}
|
else -> return null
|
}
|
}
|
|
/**
|
* @return true 收到责令改正决定书
|
*/
|
private fun condition1(s: Date, e: Date): Boolean {
|
val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
|
createCriteria().andEqualTo("pmSceneId", info.tzUserId)
|
.andEqualTo("pmExtension1", "1")
|
.andGreaterThanOrEqualTo("pmTime", s)
|
.andLessThan("pmTime", e)
|
})
|
return p.isNotEmpty()
|
}
|
|
/**
|
* @return true 收到执法意见书
|
*/
|
private fun condition2(s: Date, e: Date): Boolean {
|
return false
|
}
|
|
/**
|
* @return true 有环境违法行为且受到行政处罚
|
*/
|
private fun condition3(s: Date, e: Date): Boolean {
|
val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
|
createCriteria().andEqualTo("pmSceneId", info.tzUserId)
|
.andEqualTo("pmExtension1", "0")
|
.andGreaterThanOrEqualTo("pmTime", s)
|
.andLessThan("pmTime", e)
|
})
|
return p.isNotEmpty()
|
}
|
}
|