| | |
| | | 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) |
| | |
| | | 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 |
| | |
| | | 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 } |
| | | 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}") |
| | | } |
| | |
| | | |
| | | override fun createOneScene(scense: Scense) { |
| | | //1. 插入场景表 |
| | | scense.townname = scense.townname?.trim() |
| | | sceneRep.insert(scense) |
| | | //2. 生成对应账户信息 |
| | | val userInfo = userinfoService.createAccount(scense) |