From aed297a5fbc8df9dab01b28da21f872ee546b43c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 13 十月 2025 16:15:11 +0800
Subject: [PATCH] 2025.10.13 1. 统一调整controller层的返回类型,通过添加全局响应增强器GlobalResponseAdvice来管理返回结果; 2. 新增mybatis-generator自定义插件,实现给数据库实体entity自动添加swagger注解@ApiModel和@ApiModelProperty
---
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt | 150 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 149 insertions(+), 1 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
index bf7c41a..623d7b1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
@@ -11,6 +11,7 @@
import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteRep
import cn.flightfeather.supervision.domain.ds3.repository.XHFumeSiteMapRep
import cn.flightfeather.supervision.lightshare.vo.*
+import com.github.pagehelper.PageHelper
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.springframework.stereotype.Component
import java.io.FileOutputStream
@@ -84,6 +85,153 @@
}
}
+ fun insertOrUpdate(areaVo: AreaVo, mapSet: List<DeviceMapVo>):Int {
+ return when (areaVo.sourceType) {
+ //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+ 1 -> {
+ insertOrUpdate1(areaVo,mapSet)
+ }
+ //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+ 2 -> {
+ insertOrUpdate2(areaVo,mapSet)
+ }
+ else -> 0
+ }
+ }
+
+ private fun insertOrUpdate1(areaVo: AreaVo, mapSet: List<DeviceMapVo>):Int {
+ return when (areaVo.districtcode) {
+ //寰愭眹鍖�
+ "310104" -> {
+ when (areaVo.scensetypeid) {
+ //姹戒慨
+ Constant.SceneTypeTZ.VehicleRepair.value.toString() -> 0
+ else -> 0
+ }
+ }
+ else -> 0
+ }
+ }
+
+ private fun insertOrUpdate2(areaVo: AreaVo, mapSet: List<DeviceMapVo>):Int {
+ return when (areaVo.districtcode) {
+ //闈欏畨鍖�
+ "310106" -> {
+ val mapSet1 = mapSet.map { DeviceMapVo.toJADustSiteMap(it) }
+ when (areaVo.scensetypeid) {
+ //宸ュ湴
+ Constant.SceneType.TYPE1.value -> {
+ var rc = 0
+ mapSet1.forEach {
+ rc += if(jaDustSiteRep.findByPrimaryKey(it.id) == null) {
+ jaDustSiteRep.insert(it)
+ } else {
+ jaDustSiteRep.update(it)
+ }
+ }
+ rc
+ }
+ else -> 0
+ }
+ }
+ //閲戝北鍖�
+ "310116" -> {
+ val mapSet1 = mapSet.map { DeviceMapVo.toJSDustSiteMap(it) }
+ when (areaVo.scensetypeid) {
+ //宸ュ湴,鐮佸ご姘存偿鎼呮媽绔�
+ Constant.SceneType.TYPE1.value,
+ Constant.SceneType.TYPE2.value,
+ Constant.SceneType.TYPE3.value,
+ -> {
+ var rc = 0
+ mapSet1.forEach {
+ rc += if(jsDustSiteRep.findByPrimaryKey(it.id) == null) {
+ jsDustSiteRep.insert(it)
+ } else {
+ jsDustSiteRep.update(it)
+ }
+ }
+ rc
+ }
+
+ else -> 0
+ }
+ }
+ //寰愭眹鍖�
+ "310104" -> {
+ val mapSet1 = mapSet.map { DeviceMapVo.toXHFumeSiteMap(it) }
+ when (areaVo.scensetypeid) {
+ //椁愰ギ
+ Constant.SceneType.TYPE5.value -> {
+ var rc = 0
+ mapSet1.forEach {
+ rc += if(xhFumeSiteMapRep.findByPrimaryKey(it.id) == null) {
+ xhFumeSiteMapRep.insert(it)
+ } else {
+ xhFumeSiteMapRep.update(it)
+ }
+ }
+ rc
+ }
+ else -> 0
+ }
+ }
+ else -> 0
+
+ }
+ }
+
+ /**
+ * 鎼滅储璁惧
+ * @param areaVo 鍖哄煙鏉′欢
+ * @param keyword 鎼滅储鍏抽敭璇�
+ * @param page 椤电爜
+ * @param perPage 姣忛〉鏁伴噺
+ * @return 璁惧鍒楄〃
+ */
+ fun searchDevice(areaVo: AreaVo, keyword: String, page: Int, perPage: Int): Pair<DataHead, List<DeviceSiteVo>> {
+ return when (areaVo.districtcode) {
+ //闈欏畨鍖�
+ "310106" -> when (areaVo.scensetypeid) {
+ //宸ュ湴
+ Constant.SceneType.TYPE1.value -> {
+ val pageInfo = PageHelper.startPage<DeviceSiteVo>(page, perPage)
+ val list = jaDustSiteRep.searchSiteInfo(keyword)
+ DataHead(pageInfo.pageNum, pageInfo.pages, pageInfo.total) to list
+ }
+
+ else -> DataHead() to emptyList()
+ }
+ //閲戝北鍖�
+ "310116" -> when (areaVo.scensetypeid) {
+ //宸ュ湴,鐮佸ご姘存偿鎼呮媽绔�
+ Constant.SceneType.TYPE1.value,
+ Constant.SceneType.TYPE2.value,
+ Constant.SceneType.TYPE3.value,
+ -> {
+ val pageInfo = PageHelper.startPage<DeviceSiteVo>(page, perPage)
+ val list = jsDustSiteRep.searchSiteInfo(keyword)
+ DataHead(pageInfo.pageNum, pageInfo.pages, pageInfo.total) to list
+ }
+
+ else -> DataHead() to emptyList()
+ }
+ //寰愭眹鍖�
+ "310104" -> when (areaVo.scensetypeid) {
+ //椁愰ギ
+ Constant.SceneType.TYPE5.value -> {
+// val pageInfo = PageHelper.startPage<DeviceSiteVo>(page, perPage)
+// val list = xhFumeSiteRep.searchSiteInfo(keyword)
+// DataHead(pageInfo.pageNum, pageInfo.pages, pageInfo.total) to list
+ DataHead() to emptyList()
+ }
+ else -> DataHead() to emptyList()
+ }
+
+ else -> DataHead() to emptyList()
+ }
+ }
+
/**
* 杈撳嚭鐩戞祴鐐逛綅鍜岀洃娴嬭澶囩殑瀵瑰簲鍖归厤鍏崇郴
* @param areaVo 鍖哄煙鏉′欢
@@ -92,7 +240,7 @@
// 鐩戠鎬讳换鍔�
val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
// 鎬讳换鍔″寘鍚搴旂被鍨嬬殑鍦烘櫙
- val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
+ val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
val sceneIds = scenes.map { it?.guid }
val userIdList = userInfoSVRep.findUser(sceneIds).map { it?.guid }
// 鍦烘櫙鍜岀洃娴嬬偣鐨勫尮閰嶅叧绯�
--
Gitblit v1.9.3