|
|
@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.xunmei.common.core.constant.ErrorMsgConstants;
|
|
|
-import com.xunmei.common.core.constant.HttpStatus;
|
|
|
import com.xunmei.common.core.domain.iot.domain.*;
|
|
|
import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
|
|
|
import com.xunmei.common.core.domain.mediator.domain.IotAlarmSystemField;
|
|
|
@@ -35,7 +34,6 @@ import com.xunmei.host.websocket.dto.WebsocketResult;
|
|
|
import com.xunmei.host.websocket.enums.DeviceCacheEnum;
|
|
|
import com.xunmei.host.websocket.enums.ProductEnums;
|
|
|
import com.xunmei.host.websocket.service.RouterService;
|
|
|
-import com.xunmei.host.websocket.utils.IotServerUtils;
|
|
|
import com.xunmei.host.websocket.utils.WebSocketUtils;
|
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfo;
|
|
|
import com.xunmei.system.api.domain.iot.IotDeviceStatus;
|
|
|
@@ -131,7 +129,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
return WebsocketResult.getSuccessPayload();
|
|
|
} catch (Exception e) {
|
|
|
LogUtils.STATUS_INFO_DEFENCEAREA.error("处理报警主机布撤防状态改变事件出错", e);
|
|
|
- return WebsocketResult.getResPayload(HttpStatus.ERROR, e.getMessage());
|
|
|
+ return WebsocketResult.getErrorPayload(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -199,12 +197,12 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
String str = "【报警主机传感器状态事件,未找到对应传感器】【token:%s】【设备名称:%s】【子系统id:%s】【传感器index:%s】";
|
|
|
String logMsg = String.format(str, req.getServerInfo().getIotCode(), req.getDeviceName(), subSystemId, inputIndex);
|
|
|
LogUtils.STATUS_INFO_STATUS_SENSOR.info(logMsg);
|
|
|
- return WebsocketResult.getResPayload(HttpStatus.ERROR, logMsg);
|
|
|
+ return WebsocketResult.getErrorPayload(logMsg);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
LogUtils.STATUS_INFO_STATUS_SENSOR.error("处理报警主机传感器状态事件出错", e);
|
|
|
- return WebsocketResult.getResPayload(HttpStatus.ERROR, e.getMessage());
|
|
|
+ return WebsocketResult.getErrorPayload(e.getMessage());
|
|
|
}
|
|
|
return WebsocketResult.getSuccessPayload();
|
|
|
}
|
|
|
@@ -229,7 +227,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
headers.put("productName", deviceInfo.getDeviceProduct());
|
|
|
headers.put("deviceName", deviceInfo.getDeviceCode());
|
|
|
LogUtils.DEVICE_CONTROL_LOG.info("报警主机布撤防控制topic:{},控制参数:{}", topic, args.toJSONString());
|
|
|
- WebsocketResult websocketResult = IotServerUtils.invokeHostServer(topic, headers, WebSocketConstants.SUB_SYSTEM_CONTROL, args);
|
|
|
+ WebsocketResult websocketResult = WebsocketResult.invokeHostServer(topic, headers, WebSocketConstants.SUB_SYSTEM_CONTROL, args);
|
|
|
LogUtils.WEBSOCKET_MSG.info("布撤防控制指令:{}", JacksonUtils.toJSONString(websocketResult));
|
|
|
boolean invoked = WebSocketUtils.sendMessage(subsystem.getIotToken(), JacksonUtils.toJSONString(websocketResult));
|
|
|
if (!invoked) {
|
|
|
@@ -250,7 +248,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
|
|
|
@Override
|
|
|
public void breakerControlByOrgId(Long orgId, String command) {
|
|
|
- try {
|
|
|
+ /* try {
|
|
|
QueryWrapper<IotDeviceInfo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda()
|
|
|
.eq(IotDeviceInfo::getDeleted, 0)
|
|
|
@@ -282,12 +280,12 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
e.printStackTrace();
|
|
|
LogUtils.DEVICE_CONTROL_LOG.error("通断电控制", e);
|
|
|
throw new RuntimeException(e);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void breakerControlByDeviceId(Serializable id, String command) {
|
|
|
- try {
|
|
|
+ /* try {
|
|
|
IotDeviceInfo deviceInfo = iIotDeviceInfoService.getById(id);
|
|
|
if (deviceInfo != null) {
|
|
|
String topic = "/things/" + deviceInfo.getDeviceProduct() + "/" + deviceInfo.getDeviceCode() + "/service/invoke";
|
|
|
@@ -311,7 +309,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
e.printStackTrace();
|
|
|
LogUtils.DEVICE_CONTROL_LOG.error("通断电控制", e);
|
|
|
throw new RuntimeException(e);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
private void saveProtectionLog(IotAlarmSubsystem protection) {
|
|
|
@@ -339,7 +337,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Object execute(WebsocketExecuteReq req) {
|
|
|
+ public WebsocketResult execute(WebsocketExecuteReq req) {
|
|
|
final String event = req.getEvent();
|
|
|
JSONObject jsb;
|
|
|
switch (event) {
|