zhaowenyu
2026-02-10 8fe9faddf234f7087a516d7e1e068b558289e605
ard-work/src/main/java/com/ard/work/component/websocket/handler/UavControlManager.java
@@ -26,7 +26,7 @@
     */
    public void sendControlRequest(Long controllerId, String boxSn, String type, Long requesterId) {
        SysUser requester = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + requesterId);
        SysUser requester = redisCache.getCacheMapValue(CacheConstants.SYS_USER, requesterId.toString());
        UavControlMessage msg = new UavControlMessage();
        msg.setBoxSn(boxSn);
@@ -45,7 +45,7 @@
     */
    public void sendControlApproval(Long requesterId, String boxSn, String type, Long controllerId) {
        SysUser controller = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + controllerId);
        SysUser controller = redisCache.getCacheMapValue(CacheConstants.SYS_USER, controllerId.toString());
        UavControlMessage msg = new UavControlMessage();
        msg.setBoxSn(boxSn);
@@ -64,7 +64,7 @@
     */
    public void sendControlRejection(Long requesterId, String boxSn, String type, Long controllerId) {
        SysUser controller = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + controllerId);
        SysUser controller = redisCache.getCacheMapValue(CacheConstants.SYS_USER, controllerId.toString());
        UavControlMessage msg = new UavControlMessage();
        msg.setBoxSn(boxSn);
@@ -83,8 +83,8 @@
     */
    public void sendControlTakeover(Long oldControllerId, Long newControllerId, String boxSn, String type) {
        SysUser newController = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + newControllerId);
        SysUser oldController = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + oldControllerId);
        SysUser newController = redisCache.getCacheMapValue(CacheConstants.SYS_USER, newControllerId.toString());
        SysUser oldController = redisCache.getCacheMapValue(CacheConstants.SYS_USER, oldControllerId.toString());
        // 1️⃣ 通知原控制者:你被抢占了
        UavControlMessage msgOld = new UavControlMessage();
@@ -125,7 +125,7 @@
     * 控制权释放
     */
    public void sendControlRelease(String boxSn, String type, Long operatorId) {
        SysUser operator = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + operatorId);
        SysUser operator = redisCache.getCacheMapValue(CacheConstants.SYS_USER, operatorId.toString());
        UavControlMessage message = new UavControlMessage();
        message.setBoxSn(boxSn);
@@ -155,10 +155,10 @@
        Map<String, Object> map = new HashMap<>();
        map.put("boxSn", boxSn);
        // 将飞行当前控制者用户ID添加到映射中
        SysUser flyUser = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + flyUserId);
        SysUser flyUser = redisCache.getCacheMapValue(CacheConstants.SYS_USER, flyUserId.toString());
        map.put("flyController", flyUser);
        // 将载荷当前控制者用户ID添加到映射中
        SysUser payloadUser = redisCache.getCacheObject(CacheConstants.SYS_USER_KEY + payloadUserId);
        SysUser payloadUser = redisCache.getCacheMapValue(CacheConstants.SYS_USER, payloadUserId.toString());
        map.put("payloadController", payloadUser);
        // 返回包含当前控制者信息的映射
        return map;