From c6f298dc2f39673891eb90f219f610cdde20ef24 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期日, 15 三月 2026 20:32:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java
index afa64a5..6dfdcff 100644
--- a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java
+++ b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java
@@ -8,16 +8,19 @@
 import com.xiaopeng.account.model.dto.XpOperationsUserDTO;
 import com.xiaopeng.account.model.query.XpOperationsUserPageQuery;
 import com.xiaopeng.account.model.query.XpOperationsUserQuery;
-import com.xiaopeng.account.service.IXpOperationsRoleService;
 import com.xiaopeng.account.service.IXpOperationsUserService;
 import com.xiaopeng.api.dto.account.XpOperationsUserQueryDTO;
+import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetClient;
 import com.xiaopeng.api.model.account.XpOperationsUser;
+import com.xiaopeng.api.model.vehicleConvoy.XpFleet;
 import com.xiaopeng.api.vo.account.XpOperationsUserProfileVO;
 import com.xiaopeng.api.vo.account.XpOperationsUserVO;
 import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO;
+import com.xiaopeng.common.core.exception.ServiceException;
 import com.xiaopeng.common.core.domain.R;
 import com.xiaopeng.common.core.web.page.PageInfo;
 import com.xiaopeng.common.security.service.TokenService;
+import com.xiaopeng.account.constant.I18nKeyConstant;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
@@ -47,11 +50,17 @@
 
     private final TokenService tokenService;
 
+    private final XpFleetClient xpFleetClient;
+
     @Autowired
-    public XpOperationsUserController(IXpOperationsUserService xpOperationsUserService, XpOperationsRoleMapper xpOperationsRoleMapper, TokenService tokenService) {
+    public XpOperationsUserController(IXpOperationsUserService xpOperationsUserService,
+                                      XpOperationsRoleMapper xpOperationsRoleMapper,
+                                      TokenService tokenService,
+                                      XpFleetClient xpFleetClient) {
         this.xpOperationsUserService = xpOperationsUserService;
         this.xpOperationsRoleMapper = xpOperationsRoleMapper;
         this.tokenService = tokenService;
+        this.xpFleetClient = xpFleetClient;
     }
 
     /**
@@ -209,6 +218,27 @@
     @ApiOperation(value = "运维人员管理删除", tags = {"管理后台-运维执行"})
     @DeleteMapping("/api/v1/operationsUser/deleteById")
     public R<String> deleteById(@RequestParam Long id) {
+        try {
+            R<XpFleet> fleetResult = xpFleetClient.getFleetByOperationsUserId(id);
+            if (fleetResult == null) {
+                throw new ServiceException("请求失败,请稍后重试", I18nKeyConstant.REQUEST_FAILED);
+            }
+            XpFleet fleet = fleetResult.getData();
+            if (fleet != null && fleet.getId() != null) {
+                String fleetName = com.xiaopeng.common.core.utils.StringUtils.isBlank(fleet.getFleetName())
+                        ? String.valueOf(fleet.getId())
+                        : fleet.getFleetName();
+                throw new ServiceException(
+                        "删除失败,该人员已关联车队:" + fleetName,
+                        I18nKeyConstant.OPERATIONS_USER_DELETE_FLEET_BOUND,
+                        new Object[]{fleetName}
+                );
+            }
+        } catch (ServiceException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ServiceException("请求失败,请稍后重试", I18nKeyConstant.REQUEST_FAILED);
+        }
         xpOperationsUserService.removeById(id);
         return R.ok();
     }

--
Gitblit v1.7.1