Преглед на файлове

修复NOTIFY消息通道信息的更新

648540858 преди 1 година
родител
ревизия
f38c86092d

+ 59 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java

@@ -501,6 +501,58 @@ public interface DeviceChannelMapper {
             "</script>"})
     int batchUpdate(List<DeviceChannel> updateChannels);
 
+
+    @Update({"<script>" +
+            "<foreach collection='updateChannels' item='item' separator=';'>" +
+            " UPDATE" +
+            " wvp_device_channel" +
+            " SET update_time=#{item.updateTime}" +
+            ", device_id=#{item.deviceId}" +
+            ", device_db_id=#{item.deviceDbId}" +
+            ", name=#{item.name}" +
+            ", manufacturer=#{item.manufacturer}" +
+            ", model=#{item.model}" +
+            ", owner=#{item.owner}" +
+            ", civil_code=#{item.civilCode}" +
+            ", block=#{item.block}" +
+            ", address=#{item.address}" +
+            ", parental=#{item.parental}" +
+            ", parent_id=#{item.parentId}" +
+            ", safety_way=#{item.safetyWay}" +
+            ", register_way=#{item.registerWay}" +
+            ", cert_num=#{item.certNum}" +
+            ", certifiable=#{item.certifiable}" +
+            ", err_code=#{item.errCode}" +
+            ", end_time=#{item.endTime}" +
+            ", secrecy=#{item.secrecy}" +
+            ", ip_address=#{item.ipAddress}" +
+            ", port=#{item.port}" +
+            ", password=#{item.password}" +
+            ", status=#{item.status}" +
+            ", longitude=#{item.longitude}" +
+            ", latitude=#{item.latitude}" +
+            ", ptz_type=#{item.ptzType}" +
+            ", position_type=#{item.positionType}" +
+            ", room_type=#{item.roomType}" +
+            ", use_type=#{item.useType}" +
+            ", supply_light_type=#{item.supplyLightType}" +
+            ", direction_type=#{item.directionType}" +
+            ", resolution=#{item.resolution}" +
+            ", business_group_id=#{item.businessGroupId}" +
+            ", download_speed=#{item.downloadSpeed}" +
+            ", svc_space_support_mod=#{item.svcSpaceSupportMod}" +
+            ", svc_time_support_mode=#{item.svcTimeSupportMode}" +
+            ", sub_count=#{item.subCount}" +
+            ", stream_id=#{item.streamId}" +
+            ", has_audio=#{item.hasAudio}" +
+            ", gps_time=#{item.gpsTime}" +
+            ", stream_identification=#{item.streamIdentification}" +
+            ", channel_type=#{item.channelType}" +
+            " WHERE device_id=#{item.deviceId}" +
+            "</foreach>" +
+            "</script>"})
+    int batchUpdateForNotify(List<DeviceChannel> updateChannels);
+
     @Update(" update wvp_device_channel" +
             " set sub_count = (select *" +
             "             from (select count(0)" +
@@ -626,6 +678,13 @@ public interface DeviceChannelMapper {
             "</script>"})
     int batchDel(List<DeviceChannel> deleteChannelList);
 
+    @Delete({"<script>" +
+            "<foreach collection='deleteChannelList' item='item' separator=';'>" +
+            "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId}" +
+            "</foreach>" +
+            "</script>"})
+    int batchDelForNotify(List<DeviceChannel> deleteChannelList);
+
     @Update({"<script>" +
             "<foreach collection='channels' item='item' separator=';'>" +
             "UPDATE wvp_device_channel SET status='ON' WHERE device_id=#{item.deviceId}" +

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java

@@ -45,7 +45,7 @@ public interface IDeviceChannelService {
      * 批量删除通道
      * @param deleteChannelList 待删除的通道列表
      */
-    int deleteChannels(List<DeviceChannel> deleteChannelList);
+    int deleteChannelsForNotify(List<DeviceChannel> deleteChannelList);
 
     /**
      * 批量上线
@@ -67,7 +67,7 @@ public interface IDeviceChannelService {
     /**
      * 直接批量更新通道
      */
-    void batchUpdateChannel(List<DeviceChannel> channels);
+    void batchUpdateChannelForNotify(List<DeviceChannel> channels);
 
     /**
      * 直接批量添加

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java

@@ -193,8 +193,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
     }
 
     @Override
-    public int deleteChannels(List<DeviceChannel> deleteChannelList) {
-       return channelMapper.batchDel(deleteChannelList);
+    public int deleteChannelsForNotify(List<DeviceChannel> deleteChannelList) {
+       return channelMapper.batchDelForNotify(deleteChannelList);
     }
 
     @Override
@@ -242,7 +242,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
     }
 
     @Override
-    public synchronized void batchUpdateChannel(List<DeviceChannel> channels) {
+    public synchronized void batchUpdateChannelForNotify(List<DeviceChannel> channels) {
         String now = DateUtil.getNow();
         for (DeviceChannel channel : channels) {
             channel.setUpdateTime(now);
@@ -255,10 +255,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                     if (i + limitCount > channels.size()) {
                         toIndex = channels.size();
                     }
-                    channelMapper.batchUpdate(channels.subList(i, toIndex));
+                    channelMapper.batchUpdateForNotify(channels.subList(i, toIndex));
                 }
             }else {
-                channelMapper.batchUpdate(channels);
+                channelMapper.batchUpdateForNotify(channels);
             }
         }
     }

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java

@@ -284,7 +284,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
 		if (!updateChannelMap.values().isEmpty()) {
 			log.info("[存储收到的更新通道], 数量: {}", updateChannelMap.size());
 			ArrayList<DeviceChannel> deviceChannels = new ArrayList<>(updateChannelMap.values());
-			deviceChannelService.batchUpdateChannel(deviceChannels);
+			deviceChannelService.batchUpdateChannelForNotify(deviceChannels);
 			updateChannelMap.clear();
 		}
 	}
@@ -299,7 +299,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
 
 	private void executeSaveForDelete(){
 		if (!deleteChannelList.isEmpty()) {
-			deviceChannelService.deleteChannels(deleteChannelList);
+			deviceChannelService.deleteChannelsForNotify(deleteChannelList);
 			deleteChannelList.clear();
 		}
 	}