From 274bc2d0f7fe8fe7525196e4d7d6ece1cafe2c6c Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期日, 04 二月 2024 17:32:14 +0800 Subject: [PATCH] 1. 新增静安50分制评估结果转换逻辑; 2. 新增根据坐标圆心和半径查询范围内场景逻辑; --- src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 73 +++++++++++++++++++++++------------- 1 files changed, 47 insertions(+), 26 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt index 71f5ce4..d334b56 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt @@ -11,13 +11,10 @@ import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo -import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example -import java.time.Duration import java.time.LocalDateTime import java.time.ZoneId -import javax.annotation.PostConstruct /** * 鎶ュ憡鎵�闇�婧愭暟鎹� @@ -39,21 +36,22 @@ val rowData = RowData() init { - if (config.districtCode == null) { - throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]") - } - if (config.sceneType == null) { - throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]") - } +// if (config.districtCode == null) { +// throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]") +// } +// if (config.sceneType == null) { +// throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]") +// } getSource(config) } fun loop(callback: (index:Int, rowData: RowData) -> Unit) { - reset() +// reset() for (i in sourceList.indices) { +// rowData.recordLastScene() rowData.index = i - rowData.clear() rowData.subTask = sourceList[i] + rowData.clear() callback(i, rowData) } } @@ -72,14 +70,14 @@ */ fun areaName(): String { val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid) - return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.ScenseType.getDes(config.sceneType)}" + return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}" } /** - * 鑾峰彇鎶ュ憡鏁版嵁婧� + * 鑾峰彇鎶ュ憡鏁版嵁婧愶紙宸℃煡浠诲姟锛� */ private fun getSource(config: ExcelConfigVo) { - if (config.sceneType == null) return +// if (config.sceneType == null) return val result = mutableListOf<Subtask>() @@ -108,10 +106,13 @@ } config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) } config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } + config.districtCode?.let { andEqualTo("districtcode", it) } +// andEqualTo("tguid", config.topTaskGuid) } }) } else { - taskSceneIdList = dbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) + taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config + .sceneType, config.townCode).map { it.guid ?: "" } dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { createCriteria().andIn("scenseid", taskSceneIdList) .andEqualTo("tguid", config.topTaskGuid) @@ -124,11 +125,12 @@ for (s in subTaskList) { if (s.scenseid == it) { subtask = s - break + result.add(s) } } - if (subtask == null) subtask = Subtask().apply { scenseid = it } - result.add(subtask) + if (subtask == null) { + result.add(Subtask().apply { scenseid = it }) + } } } else { result.addAll(subTaskList) @@ -142,6 +144,8 @@ var index = 0 var subTask: Subtask? = null + + private var lastScene: Scense? = null //鍦烘櫙鍩烘湰淇℃伅 val scene: Scense? @@ -158,16 +162,16 @@ get() { if (_baseScene == null) { _baseScene = when (this.scene?.typeid.toString()) { - Constant.ScenseType.TYPE1.value -> { + Constant.SceneType.TYPE1.value -> { dbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene?.guid) } - Constant.ScenseType.TYPE2.value -> { + Constant.SceneType.TYPE2.value -> { dbMapper.sceneWharfMapper.selectByPrimaryKey(scene?.guid) } - Constant.ScenseType.TYPE3.value -> { + Constant.SceneType.TYPE3.value -> { dbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene?.guid) } - Constant.ScenseType.TYPE14.value -> { + Constant.SceneType.TYPE14.value -> { dbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene?.guid) } else -> null @@ -192,6 +196,7 @@ } private var _problems = mutableListOf<Problemlist>() + //璇勪及鎬诲垎 val evaluation: Evaluation? get() { if (_evaluation == null) { @@ -205,6 +210,7 @@ } private var _evaluation: Evaluation? = null + //璇勪及缁嗗垯寰楀垎 val itemevaluationList: MutableList<Itemevaluation> get() { if (_itemevaluationList.isEmpty()) { @@ -223,8 +229,8 @@ get() { if (_problemTypes.isEmpty()) { val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { - createCriteria().andEqualTo("scensetypeid", config.sceneType) - .andEqualTo("districtcode", config.districtCode) + createCriteria().andEqualTo("scensetypeid", scene?.typeid) + .andEqualTo("districtcode", scene?.districtcode) orderBy("extension1") }) _problemTypes.addAll(r) @@ -240,7 +246,7 @@ val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria() .andEqualTo("tasktypeid", 99) - .andEqualTo("scensetypeid", config.sceneType) + .andEqualTo("scensetypeid", scene?.typeid) }) if (rule.isNotEmpty()) { val ruleId = rule[0].guid @@ -299,7 +305,7 @@ val ledgerCount: Int get() { if (_ledgerCount == -1) { - val tzSceneType = Constant.ScenseType.typeMap(config.sceneType?.toByte()) + val tzSceneType = Constant.SceneType.typeMap(scene?.typeid) _ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply { createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true) }) @@ -353,6 +359,13 @@ } /** + * 璁板綍涓婁竴涓満鏅� + */ + fun recordLastScene() { + lastScene = scene + } + + /** * 娓呯┖褰撳墠澶勭悊鐨勫璞$殑鐩稿叧鏁版嵁婧� */ fun clear() { @@ -362,6 +375,13 @@ _evaluation = null _itemevaluationList.clear() _ledgerRecordNum = null + if (lastScene != null && lastScene?.typeid != scene?.typeid) { + _problemTypes.clear() + _topItems.clear() + _rules.clear() + _ledgerCount = -1 + } + recordLastScene() } /** @@ -371,6 +391,7 @@ } } +@Component data class DbMapper( val scenseMapper: ScenseMapper, val problemlistMapper: ProblemlistMapper, -- Gitblit v1.9.3