From b212ef0208cb094f63ea8a239a1361f8e859c839 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 08 七月 2024 17:40:39 +0800 Subject: [PATCH] 2024.7.8 --- src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt | 93 +++++++++++++++++++++++++++++++++------------- 1 files changed, 66 insertions(+), 27 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt index 80d462f..a19472f 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.business.autooutput.datasource +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord @@ -47,6 +48,18 @@ } } + fun setResource(subtask: Subtask) { + val scene = aopDbMapper.scenseMapper.selectByPrimaryKey(subtask.scenseid) + val sceneType = scene.typeid?.toInt() + val config = AopDataConfig(topTaskGuid = subtask.tguid, sceneType = sceneType, + districtName = subtask.districtname, townCode = subtask.towncode) + evaluationScene.config = config +// val check = aopSceneTypeCheck.checkSceneType(sceneType) + this.mode = 0 + sceneSourceList.clear() + sceneSourceList.add(scene) + } + /** * 杞鏁版嵁婧� */ @@ -57,7 +70,9 @@ evaluationScene.clear() evaluationScene.index = i evaluationScene.setDefaultScene(scene) - callback(i, evaluationScene) + do { + callback(i, evaluationScene) + } while (evaluationScene.gotoNextSubTask()) } } 1 -> { @@ -73,23 +88,16 @@ // 浠庣洃绠$郴缁熻幏鍙栧満鏅� private fun initSceneSource(config: AopDataConfig) { - config.topTaskGuid ?: throw IllegalStateException("椤跺眰浠诲姟id涓嶈兘涓簄ull") + config.topTaskGuid ?: throw BizException("椤跺眰浠诲姟id涓嶈兘涓簄ull") this.config = config this.mode = 0 sceneSourceList.clear() val taskSceneIdList = - aopDbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) - - aopDbMapper.scenseMapper.selectByExample(Example(Scense::class.java).apply { - createCriteria() - .andIn("guid", taskSceneIdList) -// .andEqualTo("provincecode", config.provinceCode) -// .andEqualTo("citycode", config.cityCode) -// .andEqualTo("districtcode", config.districtCode) -// .andEqualTo("towncode", config.townCode) -// .andEqualTo("typeid", config.sceneType) -// .andNotEqualTo("extension1", '0') - })?.let { sceneSourceList.addAll(it) } + aopDbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) + taskSceneIdList.forEach { + println(it.name) + } + sceneSourceList.addAll(taskSceneIdList) } // 浠庡彴璐︾郴缁熻幏鍙栧満鏅� @@ -147,12 +155,21 @@ }) } //宸℃煡浠诲姟淇℃伅 + var subTaskIndex = 0 val subTask = InfoProxy<Subtask> {_,_ -> + return@InfoProxy if (subTaskList.value?.isNotEmpty() == true) { + subTaskList.value?.get(subTaskIndex) + } else { + null + } + } + + val subTaskList = InfoProxy<List<Subtask>> {_,_ -> return@InfoProxy aopDbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { createCriteria().andEqualTo("scenseid", scene.value?.guid) // .andBetween("planstarttime", config?.startTime, config?.endTime) .andEqualTo("tguid", config?.topTaskGuid) - })?.takeIf { it.isNotEmpty() }?.get(0) + }) } //鐜板満宸℃煡淇℃伅 @@ -166,23 +183,23 @@ val baseScene = InfoProxy<BaseScene> {_,_ -> return@InfoProxy when (config?.sceneType.toString()) { // 鐩戠绯荤粺 - Constant.ScenseType.TYPE1.value -> { + Constant.SceneType.TYPE1.value -> { aopDbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene.value?.guid) } - Constant.ScenseType.TYPE2.value -> { + Constant.SceneType.TYPE2.value -> { aopDbMapper.sceneWharfMapper.selectByPrimaryKey(scene.value?.guid) } - Constant.ScenseType.TYPE3.value -> { + Constant.SceneType.TYPE3.value -> { aopDbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene.value?.guid) } - Constant.ScenseType.TYPE14.value -> { + Constant.SceneType.TYPE14.value -> { aopDbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene.value?.guid) } // 鍙拌处绯荤粺 - Constant.ScenseType.TYPE5.value -> { + Constant.SceneType.TYPE5.value -> { aopDbMapper.restaurantBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid) } - Constant.ScenseType.TYPE6.value -> { + Constant.SceneType.TYPE6.value -> { aopDbMapper.vehicleBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid) } else -> null @@ -295,7 +312,7 @@ //蹇呭~鍙拌处鏁伴噺 val ledgerCount = InfoProxy<Int>(config?.sceneType.toString()) {_, cacheMap -> - val tzSceneType = Constant.ScenseType.typeMap(scene.value?.typeid) + val tzSceneType = Constant.SceneType.typeMap(scene.value?.typeid) val list = aopDbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply { createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true) }) @@ -338,21 +355,43 @@ */ fun clear() { scene.clear() + subTaskIndex = 0 + subTaskList.clear() userInfo.clear() userInfoTZ.clear() + baseScene.clear() + problemTypes.clear() + ledgerCount.clear() + ledgerRecords.clear() + + clearSubtask() + } + + fun clearSubtask() { subTask.clear() inspection.clear() - baseScene.clear() problems.clear() evaluation.clear() itemevaluationList.clear() - problemTypes.clear() - baseRule.clear() totalScore.clear() topItems.clear() + baseRule.clear() rules.clear() - ledgerCount.clear() - ledgerRecords.clear() + } + + /** + * 鍒囨崲鑷充笅涓�涓贰鏌ヤ换鍔� + * 涓�涓満鏅彲鑳藉悓鏃跺瓨鍦ㄥ涓贰鏌ヤ换鍔subTaskList]锛岄渶瑕佸姣忎釜宸℃煡浠诲姟鍒嗗埆杩涜璇勫垎 + * @return 鏄惁鏈変笅涓�涓贰鏌ヤ换鍔� + */ + fun gotoNextSubTask(): Boolean { + return if (subTaskIndex + 1 < (subTaskList.value?.size ?: 0)) { + clearSubtask() + subTaskIndex++ + true + } else { + false + } } /** -- Gitblit v1.9.3