通道编辑修复分组路径显示异常,支持行政区划路径显示
This commit is contained in:
@@ -396,4 +396,56 @@ public class CommonGBChannel {
|
|||||||
return commonGBChannel;
|
return commonGBChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CommonGBChannel{" +
|
||||||
|
"gbId=" + gbId +
|
||||||
|
", gbDeviceId='" + gbDeviceId + '\'' +
|
||||||
|
", gbName='" + gbName + '\'' +
|
||||||
|
", gbManufacturer='" + gbManufacturer + '\'' +
|
||||||
|
", gbModel='" + gbModel + '\'' +
|
||||||
|
", gbOwner='" + gbOwner + '\'' +
|
||||||
|
", gbCivilCode='" + gbCivilCode + '\'' +
|
||||||
|
", gbBlock='" + gbBlock + '\'' +
|
||||||
|
", gbAddress='" + gbAddress + '\'' +
|
||||||
|
", gbParental=" + gbParental +
|
||||||
|
", gbParentId='" + gbParentId + '\'' +
|
||||||
|
", gbSafetyWay=" + gbSafetyWay +
|
||||||
|
", gbRegisterWay=" + gbRegisterWay +
|
||||||
|
", gbCertNum='" + gbCertNum + '\'' +
|
||||||
|
", gbCertifiable=" + gbCertifiable +
|
||||||
|
", gbErrCode=" + gbErrCode +
|
||||||
|
", gbEndTime='" + gbEndTime + '\'' +
|
||||||
|
", gbSecrecy=" + gbSecrecy +
|
||||||
|
", gbIpAddress='" + gbIpAddress + '\'' +
|
||||||
|
", gbPort=" + gbPort +
|
||||||
|
", gbPassword='" + gbPassword + '\'' +
|
||||||
|
", gbStatus='" + gbStatus + '\'' +
|
||||||
|
", gbLongitude=" + gbLongitude +
|
||||||
|
", gbLatitude=" + gbLatitude +
|
||||||
|
", gpsAltitude=" + gpsAltitude +
|
||||||
|
", gpsSpeed=" + gpsSpeed +
|
||||||
|
", gpsDirection=" + gpsDirection +
|
||||||
|
", gpsTime='" + gpsTime + '\'' +
|
||||||
|
", gbBusinessGroupId='" + gbBusinessGroupId + '\'' +
|
||||||
|
", gbPtzType=" + gbPtzType +
|
||||||
|
", gbPositionType=" + gbPositionType +
|
||||||
|
", gbRoomType=" + gbRoomType +
|
||||||
|
", gbUseType=" + gbUseType +
|
||||||
|
", gbSupplyLightType=" + gbSupplyLightType +
|
||||||
|
", gbDirectionType=" + gbDirectionType +
|
||||||
|
", gbResolution='" + gbResolution + '\'' +
|
||||||
|
", gbDownloadSpeed='" + gbDownloadSpeed + '\'' +
|
||||||
|
", gbSvcSpaceSupportMod=" + gbSvcSpaceSupportMod +
|
||||||
|
", gbSvcTimeSupportMode=" + gbSvcTimeSupportMode +
|
||||||
|
", recordPLan=" + recordPLan +
|
||||||
|
", dataType=" + dataType +
|
||||||
|
", dataDeviceId=" + dataDeviceId +
|
||||||
|
", createTime='" + createTime + '\'' +
|
||||||
|
", updateTime='" + updateTime + '\'' +
|
||||||
|
", streamId='" + streamId + '\'' +
|
||||||
|
", enableBroadcast=" + enableBroadcast +
|
||||||
|
", mapLevel=" + mapLevel +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ public class SubscribeHolder {
|
|||||||
public void putCatalogSubscribe(String platformId, SubscribeInfo subscribeInfo) {
|
public void putCatalogSubscribe(String platformId, SubscribeInfo subscribeInfo) {
|
||||||
log.info("[国标级联] 添加目录订阅,平台: {}, 有效期: {}", platformId, subscribeInfo.getExpires());
|
log.info("[国标级联] 添加目录订阅,平台: {}, 有效期: {}", platformId, subscribeInfo.getExpires());
|
||||||
|
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "catalog", platformId);
|
subscribeInfo.setServerId(userSetting.getServerId());
|
||||||
|
String key = String.format("%s:%s:%s", prefix, "catalog", platformId);
|
||||||
if (subscribeInfo.getExpires() > 0) {
|
if (subscribeInfo.getExpires() > 0) {
|
||||||
Duration duration = Duration.ofSeconds(subscribeInfo.getExpires());
|
Duration duration = Duration.ofSeconds(subscribeInfo.getExpires());
|
||||||
redisTemplate.opsForValue().set(key, subscribeInfo, duration);
|
redisTemplate.opsForValue().set(key, subscribeInfo, duration);
|
||||||
@@ -42,18 +43,19 @@ public class SubscribeHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubscribeInfo getCatalogSubscribe(String platformId) {
|
public SubscribeInfo getCatalogSubscribe(String platformId) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "catalog", platformId);
|
String key = String.format("%s:%s:%s", prefix, "catalog", platformId);
|
||||||
return (SubscribeInfo)redisTemplate.opsForValue().get(key);
|
return (SubscribeInfo)redisTemplate.opsForValue().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCatalogSubscribe(String platformId) {
|
public void removeCatalogSubscribe(String platformId) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "catalog", platformId);
|
String key = String.format("%s:%s:%s", prefix, "catalog", platformId);
|
||||||
redisTemplate.delete(key);
|
redisTemplate.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) {
|
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) {
|
||||||
log.info("[国标级联] 添加移动位置订阅,平台: {}, 有效期: {}s", platformId, subscribeInfo.getExpires());
|
log.info("[国标级联] 添加移动位置订阅,平台: {}, 有效期: {}s", platformId, subscribeInfo.getExpires());
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "mobilePosition", platformId);
|
subscribeInfo.setServerId(userSetting.getServerId());
|
||||||
|
String key = String.format("%s:%s:%s", prefix, "mobilePosition", platformId);
|
||||||
if (subscribeInfo.getExpires() > 0) {
|
if (subscribeInfo.getExpires() > 0) {
|
||||||
Duration duration = Duration.ofSeconds(subscribeInfo.getExpires());
|
Duration duration = Duration.ofSeconds(subscribeInfo.getExpires());
|
||||||
redisTemplate.opsForValue().set(key, subscribeInfo, duration);
|
redisTemplate.opsForValue().set(key, subscribeInfo, duration);
|
||||||
@@ -81,12 +83,12 @@ public class SubscribeHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubscribeInfo getMobilePositionSubscribe(String platformId) {
|
public SubscribeInfo getMobilePositionSubscribe(String platformId) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "mobilePosition", platformId);
|
String key = String.format("%s:%s:%s", prefix, "mobilePosition", platformId);
|
||||||
return (SubscribeInfo)redisTemplate.opsForValue().get(key);
|
return (SubscribeInfo)redisTemplate.opsForValue().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMobilePositionSubscribe(String platformId) {
|
public void removeMobilePositionSubscribe(String platformId) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "mobilePosition", platformId);
|
String key = String.format("%s:%s:%s", prefix, "mobilePosition", platformId);
|
||||||
redisTemplate.delete(key);
|
redisTemplate.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +98,7 @@ public class SubscribeHolder {
|
|||||||
}
|
}
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (Platform platform : platformList) {
|
for (Platform platform : platformList) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "catalog", platform.getServerGBId());
|
String key = String.format("%s:%s:%s", prefix, "catalog", platform.getServerGBId());
|
||||||
if (redisTemplate.hasKey(key)) {
|
if (redisTemplate.hasKey(key)) {
|
||||||
result.add(platform.getServerGBId());
|
result.add(platform.getServerGBId());
|
||||||
}
|
}
|
||||||
@@ -110,7 +112,7 @@ public class SubscribeHolder {
|
|||||||
}
|
}
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (Platform platform : platformList) {
|
for (Platform platform : platformList) {
|
||||||
String key = String.format("%s_%s_%s_%s", prefix, userSetting.getServerId(), "mobilePosition", platform.getServerGBId());
|
String key = String.format("%s:%s:%s", prefix, "mobilePosition", platform.getServerGBId());
|
||||||
if (redisTemplate.hasKey(key)) {
|
if (redisTemplate.hasKey(key)) {
|
||||||
result.add(platform.getServerGBId());
|
result.add(platform.getServerGBId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ public class SubscribeInfo {
|
|||||||
*/
|
*/
|
||||||
private String simulatedCallId;
|
private String simulatedCallId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源serverId
|
||||||
|
*/
|
||||||
|
private String serverId;
|
||||||
|
|
||||||
|
|
||||||
public static SubscribeInfo getInstance(SIPResponse response, String id, int expires, EventHeader eventHeader){
|
public static SubscribeInfo getInstance(SIPResponse response, String id, int expires, EventHeader eventHeader){
|
||||||
SubscribeInfo subscribeInfo = new SubscribeInfo();
|
SubscribeInfo subscribeInfo = new SubscribeInfo();
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ public interface DeviceChannelMapper {
|
|||||||
"insert into wvp_device_channel " +
|
"insert into wvp_device_channel " +
|
||||||
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||||
"ip_address, port, password, status, longitude, latitude, gb_longitude, gb_latitude, ptz_type, position_type, room_type, use_type, " +
|
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||||
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||||
"values " +
|
"values " +
|
||||||
"(#{deviceId}, #{dataType}, #{dataDeviceId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}, " +
|
"(#{deviceId}, #{dataType}, #{dataDeviceId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}, " +
|
||||||
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
|
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
|
||||||
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{gbLongitude}, #{gbLatitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
|
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
|
||||||
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
|
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
|
||||||
" #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification}, #{channelType}) " +
|
" #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification}, #{channelType}) " +
|
||||||
"</script>")
|
"</script>")
|
||||||
@@ -63,8 +63,6 @@ public interface DeviceChannelMapper {
|
|||||||
", status=#{status}" +
|
", status=#{status}" +
|
||||||
", longitude=#{longitude}" +
|
", longitude=#{longitude}" +
|
||||||
", latitude=#{latitude}" +
|
", latitude=#{latitude}" +
|
||||||
", gb_longitude=#{gbLongitude}" +
|
|
||||||
", gb_latitude=#{gbLatitude}" +
|
|
||||||
", ptz_type=#{ptzType}" +
|
", ptz_type=#{ptzType}" +
|
||||||
", position_type=#{positionType}" +
|
", position_type=#{positionType}" +
|
||||||
", room_type=#{roomType}" +
|
", room_type=#{roomType}" +
|
||||||
@@ -200,14 +198,14 @@ public interface DeviceChannelMapper {
|
|||||||
"insert into wvp_device_channel " +
|
"insert into wvp_device_channel " +
|
||||||
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||||
"ip_address, port, password, status, longitude, latitude, gb_longitude, gb_latitude, ptz_type, position_type, room_type, use_type, " +
|
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||||
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||||
"values " +
|
"values " +
|
||||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||||
"(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
|
"(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
|
||||||
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
|
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
|
||||||
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.gbLongitude}, #{item.gbLatitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
|
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
|
||||||
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
|
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
|
||||||
" #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType}) " +
|
" #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType}) " +
|
||||||
"</foreach> " +
|
"</foreach> " +
|
||||||
@@ -534,8 +532,6 @@ public interface DeviceChannelMapper {
|
|||||||
", status=#{status}" +
|
", status=#{status}" +
|
||||||
", longitude=#{longitude}" +
|
", longitude=#{longitude}" +
|
||||||
", latitude=#{latitude}" +
|
", latitude=#{latitude}" +
|
||||||
", gb_longitude=#{gbLongitude}" +
|
|
||||||
", gb_latitude=#{gbLatitude}" +
|
|
||||||
", ptz_type=#{ptzType}" +
|
", ptz_type=#{ptzType}" +
|
||||||
", position_type=#{positionType}" +
|
", position_type=#{positionType}" +
|
||||||
", room_type=#{roomType}" +
|
", room_type=#{roomType}" +
|
||||||
|
|||||||
@@ -65,16 +65,19 @@ public class EventPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void channelEventPublishForUpdate(CommonGBChannel commonGBChannel, CommonGBChannel deviceChannelForOld) {
|
public void channelEventPublishForUpdate(CommonGBChannel commonGBChannel, CommonGBChannel deviceChannelForOld) {
|
||||||
|
log.info("[通道改变内部分发-更新] {}", commonGBChannel.getGbDeviceId());
|
||||||
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, Collections.singletonList(commonGBChannel), Collections.singletonList(deviceChannelForOld));
|
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, Collections.singletonList(commonGBChannel), Collections.singletonList(deviceChannelForOld));
|
||||||
applicationEventPublisher.publishEvent(channelEvent);
|
applicationEventPublisher.publishEvent(channelEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void channelEventPublishForUpdate(List<CommonGBChannel> channelList, List<CommonGBChannel> channelListForOld) {
|
public void channelEventPublishForUpdate(List<CommonGBChannel> channelList, List<CommonGBChannel> channelListForOld) {
|
||||||
|
log.info("[通道改变内部分发-更新] 数量: {}", channelList.size());
|
||||||
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, channelList, channelListForOld);
|
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, channelList, channelListForOld);
|
||||||
applicationEventPublisher.publishEvent(channelEvent);
|
applicationEventPublisher.publishEvent(channelEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void channelEventPublish(List<CommonGBChannel> channelList, ChannelEvent.ChannelEventMessageType type) {
|
public void channelEventPublish(List<CommonGBChannel> channelList, ChannelEvent.ChannelEventMessageType type) {
|
||||||
|
log.info("[通道改变内部分发-{}] 数量: {}", type, channelList.size());
|
||||||
ChannelEvent channelEvent = ChannelEvent.getInstance(this, type, channelList);
|
ChannelEvent channelEvent = ChannelEvent.getInstance(this, type, channelList);
|
||||||
applicationEventPublisher.publishEvent(channelEvent);
|
applicationEventPublisher.publishEvent(channelEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ public interface IGbChannelService {
|
|||||||
|
|
||||||
int offline(CommonGBChannel commonGBChannel);
|
int offline(CommonGBChannel commonGBChannel);
|
||||||
|
|
||||||
int offline(List<CommonGBChannel> commonGBChannelList);
|
int offline(List<CommonGBChannel> commonGBChannelList, boolean permission);
|
||||||
|
|
||||||
int online(CommonGBChannel commonGBChannel);
|
int online(CommonGBChannel commonGBChannel);
|
||||||
|
|
||||||
int online(List<CommonGBChannel> commonGBChannelList);
|
int online(List<CommonGBChannel> commonGBChannelList, boolean permission);
|
||||||
|
|
||||||
void batchAdd(List<CommonGBChannel> commonGBChannels);
|
void batchAdd(List<CommonGBChannel> commonGBChannels);
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public interface IGbChannelService {
|
|||||||
|
|
||||||
void deleteChannelToGroupByGbDevice(List<Integer> deviceIds);
|
void deleteChannelToGroupByGbDevice(List<Integer> deviceIds);
|
||||||
|
|
||||||
void batchUpdate(List<CommonGBChannel> commonGBChannels);
|
void batchUpdateForStreamPushRedisMsg(List<CommonGBChannel> commonGBChannels, boolean permission);
|
||||||
|
|
||||||
CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId);
|
CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId);
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(CommonGBChannel commonGBChannel) {
|
public int update(CommonGBChannel commonGBChannel) {
|
||||||
log.info("[更新通道] 通道ID: {}, ", commonGBChannel.getGbId());
|
log.info("[更新通道] 通道ID: {}, ", commonGBChannel.toString());
|
||||||
if (commonGBChannel.getGbId() <= 0) {
|
if (commonGBChannel.getGbId() <= 0) {
|
||||||
log.warn("[更新通道] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
|
log.warn("[更新通道] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
|
||||||
return 0;
|
return 0;
|
||||||
@@ -248,32 +248,33 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int offline(List<CommonGBChannel> commonGBChannelList) {
|
public int offline(List<CommonGBChannel> commonGBChannelList, boolean permission) {
|
||||||
if (commonGBChannelList.isEmpty()) {
|
if (commonGBChannelList.isEmpty()) {
|
||||||
log.warn("[多个通道离线] 通道数量为0,更新失败");
|
log.warn("[多个通道离线] 通道数量为0,更新失败");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
log.info("[通道离线] 共 {} 个", commonGBChannelList.size());
|
log.info("[通道离线] 共 {} 个", commonGBChannelList.size());
|
||||||
int limitCount = 1000;
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (commonGBChannelList.size() > limitCount) {
|
if (permission) {
|
||||||
for (int i = 0; i < commonGBChannelList.size(); i += limitCount) {
|
int limitCount = 1000;
|
||||||
int toIndex = i + limitCount;
|
if (commonGBChannelList.size() > limitCount) {
|
||||||
if (i + limitCount > commonGBChannelList.size()) {
|
for (int i = 0; i < commonGBChannelList.size(); i += limitCount) {
|
||||||
toIndex = commonGBChannelList.size();
|
int toIndex = i + limitCount;
|
||||||
|
if (i + limitCount > commonGBChannelList.size()) {
|
||||||
|
toIndex = commonGBChannelList.size();
|
||||||
|
}
|
||||||
|
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList.subList(i, toIndex), "OFF");
|
||||||
}
|
}
|
||||||
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList.subList(i, toIndex), "OFF");
|
} else {
|
||||||
|
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList, "OFF");
|
||||||
}
|
}
|
||||||
} else {
|
log.info("[通道离线] 保存入库 共 {} 个改变", result);
|
||||||
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList, "OFF");
|
|
||||||
}
|
}
|
||||||
if (result > 0) {
|
try {
|
||||||
try {
|
// 发送catalog
|
||||||
// 发送catalog
|
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.OFF);
|
||||||
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.OFF);
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
log.warn("[多个通道离线] 发送失败,数量:{}", commonGBChannelList.size(), e);
|
||||||
log.warn("[多个通道离线] 发送失败,数量:{}", commonGBChannelList.size(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -298,24 +299,26 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int online(List<CommonGBChannel> commonGBChannelList) {
|
public int online(List<CommonGBChannel> commonGBChannelList, boolean permission) {
|
||||||
if (commonGBChannelList.isEmpty()) {
|
if (commonGBChannelList.isEmpty()) {
|
||||||
log.warn("[多个通道上线] 通道数量为0,更新失败");
|
log.warn("[多个通道上线] 通道数量为0,更新失败");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 批量更新
|
|
||||||
int limitCount = 1000;
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (commonGBChannelList.size() > limitCount) {
|
if (permission) {
|
||||||
for (int i = 0; i < commonGBChannelList.size(); i += limitCount) {
|
// 批量更新
|
||||||
int toIndex = i + limitCount;
|
int limitCount = 1000;
|
||||||
if (i + limitCount > commonGBChannelList.size()) {
|
if (commonGBChannelList.size() > limitCount) {
|
||||||
toIndex = commonGBChannelList.size();
|
for (int i = 0; i < commonGBChannelList.size(); i += limitCount) {
|
||||||
|
int toIndex = i + limitCount;
|
||||||
|
if (i + limitCount > commonGBChannelList.size()) {
|
||||||
|
toIndex = commonGBChannelList.size();
|
||||||
|
}
|
||||||
|
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList.subList(i, toIndex), "ON");
|
||||||
}
|
}
|
||||||
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList.subList(i, toIndex), "ON");
|
} else {
|
||||||
|
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList, "ON");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
result += commonGBChannelMapper.updateStatusForListById(commonGBChannelList, "ON");
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 发送catalog
|
// 发送catalog
|
||||||
@@ -358,27 +361,29 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchUpdate(List<CommonGBChannel> commonGBChannels) {
|
public void batchUpdateForStreamPushRedisMsg(List<CommonGBChannel> commonGBChannels, boolean permission) {
|
||||||
if (commonGBChannels.isEmpty()) {
|
if (commonGBChannels.isEmpty()) {
|
||||||
log.warn("[更新多个通道] 通道数量为0,更新失败");
|
log.warn("[更新多个通道] 通道数量为0,更新失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<CommonGBChannel> oldCommonGBChannelList = commonGBChannelMapper.queryOldChanelListByChannels(commonGBChannels);
|
List<CommonGBChannel> oldCommonGBChannelList = commonGBChannelMapper.queryOldChanelListByChannels(commonGBChannels);
|
||||||
// 批量保存
|
if (permission) {
|
||||||
int limitCount = 1000;
|
// 批量保存
|
||||||
int result = 0;
|
int limitCount = 1000;
|
||||||
if (commonGBChannels.size() > limitCount) {
|
int result = 0;
|
||||||
for (int i = 0; i < commonGBChannels.size(); i += limitCount) {
|
if (commonGBChannels.size() > limitCount) {
|
||||||
int toIndex = i + limitCount;
|
for (int i = 0; i < commonGBChannels.size(); i += limitCount) {
|
||||||
if (i + limitCount > commonGBChannels.size()) {
|
int toIndex = i + limitCount;
|
||||||
toIndex = commonGBChannels.size();
|
if (i + limitCount > commonGBChannels.size()) {
|
||||||
|
toIndex = commonGBChannels.size();
|
||||||
|
}
|
||||||
|
result += commonGBChannelMapper.batchUpdate(commonGBChannels.subList(i, toIndex));
|
||||||
}
|
}
|
||||||
result += commonGBChannelMapper.batchUpdate(commonGBChannels.subList(i, toIndex));
|
} else {
|
||||||
|
result += commonGBChannelMapper.batchUpdate(commonGBChannels);
|
||||||
}
|
}
|
||||||
} else {
|
log.info("[更新多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
||||||
result += commonGBChannelMapper.batchUpdate(commonGBChannels);
|
|
||||||
}
|
}
|
||||||
log.info("[更新多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
|
||||||
// 发送通过更新通知
|
// 发送通过更新通知
|
||||||
try {
|
try {
|
||||||
// 发送通知
|
// 发送通知
|
||||||
|
|||||||
@@ -269,14 +269,12 @@ public class GroupServiceImpl implements IGroupService {
|
|||||||
if (businessGroupInDb == null) {
|
if (businessGroupInDb == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "业务分组不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "业务分组不存在");
|
||||||
}
|
}
|
||||||
List<Group> groupList = new LinkedList<>();
|
|
||||||
groupList.add(businessGroupInDb);
|
|
||||||
Group group = groupManager.queryOneByDeviceId(deviceId, businessGroup);
|
Group group = groupManager.queryOneByDeviceId(deviceId, businessGroup);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "虚拟组织不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "虚拟组织不存在");
|
||||||
}
|
}
|
||||||
List<Group> allParent = getAllParent(group);
|
List<Group> allParent = getAllParent(group);
|
||||||
groupList.addAll(allParent);
|
List<Group> groupList = new LinkedList<>(allParent);
|
||||||
groupList.add(group);
|
groupList.add(group);
|
||||||
return groupList;
|
return groupList;
|
||||||
}
|
}
|
||||||
@@ -286,10 +284,9 @@ public class GroupServiceImpl implements IGroupService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Group> groupList = new ArrayList<>();
|
|
||||||
Group parent = groupManager.queryOneByDeviceId(group.getParentDeviceId(), group.getBusinessGroup());
|
Group parent = groupManager.queryOneByDeviceId(group.getParentDeviceId(), group.getBusinessGroup());
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return groupList;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<Group> allParent = getAllParent(parent);
|
List<Group> allParent = getAllParent(parent);
|
||||||
allParent.add(parent);
|
allParent.add(parent);
|
||||||
|
|||||||
@@ -236,8 +236,9 @@ public class RegionServiceImpl implements IRegionService {
|
|||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "行政区划不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "行政区划不存在");
|
||||||
}
|
}
|
||||||
List<Region> allParent = getAllParent(region);
|
List<Region> allParent = getAllParent(region);
|
||||||
allParent.add(region);
|
List<Region> regionList = new LinkedList<>(allParent);
|
||||||
return allParent;
|
regionList.add(region);
|
||||||
|
return regionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -246,15 +247,13 @@ public class RegionServiceImpl implements IRegionService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Region> regionList = new LinkedList<>();
|
|
||||||
Region parent = regionMapper.queryByDeviceId(region.getParentDeviceId());
|
Region parent = regionMapper.queryByDeviceId(region.getParentDeviceId());
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return regionList;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
regionList.add(parent);
|
|
||||||
List<Region> allParent = getAllParent(parent);
|
List<Region> allParent = getAllParent(parent);
|
||||||
regionList.addAll(allParent);
|
allParent.add(parent);
|
||||||
return regionList;
|
return allParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询最新移动位置
|
* 查询最新移动位置
|
||||||
* @param deviceId
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MobilePosition queryLatestPosition(String deviceId) {
|
public MobilePosition queryLatestPosition(String deviceId) {
|
||||||
@@ -104,7 +103,7 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
|
|||||||
if (userSetting.getSavePositionHistory()) {
|
if (userSetting.getSavePositionHistory()) {
|
||||||
mobilePositionMapper.batchadd(mobilePositions);
|
mobilePositionMapper.batchadd(mobilePositions);
|
||||||
}
|
}
|
||||||
log.debug("[移动位置订阅]更新通道位置: {}", mobilePositions.size());
|
log.info("[移动位置订阅]更新通道位置: {}", mobilePositions.size());
|
||||||
Map<String, Map<Integer, DeviceChannel>> updateChannelMap = new HashMap<>();
|
Map<String, Map<Integer, DeviceChannel>> updateChannelMap = new HashMap<>();
|
||||||
for (MobilePosition mobilePosition : mobilePositions) {
|
for (MobilePosition mobilePosition : mobilePositions) {
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
|
|||||||
@@ -109,50 +109,49 @@ public class RedisGroupMsgListener implements MessageListener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group topGroup = aliasGroupMap.get(groupMessage.getTopGroupGAlias());
|
Group topGroup = aliasGroupMap.get(groupMessage.getTopGroupGAlias());
|
||||||
if (topGroup == null) {
|
if (topGroup == null) {
|
||||||
topGroup = aliasGroupToSave.get(groupMessage.getTopGroupGAlias());
|
topGroup = aliasGroupToSave.get(groupMessage.getTopGroupGAlias());
|
||||||
}
|
|
||||||
if (topGroup == null) {
|
|
||||||
log.info("[REDIS消息-业务分组同步回复] 业务分组信息未发送或者未首先发送, {}", groupMessage.toString());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
group.setBusinessGroup(topGroup.getDeviceId());
|
|
||||||
if (groupMessage.getParentGAlias() != null) {
|
|
||||||
Group parentGroup = aliasGroupMap.get(groupMessage.getParentGAlias());
|
|
||||||
if (parentGroup == null) {
|
|
||||||
parentGroup = aliasGroupToSave.get(groupMessage.getParentGAlias());
|
|
||||||
}
|
}
|
||||||
if (parentGroup == null) {
|
if (topGroup == null) {
|
||||||
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点未发送或者未首先发送, {}", groupMessage.toString());
|
log.info("[REDIS消息-业务分组同步回复] 业务分组信息未发送或者未首先发送, {}", groupMessage.toString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
group.setParentId(null);
|
group.setBusinessGroup(topGroup.getDeviceId());
|
||||||
group.setParentDeviceId(parentGroup.getDeviceId());
|
if (groupMessage.getParentGAlias() != null) {
|
||||||
|
Group parentGroup = aliasGroupMap.get(groupMessage.getParentGAlias());
|
||||||
|
if (parentGroup == null) {
|
||||||
|
parentGroup = aliasGroupToSave.get(groupMessage.getParentGAlias());
|
||||||
|
}
|
||||||
|
if (parentGroup == null) {
|
||||||
|
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点未发送或者未首先发送, {}", groupMessage.toString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
group.setParentId(null);
|
||||||
|
group.setParentDeviceId(parentGroup.getDeviceId());
|
||||||
|
} else {
|
||||||
|
group.setParentId(null);
|
||||||
|
group.setParentDeviceId(topGroup.getDeviceId());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
group.setParentId(null);
|
group.setParentId(null);
|
||||||
group.setParentDeviceId(topGroup.getDeviceId());
|
group.setBusinessGroup(group.getDeviceId());
|
||||||
|
group.setParentDeviceId(null);
|
||||||
}
|
}
|
||||||
} else {
|
group.setUpdateTime(DateUtil.getNow());
|
||||||
group.setParentId(null);
|
aliasGroupToSave.put(group.getAlias(), group);
|
||||||
group.setBusinessGroup(group.getDeviceId());
|
|
||||||
group.setParentDeviceId(null);
|
|
||||||
}
|
}
|
||||||
group.setUpdateTime(DateUtil.getNow());
|
log.info("[业务分组同步回复-存储分组数据] {}", JSONObject.toJSONString(aliasGroupToSave.values()));
|
||||||
aliasGroupToSave.put(group.getAlias(), group);
|
// 存储分组数据
|
||||||
|
groupService.saveByAlias(aliasGroupToSave.values());
|
||||||
|
|
||||||
|
} catch (ControllerException e) {
|
||||||
|
log.warn("[REDIS消息-业务分组同步回复] 失败, \r\n{}", e.getMsg());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[REDIS消息-业务分组同步回复] 发现未处理的异常, \r\n{}", new String(msg.getBody()));
|
||||||
|
log.error("[REDIS消息-业务分组同步回复] 异常内容: ", e);
|
||||||
}
|
}
|
||||||
log.info("[业务分组同步回复-存储分组数据] {}", JSONObject.toJSONString(aliasGroupToSave.values()));
|
|
||||||
// 存储分组数据
|
|
||||||
groupService.saveByAlias(aliasGroupToSave.values());
|
|
||||||
|
|
||||||
} catch (ControllerException e) {
|
|
||||||
log.warn("[REDIS消息-业务分组同步回复] 失败, \r\n{}", e.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("[REDIS消息-业务分组同步回复] 发现未处理的异常, \r\n{}", new String(msg.getBody()));
|
|
||||||
log.error("[REDIS消息-业务分组同步回复] 异常内容: ", e);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -175,7 +174,7 @@ public class RedisGroupMsgListener implements MessageListener {
|
|||||||
codeType = "215";
|
codeType = "215";
|
||||||
}
|
}
|
||||||
return String.format(deviceTemplate, codeType, RandomStringUtils.insecure().next(6, false, true));
|
return String.format(deviceTemplate, codeType, RandomStringUtils.insecure().next(6, false, true));
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[REDIS消息-业务分组同步回复] 构建新的分组编号失败", e);
|
log.error("[REDIS消息-业务分组同步回复] 构建新的分组编号失败", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,6 @@ public class RedisPushStreamListMsgListener implements MessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
String serverId = redisCatchStorage.chooseOneServer(null);
|
|
||||||
if (!userSetting.getServerId().equals(serverId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
log.info("[REDIS: 推流设备列表更新]: {}", new String(message.getBody()));
|
log.info("[REDIS: 推流设备列表更新]: {}", new String(message.getBody()));
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
}
|
}
|
||||||
@@ -130,7 +126,7 @@ public class RedisPushStreamListMsgListener implements MessageListener {
|
|||||||
if (!streamPushItemForUpdate.isEmpty()) {
|
if (!streamPushItemForUpdate.isEmpty()) {
|
||||||
log.info("修改{}条", streamPushItemForUpdate.size());
|
log.info("修改{}条", streamPushItemForUpdate.size());
|
||||||
log.info(JSONObject.toJSONString(streamPushItemForUpdate));
|
log.info(JSONObject.toJSONString(streamPushItemForUpdate));
|
||||||
streamPushService.batchUpdate(streamPushItemForUpdate);
|
streamPushService.batchUpdateForRedisMsg(streamPushItemForUpdate);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[REDIS消息-推流设备列表更新] 发现未处理的异常, \r\n{}", new String(msg.getBody()));
|
log.warn("[REDIS消息-推流设备列表更新] 发现未处理的异常, \r\n{}", new String(msg.getBody()));
|
||||||
|
|||||||
@@ -79,19 +79,19 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
|
|||||||
dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED);
|
dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED);
|
||||||
if (streamStatusMessage.isSetAllOffline()) {
|
if (streamStatusMessage.isSetAllOffline()) {
|
||||||
// 所有设备离线
|
// 所有设备离线
|
||||||
streamPushService.allOffline();
|
streamPushService.allOfflineForRedisMsg();
|
||||||
}
|
}
|
||||||
if (streamStatusMessage.getOfflineStreams() != null
|
if (streamStatusMessage.getOfflineStreams() != null
|
||||||
&& !streamStatusMessage.getOfflineStreams().isEmpty()) {
|
&& !streamStatusMessage.getOfflineStreams().isEmpty()) {
|
||||||
// 更新部分设备离线
|
// 更新部分设备离线
|
||||||
log.info("[REDIS: 推流设备状态变化] 更新部分设备离线: {}个", streamStatusMessage.getOfflineStreams().size());
|
log.info("[REDIS: 推流设备状态变化] 更新部分设备离线: {}个", streamStatusMessage.getOfflineStreams().size());
|
||||||
streamPushService.offline(streamStatusMessage.getOfflineStreams());
|
streamPushService.offlineforRedisMsg(streamStatusMessage.getOfflineStreams());
|
||||||
}
|
}
|
||||||
if (streamStatusMessage.getOnlineStreams() != null &&
|
if (streamStatusMessage.getOnlineStreams() != null &&
|
||||||
!streamStatusMessage.getOnlineStreams().isEmpty()) {
|
!streamStatusMessage.getOnlineStreams().isEmpty()) {
|
||||||
// 更新部分设备上线
|
// 更新部分设备上线
|
||||||
log.info("[REDIS: 推流设备状态变化] 更新部分设备上线: {}个", streamStatusMessage.getOnlineStreams().size());
|
log.info("[REDIS: 推流设备状态变化] 更新部分设备上线: {}个", streamStatusMessage.getOnlineStreams().size());
|
||||||
streamPushService.online(streamStatusMessage.getOnlineStreams());
|
streamPushService.onlineForRedisMsg(streamStatusMessage.getOnlineStreams());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.parseObject(msg.getBody()));
|
log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.parseObject(msg.getBody()));
|
||||||
@@ -115,7 +115,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
|
|||||||
dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, () -> {
|
dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, () -> {
|
||||||
log.info("[REDIS消息]未收到redis回复推流设备状态,执行推流设备离线");
|
log.info("[REDIS消息]未收到redis回复推流设备状态,执行推流设备离线");
|
||||||
// 五秒收不到请求就设置通道离线,然后通知上级离线
|
// 五秒收不到请求就设置通道离线,然后通知上级离线
|
||||||
streamPushService.allOffline();
|
streamPushService.allOfflineForRedisMsg();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -524,7 +524,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||||||
if (serverId != null) {
|
if (serverId != null) {
|
||||||
redisTemplate.opsForZSet().remove(key, serverId);
|
redisTemplate.opsForZSet().remove(key, serverId);
|
||||||
}
|
}
|
||||||
Set<Object> range = redisTemplate.opsForZSet().range(key, 0, 0);
|
// 获取得分最高的,也是最后更新时间到redis的wvp,这样可以避免读取到离线的wvp,同时时间最新也一定程度代表最健康的
|
||||||
|
Set<Object> range = redisTemplate.opsForZSet().reverseRange(key, 0, 0);
|
||||||
if (range == null || range.isEmpty()) {
|
if (range == null || range.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!channelListForOnline.isEmpty()) {
|
if (!channelListForOnline.isEmpty()) {
|
||||||
gbChannelService.online(channelListForOnline);
|
gbChannelService.online(channelListForOnline, true);
|
||||||
}
|
}
|
||||||
List<CommonGBChannel> channelListForOffline = new ArrayList<>();
|
List<CommonGBChannel> channelListForOffline = new ArrayList<>();
|
||||||
List<StreamProxy> streamProxiesForRemove = new ArrayList<>();
|
List<StreamProxy> streamProxiesForRemove = new ArrayList<>();
|
||||||
@@ -302,7 +302,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!channelListForOffline.isEmpty()) {
|
if (!channelListForOffline.isEmpty()) {
|
||||||
gbChannelService.offline(channelListForOffline);
|
gbChannelService.offline(channelListForOffline, true);
|
||||||
}
|
}
|
||||||
if (!streamProxiesForRemove.isEmpty()) {
|
if (!streamProxiesForRemove.isEmpty()) {
|
||||||
streamProxyMapper.deleteByList(streamProxiesForRemove);
|
streamProxyMapper.deleteByList(streamProxiesForRemove);
|
||||||
@@ -338,7 +338,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
}
|
}
|
||||||
if (!channelListForOffline.isEmpty()) {
|
if (!channelListForOffline.isEmpty()) {
|
||||||
// 修改国标关联的国标通道的状态
|
// 修改国标关联的国标通道的状态
|
||||||
gbChannelService.offline(channelListForOffline);
|
gbChannelService.offline(channelListForOffline, true);
|
||||||
}
|
}
|
||||||
if (!streamProxiesForSendMessage.isEmpty()) {
|
if (!streamProxiesForSendMessage.isEmpty()) {
|
||||||
for (StreamProxy streamProxy : streamProxiesForSendMessage) {
|
for (StreamProxy streamProxy : streamProxiesForSendMessage) {
|
||||||
|
|||||||
@@ -160,6 +160,6 @@ public interface StreamPushMapper {
|
|||||||
|
|
||||||
@Delete(" DELETE FROM wvp_stream_push st " +
|
@Delete(" DELETE FROM wvp_stream_push st " +
|
||||||
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
||||||
" where wdc.id is null and st.server_id = #{id}")
|
" where wdc.id is null and st.server_id = #{serverId}")
|
||||||
void deleteWithoutGBId(String id);
|
void deleteWithoutGBId(@Param("serverId") String serverId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,17 +52,17 @@ public interface IStreamPushService {
|
|||||||
/**
|
/**
|
||||||
* 全部离线
|
* 全部离线
|
||||||
*/
|
*/
|
||||||
void allOffline();
|
void allOfflineForRedisMsg();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推流离线
|
* 推流离线
|
||||||
*/
|
*/
|
||||||
void offline(List<StreamPushItemFromRedis> offlineStreams);
|
void offlineforRedisMsg(List<StreamPushItemFromRedis> offlineStreams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推流上线
|
* 推流上线
|
||||||
*/
|
*/
|
||||||
void online(List<StreamPushItemFromRedis> onlineStreams);
|
void onlineForRedisMsg(List<StreamPushItemFromRedis> onlineStreams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加推流
|
* 增加推流
|
||||||
@@ -91,7 +91,7 @@ public interface IStreamPushService {
|
|||||||
|
|
||||||
void updatePushStatus(StreamPush streamPush);
|
void updatePushStatus(StreamPush streamPush);
|
||||||
|
|
||||||
void batchUpdate(List<StreamPush> streamPushItemForUpdate);
|
void batchUpdateForRedisMsg(List<StreamPush> streamPushItemForUpdate);
|
||||||
|
|
||||||
int delete(int id);
|
int delete(int id);
|
||||||
|
|
||||||
|
|||||||
@@ -446,7 +446,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void allOffline() {
|
public void allOfflineForRedisMsg() {
|
||||||
|
String serverId = redisCatchStorage.chooseOneServer(null);
|
||||||
|
boolean permission = userSetting.getServerId().equals(serverId);
|
||||||
List<StreamPush> streamPushList = streamPushMapper.selectAll(null, null, null);
|
List<StreamPush> streamPushList = streamPushMapper.selectAll(null, null, null);
|
||||||
if (streamPushList.isEmpty()) {
|
if (streamPushList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -458,11 +460,13 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
commonGBChannelList.add(streamPush.buildCommonGBChannel());
|
commonGBChannelList.add(streamPush.buildCommonGBChannel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gbChannelService.offline(commonGBChannelList);
|
gbChannelService.offline(commonGBChannelList, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void offline(List<StreamPushItemFromRedis> offlineStreams) {
|
public void offlineforRedisMsg(List<StreamPushItemFromRedis> offlineStreams) {
|
||||||
|
String serverId = redisCatchStorage.chooseOneServer(null);
|
||||||
|
boolean permission = userSetting.getServerId().equals(serverId);
|
||||||
// 更新部分设备离线
|
// 更新部分设备离线
|
||||||
List<StreamPush> streamPushList = streamPushMapper.getListInList(offlineStreams);
|
List<StreamPush> streamPushList = streamPushMapper.getListInList(offlineStreams);
|
||||||
if (streamPushList.isEmpty()) {
|
if (streamPushList.isEmpty()) {
|
||||||
@@ -470,15 +474,17 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<CommonGBChannel> commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList);
|
List<CommonGBChannel> commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList);
|
||||||
gbChannelService.offline(commonGBChannelList);
|
gbChannelService.offline(commonGBChannelList, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void online(List<StreamPushItemFromRedis> onlineStreams) {
|
public void onlineForRedisMsg(List<StreamPushItemFromRedis> onlineStreams) {
|
||||||
if (onlineStreams.isEmpty()) {
|
if (onlineStreams.isEmpty()) {
|
||||||
log.info("[设备上线] 推流设备列表为空");
|
log.info("[设备上线] 推流设备列表为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String serverId = redisCatchStorage.chooseOneServer(null);
|
||||||
|
boolean permission = userSetting.getServerId().equals(serverId);
|
||||||
// 更新部分设备上线streamPushService
|
// 更新部分设备上线streamPushService
|
||||||
List<StreamPush> streamPushList = streamPushMapper.getListInList(onlineStreams);
|
List<StreamPush> streamPushList = streamPushMapper.getListInList(onlineStreams);
|
||||||
if (streamPushList.isEmpty()) {
|
if (streamPushList.isEmpty()) {
|
||||||
@@ -488,7 +494,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<CommonGBChannel> commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList);
|
List<CommonGBChannel> commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList);
|
||||||
gbChannelService.online(commonGBChannelList);
|
gbChannelService.online(commonGBChannelList, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -556,15 +562,19 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void batchUpdate(List<StreamPush> streamPushItemForUpdate) {
|
public void batchUpdateForRedisMsg(List<StreamPush> streamPushItemForUpdate) {
|
||||||
streamPushMapper.batchUpdate(streamPushItemForUpdate);
|
String serverId = redisCatchStorage.chooseOneServer(null);
|
||||||
|
boolean permission = userSetting.getServerId().equals(serverId);
|
||||||
|
if (permission) {
|
||||||
|
streamPushMapper.batchUpdate(streamPushItemForUpdate);
|
||||||
|
}
|
||||||
List<CommonGBChannel> commonGBChannels = new ArrayList<>();
|
List<CommonGBChannel> commonGBChannels = new ArrayList<>();
|
||||||
for (StreamPush streamPush : streamPushItemForUpdate) {
|
for (StreamPush streamPush : streamPushItemForUpdate) {
|
||||||
if (!ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
|
if (!ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
|
||||||
commonGBChannels.add(streamPush.buildCommonGBChannel());
|
commonGBChannels.add(streamPush.buildCommonGBChannel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gbChannelService.batchUpdate(commonGBChannels);
|
gbChannelService.batchUpdateForStreamPushRedisMsg(commonGBChannels, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ public class SYMember {
|
|||||||
private Long blockId;
|
private Long blockId;
|
||||||
private String unitNo;
|
private String unitNo;
|
||||||
private String terminalMemberStatus;
|
private String terminalMemberStatus;
|
||||||
|
private String channelDeviceId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
private final String REDIS_CHANNEL_MESSAGE = "VM_MSG_MOBILE_CHANNEL";
|
private final String REDIS_CHANNEL_MESSAGE = "VM_MSG_MOBILE_CHANNEL";
|
||||||
private final String REDIS_MEMBER_STATUS_MESSAGE = "VM_MSG_MEMBER_STATUS_CHANNEL";
|
private final String REDIS_MEMBER_STATUS_MESSAGE = "VM_MSG_MEMBER_STATUS_CHANNEL";
|
||||||
private final String MOBILE_CHANNEL_PREFIX = "nationalStandardMobileTerminal_";
|
private final String MOBILE_CHANNEL_PREFIX = "nationalStandardMobileTerminal_";
|
||||||
|
private final String DELAY_TASK_KEY = "DELAY_TASK_KEY_";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonGBChannelMapper channelMapper;
|
private CommonGBChannelMapper channelMapper;
|
||||||
@@ -126,9 +127,9 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
List<CommonGBChannel> resultListForOnline = new ArrayList<>();
|
List<CommonGBChannel> resultListForOnline = new ArrayList<>();
|
||||||
List<CommonGBChannel> resultListForOffline = new ArrayList<>();
|
List<CommonGBChannel> resultListForOffline = new ArrayList<>();
|
||||||
|
|
||||||
List<SYMember> memberList = new ArrayList<>();
|
Map<String, CommonGBChannel> delayChannelMap = new HashMap<>();
|
||||||
List<CommonGBChannel> addMemberList = new ArrayList<>();
|
|
||||||
|
|
||||||
|
List<SYMember> memberList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
switch (event.getMessageType()) {
|
switch (event.getMessageType()) {
|
||||||
@@ -157,16 +158,29 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
if (oldChannel != null) {
|
if (oldChannel != null) {
|
||||||
if (oldChannel.getGbPtzType() != null && oldChannel.getGbPtzType() == 99) {
|
if (oldChannel.getGbPtzType() != null && oldChannel.getGbPtzType() == 99) {
|
||||||
resultListForUpdate.add(channel);
|
resultListForUpdate.add(channel);
|
||||||
|
// 如果状态变化发送消息
|
||||||
|
if (!Objects.equals(oldChannel.getGbStatus(), channel.getGbStatus())) {
|
||||||
|
SYMember member = getMember(channel.getGbDeviceId());
|
||||||
|
if (member != null) {
|
||||||
|
if ("ON".equals(channel.getGbStatus())) {
|
||||||
|
member.setTerminalMemberStatus("ONLINE");
|
||||||
|
}else {
|
||||||
|
member.setTerminalMemberStatus("OFFLINE");
|
||||||
|
}
|
||||||
|
memberList.add(member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
resultListForAdd.add(channel);
|
resultListForAdd.add(channel);
|
||||||
if ("ON".equals(channel.getGbStatus())) {
|
if ("ON".equals(channel.getGbStatus())) {
|
||||||
addMemberList.add(channel);
|
delayChannelMap.put(channel.getGbDeviceId(), channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
resultListForAdd.add(channel);
|
resultListForAdd.add(channel);
|
||||||
if ("ON".equals(channel.getGbStatus())) {
|
if ("ON".equals(channel.getGbStatus())) {
|
||||||
addMemberList.add(channel);
|
delayChannelMap.put(channel.getGbDeviceId(), channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@@ -175,6 +189,11 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
CameraChannel cameraChannel = new CameraChannel();
|
CameraChannel cameraChannel = new CameraChannel();
|
||||||
cameraChannel.setGbDeviceId(channel.getGbDeviceId());
|
cameraChannel.setGbDeviceId(channel.getGbDeviceId());
|
||||||
resultListForDelete.add(cameraChannel);
|
resultListForDelete.add(cameraChannel);
|
||||||
|
SYMember member = getMember(cameraChannel.getGbDeviceId());
|
||||||
|
if (member != null) {
|
||||||
|
member.setTerminalMemberStatus("OFFLINE");
|
||||||
|
memberList.add(member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,8 +205,14 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
CameraChannel cameraChannel = new CameraChannel();
|
CameraChannel cameraChannel = new CameraChannel();
|
||||||
cameraChannel.setGbDeviceId(channel.getGbDeviceId());
|
cameraChannel.setGbDeviceId(channel.getGbDeviceId());
|
||||||
resultListForDelete.add(cameraChannel);
|
resultListForDelete.add(cameraChannel);
|
||||||
|
SYMember member = getMember(cameraChannel.getGbDeviceId());
|
||||||
|
if (member != null) {
|
||||||
|
member.setTerminalMemberStatus("OFFLINE");
|
||||||
|
memberList.add(member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ON:
|
case ON:
|
||||||
case OFF:
|
case OFF:
|
||||||
@@ -221,7 +246,7 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
if (channel.getGbPtzType() != null && channel.getGbPtzType() == 99) {
|
if (channel.getGbPtzType() != null && channel.getGbPtzType() == 99) {
|
||||||
resultListForAdd.add(channel);
|
resultListForAdd.add(channel);
|
||||||
if ("ON".equals(channel.getGbStatus())) {
|
if ("ON".equals(channel.getGbStatus())) {
|
||||||
addMemberList.add(channel);
|
delayChannelMap.put(channel.getGbDeviceId(), channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,27 +274,34 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
if (!memberList.isEmpty()) {
|
if (!memberList.isEmpty()) {
|
||||||
sendMemberStatusMessage(memberList);
|
sendMemberStatusMessage(memberList);
|
||||||
}
|
}
|
||||||
if (!addMemberList.isEmpty()) {
|
if (!delayChannelMap.isEmpty()) {
|
||||||
// 对于在线的终端进行延迟检查和发送
|
// 对于在线的终端进行延迟检查和发送
|
||||||
String key = UUID.randomUUID().toString();
|
for (CommonGBChannel commonGBChannel : delayChannelMap.values()) {
|
||||||
dynamicTask.startDelay(key, () -> {
|
String key = DELAY_TASK_KEY + commonGBChannel.getGbDeviceId();
|
||||||
List<SYMember> members = new ArrayList<>();
|
dynamicTask.startDelay(key, () -> {
|
||||||
for (CommonGBChannel commonGBChannel : addMemberList) {
|
dynamicTask.stop(key);
|
||||||
SYMember member = getMember(commonGBChannel.getGbDeviceId());
|
SYMember member = getMember(commonGBChannel.getGbDeviceId());
|
||||||
if (member == null) {
|
if (member == null) {
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
member.setTerminalMemberStatus("ONLINE");
|
member.setTerminalMemberStatus("ONLINE");
|
||||||
members.add(member);
|
sendMemberStatusMessage(List.of(member));
|
||||||
}
|
}, 3000);
|
||||||
if (!members.isEmpty()) {
|
}
|
||||||
sendMemberStatusMessage(members);
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendMemberStatusMessage(List<SYMember> memberList) {
|
private void sendMemberStatusMessage(List<SYMember> memberList) {
|
||||||
|
// 取消延时发送
|
||||||
|
for (SYMember syMember : memberList) {
|
||||||
|
String key = DELAY_TASK_KEY + syMember.getChannelDeviceId();
|
||||||
|
if (dynamicTask.contains(key)) {
|
||||||
|
log.info("[SY-redis发送通知] 取消延时新增任务: {}", key);
|
||||||
|
dynamicTask.stop(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String jsonString = JSONObject.toJSONString(memberList);
|
String jsonString = JSONObject.toJSONString(memberList);
|
||||||
log.info("[SY-redis发送通知] 发送 状态变化 {}: {}", REDIS_MEMBER_STATUS_MESSAGE, jsonString);
|
log.info("[SY-redis发送通知] 发送 状态变化 {}: {}", REDIS_MEMBER_STATUS_MESSAGE, jsonString);
|
||||||
redisTemplateForString.convertAndSend(REDIS_MEMBER_STATUS_MESSAGE, jsonString);
|
redisTemplateForString.convertAndSend(REDIS_MEMBER_STATUS_MESSAGE, jsonString);
|
||||||
@@ -277,6 +309,7 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
|
|
||||||
private void sendChannelMessage(List<CommonGBChannel> channelList, ChannelEvent.ChannelEventMessageType type) {
|
private void sendChannelMessage(List<CommonGBChannel> channelList, ChannelEvent.ChannelEventMessageType type) {
|
||||||
if (channelList.isEmpty()) {
|
if (channelList.isEmpty()) {
|
||||||
|
log.warn("[SY-redis发送通知-{}] 发送失败,数据为空, 通道信息变化 {}", type, REDIS_CHANNEL_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<CameraChannel> cameraChannelList = channelMapper.queryCameraChannelByIds(channelList);
|
List<CameraChannel> cameraChannelList = channelMapper.queryCameraChannelByIds(channelList);
|
||||||
@@ -311,6 +344,7 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
jsonObject.put("direction", mobilePosition.getDirection());
|
jsonObject.put("direction", mobilePosition.getDirection());
|
||||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||||
jsonObject.put("blockId", member.getBlockId());
|
jsonObject.put("blockId", member.getBlockId());
|
||||||
|
jsonObject.put("gbDeviceId", mobilePosition.getChannelDeviceId());
|
||||||
log.info("[SY-redis发送通知-移动设备位置信息] 发送 {}: {}", REDIS_GPS_MESSAGE, jsonObject.toString());
|
log.info("[SY-redis发送通知-移动设备位置信息] 发送 {}: {}", REDIS_GPS_MESSAGE, jsonObject.toString());
|
||||||
redisTemplateForString.convertAndSend(REDIS_GPS_MESSAGE, jsonObject.toString());
|
redisTemplateForString.convertAndSend(REDIS_GPS_MESSAGE, jsonObject.toString());
|
||||||
}
|
}
|
||||||
@@ -322,7 +356,9 @@ public class CameraChannelService implements CommandLineRunner {
|
|||||||
if (jsonObject == null) {
|
if (jsonObject == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSONObject.parseObject(jsonObject.toString(), SYMember.class);
|
SYMember syMember = JSONObject.parseObject(jsonObject.toString(), SYMember.class);
|
||||||
|
syMember.setChannelDeviceId(deviceId);
|
||||||
|
return syMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,14 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="行政区域">
|
<el-form-item label="行政区域">
|
||||||
<el-input v-model="form.gbCivilCode" placeholder="请输入行政区域">
|
<el-input v-model="form.gbCivilCode" placeholder="请输入行政区域" @change="getRegionPaths">
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<el-button @click="chooseCivilCode()">选择</el-button>
|
<el-button @click="chooseCivilCode()">选择</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<el-breadcrumb v-if="regionPath.length > 0" separator="/" style="display: block; margin-top: 8px; font-size: 14px;">
|
||||||
|
<el-breadcrumb-item v-for="key in regionPath" :key="key">{{ key }}</el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="安装地址">
|
<el-form-item label="安装地址">
|
||||||
@@ -274,6 +277,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
modelList: [],
|
modelList: [],
|
||||||
parentPath: [],
|
parentPath: [],
|
||||||
|
regionPath: [],
|
||||||
form: {}
|
form: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -387,6 +391,7 @@ export default {
|
|||||||
this.form = data
|
this.form = data
|
||||||
this.$set(this.form, 'enableBroadcastForBool', this.form.enableBroadcast === 1)
|
this.$set(this.form, 'enableBroadcastForBool', this.form.enableBroadcast === 1)
|
||||||
this.getPaths()
|
this.getPaths()
|
||||||
|
this.getRegionPaths()
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@@ -400,6 +405,7 @@ export default {
|
|||||||
chooseCivilCode: function() {
|
chooseCivilCode: function() {
|
||||||
this.$refs.chooseCivilCode.openDialog(code => {
|
this.$refs.chooseCivilCode.openDialog(code => {
|
||||||
this.form.gbCivilCode = code
|
this.form.gbCivilCode = code
|
||||||
|
this.getRegionPaths()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
chooseGroup: function() {
|
chooseGroup: function() {
|
||||||
@@ -431,6 +437,20 @@ export default {
|
|||||||
this.parentPath = path
|
this.parentPath = path
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getRegionPaths: function() {
|
||||||
|
this.regionPath = []
|
||||||
|
if (this.form.gbCivilCode) {
|
||||||
|
this.$store.dispatch('region/queryPath', this.form.gbCivilCode)
|
||||||
|
.then(data => {
|
||||||
|
console.log(data)
|
||||||
|
const path = []
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
path.push(data[i].name)
|
||||||
|
}
|
||||||
|
this.regionPath = path
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user