| | |
| | | val name = scense.name ?: "" |
| | | val example = Example(Scense::class.java) |
| | | val criteria = example.createCriteria() |
| | | criteria.andEqualTo("typeid", scense.typeid) |
| | | //如果有type信息,就构建type查询 |
| | | if (StringUtil.isNotEmpty(scense.type)) { |
| | | criteria.andEqualTo("type", scense.type) |
| | |
| | | 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) |
| | |
| | | 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 |
| | |
| | | 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 |
| | | } |