From 277b4f8a32c2332bc067a263bcce2e763e8d13aa Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Wed, 21 Jan 2026 16:38:01 +0800
Subject: [PATCH] 1. 新增航线任务接口。 2. 新增查询航线任务列表接口。 3. 新增获取航线任务详细信息。 4. 新增航线任务接口。 5. 新增修改航线任务接口。 6. 新增删除航线任务接口。 7. 新增修改航线任务状态接口。 8. 优化查询分组业务逻辑。 9. 航线(kmz)对象增加航线任务ID信息。 10. 新增航线(kmz)业务增加航线任务数据加工校验相关业务逻辑。 11. 新增航向任务下航点信息业务相关接口。

---
 ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java b/ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java
index 5744902..1efc113 100644
--- a/ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java
+++ b/ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java
@@ -1,21 +1,46 @@
 package com.ard.framework.security.handle;
 
+import com.ard.common.constant.CacheConstants;
 import com.ard.common.constant.Constants;
+import com.ard.common.core.domain.model.LoginUser;
 import com.ard.common.core.redis.RedisCache;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Component;
 
 @Component
 public class CustomAuthenticationSuccessHandler {
 
+    @Value("${token.soloLogin}")
+    private boolean soloLogin;
+
     @Autowired
     private RedisCache redisCache;
 
-    public void onAuthenticationSuccess(Long userId) {
+    @Autowired
+    private ApplicationEventPublisher publisher;
+
+    public void onAuthenticationSuccess(Authentication authentication) {
+        // 允许多端登录,直接放行
+        if (soloLogin) {
+            return;
+        }
         // 检查 Redis 中是否已有该用户登录
-        String key = Constants.LOGIN_USERID_KEY + userId;
+        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+        Long userId = loginUser.getUser().getUserId();
+
+        String key = CacheConstants.LOGIN_USERID_KEY + userId;
         if (redisCache.hasKey(key)) {
             throw new RuntimeException("用户已登录,请勿重复登录");
         }
+        // 登录成功事件推送
+        if (authentication != null && authentication.isAuthenticated()) {
+            publisher.publishEvent(new AuthenticationSuccessEvent(authentication));
+        }
     }
+
 }

--
Gitblit v1.9.3