riku
2022-06-09 9867f6d5c5bccfe52b878c344c536905dd6b309e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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 java.time.LocalDate
import java.time.ZoneId
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> {
        val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault())
        val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault())
        // 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)
                .andGreaterThanOrEqualTo("cpTime", startTime)
                .andLessThan("cpTime", lastTime)
        })
        
        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
    }
}