From 9821e05e90ef31f2f2dce4128a7cd1adf032a60c Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 28 二月 2026 23:32:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java
index 7b3ba86..62a98e2 100644
--- a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java
+++ b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java
@@ -1,8 +1,10 @@
 package com.xiaopeng.maintenance.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xiaopeng.api.feignClient.account.XpOperationUserClient;
+import com.xiaopeng.api.model.account.SysRole;
 import com.xiaopeng.api.model.account.XpOperationsRole;import com.xiaopeng.api.model.account.XpOperationsUser;import com.xiaopeng.api.model.maintenance.XpCheckLocation;
 import com.xiaopeng.api.model.maintenance.XpClockIn;
 import com.xiaopeng.api.model.maintenance.XpShift;
@@ -41,6 +43,7 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.List;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -253,17 +256,19 @@
         List<String> appUserIdList = clockInStatistics.stream().map(ClockInStatisticsDto::getAppUserId).collect(Collectors.toList());
         List<Long> ids = appUserIdList.stream().map(Long::parseLong).collect(Collectors.toList());
         List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(ids).getData();
+        Map<Long, XpOperationsUserWithRoleVO> userMap = data.stream().collect(Collectors.toMap(XpOperationsUserWithRoleVO::getId, Function.identity()));
         //将查询结果组装成map对象,用于循环中提取数据
         for (ClockInStatisticsDto clockInStatistic : clockInStatistics) {
             String appUserId = clockInStatistic.getAppUserId();
             //运维账号可以拥有多个角色
-            List<XpOperationsUserWithRoleVO> collect = data.stream().filter(x->x.getId().equals(Long.parseLong(appUserId))).collect(Collectors.toList());
-            if(!collect.isEmpty()){
-                XpOperationsUserWithRoleVO xpOperationsUserWithRoleVO = collect.get(0);
-                clockInStatistic.setName(xpOperationsUserWithRoleVO.getNickName());
+            if(CollUtil.isNotEmpty(userMap)){
+                XpOperationsUserWithRoleVO vo = userMap.get(Long.parseLong(appUserId));
+                if (Objects.nonNull(vo)) {
+                    clockInStatistic.setName(vo.getNickName());
+                    String roleName = vo.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(";"));
+                    clockInStatistic.setRoleName(roleName);
+                }
             }
-            String roleName = collect.stream().map(XpOperationsUserWithRoleVO::getRoleName).collect(Collectors.joining(";"));
-            clockInStatistic.setRoleName(roleName);
             Integer shouldClockInDays = clockInStatistic.getShouldClockInDays();
             Integer clockInDays = clockInStatistic.getClockInDays();
             clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays);
@@ -311,16 +316,18 @@
         List<String> appUserIdList = clockInStatistics.stream().map(ClockInStatisticsDto::getAppUserId).collect(Collectors.toList());
         List<Long> ids = appUserIdList.stream().map(Long::parseLong).collect(Collectors.toList());
         List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(ids).getData();
+        Map<Long, XpOperationsUserWithRoleVO> userMap = data.stream().collect(Collectors.toMap(XpOperationsUserWithRoleVO::getId, Function.identity()));
         for (ClockInStatisticsDto clockInStatistic : clockInStatistics) {
             String appUserId = clockInStatistic.getAppUserId();
             //运维账号可以拥有多个角色
-            List<XpOperationsUserWithRoleVO> collect = data.stream().filter(x->x.getId().equals(Long.parseLong(appUserId))).collect(Collectors.toList());
-            if(!collect.isEmpty()){
-                XpOperationsUserWithRoleVO xpOperationsUserWithRoleVO = collect.get(0);
-                clockInStatistic.setName(xpOperationsUserWithRoleVO.getNickName());
+            if(CollUtil.isNotEmpty(userMap)){
+                XpOperationsUserWithRoleVO vo = userMap.get(Long.parseLong(appUserId));
+                if (Objects.nonNull(vo)) {
+                    clockInStatistic.setName(vo.getNickName());
+                    String roleName = vo.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(";"));
+                    clockInStatistic.setRoleName(roleName);
+                }
             }
-            String roleName = collect.stream().map(XpOperationsUserWithRoleVO::getRoleName).collect(Collectors.joining(";"));
-            clockInStatistic.setRoleName(roleName);
             Integer shouldClockInDays = clockInStatistic.getShouldClockInDays();
             Integer clockInDays = clockInStatistic.getClockInDays();
             clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays);
@@ -356,7 +363,7 @@
         //将查询结果组装成map对象,用于循环中提取数据
         for (ClockInStatisticsDetailsDto clockInStatistic : clockInStatisticsDetails) {
             clockInStatistic.setName(xpOperationsUserWithRoleVO.getNickName());
-            clockInStatistic.setRoleName(xpOperationsUserWithRoleVO.getRoleName());
+            clockInStatistic.setRoleName(xpOperationsUserWithRoleVO.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(";")));
         }
         pageInfo.setRecords(clockInStatisticsDetails);
         return pageInfo;
@@ -385,7 +392,7 @@
         //将查询结果组装成map对象,用于循环中提取数据
         for (ClockInStatisticsDetailsDto clockInStatistic : clockInStatisticsDetails) {
             clockInStatistic.setName(xpOperationsUserWithRoleVO.getNickName());
-            clockInStatistic.setRoleName(xpOperationsUserWithRoleVO.getRoleName());
+            clockInStatistic.setRoleName(xpOperationsUserWithRoleVO.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(";")));
         }
 
         ExcelUtil<ClockInStatisticsDetailsDto> excel = new ExcelUtil<ClockInStatisticsDetailsDto>(ClockInStatisticsDetailsDto.class);

--
Gitblit v1.7.1