|
|
@ -3,9 +3,11 @@ package com.qyft.gd.service; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.qyft.gd.common.constant.Commands; |
|
|
|
import com.qyft.gd.common.result.CMDResultCode; |
|
|
|
import com.qyft.gd.config.WebSocketServer; |
|
|
|
import com.qyft.gd.device.service.DeviceService; |
|
|
|
import com.qyft.gd.model.form.CMDForm; |
|
|
|
import com.qyft.gd.model.vo.ExecutionResult; |
|
|
|
import com.qyft.gd.model.vo.WebsocketResult; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -29,11 +31,16 @@ public class CMDService { |
|
|
|
} |
|
|
|
|
|
|
|
private void upTray(CMDForm cmdForm) { |
|
|
|
WebsocketResult websocketResult = new WebsocketResult(); |
|
|
|
websocketResult.setType("cmd"); |
|
|
|
// TODO 执行指令 |
|
|
|
ExecutionResult executionResult = new ExecutionResult(); |
|
|
|
executionResult.setCommandId(cmdForm.getCommandId()); |
|
|
|
executionResult.setStatus(CMDResultCode.SUCCESS.getCode()); |
|
|
|
executionResult.setMessage(CMDResultCode.SUCCESS.getMsg()); |
|
|
|
WebSocketServer.sendMessageToClients(JSONUtil.toJsonStr(executionResult)); |
|
|
|
websocketResult.setData(executionResult); |
|
|
|
// 发送消息给客户端 |
|
|
|
WebSocketServer.sendMessageToClients(JSONUtil.toJsonStr(websocketResult)); |
|
|
|
} |
|
|
|
|
|
|
|
} |