From a3cc1d220f8a1de11874bebceba0130d32157ff1 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 30 九月 2025 09:26:32 +0800 Subject: [PATCH] 2025.9.30 1. 联合前端调试数据产品接口(待完成) --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt index 3322c91..c26f05b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt @@ -83,6 +83,7 @@ val name = scense.name ?: "" val example = Example(Scense::class.java) val criteria = example.createCriteria() + criteria.andEqualTo("typeid", scense.typeid) //濡傛灉鏈塼ype淇℃伅,灏辨瀯寤簍ype鏌ヨ if (StringUtil.isNotEmpty(scense.type)) { criteria.andEqualTo("type", scense.type) @@ -99,6 +100,10 @@ if (StringUtil.isNotEmpty(scense.towncode)) { criteria.andEqualTo("towncode", scense.towncode) } + if (StringUtil.isNotEmpty(scense.extension1)) { + criteria.andEqualTo("extension1", scense.extension1) + } + criteria.andEqualTo("index", scense.index) //name鏌ヨ criteria.andLike("name", "%$name%") val re = scenseMapper.selectByExample(example) @@ -278,10 +283,10 @@ override fun getSceneDetail(sceneId: String): BaseResponse<SceneDetail> { val sceneDetail = SceneDetail() - val scene = scenseMapper.selectByPrimaryKey(sceneId) + val scene = sceneRep.findScene(sceneId = sceneId) sceneDetail.scense = scene - val mapper = when (scene.typeid.toString()) { + val mapper = when (scene?.typeid.toString()) { Constant.SceneType.TYPE1.value -> sceneConstructionSiteMapper Constant.SceneType.TYPE2.value -> sceneWharfMapper Constant.SceneType.TYPE3.value -> sceneMixingPlantMapper @@ -324,6 +329,7 @@ when (typeId.toString()) { Constant.SceneType.TYPE1.value -> { val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneConstructionSite::class.java) + subScene.csUpdateTime = Date() if (subScene.getsGuid() != null) { val record = sceneConstructionSiteMapper.selectByPrimaryKey(subScene.getsGuid()) isUpdate = record != null @@ -406,24 +412,29 @@ return locationRoadNearby.searchByRadius(Pair(lng, lat), radius) } - override fun importSceneInfo(file: MultipartFile): Boolean { - val f = ByteArrayInputStream(file.bytes) + override fun importSceneInfo(files: Array<MultipartFile>): Boolean { + if (files.isEmpty()) throw BizException("鏈纭笂浼犳枃浠讹紝鎺ュ彛璋冪敤閿欒") + + val f = ByteArrayInputStream(files[0].bytes) val scenes = sceneImport.readFromFile(f) + if (scenes.isEmpty()) throw BizException("鏂囦欢鍐呭涓虹┖") // 鏌ユ壘鍦烘櫙鍚嶇О鏄惁閲嶅 - val names = scenes.map { it.name } - sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { + val names = scenes.map { it.scense?.name } + sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty { val str = this.joinToString("锛�") throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}") } scenes.forEach { - createOneScene(it) + it.scense ?: return@forEach + createOneScene(it.scense!!) + sceneRep.insertOrUpdateSubScene(it.scense!!.typeid?.toInt(), it.scense!!.guid, it.subScene) } return true } override fun createScene(scense: Scense): Scense { val names = listOf(scense.name) - sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { + sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty { val str = this.joinToString("锛�") throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}") } @@ -434,6 +445,7 @@ override fun createOneScene(scense: Scense) { //1. 鎻掑叆鍦烘櫙琛� + scense.townname = scense.townname?.trim() sceneRep.insert(scense) //2. 鐢熸垚瀵瑰簲璐︽埛淇℃伅 val userInfo = userinfoService.createAccount(scense) -- Gitblit v1.9.3