feiyu02
2025-09-18 baf2cc2ce3dfd1235c012a3750132769fcd9ad2f
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
@@ -329,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
@@ -411,17 +412,22 @@
        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 }
        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
    }