Commit 59ef6e67d3a1357c19039527dac47747e2ac20fe
1 parent
c8f9f19c
统一国标设备与级联平台字符集的使用
Showing
8 changed files
with
46 additions
and
96 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -105,7 +105,7 @@ public class Device { | @@ -105,7 +105,7 @@ public class Device { | ||
| 105 | private boolean firsRegister; | 105 | private boolean firsRegister; |
| 106 | 106 | ||
| 107 | /** | 107 | /** |
| 108 | - * 字符集, 支持 utf-8 与 gb2312 | 108 | + * 字符集, 支持 UTF-8 与 GB2312 |
| 109 | */ | 109 | */ |
| 110 | private String charset ; | 110 | private String charset ; |
| 111 | 111 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
| @@ -223,7 +223,7 @@ public class SIPRequestHeaderPlarformProvider { | @@ -223,7 +223,7 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 223 | CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(Request.MESSAGE), Request.MESSAGE); | 223 | CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(Request.MESSAGE), Request.MESSAGE); |
| 224 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); | 224 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); |
| 225 | // 设置编码, 防止中文乱码 | 225 | // 设置编码, 防止中文乱码 |
| 226 | - messageFactory.setDefaultContentEncodingCharset("gb2312"); | 226 | + messageFactory.setDefaultContentEncodingCharset(parentPlatform.getCharacterSet()); |
| 227 | request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, | 227 | request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, |
| 228 | toHeader, viaHeaders, maxForwards); | 228 | toHeader, viaHeaders, maxForwards); |
| 229 | List<String> agentParam = new ArrayList<>(); | 229 | List<String> agentParam = new ArrayList<>(); |
| @@ -235,58 +235,4 @@ public class SIPRequestHeaderPlarformProvider { | @@ -235,58 +235,4 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 235 | request.setContent(content, contentTypeHeader); | 235 | request.setContent(content, contentTypeHeader); |
| 236 | return request; | 236 | return request; |
| 237 | } | 237 | } |
| 238 | - | ||
| 239 | -// public Request createNotifyRequest(ParentPlatform parentPlatform, String content, CallIdHeader callIdHeader, String viaTag, String fromTag, SubscribeInfo subscribeInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException { | ||
| 240 | -// Request request = null; | ||
| 241 | -// // sipuri | ||
| 242 | -// SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort()); | ||
| 243 | -// // via | ||
| 244 | -// ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>(); | ||
| 245 | -// ViaHeader viaHeader = sipFactory.createHeaderFactory().createViaHeader(parentPlatform.getDeviceIp(), Integer.parseInt(parentPlatform.getDevicePort()), | ||
| 246 | -// parentPlatform.getTransport(), viaTag); | ||
| 247 | -// viaHeader.setRPort(); | ||
| 248 | -// viaHeaders.add(viaHeader); | ||
| 249 | -// // from | ||
| 250 | -// SipURI fromSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), | ||
| 251 | -// parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort()); | ||
| 252 | -// Address fromAddress = sipFactory.createAddressFactory().createAddress(fromSipURI); | ||
| 253 | -// FromHeader fromHeader = sipFactory.createHeaderFactory().createFromHeader(fromAddress, fromTag); | ||
| 254 | -// // to | ||
| 255 | -// SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerGBDomain()); | ||
| 256 | -// Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI); | ||
| 257 | -// ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, subscribeInfo.getFromTag()); | ||
| 258 | -// | ||
| 259 | -// // Forwards | ||
| 260 | -// MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); | ||
| 261 | -// // ceq | ||
| 262 | -// CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(Request.NOTIFY), Request.NOTIFY); | ||
| 263 | -// MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); | ||
| 264 | -// // 设置编码, 防止中文乱码 | ||
| 265 | -// messageFactory.setDefaultContentEncodingCharset("gb2312"); | ||
| 266 | -// request = messageFactory.createRequest(requestURI, Request.NOTIFY, callIdHeader, cSeqHeader, fromHeader, | ||
| 267 | -// toHeader, viaHeaders, maxForwards); | ||
| 268 | -// List<String> agentParam = new ArrayList<>(); | ||
| 269 | -// agentParam.add("wvp-pro"); | ||
| 270 | -// UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 271 | -// request.addHeader(userAgentHeader); | ||
| 272 | -// | ||
| 273 | -// EventHeader event = sipFactory.createHeaderFactory().createEventHeader(subscribeInfo.getEventType()); | ||
| 274 | -// if (subscribeInfo.getEventId() != null) { | ||
| 275 | -// event.setEventId(subscribeInfo.getEventId()); | ||
| 276 | -// } | ||
| 277 | -// | ||
| 278 | -// request.addHeader(event); | ||
| 279 | -// | ||
| 280 | -// SubscriptionStateHeader active = sipFactory.createHeaderFactory().createSubscriptionStateHeader("active"); | ||
| 281 | -// request.setHeader(active); | ||
| 282 | -// | ||
| 283 | -// String sipAddress = sipConfig.getIp() + ":" + sipConfig.getPort(); | ||
| 284 | -// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory() | ||
| 285 | -// .createSipURI(parentPlatform.getDeviceGBId(), sipAddress)); | ||
| 286 | -// request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); | ||
| 287 | -// | ||
| 288 | -// ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); | ||
| 289 | -// request.setContent(content, contentTypeHeader); | ||
| 290 | -// return request; | ||
| 291 | -// } | ||
| 292 | } | 238 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -1120,8 +1120,9 @@ public class SIPCommander implements ISIPCommander { | @@ -1120,8 +1120,9 @@ public class SIPCommander implements ISIPCommander { | ||
| 1120 | @Override | 1120 | @Override |
| 1121 | public boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) { | 1121 | public boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) { |
| 1122 | try { | 1122 | try { |
| 1123 | + String charset = device.getCharset(); | ||
| 1123 | StringBuffer catalogXml = new StringBuffer(200); | 1124 | StringBuffer catalogXml = new StringBuffer(200); |
| 1124 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1125 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); |
| 1125 | catalogXml.append("<Query>\r\n"); | 1126 | catalogXml.append("<Query>\r\n"); |
| 1126 | catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); | 1127 | catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); |
| 1127 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1128 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1153,7 +1154,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1153,7 +1154,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1153 | public boolean deviceInfoQuery(Device device) { | 1154 | public boolean deviceInfoQuery(Device device) { |
| 1154 | try { | 1155 | try { |
| 1155 | StringBuffer catalogXml = new StringBuffer(200); | 1156 | StringBuffer catalogXml = new StringBuffer(200); |
| 1156 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1157 | + String charset = device.getCharset(); |
| 1158 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1157 | catalogXml.append("<Query>\r\n"); | 1159 | catalogXml.append("<Query>\r\n"); |
| 1158 | catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); | 1160 | catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); |
| 1159 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1161 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1185,7 +1187,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1185,7 +1187,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1185 | public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) { | 1187 | public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) { |
| 1186 | try { | 1188 | try { |
| 1187 | StringBuffer catalogXml = new StringBuffer(200); | 1189 | StringBuffer catalogXml = new StringBuffer(200); |
| 1188 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1190 | + String charset = device.getCharset(); |
| 1191 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1189 | catalogXml.append("<Query>\r\n"); | 1192 | catalogXml.append("<Query>\r\n"); |
| 1190 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); | 1193 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 1191 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1194 | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1224,7 +1227,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1224,7 +1227,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1224 | } | 1227 | } |
| 1225 | try { | 1228 | try { |
| 1226 | StringBuffer recordInfoXml = new StringBuffer(200); | 1229 | StringBuffer recordInfoXml = new StringBuffer(200); |
| 1227 | - recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1230 | + String charset = device.getCharset(); |
| 1231 | + recordInfoXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1228 | recordInfoXml.append("<Query>\r\n"); | 1232 | recordInfoXml.append("<Query>\r\n"); |
| 1229 | recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); | 1233 | recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); |
| 1230 | recordInfoXml.append("<SN>" + sn + "</SN>\r\n"); | 1234 | recordInfoXml.append("<SN>" + sn + "</SN>\r\n"); |
| @@ -1396,7 +1400,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1396,7 +1400,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1396 | public boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) { | 1400 | public boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) { |
| 1397 | try { | 1401 | try { |
| 1398 | StringBuffer mobilePostitionXml = new StringBuffer(200); | 1402 | StringBuffer mobilePostitionXml = new StringBuffer(200); |
| 1399 | - mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1403 | + String charset = device.getCharset(); |
| 1404 | + mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1400 | mobilePostitionXml.append("<Query>\r\n"); | 1405 | mobilePostitionXml.append("<Query>\r\n"); |
| 1401 | mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); | 1406 | mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); |
| 1402 | mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1407 | mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1431,7 +1436,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1431,7 +1436,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1431 | public boolean mobilePositionSubscribe(Device device, int expires, int interval) { | 1436 | public boolean mobilePositionSubscribe(Device device, int expires, int interval) { |
| 1432 | try { | 1437 | try { |
| 1433 | StringBuffer subscribePostitionXml = new StringBuffer(200); | 1438 | StringBuffer subscribePostitionXml = new StringBuffer(200); |
| 1434 | - subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1439 | + String charset = device.getCharset(); |
| 1440 | + subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1435 | subscribePostitionXml.append("<Query>\r\n"); | 1441 | subscribePostitionXml.append("<Query>\r\n"); |
| 1436 | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); | 1442 | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); |
| 1437 | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1443 | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1473,7 +1479,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1473,7 +1479,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1473 | public boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) { | 1479 | public boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) { |
| 1474 | try { | 1480 | try { |
| 1475 | StringBuffer cmdXml = new StringBuffer(200); | 1481 | StringBuffer cmdXml = new StringBuffer(200); |
| 1476 | - cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1482 | + String charset = device.getCharset(); |
| 1483 | + cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1477 | cmdXml.append("<Query>\r\n"); | 1484 | cmdXml.append("<Query>\r\n"); |
| 1478 | cmdXml.append("<CmdType>Alarm</CmdType>\r\n"); | 1485 | cmdXml.append("<CmdType>Alarm</CmdType>\r\n"); |
| 1479 | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1486 | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -1518,7 +1525,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1518,7 +1525,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1518 | public boolean catalogSubscribe(Device device, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { | 1525 | public boolean catalogSubscribe(Device device, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { |
| 1519 | try { | 1526 | try { |
| 1520 | StringBuffer cmdXml = new StringBuffer(200); | 1527 | StringBuffer cmdXml = new StringBuffer(200); |
| 1521 | - cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1528 | + String charset = device.getCharset(); |
| 1529 | + cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); | ||
| 1522 | cmdXml.append("<Query>\r\n"); | 1530 | cmdXml.append("<Query>\r\n"); |
| 1523 | cmdXml.append("<CmdType>Catalog</CmdType>\r\n"); | 1531 | cmdXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 1524 | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1532 | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -215,8 +215,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -215,8 +215,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 215 | return false; | 215 | return false; |
| 216 | } | 216 | } |
| 217 | try { | 217 | try { |
| 218 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 218 | StringBuffer catalogXml = new StringBuffer(600); | 219 | StringBuffer catalogXml = new StringBuffer(600); |
| 219 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 220 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet +"\"?>\r\n"); |
| 220 | catalogXml.append("<Response>\r\n"); | 221 | catalogXml.append("<Response>\r\n"); |
| 221 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); | 222 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 222 | catalogXml.append("<SN>" +sn + "</SN>\r\n"); | 223 | catalogXml.append("<SN>" +sn + "</SN>\r\n"); |
| @@ -280,8 +281,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -280,8 +281,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 280 | return false; | 281 | return false; |
| 281 | } | 282 | } |
| 282 | try { | 283 | try { |
| 284 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 283 | StringBuffer deviceInfoXml = new StringBuffer(600); | 285 | StringBuffer deviceInfoXml = new StringBuffer(600); |
| 284 | - deviceInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 286 | + deviceInfoXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 285 | deviceInfoXml.append("<Response>\r\n"); | 287 | deviceInfoXml.append("<Response>\r\n"); |
| 286 | deviceInfoXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); | 288 | deviceInfoXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); |
| 287 | deviceInfoXml.append("<SN>" +sn + "</SN>\r\n"); | 289 | deviceInfoXml.append("<SN>" +sn + "</SN>\r\n"); |
| @@ -319,8 +321,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -319,8 +321,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 319 | return false; | 321 | return false; |
| 320 | } | 322 | } |
| 321 | try { | 323 | try { |
| 324 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 322 | StringBuffer deviceStatusXml = new StringBuffer(600); | 325 | StringBuffer deviceStatusXml = new StringBuffer(600); |
| 323 | - deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 326 | + deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 324 | deviceStatusXml.append("<Response>\r\n"); | 327 | deviceStatusXml.append("<Response>\r\n"); |
| 325 | deviceStatusXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); | 328 | deviceStatusXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); |
| 326 | deviceStatusXml.append("<SN>" +sn + "</SN>\r\n"); | 329 | deviceStatusXml.append("<SN>" +sn + "</SN>\r\n"); |
| @@ -350,8 +353,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -350,8 +353,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 350 | } | 353 | } |
| 351 | 354 | ||
| 352 | try { | 355 | try { |
| 356 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 353 | StringBuffer deviceStatusXml = new StringBuffer(600); | 357 | StringBuffer deviceStatusXml = new StringBuffer(600); |
| 354 | - deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 358 | + deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 355 | deviceStatusXml.append("<Notify>\r\n"); | 359 | deviceStatusXml.append("<Notify>\r\n"); |
| 356 | deviceStatusXml.append("<CmdType>MobilePosition</CmdType>\r\n"); | 360 | deviceStatusXml.append("<CmdType>MobilePosition</CmdType>\r\n"); |
| 357 | deviceStatusXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 361 | deviceStatusXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| @@ -418,8 +422,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -418,8 +422,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 418 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) | 422 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) |
| 419 | throws NoSuchFieldException, IllegalAccessException, SipException, ParseException { | 423 | throws NoSuchFieldException, IllegalAccessException, SipException, ParseException { |
| 420 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); | 424 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); |
| 425 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 421 | // 设置编码, 防止中文乱码 | 426 | // 设置编码, 防止中文乱码 |
| 422 | - messageFactory.setDefaultContentEncodingCharset("gb2312"); | 427 | + messageFactory.setDefaultContentEncodingCharset(characterSet); |
| 423 | Dialog dialog = subscribeInfo.getDialog(); | 428 | Dialog dialog = subscribeInfo.getDialog(); |
| 424 | if (dialog == null) return; | 429 | if (dialog == null) return; |
| 425 | SIPRequest notifyRequest = (SIPRequest)dialog.createRequest(Request.NOTIFY); | 430 | SIPRequest notifyRequest = (SIPRequest)dialog.createRequest(Request.NOTIFY); |
| @@ -462,27 +467,13 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -462,27 +467,13 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 462 | 467 | ||
| 463 | } | 468 | } |
| 464 | 469 | ||
| 465 | -// private Request getCatalogNotifyRequestForCatalogAddOrUpdate(ParentPlatform parentPlatform, DeviceChannel channel, int size, String type, | ||
| 466 | -// SubscribeInfo subscribeInfo) throws ParseException, InvalidArgumentException, | ||
| 467 | -// PeerUnavailableException, NoSuchFieldException, IllegalAccessException { | ||
| 468 | -// String catalogXmlContent = getCatalogXmlContentForCatalogAddOrUpdate(parentPlatform, channel, size, type, subscribeInfo); | ||
| 469 | -// | ||
| 470 | -// CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | ||
| 471 | -// : udpSipProvider.getNewCallId(); | ||
| 472 | -// callIdHeader.setCallId(subscribeInfo.getCallId()); | ||
| 473 | -// String tm = Long.toString(System.currentTimeMillis()); | ||
| 474 | -// | ||
| 475 | -// Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, catalogXmlContent, | ||
| 476 | -// callIdHeader, "z9hG4bK-" + UUID.randomUUID().toString().replace("-", ""),"FromRegister" + tm, subscribeInfo); | ||
| 477 | -// return request; | ||
| 478 | -// } | ||
| 479 | - | ||
| 480 | private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, DeviceChannel channel, int sumNum, String type, SubscribeInfo subscribeInfo) { | 470 | private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, DeviceChannel channel, int sumNum, String type, SubscribeInfo subscribeInfo) { |
| 481 | StringBuffer catalogXml = new StringBuffer(600); | 471 | StringBuffer catalogXml = new StringBuffer(600); |
| 482 | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | 472 | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { |
| 483 | channel.setParentId(parentPlatform.getDeviceGBId()); | 473 | channel.setParentId(parentPlatform.getDeviceGBId()); |
| 484 | } | 474 | } |
| 485 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 475 | + String characterSet = parentPlatform.getCharacterSet(); |
| 476 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); | ||
| 486 | catalogXml.append("<Notify>\r\n"); | 477 | catalogXml.append("<Notify>\r\n"); |
| 487 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); | 478 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 488 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 479 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); |
| @@ -554,8 +545,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -554,8 +545,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 554 | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | 545 | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { |
| 555 | channel.setParentId(parentPlatform.getDeviceGBId()); | 546 | channel.setParentId(parentPlatform.getDeviceGBId()); |
| 556 | } | 547 | } |
| 548 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 557 | StringBuffer catalogXml = new StringBuffer(600); | 549 | StringBuffer catalogXml = new StringBuffer(600); |
| 558 | - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 550 | + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 559 | catalogXml.append("<Notify>\r\n"); | 551 | catalogXml.append("<Notify>\r\n"); |
| 560 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); | 552 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 561 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 553 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); |
| @@ -576,8 +568,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -576,8 +568,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 576 | return false; | 568 | return false; |
| 577 | } | 569 | } |
| 578 | try { | 570 | try { |
| 571 | + String characterSet = parentPlatform.getCharacterSet(); | ||
| 579 | StringBuffer recordXml = new StringBuffer(600); | 572 | StringBuffer recordXml = new StringBuffer(600); |
| 580 | - recordXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 573 | + recordXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 581 | recordXml.append("<Response>\r\n"); | 574 | recordXml.append("<Response>\r\n"); |
| 582 | recordXml.append("<CmdType>RecordInfo</CmdType>\r\n"); | 575 | recordXml.append("<CmdType>RecordInfo</CmdType>\r\n"); |
| 583 | recordXml.append("<SN>" +recordInfo.getSn() + "</SN>\r\n"); | 576 | recordXml.append("<SN>" +recordInfo.getSn() + "</SN>\r\n"); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
| @@ -155,7 +155,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | @@ -155,7 +155,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | ||
| 155 | if (device == null) { | 155 | if (device == null) { |
| 156 | device = new Device(); | 156 | device = new Device(); |
| 157 | device.setStreamMode("UDP"); | 157 | device.setStreamMode("UDP"); |
| 158 | - device.setCharset("gb2312"); | 158 | + device.setCharset("GB2312"); |
| 159 | device.setDeviceId(deviceId); | 159 | device.setDeviceId(deviceId); |
| 160 | device.setFirsRegister(true); | 160 | device.setFirsRegister(true); |
| 161 | }else { | 161 | }else { |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -141,6 +141,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -141,6 +141,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 141 | String now = this.format.format(System.currentTimeMillis()); | 141 | String now = this.format.format(System.currentTimeMillis()); |
| 142 | device.setUpdateTime(now); | 142 | device.setUpdateTime(now); |
| 143 | Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId()); | 143 | Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId()); |
| 144 | + device.setCharset(device.getCharset().toUpperCase()); | ||
| 144 | if (deviceByDeviceId == null) { | 145 | if (deviceByDeviceId == null) { |
| 145 | device.setCreateTime(now); | 146 | device.setCreateTime(now); |
| 146 | redisCatchStorage.updateDevice(device); | 147 | redisCatchStorage.updateDevice(device); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| @@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.*; | @@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 29 | import com.genersoft.iot.vmp.conf.SipConfig; | 29 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 30 | 30 | ||
| 31 | import java.util.List; | 31 | import java.util.List; |
| 32 | +import java.util.Locale; | ||
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * 级联平台管理 | 35 | * 级联平台管理 |
| @@ -230,6 +231,7 @@ public class PlatformController { | @@ -230,6 +231,7 @@ public class PlatformController { | ||
| 230 | wvpResult.setMsg("missing parameters"); | 231 | wvpResult.setMsg("missing parameters"); |
| 231 | return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); | 232 | return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); |
| 232 | } | 233 | } |
| 234 | + parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); | ||
| 233 | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); | 235 | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); |
| 234 | 236 | ||
| 235 | boolean updateResult = storager.updateParentPlatform(parentPlatform); | 237 | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
web_src/src/components/ParentPlatformList.vue
| @@ -43,12 +43,12 @@ | @@ -43,12 +43,12 @@ | ||
| 43 | <el-table-column prop="channelCount" label="通道数" width="120" align="center"></el-table-column> | 43 | <el-table-column prop="channelCount" label="通道数" width="120" align="center"></el-table-column> |
| 44 | <el-table-column label="订阅信息" width="240" align="center" fixed="right"> | 44 | <el-table-column label="订阅信息" width="240" align="center" fixed="right"> |
| 45 | <template slot-scope="scope"> | 45 | <template slot-scope="scope"> |
| 46 | - <i v-if="scope.row.alarmSubscribe" style="font-size: 1.5rem;" title="报警订阅" class="subscribe-on iconfont icon-gbaojings" ></i> | ||
| 47 | - <i v-if="!scope.row.alarmSubscribe" style="font-size: 1.5rem;" title="报警订阅" class="subscribe-off iconfont icon-gbaojings" ></i> | ||
| 48 | - <i v-if="scope.row.catalogSubscribe" title="目录订阅" class="subscribe-on iconfont icon-gjichus" ></i> | ||
| 49 | - <i v-if="!scope.row.catalogSubscribe" title="目录订阅" class="subscribe-off iconfont icon-gjichus" ></i> | ||
| 50 | - <i v-if="scope.row.gpsSubscribe" title="位置订阅" class="subscribe-on iconfont icon-gxunjians" ></i> | ||
| 51 | - <i v-if="!scope.row.gpsSubscribe" title="位置订阅" class="subscribe-off iconfont icon-gxunjians" ></i> | 46 | + <i v-if="scope.row.alarmSubscribe" style="font-size: 20px" title="报警订阅" class="iconfont icon-gbaojings subscribe-on " ></i> |
| 47 | + <i v-if="!scope.row.alarmSubscribe" style="font-size: 20px" title="报警订阅" class="iconfont icon-gbaojings subscribe-off " ></i> | ||
| 48 | + <i v-if="scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-on" ></i> | ||
| 49 | + <i v-if="!scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-off" ></i> | ||
| 50 | + <i v-if="scope.row.gpsSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-on" ></i> | ||
| 51 | + <i v-if="!scope.row.gpsSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-off" ></i> | ||
| 52 | </template> | 52 | </template> |
| 53 | </el-table-column> | 53 | </el-table-column> |
| 54 | 54 | ||
| @@ -182,10 +182,10 @@ export default { | @@ -182,10 +182,10 @@ export default { | ||
| 182 | <style> | 182 | <style> |
| 183 | .subscribe-on{ | 183 | .subscribe-on{ |
| 184 | color: #409EFF; | 184 | color: #409EFF; |
| 185 | - font-size: 1.3rem; | 185 | + font-size: 18px; |
| 186 | } | 186 | } |
| 187 | .subscribe-off{ | 187 | .subscribe-off{ |
| 188 | color: #afafb3; | 188 | color: #afafb3; |
| 189 | - font-size: 1.3rem; | 189 | + font-size: 18px; |
| 190 | } | 190 | } |
| 191 | </style> | 191 | </style> |