feiyu02
2022-11-15 23bd719cebe5feeff4e48fde925b0b39755eea93
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
package cn.flightfeather.supervision.common.score.item
 
import cn.flightfeather.supervision.common.score.Info
import cn.flightfeather.supervision.common.score.ScoreItem
import cn.flightfeather.supervision.domain.entity.BaseInfo
import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
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_13: ScoreItem() {
    companion object {
        private lateinit var instance: ScoreItem_13
    }
 
    @Autowired
    lateinit var baseInfoMapper: BaseInfoMapper
 
    @PostConstruct
    fun init() {
        instance = this
    }
 
    override var id: String = ""
 
    override var name: String="有无VOCs在线监测设备"
 
    override var maxScore: Int = 5
 
    override fun calScore(): Pair<Int, Int> {
        // 额外项,符合的加分,不符合的不扣分
        return if (condition1()) {
            Pair(0, maxScore*2)
        } else {
            Pair(1, maxScore)
        }
    }
 
    /**
     * 有VOCs在线监测设备
     * @return true 已安装;false 未安装
     */
    private fun condition1(): Boolean {
        val baseInfo = baseInfoMapper.selectByPrimaryKey(info.userId)
        return if (baseInfo == null) {
            false
        } else {
            !baseInfo.biExtension2.isNullOrBlank()
        }
    }
}