riku
2022-06-17 3a5c011d9509d3bc0367921f463676c81ff2e374
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
84
85
package cn.flightfeather.supervision.business.fume.item
 
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds2.entity.Complaint
import cn.flightfeather.supervision.domain.ds2.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 java.time.format.DateTimeFormatter
import javax.annotation.PostConstruct
 
@Component
class ScoreItem_9: ScoreItem() {
    companion object {
        private lateinit var instance: ScoreItem_9
    }
 
    @PostConstruct
    fun init() {
        instance = this
    }
 
    @Autowired
    lateinit var complaintMapper: ComplaintMapper
 
    override var id: String = "mTre4cqan43BOW82"
 
    override var name: String="信访投诉"
 
    /**
     * 季度内信访记录规格化导入
     * 选项如下:
     *      1.无信访、无投诉、监管配合积极
     *      2.本季度发生单次区级信访投诉
     *      3.本季度发生市级信访投诉或多次区级信访、投诉或监管不配合
     */
    override fun otherProblem(size: Int): Int? {
        val complaints = complaintMapper.selectByExample(Example(Complaint::class.java).apply {
            createCriteria().andEqualTo("cpSceneid", info.tzUserId)
                .andGreaterThanOrEqualTo("cpTime", info.sTime)
                .andLessThan("cpTime", info.eTime)
        })
 
        var i = 2
        if (condition2(complaints)) {
            if (i > size - 1) i = size - 1
            return i
        } else if (condition1(complaints)) {
            i = 1
            if (i > size - 1) i = size - 1
            return i
        }
        return null
    }
 
    /**
     * @return true  本季度发生单次区级信访投诉
     */
    private fun condition1(c: List<Complaint>): Boolean {
        c.forEach {
            if (it.cpExtension1 == "1") {
                return true
            }
        }
        return false
    }
 
    /**
     * @return true  本季度发生市级信访投诉或多次区级信访、投诉或监管不配合
     */
    private fun condition2(c: List<Complaint>): Boolean {
        var count = 0
        c.forEach {
            if (it.cpExtension1 == "0") {
                //发生市级信访投诉
                return true
            } else {
                count++
            }
        }
        return count > 1
    }
}