From 2ae8bf126599f68ba1ca721ff2acc1dd4461e9a5 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 12 九月 2023 11:05:47 +0800 Subject: [PATCH] 1. 整合了飞羽环境、徐汇油烟及金山扬尘两个数据库; 2. 优化重构自动评估模块逻辑; 3. 新增监测数据自动化统; 4. 将自动统计应用于自动评估中; --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 126 +++++++++++++++++++++++++---------------- 1 files changed, 77 insertions(+), 49 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 5af47d9..09bde16 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 @@ -300,60 +300,88 @@ } } - var r = 0 - var isUpdate = true - when (typeId.toString()) { - Constant.ScenseType.TYPE1.value -> { - val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneConstructionSite::class.java) - if (subScene.getsGuid() != null) { - val record =sceneConstructionSiteMapper.selectByPrimaryKey(subScene.getsGuid()) - isUpdate = record != null - r = if (record == null) { - sceneConstructionSiteMapper.insert(subScene) - } else { - sceneConstructionSiteMapper.updateByPrimaryKeySelective(subScene) + if (sceneDetailStr.subScene != null) { + var r = 0 + var isUpdate = true + when (typeId.toString()) { + Constant.ScenseType.TYPE1.value -> { + val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneConstructionSite::class.java) + if (subScene.getsGuid() != null) { + val record = sceneConstructionSiteMapper.selectByPrimaryKey(subScene.getsGuid()) + isUpdate = record != null + r = if (record == null) { + sceneConstructionSiteMapper.insert(subScene) + } else { + sceneConstructionSiteMapper.updateByPrimaryKeySelective(subScene) + } + } + } + Constant.ScenseType.TYPE2.value -> { + val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneWharf::class.java) + if (subScene.getsGuid() != null) { + val record = sceneWharfMapper.selectByPrimaryKey(subScene.getsGuid()) + isUpdate = record != null + r = if (record == null) { + sceneWharfMapper.insert(subScene) + } else { + sceneWharfMapper.updateByPrimaryKeySelective(subScene) + } + } + } + Constant.ScenseType.TYPE3.value -> { + val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneMixingPlant::class.java) + if (subScene.getsGuid() != null) { + val record = sceneMixingPlantMapper.selectByPrimaryKey(subScene.getsGuid()) + isUpdate = record != null + r = if (record == null) { + sceneMixingPlantMapper.insert(subScene) + } else { + sceneMixingPlantMapper.updateByPrimaryKeySelective(subScene) + } + } + } + Constant.ScenseType.TYPE14.value -> { + val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneStorageYard::class.java) + if (subScene.getsGuid() != null) { + val record = sceneStorageYardMapper.selectByPrimaryKey(subScene.getsGuid()) + isUpdate = record != null + r = if (record == null) { + sceneStorageYardMapper.insert(subScene) + } else { + sceneStorageYardMapper.updateByPrimaryKeySelective(subScene) + } } } } - Constant.ScenseType.TYPE2.value -> { - val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneWharf::class.java) - if (subScene.getsGuid() != null) { - val record =sceneWharfMapper.selectByPrimaryKey(subScene.getsGuid()) - isUpdate = record != null - r = if (record == null) { - sceneWharfMapper.insert(subScene) - } else { - sceneWharfMapper.updateByPrimaryKeySelective(subScene) - } - } - } - Constant.ScenseType.TYPE3.value -> { - val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneMixingPlant::class.java) - if (subScene.getsGuid() != null) { - val record =sceneMixingPlantMapper.selectByPrimaryKey(subScene.getsGuid()) - isUpdate = record != null - r = if (record == null) { - sceneMixingPlantMapper.insert(subScene) - } else { - sceneMixingPlantMapper.updateByPrimaryKeySelective(subScene) - } - } - } - Constant.ScenseType.TYPE14.value -> { - val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneStorageYard::class.java) - if (subScene.getsGuid() != null) { - val record =sceneStorageYardMapper.selectByPrimaryKey(subScene.getsGuid()) - isUpdate = record != null - r = if (record == null) { - sceneStorageYardMapper.insert(subScene) - } else { - sceneStorageYardMapper.updateByPrimaryKeySelective(subScene) - } - } - } + result.append("鍦烘櫙鐗规湁淇℃伅${if (isUpdate) "鏇存柊" else "鏂板"}: $r; ") } - result.append("鍦烘櫙鐗规湁淇℃伅${if (isUpdate) "鏇存柊" else "鏂板"}: $r; ") return BaseResponse(true, data = result.toString()) } + + override fun searchScene(areaVo: AreaVo, page: Int?, perPage: Int?): BaseResponse<List<Scense>> { + val p = PageHelper.startPage<Scense>(page ?: 1, perPage ?: 30) + val list = scenseMapper.selectByExample(Example(Scense::class.java).apply { + createCriteria().apply { + areaVo.provincecode?.let { andEqualTo("provincecode", it) } + areaVo.citycode?.let { andEqualTo("citycode", it) } + areaVo.districtcode?.let { andEqualTo("districtcode", it) } + areaVo.towncode?.let { andEqualTo("towncode", it) } + areaVo.scensetypeid?.let { andEqualTo("typeid", it) } + areaVo.sceneName?.let { andLike("name", "%${it}%") } + + } + areaVo.online?.let { + and(createCriteria().apply { + if (it) { + orNotEqualTo("extension1", "0").orIsNull("extension1") + } else { + andEqualTo("extension1", "0") + } + }) + } + orderBy("typeid").orderBy("index") + }) + return BaseResponse(true, head = DataHead(p.pageNum, p.pages, p.total), data = list) + } } \ No newline at end of file -- Gitblit v1.9.3