hotcoffie
3 years ago
committed by
GitHub
14 changed files with 327 additions and 76 deletions
@ -0,0 +1,28 @@ |
|||
package com.genersoft.iot.vmp.domain.req; |
|||
|
|||
|
|||
/** |
|||
* @author chenjialing |
|||
*/ |
|||
public class PresetQuerySipReq { |
|||
|
|||
private String presetId; |
|||
|
|||
private String presetName; |
|||
|
|||
public String getPresetId() { |
|||
return presetId; |
|||
} |
|||
|
|||
public void setPresetId(String presetId) { |
|||
this.presetId = presetId; |
|||
} |
|||
|
|||
public String getPresetName() { |
|||
return presetName; |
|||
} |
|||
|
|||
public void setPresetName(String presetName) { |
|||
this.presetName = presetName; |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.genersoft.iot.vmp.gb28181.bean; |
|||
|
|||
/** |
|||
* 报警方式 |
|||
* @author lin |
|||
* 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警, |
|||
* 7其他报警;可以为直接组合如12为电话报警或 设备报警- |
|||
*/ |
|||
public enum DeviceAlarmMethod { |
|||
// 1为电话报警
|
|||
Telephone(1), |
|||
|
|||
// 2为设备报警
|
|||
Device(2), |
|||
|
|||
// 3为短信报警
|
|||
SMS(3), |
|||
|
|||
// 4为 GPS报警
|
|||
GPS(4), |
|||
|
|||
// 5为视频报警
|
|||
Video(5), |
|||
|
|||
// 6为设备故障报警
|
|||
DeviceFailure(6), |
|||
|
|||
// 7其他报警
|
|||
Other(7); |
|||
|
|||
private final int val; |
|||
|
|||
DeviceAlarmMethod(int val) { |
|||
this.val=val; |
|||
} |
|||
|
|||
public int getVal() { |
|||
return val; |
|||
} |
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
|||
|
|||
import com.genersoft.iot.vmp.conf.SipConfig; |
|||
import com.genersoft.iot.vmp.conf.UserSetting; |
|||
import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; |
|||
import com.genersoft.iot.vmp.gb28181.bean.*; |
|||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
|||
import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
|||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
|||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
|||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
|||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
|||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
|||
import org.dom4j.DocumentException; |
|||
import org.dom4j.Element; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.InitializingBean; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import javax.sip.InvalidArgumentException; |
|||
import javax.sip.RequestEvent; |
|||
import javax.sip.SipException; |
|||
import javax.sip.message.Response; |
|||
import java.text.ParseException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Iterator; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; |
|||
|
|||
@Component |
|||
public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(PresetQueryResponseMessageHandler.class); |
|||
private final String cmdType = "PresetQuery"; |
|||
|
|||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
|
|||
@Autowired |
|||
private ResponseMessageHandler responseMessageHandler; |
|||
|
|||
@Autowired |
|||
private DeferredResultHolder deferredResultHolder; |
|||
|
|||
|
|||
@Override |
|||
public void afterPropertiesSet() throws Exception { |
|||
responseMessageHandler.addHandler(cmdType, this); |
|||
} |
|||
|
|||
@Override |
|||
public void handForDevice(RequestEvent evt, Device device, Element element) { |
|||
Element rootElement = null; |
|||
try { |
|||
rootElement = getRootElement(evt, device.getCharset()); |
|||
|
|||
Element presetListNumElement = rootElement.element("PresetList"); |
|||
Element snElement = rootElement.element("SN"); |
|||
//该字段可能为通道或则设备的id
|
|||
String deviceId = getText(rootElement, "DeviceID"); |
|||
String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + deviceId; |
|||
if (snElement == null || presetListNumElement == null) { |
|||
responseAck(evt, Response.BAD_REQUEST, "xml error"); |
|||
return; |
|||
} |
|||
int sumNum = Integer.parseInt(presetListNumElement.attributeValue("Num")); |
|||
List<PresetQuerySipReq> presetQuerySipReqList = new ArrayList<>(); |
|||
if (sumNum == 0) { |
|||
// 数据无预置位信息
|
|||
|
|||
|
|||
}else { |
|||
for (Iterator<Element> presetIterator = presetListNumElement.elementIterator();presetIterator.hasNext();){ |
|||
Element itemListElement = presetIterator.next(); |
|||
PresetQuerySipReq presetQuerySipReq = new PresetQuerySipReq(); |
|||
for (Iterator<Element> itemListIterator = itemListElement.elementIterator();itemListIterator.hasNext();){ |
|||
// 遍历item
|
|||
Element itemOne = itemListIterator.next(); |
|||
String name = itemOne.getName(); |
|||
String textTrim = itemOne.getTextTrim(); |
|||
if("PresetID".equals(name)){ |
|||
presetQuerySipReq.setPresetId(textTrim); |
|||
}else { |
|||
presetQuerySipReq.setPresetName(textTrim); |
|||
} |
|||
} |
|||
presetQuerySipReqList.add(presetQuerySipReq); |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
RequestMessage requestMessage = new RequestMessage(); |
|||
requestMessage.setKey(key); |
|||
requestMessage.setData(presetQuerySipReqList); |
|||
deferredResultHolder.invokeAllResult(requestMessage); |
|||
responseAck(evt, Response.OK); |
|||
} catch (DocumentException e) { |
|||
e.printStackTrace(); |
|||
} catch (InvalidArgumentException e) { |
|||
e.printStackTrace(); |
|||
} catch (ParseException e) { |
|||
e.printStackTrace(); |
|||
} catch (SipException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) { |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
// map组件全局参数, 注释此内容可以关闭地图功能
|
|||
window.mapParam = { |
|||
// 开启/关闭地图功能
|
|||
enable: true, |
|||
// 坐标系 GCJ-02 WGS-84,
|
|||
coordinateSystem: "GCJ-02", |
|||
// 地图瓦片地址
|
|||
tilesUrl: "http://webrd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8", |
|||
// 瓦片大小
|
|||
tileSize: 256, |
|||
// 默认层级
|
|||
zoom:10, |
|||
// 默认地图中心点
|
|||
center:[116.41020, 39.915119], |
|||
// 地图最大层级
|
|||
maxZoom:18, |
|||
// 地图最小层级
|
|||
minZoom: 3 |
|||
} |
Loading…
Reference in new issue