“mitao”
2026-02-28 ec48aa303ca6904894ec352a3df2f630dc142903
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);