From af335bf1ef9104dc62c721e142eca790356d18b6 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 02 四月 2025 09:42:25 +0800
Subject: [PATCH] 修改bug

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java
index 6ecc3c0..c4c7bb9 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java
@@ -77,6 +77,9 @@
     
     @Resource
     private ITUserService userService;
+    
+    @Resource
+    private ITCarService carService;
 
 
 
@@ -283,6 +286,8 @@
                 for (int i = 0; i < 5; i++) {
                     updateTrip = fleetEngineUtil.updateTrip("COMPLETE", null, null, orderPrivateCar.getTripId(), null, null, null, null);
                     if(updateTrip){
+                        orderPrivateCar.setIsover(1);
+                        tOrderPrivateCarService.updateById(orderPrivateCar);
                         break;
                     }
                     try {
@@ -291,6 +296,9 @@
                         throw new RuntimeException(e);
                     }
                 }
+            }else{
+                orderPrivateCar.setIsover(1);
+                tOrderPrivateCarService.updateById(orderPrivateCar);
             }
             //上报行程
             boolean reportBillableEvent = fleetEngineUtil.reportBillableEvent(orderPrivateCar.getTripId());
@@ -607,7 +615,9 @@
     @ResponseBody
     public Object cancel(@RequestParam Integer tOrderPrivateCarId) {
         TOrderPrivateCar tOrderPrivateCar = tOrderPrivateCarService.selectById(tOrderPrivateCarId);
-
+        if(Arrays.asList(6, 7, 8, 9, 10).contains(tOrderPrivateCar.getState())){
+            return ERROR;
+        }
         //修改之前司机状态 -- 空闲
         if(null != tOrderPrivateCar.getDriverId()){
             TDriver driver = tDriverService.selectById(tOrderPrivateCar.getDriverId());
@@ -631,19 +641,26 @@
         orderCancelMapper.insert(orderCancel);
     
         //修改行程信息
-        boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, tOrderPrivateCar.getTripId(), null, null, null, null);
+        TCar car = carService.selectById(tOrderPrivateCar.getCarId());
+        //修改行程信息
+        boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tOrderPrivateCar.getTripId(), null, null, null, null);
         if(!updateTrip){
             for (int i = 0; i < 5; i++) {
-                updateTrip = fleetEngineUtil.updateTrip("CANCELED", null, null, tOrderPrivateCar.getTripId(), null, null, null, null);
+                updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tOrderPrivateCar.getTripId(), null, null, null, null);
                 if(updateTrip){
+                    tOrderPrivateCar.setIsover(1);
+                    tOrderPrivateCarService.updateById(tOrderPrivateCar);
                     break;
                 }
                 try {
                     Thread.sleep(3000L);
-                }catch (Exception e){
-                    e.printStackTrace();
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
                 }
             }
+        }else{
+            tOrderPrivateCar.setIsover(1);
+            tOrderPrivateCarService.updateById(tOrderPrivateCar);
         }
     
     

--
Gitblit v1.7.1