From 30a53b41f09d2eefd33513a409d472c2166ba1ea Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 10 一月 2024 17:35:03 +0800 Subject: [PATCH] 1. 新增自动评估相关数据源的检查接口 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt | 75 +++++++++++++++++++++++++------------ 1 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt index 6858f47..b7db654 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt @@ -1,6 +1,11 @@ package cn.flightfeather.supervision.lightshare.service.impl import cn.flightfeather.supervision.business.AutoScore2 +import cn.flightfeather.supervision.business.autooutput.AopTaskCtrl +import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation +import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl +import cn.flightfeather.supervision.common.executor.BgTaskStatus +import cn.flightfeather.supervision.common.executor.BgTaskType import cn.flightfeather.supervision.domain.ds1.entity.Domainitem import cn.flightfeather.supervision.domain.ds1.entity.Evaluation import cn.flightfeather.supervision.domain.ds1.entity.Subtask @@ -10,10 +15,14 @@ import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.Domain +import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.EvaluationService import cn.flightfeather.supervision.lightshare.service.SubtaskService import cn.flightfeather.supervision.lightshare.vo.AreaVo -import cn.flightfeather.supervision.lightshare.vo.SubtaskVo +import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo +import cn.flightfeather.supervision.lightshare.vo.BaseResponse +import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example @@ -21,7 +30,12 @@ import kotlin.Comparator @Service -class EvaluationServiceImpl(val evaluationMapper: EvaluationMapper) : EvaluationService { +class EvaluationServiceImpl( + private val evaluationMapper: EvaluationMapper, + private val evaluationRep: EvaluationRep, + private val taskRep: TaskRep, + private val aopTaskCtrl: AopTaskCtrl, +) : EvaluationService { @Autowired lateinit var subtaskService: SubtaskService @@ -29,11 +43,14 @@ lateinit var domainitemMapper: DomainitemMapper @Autowired lateinit var subtaskMapper: SubtaskMapper + @Autowired + lateinit var aopEvaluation: AopEvaluation + private var isAutoScoreRunning = false //鑾峰彇鏌愰《灞備换鍔′笅鏌愪釜鍦烘櫙鐨勮閬撹瘎鍒嗘帓鍚� - override fun getRankOfTown(tguid: String, scensetypeid: String?): List<AreaVo> { + override fun getRankOfTown(tguid: String, scensetypeid: String?): List<EvaluateResVo> { val evaluationlist = getRankInfo(tguid, scensetypeid, null) - var areaVolist = mutableListOf<AreaVo>() + var areaVolist = mutableListOf<EvaluateResVo>() //鑰冩牳绫诲瀷鏄鑼冭�冩牳 if (evaluationlist.isNotEmpty() && Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.STANDARD.value)) { @@ -49,7 +66,7 @@ val iterator: MutableIterator<Evaluation> = tmplist.iterator() val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀� - var areaVo = AreaVo() + var areaVo = EvaluateResVo() areaVo = transform(areaVo, evaluation) while (iterator.hasNext()){ val tmp = iterator.next() @@ -81,7 +98,7 @@ val iterator: MutableIterator<Evaluation> = tmplist.iterator() val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀� - var areaVo = AreaVo() + var areaVo = EvaluateResVo() areaVo = transform(areaVo, evaluation) while (iterator.hasNext()){ val tmp = iterator.next() @@ -155,7 +172,7 @@ } //Evaluation浼犻�掓暟鎹粰AreaVo - fun transform(areaVo: AreaVo, evaluation: Evaluation):AreaVo{ + fun transform(areaVo: EvaluateResVo, evaluation: Evaluation):EvaluateResVo{ areaVo.provincecode = evaluation.provincecode areaVo.provincename = evaluation.provincename areaVo.citycode = evaluation.citycode @@ -168,9 +185,9 @@ } //鎸夎閬撲弗閲嶄笉瑙勮寖鍦烘櫙鐧惧垎姣旀帓搴� - fun sort(areaVolist: MutableList<AreaVo>):MutableList<AreaVo>{ - Collections.sort(areaVolist, object : Comparator<AreaVo>{ - override fun compare(o1: AreaVo?, o2: AreaVo?): Int { + fun sort(areaVolist: MutableList<EvaluateResVo>):MutableList<EvaluateResVo>{ + Collections.sort(areaVolist, object : Comparator<EvaluateResVo>{ + override fun compare(o1: EvaluateResVo?, o2: EvaluateResVo?): Int { var num1 = 0.0 if (o1!!.allsensenum != 0) num1 = (o1.notstandardnum/o1.allsensenum).toDouble() @@ -181,21 +198,6 @@ } }) return areaVolist - } - - override fun getTopTaskByScene(sceneId: String?): String? { - val example = Example(Evaluation::class.java) - val criteria = example.createCriteria() - criteria.andEqualTo("sguid", sceneId) - example.orderBy("evaluatetime").desc() - val evaluationlist = evaluationMapper.selectByExample(example) - var subtask = SubtaskVo() - if (evaluationlist.isNotEmpty()) { - val stguid = evaluationlist[0].stguid - if (stguid != null) - subtask = subtaskService.findByID(stguid) - } - return subtask.tguid } override fun autoScore(districtCode: String, time: String): List<String> { @@ -244,9 +246,32 @@ return resultList } + override fun autoScore3(tGuid: String, sceneTypeId: String): String { + if (isAutoScoreRunning) return "鑷姩璇勫垎鎵ц涓紝璇风瓑寰呭畬鎴�" + isAutoScoreRunning = true +// val t = Constant.ScenseType.getByValue(sceneTypeId) +// autoScore.sceneType = t +// autoScore.topTaskGrade(tGuid) + aopEvaluation.executeByTopTask(tGuid, sceneTypeId.toInt()) + isAutoScoreRunning = false + return "鑷姩璇勫垎瀹屾垚" + } + override fun findByInspectionId(inspectionId: String): List<Evaluation> { return evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { createCriteria().andEqualTo("iguid", inspectionId) }) } + + override fun autoEvaluate(areaVo: AreaVo): BgTaskStatus? { + //鎵ц鑷姩璇勪及 + return aopTaskCtrl.startNewTask(areaVo) + } + + override fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? { + //1. 鏌ユ壘鍘嗗彶璁板綍锛屾煡鐪嬭瘎浼版槸鍚﹀凡瀛樺湪 + areaVo.scensetypeid ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�") + val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�") + return evaluationRep.findAutoScore(areaVo) + } } \ No newline at end of file -- Gitblit v1.9.3