package cn.flightfeather.supervision.business.autooutput.score.restaurant
|
|
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
|
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
|
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
|
import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
|
import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType
|
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
|
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.stereotype.Component
|
import tk.mybatis.mapper.entity.Example
|
import java.time.LocalDateTime
|
import java.time.ZoneId
|
import javax.annotation.PostConstruct
|
|
@Deprecated(level = DeprecationLevel.HIDDEN, message = "台账的评估通过巡查问题自动对应")
|
@Component
|
class ReScoreItem7: ScoreItem() {
|
init {
|
exemption = true
|
}
|
|
@Autowired
|
lateinit var ledgerRecordMapper: LedgerRecordMapper
|
|
@Autowired
|
lateinit var ledgerSubTypeMapper: LedgerSubTypeMapper
|
|
override var id: String = "wfzFTlcZ3xMdj5M2"
|
|
override var name: String = "台账管理"
|
|
/**
|
* 在线台账记录的提交类别完整性和及时性
|
* 选项r如下:
|
* 1.台账类别齐全、完整、及时记录更新
|
* 2.台账少量缺失或未及时记录更新
|
* 3.台账严重缺失或关键台账无效
|
*/
|
override fun otherProblem(size: Int): List<Int>? {
|
// TODO: 2021/3/9 找出用户类型对应的必填台账
|
val time = evaluationScene.subTask.value?.planstarttime
|
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
|
val year = lt.year
|
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
|
val et = st.plusMonths(1)
|
|
val ledgerTypeCount = ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
|
createCriteria().andEqualTo("lScenetype", "1").andEqualTo("lNeedupdate", true)
|
})
|
val rCount = ledgerRecordMapper.selectCountByExample(Example(LedgerRecord::class.java).apply {
|
createCriteria().andEqualTo("lrYear", year)
|
.andGreaterThanOrEqualTo("lrSubmitdate", st)
|
.andLessThanOrEqualTo("lrSubmitdate", et)
|
.andEqualTo("lrSubmitid", evaluationScene.userInfoTZ.value?.guid)
|
})
|
var i = 1
|
if (condition1(ledgerTypeCount, rCount)) {
|
if (i > size - 1) i = size - 1
|
} else if (condition2(ledgerTypeCount, rCount)) {
|
i = 2
|
if (i > size - 1) i = size - 1
|
}
|
return listOf(i)
|
}
|
|
/**
|
* @param c1 必填项台账类别数
|
* @param c2 实际上传数
|
* @return true 台账少量缺失或未及时记录更新
|
*/
|
private fun condition1(c1: Int, c2: Int): Boolean {
|
return (c2.toDouble() / c1.toDouble()) >= 0.8
|
}
|
|
/**
|
* @param c1 必填项台账类别数
|
* @param c2 实际上传数
|
* @return true 台账严重缺失或关键台账无效
|
*/
|
private fun condition2(c1: Int, c2: Int): Boolean {
|
return (c2.toDouble() / c1.toDouble()) <= 0.3
|
}
|
}
|