From 3692b4d087a45f41a21a4967b7544451eee5dbc9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 18 三月 2026 11:08:29 +0800
Subject: [PATCH] 修改图片获取

---
 xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserController.java |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 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 6dfdcff..2e12649 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
@@ -1,6 +1,7 @@
 package com.xiaopeng.account.controller;
 
 
+import com.alibaba.fastjson2.JSONObject;
 import com.xiaopeng.account.mapper.XpOperationsRoleMapper;
 import com.xiaopeng.account.model.dto.EnableDisableDTO;
 import com.xiaopeng.account.model.dto.RePasswordDTO;
@@ -21,6 +22,7 @@
 import com.xiaopeng.common.core.web.page.PageInfo;
 import com.xiaopeng.common.security.service.TokenService;
 import com.xiaopeng.account.constant.I18nKeyConstant;
+import com.xiaopeng.evi.oss.service.AliOssService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
@@ -52,15 +54,18 @@
 
     private final XpFleetClient xpFleetClient;
 
+    private final AliOssService aliOssService;
+
     @Autowired
     public XpOperationsUserController(IXpOperationsUserService xpOperationsUserService,
                                       XpOperationsRoleMapper xpOperationsRoleMapper,
                                       TokenService tokenService,
-                                      XpFleetClient xpFleetClient) {
+                                      XpFleetClient xpFleetClient, AliOssService aliOssService) {
         this.xpOperationsUserService = xpOperationsUserService;
         this.xpOperationsRoleMapper = xpOperationsRoleMapper;
         this.tokenService = tokenService;
         this.xpFleetClient = xpFleetClient;
+        this.aliOssService = aliOssService;
     }
 
     /**
@@ -176,6 +181,7 @@
         PageInfo<XpOperationsUserVO> pageList = xpOperationsUserService.pageList(query);
         return R.ok(pageList);
     }
+
     @ApiOperation(value = "运维人员管理不分页列表", tags = {"管理后台-运维执行"})
     @PostMapping("/api/v1/operationsUser/listAll")
     public R<List<XpOperationsUser>> listAll() {
@@ -254,31 +260,43 @@
     @GetMapping("/api/v1/operationsUser/detailById")
     public R<XpOperationsUserVO> detailById(@RequestParam Long id) {
         XpOperationsUserVO xpOperationsUserVO = xpOperationsUserService.detailById(id);
+        if (xpOperationsUserVO.getAvatar() != null) {
+            JSONObject jsonObject = JSONObject.parseObject(xpOperationsUserVO.getAvatar());
+            String downloadUrl = null;
+            try {
+                String downloadUrl1 = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
+                downloadUrl = downloadUrl1;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            xpOperationsUserVO.setAvatar(downloadUrl);
+        }
+
         return R.ok(xpOperationsUserVO);
     }
 
 
     @ApiOperation(value = "运维人员管理导出列表", tags = {"管理后台-运维执行"})
     @PostMapping("/api/v1/operationsUser/exportOperationsUser")
-    public void exportOperationsUser(@RequestBody XpOperationsUserQuery query, HttpServletResponse response){
+    public void exportOperationsUser(@RequestBody XpOperationsUserQuery query, HttpServletResponse response) {
         xpOperationsUserService.exportOperationsUser(query, response);
     }
 
 
     @ApiOperation(value = "运维人员管理导出模板", tags = {"管理后台-运维执行"})
     @GetMapping("/api/v1/operationsUser/exportTemplate")
-    public void exportTemplate(HttpServletResponse response){
+    public void exportTemplate(HttpServletResponse response) {
         xpOperationsUserService.exportTemplate(response);
     }
 
 
-
     @ApiOperation(value = "运维人员管理导入数据", tags = {"管理后台-运维执行"})
     @PostMapping("/api/v1/operationsUser/importOperationsUser")
-    public R<String> importOperationsUser(@RequestParam("file") MultipartFile file){
+    public R<String> importOperationsUser(@RequestParam("file") MultipartFile file) {
         xpOperationsUserService.importOperationsUser(file);
         return R.ok();
     }
+
     /**
      * 根据手机号模糊查询用户(内部接口)
      *

--
Gitblit v1.7.1