package cn.flightfeather.supervision.business.autooutput.score.restaurant
|
|
import cn.flightfeather.supervision.business.autooutput.score.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.LocalDateTime
|
import java.time.ZoneId
|
import java.util.*
|
import javax.annotation.PostConstruct
|
|
@Component
|
class ReScoreItem10: ScoreItem() {
|
companion object {
|
private lateinit var instance: ReScoreItem10
|
}
|
|
@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): List<Int>? {
|
val time = evaluationScene.subTask.value?.planstarttime
|
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
|
val s = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
|
val e = s.plusMonths(1)
|
|
var i = 0
|
when {
|
condition3(s, e) -> {
|
i = 3
|
}
|
condition2(s, e) -> {
|
i = 2
|
}
|
condition1(s, e) -> {
|
i = 1
|
}
|
}
|
if (i > size - 1) i = size - 1
|
return listOf(i)
|
}
|
|
/**
|
* @return true 收到责令改正决定书
|
*/
|
private fun condition1(s: LocalDateTime, e: LocalDateTime): Boolean {
|
val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
|
createCriteria().andEqualTo("pmSceneId", evaluationScene.userInfoTZ.value?.guid)
|
.andEqualTo("pmExtension1", "1")
|
.andGreaterThanOrEqualTo("pmTime", s)
|
.andLessThan("pmTime", e)
|
})
|
return p.isNotEmpty()
|
}
|
|
/**
|
* @return true 收到执法意见书
|
*/
|
private fun condition2(s: LocalDateTime, e: LocalDateTime): Boolean {
|
return false
|
}
|
|
/**
|
* @return true 有环境违法行为且受到行政处罚
|
*/
|
private fun condition3(s: LocalDateTime, e: LocalDateTime): Boolean {
|
val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
|
createCriteria().andEqualTo("pmSceneId", evaluationScene.userInfoTZ.value?.guid)
|
.andEqualTo("pmExtension1", "0")
|
.andGreaterThanOrEqualTo("pmTime", s)
|
.andLessThan("pmTime", e)
|
})
|
return p.isNotEmpty()
|
}
|
}
|