From 909fd8929d7906f1dca68acc05e36e29b0b9192c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 15 十一月 2022 10:57:30 +0800
Subject: [PATCH] 2022.11.15

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt |  104 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 63 insertions(+), 41 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
index 3372dde..78b73e7 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -1,7 +1,7 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
-import cn.flightfeather.supervision.business.AutoScore
-import cn.flightfeather.supervision.business.AutoScore2
+import cn.flightfeather.supervision.business.storage.StAutoScore
+import cn.flightfeather.supervision.business.storage.item.*
 import cn.flightfeather.supervision.domain.ds1.entity.*
 import cn.flightfeather.supervision.domain.ds1.mapper.*
 import cn.flightfeather.supervision.common.utils.Constant
@@ -20,10 +20,21 @@
 import java.util.*
 
 @Service
-class SubtaskServiceImpl(val subtaskMapper: SubtaskMapper) : SubtaskService {
+class SubtaskServiceImpl(
+    private val subtaskMapper: SubtaskMapper,
+    private val mpScoreItem_1: MpScoreItem_1,
+    private val mpScoreItem_2: MpScoreItem_2,
+    private val stScoreItem_1: StScoreItem_1,
+    private val whScoreItem_1: WhScoreItem_1,
+    private val whScoreItem_2: WhScoreItem_2,
+) : SubtaskService {
 
     val dateUtil = DateUtil()
 
+    @Autowired
+    lateinit var scoreItem1: CsScoreItem_1
+    @Autowired
+    lateinit var scoreItem2: CsScoreItem_2
     @Autowired
     lateinit var taskService: TaskService
     @Autowired
@@ -465,15 +476,19 @@
             criteria.andEqualTo("stguid", subtask.stguid)
             val result = evaluationMapper.selectByExample(example)
             if (result.isEmpty()) {
-                if (subtask.districtname == "寰愭眹鍖�") {
-                    val autoScore = AutoScore2()
-                    autoScore.subtask = subtask
-                    autoScore.calculateScore()
-                } else {
-                    val autoScore = AutoScore()
-                    autoScore.subtask = subtask
-                    autoScore.calculateScore()
-                }
+//                if (subtask.districtname == "寰愭眹鍖�") {
+//                    val autoScore = AutoScore2()
+//                    autoScore.subtask = subtask
+//                    autoScore.calculateScore()
+//                } else {
+//                    val autoScore = AutoScore()
+//                    autoScore.subtask = subtask
+//                    autoScore.calculateScore()
+//                }
+                val s = scenseMapper.selectByPrimaryKey(subtask.scenseid)
+                val autoScore = StAutoScore(scoreItem1, scoreItem2, mpScoreItem_1, mpScoreItem_2, stScoreItem_1, whScoreItem_1, whScoreItem_2)
+                autoScore.sceneType = Constant.ScenseType.getByValue(s.typeid?.toString())
+                autoScore.sceneGrade(subtask)
             }
         }
 
@@ -992,36 +1007,43 @@
     }
 
     override fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary> {
-        val result = mutableListOf<SubTaskSummary>()
+//        val result = mutableListOf<SubTaskSummary>()
 
-        subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach {
-            val scene = scenseMapper.selectByPrimaryKey(it.scenseid)
-            var p = 0
-            var c = 0
-            var pc = 0
-            var cc = 0
-            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
-                createCriteria().andEqualTo("stguid", it.stguid)
-            }).forEach {pro ->
-                p++
-                if (pro.ischanged == true) c++
-                if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++
-                if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++
-            }
-            result.add(SubTaskSummary().apply {
-                stGuid = it.stguid
-                stName = it.name
-                sceneId = it.scenseid
-                sceneName = scene.name
-                sceneType = scene.type
-                stPlanTime = it.planstarttime
-                proNum = p
-                changeNum = c
-                proCheckedNum = pc
-                changeCheckedNum = cc
-            })
-        }
+//        subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach {
+//            val scene = scenseMapper.selectByPrimaryKey(it.scenseid)
+//            var p = 0
+//            var c = 0
+//            var pc = 0
+//            var cc = 0
+//            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
+//                createCriteria().andEqualTo("stguid", it.stguid)
+//            }).forEach {pro ->
+//                p++
+//                if (pro.ischanged == true) c++
+//                if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++
+//                if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++
+//            }
+//            val ins = inspectionMapper.selectByExample(Example(Inspection::class.java).apply {
+//                createCriteria().andEqualTo("stguid", it.stguid)
+//            })
+//            result.add(SubTaskSummary().apply {
+//                stGuid = it.stguid
+//                stName = it.name
+//                if (ins.isNotEmpty()) insGuid = ins[0].guid
+//                sceneId = it.scenseid
+//                sceneName = scene.name
+//                sceneType = scene.type
+//                stPlanTime = it.planstarttime
+//                proNum = p
+//                changeNum = c
+//                proCheckedNum = pc
+//                changeCheckedNum = cc
+//            })
+//        }
 
-        return result
+//        return result
+
+        return subtaskMapper.getSummary(topTaskId, sceneTypeId)
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3