From 244228feba355b4df8e160fd4c7c353f674044f1 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期六, 14 二月 2026 17:08:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java
index 98a6dfd..9f7a5fe 100644
--- a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java
+++ b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java
@@ -1,10 +1,25 @@
 package com.xiaopeng.maintenance.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xiaopeng.api.feignClient.maintenance.XpCheckLocationClient;
+import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetClient;
+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.model.vehicleConvoy.XpFleet;
+import com.xiaopeng.maintenance.dto.ShiftAttendanceDTO;
+import com.xiaopeng.maintenance.mapper.XpCheckLocationMapper;
+import com.xiaopeng.maintenance.mapper.XpClockInMapper;
 import com.xiaopeng.maintenance.mapper.XpSchedulingDetailMapper;
+import com.xiaopeng.maintenance.mapper.XpShiftMapper;
 import com.xiaopeng.maintenance.service.IXpSchedulingDetailService;
+import com.xiaopeng.maintenance.vo.ShiftAttendanceVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.util.Objects;
 
 /**
  * <p>
@@ -17,4 +32,56 @@
 @Service
 public class XpSchedulingDetailServiceImpl extends ServiceImpl<XpSchedulingDetailMapper, XpSchedulingDetail> implements IXpSchedulingDetailService {
 
+    @Autowired
+    private XpFleetClient xpFleetClient;
+    @Autowired
+    private XpCheckLocationMapper xpCheckLocationMapper;
+    @Autowired
+    private XpShiftMapper xpShiftMapper;
+    @Autowired
+    private XpClockInMapper xpClockInMapper;
+
+    @Override
+    public ShiftAttendanceVO shiftAttendance(ShiftAttendanceDTO dto) {
+        // 查询用户所属车队
+        XpFleet xpFleet = xpFleetClient.getFleetByOperationsUserId(dto.getOperationsUserId()).getData();
+        if (Objects.isNull(xpFleet)) {
+            return null;
+        }
+        // 查询打卡地
+        XpCheckLocation xpCheckLocation = xpCheckLocationMapper.selectById(xpFleet.getLocationId());
+        if (Objects.isNull(xpCheckLocation)) {
+            return null;
+        }
+        // 查询排班明细
+        XpSchedulingDetail schedulingDetail = this.getOne(Wrappers.lambdaQuery(XpSchedulingDetail.class)
+                .likeRight(XpSchedulingDetail::getPlanTime, dto.getSchedulingDate())
+                .eq(XpSchedulingDetail::getFleetId, xpFleet.getId())
+                .last("LIMIT 1"));
+        if (Objects.isNull(schedulingDetail)) {
+            return null;
+        }
+        // 查询班次
+        XpShift xpShift = xpShiftMapper.selectById(schedulingDetail.getShiftId());
+        if (Objects.isNull(xpShift)) {
+            return null;
+        }
+
+        ShiftAttendanceVO shiftAttendanceVO = new ShiftAttendanceVO();
+        shiftAttendanceVO.setXpShift(xpShift);
+        shiftAttendanceVO.setXpCheckLocation(xpCheckLocation);
+        // 查询当前用户打卡信息
+        XpClockIn xpClockIn = xpClockInMapper.selectOne(Wrappers.lambdaQuery(XpClockIn.class)
+                .eq(XpClockIn::getAppUserId, dto.getOperationsUserId())
+                .likeRight(XpClockIn::getClockInTime, dto.getSchedulingDate())
+                .last("LIMIT 1"));
+        if(Objects.isNull(xpClockIn)){
+            shiftAttendanceVO.setClockIn(false);
+            shiftAttendanceVO.setClockOut(false);
+        }else {
+            shiftAttendanceVO.setClockIn(true);
+            shiftAttendanceVO.setClockOut(xpClockIn.getClockOutTime() != null);
+        }
+        return shiftAttendanceVO;
+    }
 }

--
Gitblit v1.7.1