数据库优化
This commit is contained in:
@@ -77,6 +77,8 @@ public class DeviceAlarm {
|
||||
*/
|
||||
private String alarmType;
|
||||
|
||||
private String createTime;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@@ -157,4 +159,12 @@ public class DeviceAlarm {
|
||||
public void setChannelId(String channelId) {
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,11 @@ public class DeviceChannel {
|
||||
*/
|
||||
private String businessGroupId;
|
||||
|
||||
/**
|
||||
* GPS的更新时间
|
||||
*/
|
||||
private String gpsTime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -519,4 +524,12 @@ public class DeviceChannel {
|
||||
public void setBusinessGroupId(String businessGroupId) {
|
||||
this.businessGroupId = businessGroupId;
|
||||
}
|
||||
|
||||
public String getGpsTime() {
|
||||
return gpsTime;
|
||||
}
|
||||
|
||||
public void setGpsTime(String gpsTime) {
|
||||
this.gpsTime = gpsTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,8 @@ public class GbStream extends PlatformGbStream{
|
||||
private double latitude;
|
||||
private String streamType;
|
||||
private boolean status;
|
||||
/**
|
||||
* GMT unix系统时间戳,单位秒
|
||||
*/
|
||||
public Long createStamp;
|
||||
|
||||
public String createTime;
|
||||
|
||||
@Override
|
||||
public Integer getGbStreamId() {
|
||||
@@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{
|
||||
this.mediaServerId = mediaServerId;
|
||||
}
|
||||
|
||||
|
||||
public Long getCreateStamp() {
|
||||
return createStamp;
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateStamp(Long createStamp) {
|
||||
this.createStamp = createStamp;
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ public class MobilePosition {
|
||||
*/
|
||||
private double latitudeWgs84;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
@@ -189,4 +194,12 @@ public class MobilePosition {
|
||||
public void setLatitudeWgs84(double latitudeWgs84) {
|
||||
this.latitudeWgs84 = latitudeWgs84;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,16 @@ public class ParentPlatform {
|
||||
*/
|
||||
private String administrativeDivision;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -368,4 +378,20 @@ public class ParentPlatform {
|
||||
public void setAdministrativeDivision(String administrativeDivision) {
|
||||
this.administrativeDivision = administrativeDivision;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
Element rootElement = getRootElement(evt);
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
Element deviceIdElement = rootElement.element("DeviceID");
|
||||
String channelId = deviceIdElement.getTextTrim().toString();
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
@@ -205,6 +206,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -273,6 +275,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId());
|
||||
if ("4".equals(deviceAlarm.getAlarmMethod())) {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||
@@ -309,6 +312,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
// TODO: 需要实现存储报警信息、报警分类
|
||||
|
||||
@@ -81,6 +81,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
String channelId = deviceIdElement.getText().toString();
|
||||
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||
deviceAlarm.setDeviceId(device.getDeviceId());
|
||||
deviceAlarm.setChannelId(channelId);
|
||||
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
|
||||
@@ -112,6 +113,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
|
||||
if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||
@@ -148,6 +150,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
}
|
||||
@@ -198,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
|
||||
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||
deviceAlarm.setDeviceId(parentPlatform.getServerGBId());
|
||||
deviceAlarm.setChannelId(channelId);
|
||||
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.
|
||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.GpsUtil;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -53,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
rootElement = getRootElement(evt, device.getCharset());
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
if (!StringUtils.isEmpty(device.getName())) {
|
||||
mobilePosition.setDeviceName(device.getName());
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
//回复 200 OK
|
||||
responseAck(evt, Response.OK);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons
|
||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.GpsUtil;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -53,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
rootElement = getRootElement(evt, device.getCharset());
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
if (!StringUtils.isEmpty(device.getName())) {
|
||||
mobilePosition.setDeviceName(device.getName());
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
//回复 200 OK
|
||||
responseAck(evt, Response.OK);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
@@ -314,6 +315,7 @@ public class XmlUtil {
|
||||
} else {
|
||||
deviceChannel.setLatitude(0.00);
|
||||
}
|
||||
deviceChannel.setGpsTime(DateUtil.getNow());
|
||||
if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
||||
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||
|
||||
@@ -339,9 +339,7 @@ public class ZLMHttpHookListener {
|
||||
@PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<String> onStreamChanged(@RequestBody MediaItem item){
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item));
|
||||
}
|
||||
logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item));
|
||||
String mediaServerId = item.getMediaServerId();
|
||||
JSONObject json = (JSONObject) JSON.toJSON(item);
|
||||
ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json);
|
||||
@@ -389,7 +387,6 @@ public class ZLMHttpHookListener {
|
||||
|
||||
if (mediaServerItem != null){
|
||||
if (regist) {
|
||||
StreamPushItem streamPushItem = null;
|
||||
StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
|
||||
item.setStreamInfo(streamInfoByAppAndStream);
|
||||
|
||||
@@ -455,10 +452,8 @@ public class ZLMHttpHookListener {
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
|
||||
}
|
||||
|
||||
logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
|
||||
String mediaServerId = json.getString("mediaServerId");
|
||||
String streamId = json.getString("stream");
|
||||
String app = json.getString("app");
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.StreamPushMapper;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -159,7 +160,8 @@ public class ZLMMediaListManager {
|
||||
gbStreamMapper.update(transform);
|
||||
streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());
|
||||
}else {
|
||||
transform.setCreateStamp(System.currentTimeMillis());
|
||||
transform.setCreateTime(DateUtil.getNow());
|
||||
transform.setUpdateTime(DateUtil.getNow());
|
||||
gbStreamMapper.add(transform);
|
||||
}
|
||||
if (transform != null) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.util.unit.DataUnit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -86,6 +88,21 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
*/
|
||||
private String serverId;
|
||||
|
||||
/**
|
||||
* 推流时间
|
||||
*/
|
||||
private String pushTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public String getVhost() {
|
||||
return vhost;
|
||||
}
|
||||
@@ -97,7 +114,8 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull StreamPushItem streamPushItem) {
|
||||
return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue();
|
||||
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(super.createTime)
|
||||
- DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
|
||||
}
|
||||
|
||||
public static class MediaSchema {
|
||||
@@ -232,5 +250,32 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
public void setServerId(String serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
|
||||
public String getPushTime() {
|
||||
return pushTime;
|
||||
}
|
||||
|
||||
public void setPushTime(String pushTime) {
|
||||
this.pushTime = pushTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ public class RedisAlarmMsgListener implements MessageListener {
|
||||
ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
|
||||
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||
deviceAlarm.setChannelId(gbId);
|
||||
deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
|
||||
deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
|
||||
|
||||
@@ -230,11 +230,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
public boolean start(String app, String stream) {
|
||||
boolean result = false;
|
||||
StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream);
|
||||
if (!streamProxy.isEnable() && streamProxy != null) {
|
||||
if (!streamProxy.isEnable() ) {
|
||||
JSONObject jsonObject = addStreamProxyToZlm(streamProxy);
|
||||
if (jsonObject == null) {
|
||||
return false;
|
||||
}
|
||||
System.out.println(jsonObject);
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
result = true;
|
||||
streamProxy.setEnable(true);
|
||||
@@ -250,7 +251,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
|
||||
if (streamProxyDto != null && streamProxyDto.isEnable()) {
|
||||
JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
if (jsonObject != null && jsonObject.getInteger("code") == 0) {
|
||||
streamProxyDto.setEnable(false);
|
||||
result = videoManagerStorager.updateStreamProxy(streamProxyDto);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.slf4j.Logger;
|
||||
@@ -102,7 +103,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
streamPushItem.setOriginType(item.getOriginType());
|
||||
streamPushItem.setOriginTypeStr(item.getOriginTypeStr());
|
||||
streamPushItem.setOriginUrl(item.getOriginUrl());
|
||||
streamPushItem.setCreateStamp(item.getCreateStamp() * 1000);
|
||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||
streamPushItem.setAliveSecond(item.getAliveSecond());
|
||||
streamPushItem.setStatus(true);
|
||||
streamPushItem.setStreamType("push");
|
||||
@@ -127,7 +128,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
public boolean saveToGB(GbStream stream) {
|
||||
stream.setStreamType("push");
|
||||
stream.setStatus(true);
|
||||
stream.setCreateStamp(System.currentTimeMillis());
|
||||
stream.setCreateTime(DateUtil.getNow());
|
||||
int add = gbStreamMapper.add(stream);
|
||||
|
||||
// 查找开启了全部直播流共享的上级平台
|
||||
@@ -317,7 +318,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
streamPushItem.setStreamType("push");
|
||||
streamPushItem.setStatus(true);
|
||||
streamPushItem.setGbId("34020000004111" + gbId);
|
||||
streamPushItem.setCreateStamp(System.currentTimeMillis());
|
||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||
gbId ++;
|
||||
}
|
||||
int limitCount = 30;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
@@ -94,7 +95,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
||||
streamPushItem.setGbId(streamPushExcelDto.getGbId());
|
||||
streamPushItem.setStatus(false);
|
||||
streamPushItem.setStreamType("push");
|
||||
streamPushItem.setCreateStamp(System.currentTimeMillis());
|
||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||
streamPushItem.setMediaServerId(defaultMediaServerId);
|
||||
streamPushItem.setName(streamPushExcelDto.getName());
|
||||
streamPushItem.setOriginType(2);
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface DeviceAlarmMapper {
|
||||
|
||||
@Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType ) " +
|
||||
"VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}')")
|
||||
@Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " +
|
||||
"VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')")
|
||||
int add(DeviceAlarm alarm);
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ public interface DeviceChannelMapper {
|
||||
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
|
||||
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
||||
"ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
|
||||
"longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
|
||||
"longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
|
||||
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
|
||||
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
|
||||
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +
|
||||
"${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}')")
|
||||
"${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')")
|
||||
int add(DeviceChannel channel);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
@@ -58,6 +58,7 @@ public interface DeviceChannelMapper {
|
||||
"<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
|
||||
"<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
|
||||
"<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
|
||||
"<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
|
||||
"WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
|
||||
" </script>"})
|
||||
int update(DeviceChannel channel);
|
||||
@@ -147,7 +148,7 @@ public interface DeviceChannelMapper {
|
||||
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
|
||||
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
||||
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
|
||||
" longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
|
||||
" longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
|
||||
"values " +
|
||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||
"('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
|
||||
@@ -157,7 +158,7 @@ public interface DeviceChannelMapper {
|
||||
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
|
||||
"'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
|
||||
"${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
|
||||
"'${item.businessGroupId}') " +
|
||||
"'${item.businessGroupId}', '${item.gpsTime}') " +
|
||||
"</foreach> " +
|
||||
"ON DUPLICATE KEY UPDATE " +
|
||||
"updateTime=VALUES(updateTime), " +
|
||||
@@ -189,7 +190,8 @@ public interface DeviceChannelMapper {
|
||||
"latitudeGcj02=VALUES(latitudeGcj02), " +
|
||||
"longitudeWgs84=VALUES(longitudeWgs84), " +
|
||||
"latitudeWgs84=VALUES(latitudeWgs84), " +
|
||||
"businessGroupId=VALUES(businessGroupId) " +
|
||||
"businessGroupId=VALUES(businessGroupId), " +
|
||||
"gpsTime=VALUES(gpsTime)" +
|
||||
"</script>")
|
||||
int batchAdd(List<DeviceChannel> addChannels);
|
||||
|
||||
@@ -228,6 +230,7 @@ public interface DeviceChannelMapper {
|
||||
"<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
|
||||
"<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
|
||||
"<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
|
||||
"<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
|
||||
"WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
@@ -281,10 +284,11 @@ public interface DeviceChannelMapper {
|
||||
"SET " +
|
||||
"latitude=${latitude}, " +
|
||||
"longitude=${longitude}, " +
|
||||
"longitudeGcj02=${longitudeGcj02}," +
|
||||
"latitudeGcj02=${latitudeGcj02}," +
|
||||
"longitudeWgs84=${longitudeWgs84}," +
|
||||
"latitudeWgs84=${latitudeWgs84} " +
|
||||
"longitudeGcj02=${longitudeGcj02}, " +
|
||||
"latitudeGcj02=${latitudeGcj02}, " +
|
||||
"longitudeWgs84=${longitudeWgs84}, " +
|
||||
"latitudeWgs84=${latitudeWgs84}, " +
|
||||
"gpsTime='${gpsTime}' " +
|
||||
"WHERE deviceId=#{deviceId} " +
|
||||
" <if test='channelId != null' > AND channelId=#{channelId}</if>" +
|
||||
" </script>"})
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.*;
|
||||
@Mapper
|
||||
public interface DeviceMobilePositionMapper {
|
||||
|
||||
@Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84) " +
|
||||
"VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84})")
|
||||
@Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " +
|
||||
"VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')")
|
||||
int insertNewPosition(MobilePosition mobilePosition);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
|
||||
@@ -15,10 +15,10 @@ import java.util.List;
|
||||
public interface GbStreamMapper {
|
||||
|
||||
@Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +
|
||||
"longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" +
|
||||
"longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" +
|
||||
"('${app}', '${stream}', '${gbId}', '${name}', " +
|
||||
"'${longitude}', '${latitude}', '${streamType}', " +
|
||||
"'${mediaServerId}', ${status}, ${createStamp})")
|
||||
"'${mediaServerId}', ${status}, '${createTime}')")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
|
||||
int add(GbStream gbStream);
|
||||
|
||||
@@ -120,12 +120,12 @@ public interface GbStreamMapper {
|
||||
@Insert("<script> " +
|
||||
"INSERT IGNORE into gb_stream " +
|
||||
"(app, stream, gbId, name, " +
|
||||
"longitude, latitude, streamType, mediaServerId, status, createStamp)" +
|
||||
"longitude, latitude, streamType, mediaServerId, status, createTime)" +
|
||||
"values " +
|
||||
"<foreach collection='subList' index='index' item='item' separator=','> " +
|
||||
"('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
|
||||
"'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
|
||||
"'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+
|
||||
"'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
|
||||
|
||||
@@ -16,10 +16,10 @@ public interface ParentPlatformMapper {
|
||||
|
||||
@Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
|
||||
" devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
|
||||
" status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " +
|
||||
" status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime) " +
|
||||
" VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
|
||||
" '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
|
||||
" ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})")
|
||||
" ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})")
|
||||
int addParentPlatform(ParentPlatform parentPlatform);
|
||||
|
||||
@Update("UPDATE parent_platform " +
|
||||
@@ -45,6 +45,8 @@ public interface ParentPlatformMapper {
|
||||
"startOfflinePush=${startOfflinePush}, " +
|
||||
"catalogGroup=#{catalogGroup}, " +
|
||||
"administrativeDivision=#{administrativeDivision}, " +
|
||||
"createTime=#{createTime}, " +
|
||||
"updateTime=#{updateTime}, " +
|
||||
"catalogId=#{catalogId} " +
|
||||
"WHERE id=#{id}")
|
||||
int updateParentPlatform(ParentPlatform parentPlatform);
|
||||
@@ -86,10 +88,10 @@ public interface ParentPlatformMapper {
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE parent_platform " +
|
||||
"SET catalogId=#{catalogId}" +
|
||||
"SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
|
||||
"WHERE serverGBId=#{platformId}"+
|
||||
"</script>"})
|
||||
int setDefaultCatalog(String platformId, String catalogId);
|
||||
int setDefaultCatalog(String platformId, String catalogId, String updateTime);
|
||||
|
||||
@Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " +
|
||||
"union " +
|
||||
|
||||
@@ -714,7 +714,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
streamProxyItem.setStatus(true);
|
||||
String now = DateUtil.getNow();
|
||||
streamProxyItem.setCreateTime(now);
|
||||
streamProxyItem.setCreateStamp(System.currentTimeMillis());
|
||||
try {
|
||||
if (streamProxyMapper.add(streamProxyItem) > 0) {
|
||||
if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
|
||||
@@ -1009,7 +1008,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
|
||||
@Override
|
||||
public int setDefaultCatalog(String platformId, String catalogId) {
|
||||
return platformMapper.setDefaultCatalog(platformId, catalogId);
|
||||
return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1126,6 +1125,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) {
|
||||
deviceChannel.setChannelId(null);
|
||||
}
|
||||
if (deviceChannel.getGpsTime() == null) {
|
||||
deviceChannel.setGpsTime(DateUtil.getNow());
|
||||
}
|
||||
|
||||
deviceChannelMapper.updatePosition(deviceChannel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import oshi.hardware.NetworkIF;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
|
||||
@@ -169,6 +170,8 @@ public class PlatformController {
|
||||
wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在");
|
||||
return new ResponseEntity<>(wvpResult, HttpStatus.OK);
|
||||
}
|
||||
parentPlatform.setCreateTime(DateUtil.getNow());
|
||||
parentPlatform.setUpdateTime(DateUtil.getNow());
|
||||
boolean updateResult = storager.updateParentPlatform(parentPlatform);
|
||||
|
||||
if (updateResult) {
|
||||
@@ -232,7 +235,7 @@ public class PlatformController {
|
||||
}
|
||||
parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
|
||||
ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
|
||||
|
||||
parentPlatform.setUpdateTime(DateUtil.getNow());
|
||||
boolean updateResult = storager.updateParentPlatform(parentPlatform);
|
||||
|
||||
if (updateResult) {
|
||||
|
||||
@@ -131,6 +131,9 @@ public class StreamProxyController {
|
||||
public Object start(String app, String stream){
|
||||
logger.info("启用代理: " + app + "/" + stream);
|
||||
boolean result = streamProxyService.start(app, stream);
|
||||
if (!result) {
|
||||
logger.info("启用代理失败: " + app + "/" + stream);
|
||||
}
|
||||
return result?"success":"fail";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user