puzhibing
2026-03-12 011cf35252d290dd73c52209cb97bf83f478f028
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java
@@ -1,12 +1,16 @@
package com.xiaopeng.maintenance.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.api.feignClient.account.XpOperationUserClient;
import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient;
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.XpSchedulingDetail;
import com.xiaopeng.api.model.maintenance.XpShift;
import com.xiaopeng.api.vo.account.XpOperationsUserVO;
import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO;import com.xiaopeng.common.core.constant.Constants;
@@ -16,14 +20,12 @@
import com.xiaopeng.common.core.utils.StringUtils;
import com.xiaopeng.common.core.utils.poi.ExcelUtil;
import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.maintenance.dto.ClockDTO;
import com.xiaopeng.maintenance.dto.ClockInStatisticsDetailsDto;
import com.xiaopeng.maintenance.dto.ClockInStatisticsDto;
import com.xiaopeng.maintenance.dto.VerifyRangeDTO;
import com.xiaopeng.maintenance.dto.*;
import com.xiaopeng.maintenance.mapper.XpCheckLocationMapper;
import com.xiaopeng.maintenance.mapper.XpClockInMapper;
import com.xiaopeng.maintenance.mapper.XpShiftMapper;
import com.xiaopeng.maintenance.service.IXpClockInService;
import com.xiaopeng.maintenance.service.IXpSchedulingDetailService;
import com.xiaopeng.maintenance.vo.ClockInStatisticsDetailsVo;
import com.xiaopeng.maintenance.vo.ClockInStatisticsVo;
import lombok.extern.slf4j.Slf4j;
@@ -67,6 +69,12 @@
    @Resource
    private XpOperationUserClient xpOperationUserClient;
    @Resource
    private IXpSchedulingDetailService xpSchedulingDetailService;
    @Resource
    private XpFleetOperationsClient fleetOperationsClient;
@@ -374,7 +382,8 @@
     * @return
     */
    @Override
    public PageInfo<ClockInStatisticsDetailsDto> getClockInStatisticsDetails(ClockInStatisticsDetailsVo query) {
    public GetClockInStatisticsDetailsDto getClockInStatisticsDetails(ClockInStatisticsDetailsVo query) {
        GetClockInStatisticsDetailsDto dto = new GetClockInStatisticsDetailsDto();
        PageInfo<ClockInStatisticsDetailsDto> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        String startTime = "";
@@ -393,7 +402,21 @@
            clockInStatistic.setRoleName(xpOperationsUserWithRoleVO.getRoles().stream().map(SysRole::getRoleName).collect(Collectors.joining(";")));
        }
        pageInfo.setRecords(clockInStatisticsDetails);
        return pageInfo;
        dto.setList(pageInfo);
        XpOperationsUser xpOperationsUser = xpOperationUserClient.queryById(query.getAppUserId()).getData();
        List<Long> longList = fleetOperationsClient.getFleetIdsByUserId(xpOperationsUser.getId()).getData();
        List<XpSchedulingDetail> list = xpSchedulingDetailService.list(new QueryWrapper<XpSchedulingDetail>().eq("fleetId", longList.get(0)).between(StringUtils.isNotEmpty(startTime), "plan_time", startTime, endTime));
        QueryWrapper<XpClockIn> last1 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 1 or clock_out_result = 1)"
                + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : ""));
        QueryWrapper<XpClockIn> last2 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 2 or clock_out_result = 2)"
                + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : ""));
        QueryWrapper<XpClockIn> last3 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 3 or clock_out_result = 3)"
                + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : ""));
        dto.setShouldClockInCount(list.size() * 2);
        dto.setNormalClockInCount(this.count(last1));
        dto.setLateClockInCount(this.count(last2));
        dto.setMissingClockInCount(this.count(last3));
        return dto;
    }