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.Signature
|
import cn.flightfeather.supervision.domain.mapper.ProblemMapper
|
import cn.flightfeather.supervision.domain.mapper.SignatureMapper
|
import cn.flightfeather.supervision.infrastructure.utils.DateUtil
|
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.LocalDateTime
|
import java.time.ZoneId
|
import java.util.*
|
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 signatureMapper: SignatureMapper
|
|
override var id: String = ""
|
|
override var name: String="参与环保部门线上培训情况"
|
|
override var maxScore: Int = 3
|
|
override fun calScore(): Pair<Int, Int> {
|
return if (condition1()) {
|
Pair(1, minScore)
|
} else {
|
Pair(0, maxScore)
|
}
|
}
|
|
/**
|
* 线上培训未签到或签收文件 -3分
|
*/
|
private fun condition1(): Boolean {
|
val startTime = LocalDate.of(info.year, sMonth, 1).atStartOfDay(ZoneId.systemDefault())
|
val lastTime = LocalDate.of(info.year, eMonth, 1).plusMonths(1).atStartOfDay(ZoneId.systemDefault())
|
val signs = signatureMapper.selectByExample(Example(Signature::class.java).apply {
|
createCriteria().andEqualTo("msParticipantid", info.userId)
|
.andEqualTo("msIssignin", false)
|
.andBetween("msCreatedate", startTime, lastTime)
|
})
|
return signs.isNotEmpty()
|
}
|
}
|