Commit 0e692512812a2c0a0c62e97b34bf7519ca4f9f58

Authored by 648540858
1 parent 11d40d3e

修复多平台同时导入时的bug

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
... ... @@ -100,7 +100,6 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
100 100 subscribeHolder.removeCatalogSubscribe(platformGBId);
101 101 subscribeHolder.removeMobilePositionSubscribe(platformGBId);
102 102 }
103   -
104 103 }
105 104 }
106 105  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
... ... @@ -411,38 +411,38 @@ public class StreamPushServiceImpl implements IStreamPushService {
411 411 // 遍历存储结果,查找app+Stream->platformId+catalogId的对应关系,然后执行批量写入
412 412 for (StreamPushItem streamPushItem : streamPushItemsForPlatform) {
413 413 List<String[]> platFormInfoList = streamPushItemsForAll.get(streamPushItem.getApp() + streamPushItem.getStream());
414   - if (platFormInfoList != null) {
415   - if (platFormInfoList.size() > 0) {
416   - for (String[] platFormInfoArray : platFormInfoList) {
417   - StreamPushItem streamPushItemForPlatform = new StreamPushItem();
418   - streamPushItemForPlatform.setGbStreamId(streamPushItem.getGbStreamId());
419   - if (platFormInfoArray.length > 0) {
420   - // 数组 platFormInfoArray 0 为平台ID。 1为目录ID
421   - // 不存在这个平台,则忽略导入此关联关系
422   - if (platformInfoMap.get(platFormInfoArray[0]) == null
423   - || platformInfoMap.get(platFormInfoArray[0]).get(platFormInfoArray[1]) == null) {
424   - logger.info("导入数据时不存在平台或目录{}/{},已导入未分配", platFormInfoArray[0], platFormInfoArray[1] );
425   - continue;
426   - }
427   - streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]);
428   -
429   - List<GbStream> gbStreamList = platformForEvent.get(streamPushItem.getPlatformId());
430   - if (gbStreamList == null) {
431   - gbStreamList = new ArrayList<>();
432   - platformForEvent.put(platFormInfoArray[0], gbStreamList);
433   - }
434   - // 为发送通知整理数据
435   - streamPushItemForPlatform.setName(streamPushItem.getName());
436   - streamPushItemForPlatform.setApp(streamPushItem.getApp());
437   - streamPushItemForPlatform.setStream(streamPushItem.getStream());
438   - streamPushItemForPlatform.setGbId(streamPushItem.getGbId());
439   - gbStreamList.add(streamPushItemForPlatform);
  414 + if (platFormInfoList != null && platFormInfoList.size() > 0) {
  415 + for (String[] platFormInfoArray : platFormInfoList) {
  416 + StreamPushItem streamPushItemForPlatform = new StreamPushItem();
  417 + streamPushItemForPlatform.setGbStreamId(streamPushItem.getGbStreamId());
  418 + if (platFormInfoArray.length > 0) {
  419 + // 数组 platFormInfoArray 0 为平台ID。 1为目录ID
  420 + // 不存在这个平台,则忽略导入此关联关系
  421 + if (platformInfoMap.get(platFormInfoArray[0]) == null
  422 + || platformInfoMap.get(platFormInfoArray[0]).get(platFormInfoArray[1]) == null) {
  423 + logger.info("导入数据时不存在平台或目录{}/{},已导入未分配", platFormInfoArray[0], platFormInfoArray[1] );
  424 + continue;
440 425 }
441   - if (platFormInfoArray.length > 1) {
442   - streamPushItemForPlatform.setCatalogId(platFormInfoArray[1]);
  426 + streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]);
  427 + if (platFormInfoArray[0].equals("34020000002110000001")) {
  428 + System.out.println(111);
443 429 }
444   - streamPushItemListFroPlatform.add(streamPushItemForPlatform);
  430 + List<GbStream> gbStreamList = platformForEvent.get(platFormInfoArray[0]);
  431 + if (gbStreamList == null) {
  432 + gbStreamList = new ArrayList<>();
  433 + platformForEvent.put(platFormInfoArray[0], gbStreamList);
  434 + }
  435 + // 为发送通知整理数据
  436 + streamPushItemForPlatform.setName(streamPushItem.getName());
  437 + streamPushItemForPlatform.setApp(streamPushItem.getApp());
  438 + streamPushItemForPlatform.setStream(streamPushItem.getStream());
  439 + streamPushItemForPlatform.setGbId(streamPushItem.getGbId());
  440 + gbStreamList.add(streamPushItemForPlatform);
  441 + }
  442 + if (platFormInfoArray.length > 1) {
  443 + streamPushItemForPlatform.setCatalogId(platFormInfoArray[1]);
445 444 }
  445 + streamPushItemListFroPlatform.add(streamPushItemForPlatform);
446 446 }
447 447  
448 448 }
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
... ... @@ -168,16 +168,6 @@ public class StreamPushController {
168 168 result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
169 169 return result;
170 170 }
171   -// if (!file.getContentType().endsWith(".xls")
172   -// && !file.getContentType().endsWith(".csv")
173   -// && !file.getContentType().endsWith(".xlsx") ) {
174   -// logger.warn("通道导入文件类型错误: {}",file.getContentType() );
175   -// WVPResult<Object> wvpResult = new WVPResult<>();
176   -// wvpResult.setCode(-1);
177   -// wvpResult.setMsg("文件类型错误,请使用");
178   -// result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
179   -// return result;
180   -// }
181 171 // 同时只处理一个文件
182 172 if (resultHolder.exist(key, null)) {
183 173 logger.warn("已有导入任务正在执行");
... ...