From 2ae8bf126599f68ba1ca721ff2acc1dd4461e9a5 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 12 九月 2023 11:05:47 +0800 Subject: [PATCH] 1. 整合了飞羽环境、徐汇油烟及金山扬尘两个数据库; 2. 优化重构自动评估模块逻辑; 3. 新增监测数据自动化统; 4. 将自动统计应用于自动评估中; --- src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt index 00721c7..09c69a3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt @@ -2,6 +2,7 @@ import cn.flightfeather.supervision.business.Info import cn.flightfeather.supervision.business.ScoreItem +import cn.flightfeather.supervision.business.storage.item.* import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.ExcelUtil @@ -17,8 +18,6 @@ import tk.mybatis.mapper.entity.Example import java.io.File import java.io.FileOutputStream -import java.time.LocalDate -import java.time.LocalDateTime import java.util.* import javax.annotation.PostConstruct import kotlin.math.abs @@ -29,8 +28,16 @@ * 宸ュ湴鑷姩璇勫垎 */ @Component + class StAutoScore( - stScoreItem_1: ScoreItem, + csScoreItem_1: CsScoreItem_1, + csScoreItem_2: CsScoreItem_2, + mpScoreItem_1: MpScoreItem_1, + mpScoreItem_2: MpScoreItem_2, + stScoreItem_1: StScoreItem_1, + whScoreItem_1: WhScoreItem_1, + whScoreItem_2: WhScoreItem_2, + val jinAnScore: JinAnScore, var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, ) { companion object { @@ -92,7 +99,15 @@ private val rows = mutableListOf<Array<Any>>() init { - itemList.add(stScoreItem_1) + itemList.apply { + add(csScoreItem_1) + add(csScoreItem_2) + add(mpScoreItem_1) + add(mpScoreItem_2) + add(stScoreItem_1) + add(whScoreItem_1) + add(whScoreItem_2) + } } @PostConstruct @@ -109,8 +124,9 @@ */ fun topTaskGrade(topTaskId:String) { rows.clear() + getScoreItem() subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach { - sceneGrade(it) + sceneGradeP(it) // sceneGradeToFile(it) } // toFile() @@ -124,9 +140,14 @@ // 鑾峰彇璇勫垎瑙勫垯 getScoreItem() + sceneGradeP(subtask) + } + + private fun sceneGradeP(subtask: Subtask) { val info = itemGrade(subtask) - val result = totalGrade(info) ?: return + val result = totalGrade(info, subtask) ?: return toDb(info, result) +// jinAnScore.toDb(result.first, info) // addToFile(rows, info, result.first) // toFile() } @@ -136,8 +157,11 @@ getScoreItem() val info = itemGrade(subtask) - val result = totalGrade(info) ?: return + val result = totalGrade(info, subtask) ?: return addToFile(rows, info, result.first) + } + + fun grade(subtask: Subtask) { } @@ -164,7 +188,15 @@ val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid) val info = - Info(userInfo?.guid, tzUserId, subtask.scenseid, subtask.scensename, sceneType, subTask = subtask, sceneIndex = scene.index) + Info(userInfo?.guid, + tzUserId, + subtask.scenseid, + subtask.scensename, + sceneType, + subTask = subtask, + sceneIndex = scene.index, + online = scene.extension1 != "0" + ) /** 1. 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勯棶棰樿嚜鍔ㄥ垽鏂槸鍚︽墸鍒�***************************************************************/ // 鑾峰彇璇ユ宸℃煡浠诲姟涓嬬殑鎵�鏈夐棶棰� @@ -178,6 +210,7 @@ // 鍏蜂綋璇勫垎閫夐」 val subRule = r.second subRule.forEach { sr -> + // 瀛樺湪澶氫釜璇勫垎椤瑰拰鍚屼竴涓棶棰樺叧鑱旓紝鍥犳蹇呴』鍏ㄩ儴璇勫垎椤归兘鍒ゅ畾涓�閬� sr.problemlist?.split(",")?.forEach { pId -> if (pList.contains(pId)) { sr.extension1 = (0 - (sr.maxscore ?: 0)).toString() @@ -226,7 +259,7 @@ /** * 璁$畻鎬诲垎 */ - private fun totalGrade(info: Info): Pair<Evaluation, List<Itemevaluation>>? { + private fun totalGrade(info: Info, subtask: Subtask): Pair<Evaluation, List<Itemevaluation>>? { /** 4. 璁$畻鎬诲垎*************************************************************************/ val scene = scenseMapper.selectByPrimaryKey(info.subTask?.scenseid) ?: return null val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply { @@ -258,12 +291,12 @@ townname = scene.townname scensename = scene.name scenseaddress = scene.location - evaluatetime = Date() + evaluatetime = subtask.planstarttime evaluatorguid = "admin" evaluatorusername = "admin" evaluatorrealname = "admin" resultscorebef = (totalScore - abs(total)).toString() - createdate = Date() + createdate = subtask.planstarttime updatedate = Date() } } -- Gitblit v1.9.3