| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.callback;
|
| | |
|
| | | import com.alibaba.fastjson2.JSON;
|
| | | import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | |
|
| | | public static final String CALLBACK_CMD_DOWNLOAD = "CALLBACK_DOWNLOAD";
|
| | |
|
| | | public static final String CALLBACK_CMD_PROXY = "CALLBACK_PROXY";
|
| | |
|
| | | public static final String CALLBACK_CMD_STOP = "CALLBACK_STOP";
|
| | |
|
| | | public static final String UPLOAD_FILE_CHANNEL = "UPLOAD_FILE_CHANNEL";
|
| | |
|
| | | public static final String CALLBACK_CMD_MOBILEPOSITION = "CALLBACK_MOBILEPOSITION";
|
| | | public static final String CALLBACK_CMD_MOBILE_POSITION = "CALLBACK_CMD_MOBILE_POSITION";
|
| | |
|
| | | public static final String CALLBACK_CMD_PRESETQUERY = "CALLBACK_PRESETQUERY";
|
| | |
|
| | | public static final String CALLBACK_CMD_ALARM = "CALLBACK_ALARM";
|
| | |
|
| | | public static final String CALLBACK_CMD_BROADCAST = "CALLBACK_BROADCAST";
|
| | |
|
| | | public static final String CALLBACK_CMD_SNAP= "CALLBACK_SNAP";
|
| | |
|
| | | private Map<String, Map<String, DeferredResultEx>> map = new ConcurrentHashMap<>();
|
| | |
|
| | |
| | | if (deferredResultMap == null) {
|
| | | return;
|
| | | }
|
| | | Set<String> ids = deferredResultMap.keySet();
|
| | | for (String id : ids) {
|
| | | DeferredResultEx result = deferredResultMap.get(id);
|
| | | if (result == null) {
|
| | | synchronized (this) {
|
| | | deferredResultMap = map.get(msg.getKey());
|
| | | if (deferredResultMap == null) {
|
| | | return;
|
| | | }
|
| | | if (result.getFilter() != null) {
|
| | | Object handler = result.getFilter().handler(msg.getData());
|
| | | System.out.println(JSON.toJSONString(handler));
|
| | | result.getDeferredResult().setResult(handler);
|
| | | }else {
|
| | | result.getDeferredResult().setResult(msg.getData());
|
| | | Set<String> ids = deferredResultMap.keySet();
|
| | | for (String id : ids) {
|
| | | DeferredResultEx result = deferredResultMap.get(id);
|
| | | if (result == null) {
|
| | | return;
|
| | | }
|
| | | if (result.getFilter() != null) {
|
| | | Object handler = result.getFilter().handler(msg.getData());
|
| | | result.getDeferredResult().setResult(handler);
|
| | | }else {
|
| | | result.getDeferredResult().setResult(msg.getData());
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | map.remove(msg.getKey());
|
| | | }
|
| | | map.remove(msg.getKey());
|
| | | }
|
| | |
|
| | |
|
| | | }
|