| | |
| | | import cn.flightfeather.supervision.domain.entity.Evaluationrule |
| | | import cn.flightfeather.supervision.domain.entity.Evaluationsubrule |
| | | import cn.flightfeather.supervision.domain.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.domain.enumeration.AssessmentRuleType |
| | | import cn.flightfeather.supervision.domain.enumeration.SceneType |
| | | import cn.flightfeather.supervision.domain.mapper.* |
| | | import cn.flightfeather.supervision.infrastructure.utils.DateUtil |
| | | import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SubEvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ThirdEvaluationVo |
| | | import org.springframework.stereotype.Service |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDateTime |
| | | |
| | | @Service |
| | | class EvaluationsubruleServiceImpl( |
| | |
| | | } |
| | | |
| | | override fun getScore(userId: String, time: String, platform:String?): List<EvaluationVo> { |
| | | val list = time.split("-") |
| | | var endM = list[1].toInt() |
| | | val list2 = list[0].split("/") |
| | | val year = list2[0].toInt() |
| | | var startM = list2[1].toInt() |
| | | var st = LocalDateTime.of(year, startM, 1, 0, 0, 0, 0) |
| | | var et = LocalDateTime.of(year, endM, 1, 0, 0, 0, 0).plusMonths(1) |
| | | |
| | | val userinfo = userinfoMapper.selectByPrimaryKey(userId) ?: return emptyList() |
| | | var sceneType = userinfo.extension2 |
| | | // FIXME: 2022/11/8 临时添加过度功能,提供微信小程序前端汽修类型的场景单独的评估清单 ,场景类型为 -7 |
| | |
| | | |
| | | val rIdList = mutableListOf<String?>() |
| | | rules.forEach { |
| | | // 找到总规则 |
| | | if (it.ruletype == AssessmentRuleType.Total.value.toString()) { |
| | | val rulePeriod = it.scensesubtypeid?.toInt() ?: 1 |
| | | DateUtil.getStartMonthByPeriod(startM, rulePeriod)?.let {s -> |
| | | startM = s |
| | | endM = startM + rulePeriod - 1 |
| | | st = LocalDateTime.of(year, startM, 1, 0, 0, 0, 0) |
| | | et = LocalDateTime.of(year, endM, 1, 0, 0, 0, 0).plusMonths(1) |
| | | } |
| | | } |
| | | rIdList.add(it.guid) |
| | | } |
| | | |
| | |
| | | val ruleScore = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { |
| | | createCriteria().andIn("stguid", rIdList)//规则id |
| | | .andEqualTo("evaluatorguid", userId)//用户id |
| | | .andEqualTo("scensename", time)//评估周期,例:2020/6-6 |
| | | and( |
| | | createCriteria().orEqualTo("scensename", time)//评估周期,例:2020/6-6 |
| | | .orBetween("createdate", st, et) |
| | | ) |
| | | orderBy("createdate").desc() |
| | | }) |
| | | //子规则逐条得分 |
| | | val subRuleScores = if (ruleScore.isEmpty()) { |