|
|
@@ -30,7 +30,6 @@ import com.xunmei.mediator.websocket.dto.WebsocketExecuteReq;
|
|
|
import com.xunmei.mediator.websocket.dto.WebsocketResult;
|
|
|
import com.xunmei.mediator.websocket.enums.ProductEnums;
|
|
|
import com.xunmei.mediator.websocket.enums.TopicTypeEnums;
|
|
|
-import com.xunmei.mediator.websocket.holder.WebSocketSessionHolder;
|
|
|
import com.xunmei.mediator.websocket.service.RouterService;
|
|
|
import com.xunmei.mediator.websocket.utils.IotServerUtils;
|
|
|
import com.xunmei.mediator.websocket.utils.WebSocketUtils;
|
|
|
@@ -88,25 +87,49 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
public String routerKey() {
|
|
|
StringJoiner result = new StringJoiner(",");
|
|
|
result.add(WebSocketConstants.RECORD_INFOS);
|
|
|
+ result.add(WebSocketConstants.GET_RECORD_INFOS_SERVICES);
|
|
|
return result.toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Object execute(WebsocketExecuteReq req) {
|
|
|
- JSONObject data = (JSONObject) req.getData();
|
|
|
- VideoIntegrityCheckReq checkReq = data.toJavaObject(VideoIntegrityCheckReq.class);
|
|
|
- VideoIntegrityCheckDto checkDto = transform(checkReq);
|
|
|
- checkDto.setToken(req.getToken());
|
|
|
- checkDto.setDeviceName(req.getDeviceName());
|
|
|
- checkDto.setProductName(req.getProductName());
|
|
|
- SysOrg sysOrg = iotServerInfoService.selectOrgByToken(req.getToken());
|
|
|
- checkDto.setOrganizationGuid(sysOrg.getCode());
|
|
|
- //执行业务
|
|
|
- final ReceiveErrorDto dto = this.saveData(checkDto, req.getId());
|
|
|
- //构建返回数据
|
|
|
- String topic = req.getTopic() + "/reply";
|
|
|
- final JSONObject errorDto = IotServerUtils.dealReceiveErrorDto(dto);
|
|
|
- return IotServerUtils.invokeUpLinkServer(topic, req.getProductName(), req.getDeviceName(), req.getEvent(), errorDto, req.getId());
|
|
|
+ if (WebSocketConstants.GET_RECORD_INFOS_SERVICES.equals(req.getEvent())) {
|
|
|
+ final JSONArray array = (JSONArray) req.getData();
|
|
|
+ for (Object o : array) {
|
|
|
+ final VideoIntegrityCheckReq checkReq = JSON.parseObject(o.toString(), VideoIntegrityCheckReq.class);
|
|
|
+ VideoIntegrityCheckDto checkDto = transform(checkReq);
|
|
|
+ checkDto.setToken(req.getToken());
|
|
|
+ checkDto.setDeviceName(req.getDeviceName());
|
|
|
+ checkDto.setProductName(req.getProductName());
|
|
|
+ SysOrg sysOrg = iotServerInfoService.selectOrgByToken(req.getToken());
|
|
|
+ checkDto.setOrganizationGuid(sysOrg.getCode());
|
|
|
+ //执行业务
|
|
|
+ final ReceiveErrorDto dto = this.saveData(checkDto, req.getId());
|
|
|
+ //构建返回数据
|
|
|
+ String topic = req.getTopic() + "/reply";
|
|
|
+ final JSONObject errorDto = IotServerUtils.dealReceiveErrorDto(dto);
|
|
|
+ return IotServerUtils.invokeUpLinkServer(topic, req.getProductName(), req.getDeviceName(), req.getEvent(), errorDto, req.getId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //if (WebSocketConstants.RECORD_INFOS.equals(req.getEvent())){
|
|
|
+ JSONObject data = (JSONObject) req.getData();
|
|
|
+ VideoIntegrityCheckReq checkReq = data.toJavaObject(VideoIntegrityCheckReq.class);
|
|
|
+ VideoIntegrityCheckDto checkDto = transform(checkReq);
|
|
|
+ checkDto.setToken(req.getToken());
|
|
|
+ checkDto.setDeviceName(req.getDeviceName());
|
|
|
+ checkDto.setProductName(req.getProductName());
|
|
|
+ SysOrg sysOrg = iotServerInfoService.selectOrgByToken(req.getToken());
|
|
|
+ checkDto.setOrganizationGuid(sysOrg.getCode());
|
|
|
+ //执行业务
|
|
|
+ final ReceiveErrorDto dto = this.saveData(checkDto, req.getId());
|
|
|
+ //构建返回数据
|
|
|
+ String topic = req.getTopic() + "/reply";
|
|
|
+ final JSONObject errorDto = IotServerUtils.dealReceiveErrorDto(dto);
|
|
|
+ return IotServerUtils.invokeUpLinkServer(topic, req.getProductName(), req.getDeviceName(), req.getEvent(), errorDto, req.getId());
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -115,6 +138,7 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
if (ObjectUtil.isEmpty(deviceInfoList)) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
for (IotDeviceInfo iotDeviceInfo : deviceInfoList) {
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("dvsCode", iotDeviceInfo.getHostCode());
|
|
|
@@ -124,6 +148,9 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
LogUtils.WEBSOCKET_MSG.info("获取录像完整性数据:{}", JacksonUtils.toJSONString(websocketResult));
|
|
|
WebSocketUtils.sendAll(JacksonUtils.toJSONString(websocketResult));
|
|
|
}
|
|
|
+ /* String str = "{\"id\":\"fe48fd03-d3eb-4999-9180-02005c863333\",\"topic\":\"/things/IoTServer/IoTServerDevice/service/invoke\",\"timestamp\":\"2024-07-26T17:44:32.062+08:00\",\"headers\":{\"deviceName\":\"IoTServerDevice\",\"productName\":\"IoTServer\"},\"payload\":{\"args\":{\"id\":\"fe48fd03-d3eb-4999-9180-02005c863333\",\"topic\":\"/things/VGSII_Hik/33/service/invoke\",\"timestamp\":\"2024-07-26T17:44:32.062+08:00\",\"headers\":{\"deviceName\":\"33\",\"productName\":\"VGSII_Hik\"},\"payload\":{\"args\":{\"dvsCode\":\"ZM_20240726141823051\",\"index\":\"33\",\"recordDate\":[\"2024-07-25\"]},\"service\":\"getRecordInfos\"}},\"service\":\"downlinkServicePassthrough\"}}";
|
|
|
+ final WebsocketResult result = JSON.parseObject(str, WebsocketResult.class);
|
|
|
+ WebSocketUtils.sendAll(JacksonUtils.toJSONString(result));*/
|
|
|
|
|
|
}
|
|
|
|