From c1becf4cbd2e99601ce011c14b8742427249cfb4 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 09 一月 2024 17:25:05 +0800
Subject: [PATCH] 1. 多项调整

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt |   50 ++++++++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 22 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 43af688..f5fc097 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,7 +1,11 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
 import cn.flightfeather.supervision.business.AutoScore2
-import cn.flightfeather.supervision.business.storage.StAutoScore
+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
@@ -11,10 +15,12 @@
 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.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 org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 import tk.mybatis.mapper.entity.Example
@@ -22,7 +28,11 @@
 import kotlin.Comparator
 
 @Service
-class EvaluationServiceImpl(val evaluationMapper: EvaluationMapper) : EvaluationService {
+class EvaluationServiceImpl(
+    private val evaluationMapper: EvaluationMapper,
+    private val evaluationRep: EvaluationRep,
+    private val aopTaskCtrl: AopTaskCtrl,
+) : EvaluationService {
 
     @Autowired
     lateinit var subtaskService: SubtaskService
@@ -31,7 +41,7 @@
     @Autowired
     lateinit var subtaskMapper: SubtaskMapper
     @Autowired
-    lateinit var autoScore: StAutoScore
+    lateinit var aopEvaluation: AopEvaluation
     private var isAutoScoreRunning = false
 
     //鑾峰彇鏌愰《灞備换鍔′笅鏌愪釜鍦烘櫙鐨勮閬撹瘎鍒嗘帓鍚�
@@ -187,21 +197,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> {
         val resultList = mutableListOf<String>()
 
@@ -251,9 +246,10 @@
     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)
+//        val t = Constant.ScenseType.getByValue(sceneTypeId)
+//        autoScore.sceneType = t
+//        autoScore.topTaskGrade(tGuid)
+        aopEvaluation.executeByTopTask(tGuid, sceneTypeId.toInt())
         isAutoScoreRunning = false
         return "鑷姩璇勫垎瀹屾垚"
     }
@@ -263,4 +259,14 @@
             createCriteria().andEqualTo("iguid", inspectionId)
         })
     }
+
+    override fun autoEvaluate(areaVo: AreaVo): BgTaskStatus? {
+        //鎵ц鑷姩璇勪及
+        return aopTaskCtrl.startNewTask(areaVo)
+    }
+
+    override fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? {
+        //1. 鏌ユ壘鍘嗗彶璁板綍锛屾煡鐪嬭瘎浼版槸鍚﹀凡瀛樺湪
+        return evaluationRep.findAutoScore(areaVo)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3