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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package cn.flightfeather.supervision.business.fume.item
 
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
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_8: ScoreItem() {
    companion object {
        private lateinit var instance: ScoreItem_8
    }
 
    @PostConstruct
    fun init() {
        instance = this
    }
 
    // 豁免问题id列表,豁免不做评价的问题,其对应的整改也应该不再计算
    private val exemptionItemIdList = mutableListOf<String?>()
 
    override var id: String = "yAAn3zm6e2PenHeJ"
 
    override var name: String="整改措施及效果"
 
    /**
     * 清空需要豁免的问题
     */
    fun clear() {
        exemptionItemIdList.clear()
    }
 
    /**
     * 设置需要豁免的问题
     */
    fun setExemptionProblem(
        list: List<String>,
        eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>
    ) {
        eList.forEach {
            if (list.contains(it.first.guid)) {
                it.second.forEach {e ->
                    exemptionItemIdList.addAll(e.problemlist?.split(";") ?: emptyList())
                }
            }
        }
    }
 
    fun setExemptionProblem(list: List<Evaluationsubrule2>) {
        list.forEach {
            exemptionItemIdList.addAll(it.problemlist?.split(";") ?: emptyList())
        }
    }
 
    /**
     * 执法检查汇总情况
     * 选项如下:
     *      1.全部按时整改并及时提交材料
     *      2.问题部分整改或不及时提供材料
     *      3.问题无整改
     */
    override fun otherProblem(size: Int): Int? {
        val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
            createCriteria().andEqualTo("sguid", info.sceneId)
                .andGreaterThanOrEqualTo("time", info.sTime)
                .andLessThan("time", info.eTime).apply {
                    if (exemptionItemIdList.isNotEmpty()) {
                        // FIXME: 2022/1/27 此处根据特殊要求,将【台账严重缺失或关键台账无效】和【台账少量缺失或未及时记录更新】两个问题剔除,不计算在整改率内
                        andNotIn("ptguid", exemptionItemIdList)
                    }
                }
        })
        var i = 0
 
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
                changed++
            }
        }
        return when {
            changed == 0 && total > 0 -> 2
            changed < total -> 1
            else -> 0
        }
    }
 
    /**
     * @return true  问题部分整改或不及时提供材料
     */
    private fun condition1(): Boolean {
        return false
    }
 
    /**
     * @return true  问题无整改
     */
    private fun condition2(): Boolean {
        return false
    }
}