package cn.flightfeather.supervision.common.score.item
|
|
import cn.flightfeather.supervision.common.score.ScoreItem
|
import cn.flightfeather.supervision.domain.entity.Complaint
|
import cn.flightfeather.supervision.domain.mapper.ComplaintMapper
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.stereotype.Component
|
import tk.mybatis.mapper.entity.Example
|
import javax.annotation.PostConstruct
|
|
@Component
|
class ScoreItem_6 : ScoreItem() {
|
companion object {
|
private lateinit var instance: ScoreItem_6
|
}
|
|
@Autowired
|
lateinit var scoreItem5: ScoreItem_5
|
|
@Autowired
|
lateinit var complaintMapper: ComplaintMapper
|
|
@PostConstruct
|
fun init() {
|
instance = this
|
}
|
|
override var id: String = ""
|
|
override var name: String = "信访投诉"
|
|
override var maxScore: Int = 10
|
|
override fun calScore(): Pair<Int, Int> {
|
// FIXME: 2021/4/26 涉执法意见、责令整改或行政处罚,扣除全部分数
|
val r5 = scoreItem5.execute(info)
|
if (r5.first != 0) {
|
return Pair(2, minScore)
|
}
|
|
val complaints = complaintMapper.selectByExample(Example(Complaint::class.java).apply {
|
createCriteria().andEqualTo("cpSceneid", info.userId)
|
})
|
|
return if (condition1(complaints)) {
|
Pair(2, minScore)
|
} else if (condition2(complaints)) {
|
Pair(1, maxScore / 2)
|
} else {
|
Pair(0, maxScore)
|
}
|
}
|
|
/**
|
* 本季度发生市级信访投诉 -10分
|
*/
|
private fun condition1(c: List<Complaint>): Boolean {
|
c.forEach {
|
if (it.cpExtension1 == "0") {
|
return true
|
}
|
}
|
return false
|
}
|
|
/**
|
* 本季度发生区级信访投诉 -5分
|
*/
|
private fun condition2(c: List<Complaint>): Boolean {
|
c.forEach {
|
if (it.cpExtension1 == "1") {
|
return true
|
}
|
}
|
return false
|
}
|
}
|