From dc4f12f66685260ac357997680e5f3fe723c3c4a Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 12 九月 2025 17:22:40 +0800
Subject: [PATCH] 2025.9.12 1. 新增监测设备和巡查场景信息的匹配功能

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt                  |   21 +++
 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt |  148 +++++++++++++++++++++
 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt               |   36 +++++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt                 |   18 ++
 src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt               |   35 +++++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt                         |   43 ++++++
 src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt            |   27 +++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt        |   54 +++++++
 8 files changed, 379 insertions(+), 3 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 290de1e..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 鍖哄煙鏉′欢
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt
index 4b3810b..ce208fd 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt
@@ -1,12 +1,15 @@
 package cn.flightfeather.supervision.domain.ds2.repository
 
+import cn.flightfeather.supervision.domain.ds2.entity.DustSiteInfo
 import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap
 import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteInfoMapper
 import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper
 import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
 import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
+import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
+import java.util.*
 
 /**
  * 闈欏畨宸ュ湴鎵皹鐩戞祴鐐逛綅鏁版嵁搴撶浉鍏虫搷浣�
@@ -37,4 +40,37 @@
         val res = dustSiteInfoMapper.selectAll()
         return DeviceSiteVo.fromJADustSiteInfo(res)
     }
+
+    fun searchSiteInfo(keyword: String): List<DeviceSiteVo> {
+        val res = dustSiteInfoMapper.selectByExample(Example(DustSiteInfo::class.java).apply {
+            createCriteria().andLike("name", "%$keyword%")
+        })
+        return DeviceSiteVo.fromJADustSiteInfo(res)
+    }
+
+    /**
+     * 鏍规嵁id鏌ヨ
+     */
+    fun findByPrimaryKey(id: Int?): DustSiteMap? {
+        if (id == null) {
+            return null
+        }
+        return dustSiteMapMapper.selectByPrimaryKey(id)
+    }
+
+    /**
+     * 鏂板
+     */
+    fun insert(dustSiteMap: DustSiteMap): Int {
+        dustSiteMap.createTime = Date()
+        return dustSiteMapMapper.insert(dustSiteMap)
+    }
+
+    /**
+     * 鏇存柊
+     */
+    fun update(dustSiteMap: DustSiteMap): Int {
+        dustSiteMap.createTime = Date()
+        return dustSiteMapMapper.updateByPrimaryKeySelective(dustSiteMap)
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt
index 13684fe..5ac1b36 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.domain.ds3.repository
 
+import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo
 import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap
 import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper
 import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
@@ -7,6 +8,7 @@
 import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
+import java.util.*
 
 /**
  * 閲戝北鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔
@@ -37,4 +39,37 @@
         val res = jsDustSiteInfoMapper.selectAll()
         return DeviceSiteVo.fromJSDustSiteInfo(res)
     }
+
+    fun searchSiteInfo(keyword: String): List<DeviceSiteVo> {
+        val res = jsDustSiteInfoMapper.selectByExample(Example(JSDustSiteInfo::class.java).apply {
+            createCriteria().andLike("name", "%$keyword%")
+        })
+        return DeviceSiteVo.fromJSDustSiteInfo(res)
+    }
+
+    /**
+     * 鏍规嵁id鏌ヨ
+     */
+    fun findByPrimaryKey(id: Int?): JSDustSiteMap? {
+        if (id == null) {
+            return null
+        }
+        return jsDustSiteMapMapper.selectByPrimaryKey(id)
+    }
+
+    /**
+     * 鏂板
+     */
+    fun insert(jsDustSiteMap: JSDustSiteMap): Int {
+        jsDustSiteMap.createTime = Date()
+        return jsDustSiteMapMapper.insert(jsDustSiteMap)
+    }
+
+    /**
+     * 鏇存柊
+     */
+    fun update(jsDustSiteMap: JSDustSiteMap): Int {
+        jsDustSiteMap.createTime = Date()
+        return jsDustSiteMapMapper.updateByPrimaryKeySelective(jsDustSiteMap)
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt
index 5fe2ed4..fddab52 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt
@@ -5,6 +5,7 @@
 import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
+import java.util.*
 
 /**
  * 寰愭眹娌圭儫鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔
@@ -23,4 +24,30 @@
         })
         return DeviceMapVo.fromXHFumeSiteMap(res)
     }
+
+    /**
+     * 鏂板
+     */
+    fun insert(fumeSiteMap: FumeSiteMap): Int {
+        fumeSiteMap.createTime = Date()
+        return fumeSiteMapMapper.insert(fumeSiteMap)
+    }
+
+    /**
+     * 鏇存柊
+     */
+    fun update(fumeSiteMap: FumeSiteMap): Int {
+        fumeSiteMap.createTime = Date()
+        return fumeSiteMapMapper.updateByPrimaryKeySelective(fumeSiteMap)
+    }
+
+    /**
+     * 鏍规嵁id鏌ヨ
+     */
+    fun findByPrimaryKey(id: Int?): FumeSiteMap? {
+        if (id == null) {
+            return null
+        }
+        return fumeSiteMapMapper.selectByPrimaryKey(id)
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
index 1d418bb..7fd2799 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
@@ -4,7 +4,9 @@
 import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
 import cn.flightfeather.supervision.domain.ds2.entity.UserMap
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
 import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
+import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
 
 interface UserMapService {
 
@@ -18,7 +20,23 @@
      */
     fun getSceneByTZId(tzUserId: String): Scense?
 
+    /**
+     * 鑷姩鍒涘缓椋炵窘鐩戠鍜岄缇界幆澧冪殑璐︽埛鍖归厤璁板綍
+     */
     fun autoCreateMap(userList: List<Userinfo?>)
 
+    /**
+     * 鑾峰彇鐩戞祴璁惧鍜岀洃绠¤处鎴风殑鍖归厤璁板綍
+     */
     fun fetchDeviceMap(page: Int?, perPage: Int?, areaVo: AreaVo): List<DeviceMapVo?>
+
+    /**
+     * 鏂板鎴栨洿鏂�
+     */
+    fun insertOrUpdate(param: Pair<AreaVo, DeviceMapVo>): Int
+
+    /**
+     * 鎼滅储绗笁鏂硅澶�
+     */
+    fun searchThirdPartyDevice(areaVo: AreaVo, keyword: String, page: Int?, perPage: Int?): Pair<DataHead, List<DeviceSiteVo>>
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
index 234838d..5f4a5fb 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
@@ -17,7 +17,9 @@
 import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
 import cn.flightfeather.supervision.lightshare.service.UserMapService
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
 import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
+import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
 import org.springframework.stereotype.Service
 import tk.mybatis.mapper.entity.Example
 import java.util.*
@@ -102,18 +104,64 @@
             //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋
             1 -> {
                 val u = userInfoTZRep.findEnterpriseUser(areaVo.districtname, areaVo.scensetypeid?.toInt())
-                u.map { it?.guid }
+                u.map { it?.guid to it?.realname }
             }
             //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
             2 -> {
                 val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
                 val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                     .map { it?.guid }
-                userInfoSVRep.findUser(scenes).map { it?.guid }
+                userInfoSVRep.findUser(scenes).map { it?.guid to it?.realname }
             }
             else -> emptyList()
         }
         // 2.閫氳繃鍖哄煙鏉′欢鍐冲畾鍖归厤鐨勬暟鎹潵婧�
-        return aopDataDeviceMap.findMapSet(areaVo, userIdList)
+        val mapSet = aopDataDeviceMap.findMapSet(areaVo, userIdList.map { it.first })
+        val result = mutableListOf<DeviceMapVo>()
+        // 灏嗕笉鍦╩apSet涓殑鐢ㄦ埛锛屾坊鍔犲埌缁撴灉闆嗕腑
+        userIdList.forEach {u ->
+            val ddm = mapSet.find { m->
+                when (areaVo.sourceType) {
+                    //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+                    1 -> m.tzUserId == u.first
+                    //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+                    2 -> m.svUserId == u.first
+                    else -> false
+                }
+            }
+            if (ddm == null) {
+                result.add(DeviceMapVo().apply {
+                    when (areaVo.sourceType) {
+                        //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+                        1 -> {
+                            tzUserId = u.first
+                            tzUserName = u.second
+                        }
+                        //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
+                        2 -> {
+                            svUserId = u.first
+                            svUserName = u.second
+
+                        }
+                    }
+                })
+            }
+        }
+        // 灏唌apSet涓殑鏁版嵁娣诲姞鍒扮粨鏋滈泦涓�
+        result.addAll(mapSet)
+        return result.sortedBy { it.svUserId }
+    }
+
+    override fun insertOrUpdate(param: Pair<AreaVo, DeviceMapVo>): Int {
+        return aopDataDeviceMap.insertOrUpdate(param.first, listOf(param.second))
+    }
+
+    override fun searchThirdPartyDevice(
+        areaVo: AreaVo,
+        keyword: String,
+        page: Int?,
+        perPage: Int?,
+    ): Pair<DataHead, List<DeviceSiteVo>> {
+        return aopDataDeviceMap.searchDevice(areaVo, keyword, page ?: 1, perPage ?: 30)
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt
index 888981f..7c04dde 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt
@@ -10,6 +10,7 @@
  * 鐩戞祴璁惧鍜岄缇界洃绠$郴缁熴�侀缇界幆澧冪郴缁熺敤鎴风殑鍖归厤鍏崇郴
  */
 class DeviceMapVo {
+    var id: Int? = null
     // 鐩戞祴璁惧id
     var deviceCode:String?=null
     // 鐩戞祴璁惧鎴栫珯鐐瑰悕绉�
@@ -31,6 +32,7 @@
             list.forEach {
                 it ?: return@forEach
                 res.add(DeviceMapVo().apply {
+                    id = it.id
                     deviceCode = it.jaMnCode
                     deviceName = it.jaSceneName
                     svUserId = it.svUserId
@@ -43,11 +45,25 @@
             return res
         }
 
+        fun toJADustSiteMap(deviceMapVo: DeviceMapVo?): DustSiteMap {
+            return DustSiteMap().apply {
+                id = deviceMapVo?.id
+                jaMnCode = deviceMapVo?.deviceCode
+                jaSceneName = deviceMapVo?.deviceName
+                svUserId = deviceMapVo?.svUserId
+                svUserName = deviceMapVo?.svUserName
+                tzUserId = deviceMapVo?.tzUserId
+                tzUserName = deviceMapVo?.tzUserName
+                createTime = deviceMapVo?.createTime
+            }
+        }
+
         fun fromJSDustSiteMap(list: List<JSDustSiteMap?>): List<DeviceMapVo> {
             val res = mutableListOf<DeviceMapVo>()
             list.forEach {
                 it ?: return@forEach
                 res.add(DeviceMapVo().apply {
+                    id = it.id
                     deviceCode = it.jsDeviceCode
                     deviceName = it.jsDeviceName
                     svUserId = it.svUserId
@@ -60,11 +76,25 @@
             return res
         }
 
+        fun toJSDustSiteMap(deviceMapVo: DeviceMapVo?): JSDustSiteMap {
+            return JSDustSiteMap().apply {
+                id = deviceMapVo?.id
+                jsDeviceCode = deviceMapVo?.deviceCode
+                jsDeviceName = deviceMapVo?.deviceName
+                svUserId = deviceMapVo?.svUserId
+                svUserName = deviceMapVo?.svUserName
+                tzUserId = deviceMapVo?.tzUserId
+                tzUserName = deviceMapVo?.tzUserName
+                createTime = deviceMapVo?.createTime
+            }
+        }
+
         fun fromXHFumeSiteMap(list: List<FumeSiteMap?>): List<DeviceMapVo> {
             val res = mutableListOf<DeviceMapVo>()
             list.forEach {
                 it ?: return@forEach
                 res.add(DeviceMapVo().apply {
+                    id = it.id
                     deviceCode = it.xhDeviceCode
                     deviceName = it.xhDeviceName
                     svUserId = it.svUserId
@@ -76,6 +106,19 @@
             }
             return res
         }
+
+        fun toXHFumeSiteMap(deviceMapVo: DeviceMapVo?): FumeSiteMap {
+            return FumeSiteMap().apply {
+                id = deviceMapVo?.id
+                xhDeviceCode = deviceMapVo?.deviceCode
+                xhDeviceName = deviceMapVo?.deviceName
+                svUserId = deviceMapVo?.svUserId
+                svUserName = deviceMapVo?.svUserName
+                tzUserId = deviceMapVo?.tzUserId
+                tzUserName = deviceMapVo?.tzUserName
+                createTime = deviceMapVo?.createTime
+            }
+        }
     }
 }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
index 31e8f9d..bc0c0b9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
@@ -2,6 +2,7 @@
 
 import cn.flightfeather.supervision.lightshare.service.UserMapService
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
 import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
 import io.swagger.annotations.ApiParam
@@ -30,4 +31,24 @@
         @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody
         areaVo: AreaVo
     ) = resPack { userMapService.fetchDeviceMap(page, perPage, areaVo) }
+
+    @ApiOperation(value = "鏂板鎴栨洿鏂扮敤鎴风洃娴嬭澶囨槧灏勫叧绯�")
+    @PostMapping("/insertOrUpdate")
+    fun insertOrUpdate(
+        @ApiParam("鐢ㄦ埛鐩戞祴璁惧鏄犲皠鍏崇郴") @RequestBody
+        param: Pair<AreaVo, DeviceMapVo>,
+    ) = resPack { userMapService.insertOrUpdate(param) }
+
+    @ApiOperation(value = "鎼滅储绗笁鏂硅澶�")
+    @PostMapping("/searchThirdPartyDevice")
+    fun searchThirdPartyDevice(
+        @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody
+        areaVo: AreaVo,
+        @ApiParam("鎼滅储鍏抽敭瀛楋紝鍖归厤璁惧鍚�") @RequestParam
+        keyword: String,
+        @ApiParam("鏌ヨ椤电爜", defaultValue = "1", required = false) @RequestParam("page", required = false)
+        page: Int?,
+        @ApiParam("鍗曢〉鏁版嵁閲�", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
+        perPage: Int?,
+    ) = resPack { userMapService.searchThirdPartyDevice(areaVo, keyword, page, perPage) }
 }
\ No newline at end of file

--
Gitblit v1.9.3