临时提交

pull/1642/head
648540858 2024-09-14 17:50:05 +08:00
parent 800d6c926a
commit 80912d8a2c
9 changed files with 36 additions and 375 deletions

View File

@ -172,8 +172,8 @@ public interface DeviceChannelMapper {
"OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') " +
")</if> " +
" <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR coalesce(dc.gb_civil_code, dc.civil_code) = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status= true</if>" +
" <if test='online == false' > AND dc.status= false</if>" +
" <if test='online == true' > AND dc.status= 'ON'</if>" +
" <if test='online == false' > AND dc.status= 'OFF'</if>" +
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
@ -246,8 +246,8 @@ public interface DeviceChannelMapper {
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status=1</if>" +
" <if test='online == false' > AND dc.status=0</if>" +
" <if test='online == true' > AND dc.status='ON'</if>" +
" <if test='online == false' > AND dc.status='OFF'</if>" +
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
@ -338,8 +338,8 @@ public interface DeviceChannelMapper {
"AND " +
"(COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
" OR COALESCE(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))</if> " +
" <if test='online == true' > AND dc.status=1</if> " +
" <if test='online == false' > AND dc.status=0</if> " +
" <if test='online == true' > AND dc.status='ON'</if> " +
" <if test='online == false' > AND dc.status='OFF'</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.sub_count > 0</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.sub_count = 0</if> " +
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_channel where platform_id=#{platformId} ) </if> " +
@ -396,7 +396,7 @@ public interface DeviceChannelMapper {
" FROM wvp_device_channel WHERE device_id=#{channelId}")
List<DeviceChannel> queryChannelByChannelId(@Param("channelId") String channelId);
@Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE id=#{id}"})
@Update(value = {"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{id}"})
void offline(@Param("id") int id);
@Insert("<script> " +
@ -418,7 +418,7 @@ public interface DeviceChannelMapper {
int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
@Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE id=#{id}"})
@Update(value = {"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{id}"})
void online(@Param("id") int id);
@Update({"<script>" +
@ -599,14 +599,14 @@ public interface DeviceChannelMapper {
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status=1 WHERE id=#{item.id}" +
"UPDATE wvp_device_channel SET status='ON' WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchOnline(@Param("channels") List<DeviceChannel> channels);
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status=0 WHERE id=#{item.id}" +
"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchOffline(List<DeviceChannel> channels);

View File

@ -89,7 +89,7 @@ public interface IDeviceService {
*/
List<Device> getAllOnlineDevice();
List<Device> getAllByStatus(boolean status);
List<Device> getAllByStatus(Boolean status);
/**
*

View File

@ -364,7 +364,7 @@ public class DeviceServiceImpl implements IDeviceService {
}
@Override
public List<Device> getAllByStatus(boolean status) {
public List<Device> getAllByStatus(Boolean status) {
return deviceMapper.getDevices(status);
}

View File

@ -1,11 +1,14 @@
package com.genersoft.iot.vmp.service.bean;
import lombok.Data;
import java.util.List;
/**
* redis
* @author lin
*/
@Data
public class PushStreamStatusChangeFromRedisDto {
private boolean setAllOffline;
@ -13,29 +16,4 @@ public class PushStreamStatusChangeFromRedisDto {
private List<StreamPushItemFromRedis> onlineStreams;
private List<StreamPushItemFromRedis> offlineStreams;
public boolean isSetAllOffline() {
return setAllOffline;
}
public void setSetAllOffline(boolean setAllOffline) {
this.setAllOffline = setAllOffline;
}
public List<StreamPushItemFromRedis> getOnlineStreams() {
return onlineStreams;
}
public void setOnlineStreams(List<StreamPushItemFromRedis> onlineStreams) {
this.onlineStreams = onlineStreams;
}
public List<StreamPushItemFromRedis> getOfflineStreams() {
return offlineStreams;
}
public void setOfflineStreams(List<StreamPushItemFromRedis> offlineStreams) {
this.offlineStreams = offlineStreams;
}
}

View File

@ -29,6 +29,10 @@ import java.text.ParseException;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* SUBSCRIBE alarm_receive
* PUBLISH alarm_receive '{ "gbId": "", "alarmSn": 1, "alarmType": "111", "alarmDescription": "222", }'
*/
@Slf4j
@Component
public class RedisAlarmMsgListener implements MessageListener {
@ -62,7 +66,6 @@ public class RedisAlarmMsgListener implements MessageListener {
@Override
public void onMessage(@NotNull Message message, byte[] bytes) {
// 消息示例: PUBLISH alarm_receive '{ "gbId": "", "alarmSn": 1, "alarmType": "111", "alarmDescription": "222", }'
log.info("收到来自REDIS的ALARM通知 {}", new String(message.getBody()));
boolean isEmpty = taskQueue.isEmpty();
taskQueue.offer(message);

View File

@ -20,6 +20,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* redisGPS
* @author lin
* SUBSCRIBE VM_MSG_GPS
* PUBLISH VM_MSG_GPS ''
*/
@Slf4j
@Component

View File

@ -40,9 +40,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
@Autowired
private UserSetting userSetting;
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
@Qualifier("taskExecutor")
@Autowired
@ -59,26 +57,26 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
while (!taskQueue.isEmpty()) {
Message msg = taskQueue.poll();
try {
PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(msg.getBody(), PushStreamStatusChangeFromRedisDto.class);
if (statusChangeFromPushStream == null) {
PushStreamStatusChangeFromRedisDto streamStatusMessage = JSON.parseObject(msg.getBody(), PushStreamStatusChangeFromRedisDto.class);
if (streamStatusMessage == null) {
log.warn("[REDIS消息]推流设备状态变化消息解析失败");
continue;
}
// 取消定时任务
dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED);
if (statusChangeFromPushStream.isSetAllOffline()) {
if (streamStatusMessage.isSetAllOffline()) {
// 所有设备离线
streamPushService.allOffline();
}
if (statusChangeFromPushStream.getOfflineStreams() != null
&& statusChangeFromPushStream.getOfflineStreams().size() > 0) {
if (streamStatusMessage.getOfflineStreams() != null
&& !streamStatusMessage.getOfflineStreams().isEmpty()) {
// 更新部分设备离线
streamPushService.offline(statusChangeFromPushStream.getOfflineStreams());
streamPushService.offline(streamStatusMessage.getOfflineStreams());
}
if (statusChangeFromPushStream.getOnlineStreams() != null &&
statusChangeFromPushStream.getOnlineStreams().size() > 0) {
if (streamStatusMessage.getOnlineStreams() != null &&
!streamStatusMessage.getOnlineStreams().isEmpty()) {
// 更新部分设备上线
streamPushService.online(statusChangeFromPushStream.getOnlineStreams());
streamPushService.online(streamStatusMessage.getOnlineStreams());
}
}catch (Exception e) {
log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.toJSONString(message));

View File

@ -165,7 +165,7 @@ public class ApiDeviceController {
// 1-IETF RFC3261,
// 2-基于口令的双向认证,
// 3-基于数字证书的双向认证
deviceJOSNChannel.put("Status", deviceChannelExtend.isStatus() ? "ON":"OFF");
deviceJOSNChannel.put("Status", deviceChannelExtend.getStatus());
deviceJOSNChannel.put("Longitude", deviceChannelExtend.getLongitude());
deviceJOSNChannel.put("Latitude", deviceChannelExtend.getLatitude());
deviceJOSNChannel.put("PTZType ", deviceChannelExtend.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球,

View File

@ -1,5 +1,8 @@
package com.genersoft.iot.vmp.web.gb28181.dto;
import lombok.Data;
@Data
public class DeviceChannelExtend {
@ -146,7 +149,7 @@ public class DeviceChannelExtend {
* <Status>OFF</Status>
* NVRIPC Status OFF
*/
private boolean status;
private String status;
/**
*
@ -208,21 +211,6 @@ public class DeviceChannelExtend {
*/
private String gpsTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public void setPTZType(int PTZType) {
this.PTZType = PTZType;
@ -244,312 +232,4 @@ public class DeviceChannelExtend {
break;
}
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getManufacture() {
return manufacture;
}
public void setManufacture(String manufacture) {
this.manufacture = manufacture;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getCivilCode() {
return civilCode;
}
public void setCivilCode(String civilCode) {
this.civilCode = civilCode;
}
public String getBlock() {
return block;
}
public void setBlock(String block) {
this.block = block;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getParental() {
return parental;
}
public void setParental(int parental) {
this.parental = parental;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public int getSafetyWay() {
return safetyWay;
}
public void setSafetyWay(int safetyWay) {
this.safetyWay = safetyWay;
}
public int getRegisterWay() {
return registerWay;
}
public void setRegisterWay(int registerWay) {
this.registerWay = registerWay;
}
public String getCertNum() {
return certNum;
}
public void setCertNum(String certNum) {
this.certNum = certNum;
}
public int getCertifiable() {
return certifiable;
}
public void setCertifiable(int certifiable) {
this.certifiable = certifiable;
}
public int getErrCode() {
return errCode;
}
public void setErrCode(int errCode) {
this.errCode = errCode;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getSecrecy() {
return secrecy;
}
public void setSecrecy(String secrecy) {
this.secrecy = secrecy;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPTZType() {
return PTZType;
}
public String getPTZTypeText() {
return PTZTypeText;
}
public void setPTZTypeText(String PTZTypeText) {
this.PTZTypeText = PTZTypeText;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitudeGcj02() {
return longitudeGcj02;
}
public void setLongitudeGcj02(double longitudeGcj02) {
this.longitudeGcj02 = longitudeGcj02;
}
public double getLatitudeGcj02() {
return latitudeGcj02;
}
public void setLatitudeGcj02(double latitudeGcj02) {
this.latitudeGcj02 = latitudeGcj02;
}
public double getLongitudeWgs84() {
return longitudeWgs84;
}
public void setLongitudeWgs84(double longitudeWgs84) {
this.longitudeWgs84 = longitudeWgs84;
}
public double getLatitudeWgs84() {
return latitudeWgs84;
}
public void setLatitudeWgs84(double latitudeWgs84) {
this.latitudeWgs84 = latitudeWgs84;
}
public int getSubCount() {
return subCount;
}
public void setSubCount(int subCount) {
this.subCount = subCount;
}
public boolean isHasAudio() {
return hasAudio;
}
public void setHasAudio(boolean hasAudio) {
this.hasAudio = hasAudio;
}
public String getStreamId() {
return streamId;
}
public void setStreamId(String streamId) {
this.streamId = streamId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public int getChannelType() {
return channelType;
}
public void setChannelType(int channelType) {
this.channelType = channelType;
}
public String getBusinessGroupId() {
return businessGroupId;
}
public void setBusinessGroupId(String businessGroupId) {
this.businessGroupId = businessGroupId;
}
public String getGpsTime() {
return gpsTime;
}
public void setGpsTime(String gpsTime) {
this.gpsTime = gpsTime;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public boolean isDeviceOnline() {
return deviceOnline;
}
public void setDeviceOnline(boolean deviceOnline) {
this.deviceOnline = deviceOnline;
}
}