| | |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.websocket.model.BizCodeEnum; |
| | | import com.dji.sample.component.websocket.model.CustomWebSocketMessage; |
| | | import com.dji.sample.component.websocket.model.WebSocketManager; |
| | | import com.dji.sample.component.websocket.service.ISendMessageService; |
| | | import com.dji.sample.component.websocket.service.IWebSocketManageService; |
| | | import com.dji.sample.map.model.dto.*; |
| | | import com.dji.sample.map.service.IWorkspaceElementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private ISendMessageService sendMessageService; |
| | | |
| | | @Autowired |
| | | private IWebSocketManageService webSocketManageService; |
| | | |
| | | /** |
| | | * In the first connection, pilot will send out this http request to obtain the group element list. |
| | |
| | | elementService.getElementByElementId(elementCreate.getId()) |
| | | .ifPresent(groupElement -> |
| | | sendMessageService.sendBatch( |
| | | WebSocketManager.getValueWithWorkspace(workspaceId), |
| | | webSocketManageService.getValueWithWorkspace(workspaceId), |
| | | CustomWebSocketMessage.<GroupElementDTO>builder() |
| | | .timestamp(System.currentTimeMillis()) |
| | | .bizCode(BizCodeEnum.MAP_ELEMENT_CREATE.getCode()) |
| | |
| | | elementService.getElementByElementId(elementId) |
| | | .ifPresent(groupElement -> |
| | | sendMessageService.sendBatch( |
| | | WebSocketManager.getValueWithWorkspace(workspaceId), |
| | | webSocketManageService.getValueWithWorkspace(workspaceId), |
| | | CustomWebSocketMessage.<GroupElementDTO>builder() |
| | | .timestamp(System.currentTimeMillis()) |
| | | .bizCode(BizCodeEnum.MAP_ELEMENT_UPDATE.getCode()) |
| | |
| | | if (ResponseResult.CODE_SUCCESS == response.getCode()) { |
| | | elementOpt.ifPresent(element -> |
| | | sendMessageService.sendBatch( |
| | | WebSocketManager.getValueWithWorkspace(workspaceId), |
| | | webSocketManageService.getValueWithWorkspace(workspaceId), |
| | | CustomWebSocketMessage.<WebSocketElementDelDTO>builder() |
| | | .timestamp(System.currentTimeMillis()) |
| | | .bizCode(BizCodeEnum.MAP_ELEMENT_DELETE.getCode()) |
| | |
| | | if (ResponseResult.CODE_SUCCESS == response.getCode()) { |
| | | |
| | | sendMessageService.sendBatch( |
| | | WebSocketManager.getValueWithWorkspace(workspaceId), |
| | | webSocketManageService.getValueWithWorkspace(workspaceId), |
| | | CustomWebSocketMessage.builder() |
| | | .timestamp(System.currentTimeMillis()) |
| | | .bizCode(BizCodeEnum.MAP_GROUP_REFRESH.getCode()) |