From e98ce8b681eef92b55884a88ff217e44ec6f15cb Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期四, 22 一月 2026 14:08:12 +0800
Subject: [PATCH] fix:城际专线下单联调修改

---
 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 68 insertions(+), 25 deletions(-)

diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java
index b6eba38..00939a9 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/LineShiftDriverServiceImpl.java
@@ -258,8 +258,8 @@
             }
         }
 
-        // 查询司机在指定日期的排班信息
-        List<Map<String, Object>> shiftList = lineShiftDriverMapper.queryDriverShiftByDate(driverId, date);
+        // 查询司机可预约的班次列表(包括已预约和未预约的)
+        List<Map<String, Object>> shiftList = lineShiftDriverMapper.queryDriverAvailableShifts(driverId, date);
 
         // 按线路分组
         Map<Integer, List<Map<String, Object>>> lineGroupMap = new LinkedHashMap<>();
@@ -308,35 +308,72 @@
             for (Map<String, Object> shiftMap : entry.getValue()) {
                 LineShiftItemWarpper shiftItem = new LineShiftItemWarpper();
                 shiftItem.setLineShiftId(Integer.valueOf(shiftMap.get("lineShiftId").toString()));
-                shiftItem.setLineShiftDriverId(Integer.valueOf(shiftMap.get("lineShiftDriverId").toString()));
                 shiftItem.setStartTime(shiftMap.get("startTime").toString());
                 shiftItem.setEndTime(shiftMap.get("endTime").toString());
-                shiftItem.setLaveSeat(Integer.valueOf(shiftMap.get("laveSeat").toString()));
-                shiftItem.setTotalSeat(Integer.valueOf(shiftMap.get("totalSeat").toString()));
 
-                // 判断状态:已预约的班次,判断是否过期
-                String endTime = shiftMap.get("endTime").toString();
-                boolean isExpired = false;
+                // 判断是否已预约
+                Integer isReserved = Integer.valueOf(shiftMap.get("isReserved").toString());
 
-                // 如果是今天,比较时间;如果是过去的日期,则已过期
-                if (date.equals(today)) {
-                    // 比较当前时间和班次结束时间
-                    isExpired = currentTime.compareTo(endTime) >= 0;
-                } else if (date.compareTo(today) < 0) {
-                    // 过去的日期
-                    isExpired = true;
-                }
+                if (isReserved == 1) {
+                    // 已预约的班次
+                    shiftItem.setLineShiftDriverId(Integer.valueOf(shiftMap.get("lineShiftDriverId").toString()));
+                    shiftItem.setLaveSeat(Integer.valueOf(shiftMap.get("laveSeat").toString()));
+                    shiftItem.setTotalSeat(Integer.valueOf(shiftMap.get("totalSeat").toString()));
 
-                if (isExpired) {
-                    // 已过期
-                    shiftItem.setStatus(2);
-                    shiftItem.setStatusText("已过期");
-                    shiftItem.setCanOperate(false);
+                    // 判断是否过期
+                    String endTime = shiftMap.get("endTime").toString();
+                    boolean isExpired = false;
+
+                    // 如果是今天,比较时间;如果是过去的日期,则已过期
+                    if (date.equals(today)) {
+                        // 比较当前时间和班次结束时间
+                        isExpired = currentTime.compareTo(endTime) >= 0;
+                    } else if (date.compareTo(today) < 0) {
+                        // 过去的日期
+                        isExpired = true;
+                    }
+
+                    if (isExpired) {
+                        // 已过期
+                        shiftItem.setStatus(2);
+                        shiftItem.setStatusText("已过期");
+                        shiftItem.setCanOperate(false);
+                    } else {
+                        // 已预约可操作
+                        shiftItem.setStatus(1);
+                        shiftItem.setStatusText("已预约");
+                        shiftItem.setCanOperate(true);
+                    }
                 } else {
-                    // 已预约可操作
-                    shiftItem.setStatus(1);
-                    shiftItem.setStatusText("已预约");
-                    shiftItem.setCanOperate(true);
+                    // 未预约的班次
+                    shiftItem.setLineShiftDriverId(null);
+                    shiftItem.setLaveSeat(null);
+                    shiftItem.setTotalSeat(null);
+
+                    // 判断是否可预约(未过期)
+                    String endTime = shiftMap.get("endTime").toString();
+                    boolean isExpired = false;
+
+                    // 如果是今天,比较时间;如果是过去的日期,则已过期
+                    if (date.equals(today)) {
+                        // 比较当前时间和班次结束时间
+                        isExpired = currentTime.compareTo(endTime) >= 0;
+                    } else if (date.compareTo(today) < 0) {
+                        // 过去的日期
+                        isExpired = true;
+                    }
+
+                    if (isExpired) {
+                        // 已过期,不可预约
+                        shiftItem.setStatus(2);
+                        shiftItem.setStatusText("已过期");
+                        shiftItem.setCanOperate(false);
+                    } else {
+                        // 可预约
+                        shiftItem.setStatus(3);
+                        shiftItem.setStatusText("可预约");
+                        shiftItem.setCanOperate(false);
+                    }
                 }
 
                 shifts.add(shiftItem);
@@ -394,6 +431,12 @@
         result.setStartSiteName(data.get("startSiteName") != null ? data.get("startSiteName").toString() : null);
         result.setEndSiteId(data.get("endSiteId") != null ? Integer.parseInt(data.get("endSiteId").toString()) : null);
         result.setEndSiteName(data.get("endSiteName") != null ? data.get("endSiteName").toString() : null);
+        // 城市信息
+        result.setStartCityName(data.get("startCityName") != null ? data.get("startCityName").toString() : null);
+        result.setEndCityName(data.get("endCityName") != null ? data.get("endCityName").toString() : null);
+        // 经纬度信息
+        result.setStartLonLat(data.get("startLonLat") != null ? data.get("startLonLat").toString() : null);
+        result.setEndLonLat(data.get("endLonLat") != null ? data.get("endLonLat").toString() : null);
         // 默认点信息
         result.setDefaultPointAddress(data.get("defaultPointAddress") != null ? data.get("defaultPointAddress").toString() : null);
         result.setDefaultPointLon(data.get("defaultPointLon") != null ? Double.parseDouble(data.get("defaultPointLon").toString()) : null);

--
Gitblit v1.7.1