From cb7e84fe6e40f3ce3ed1fe3fb3b4c0da8c847793 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 27 八月 2025 23:51:22 +0800
Subject: [PATCH] 修改bug

---
 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java |  107 +++++++++++++++++++++++++++++------------------------
 1 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
index 9d06f60..bc3a9eb 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -222,7 +222,7 @@
 //        }
 
         // 是否推广订单
-        Integer promotion = isPromotion(orderTaxi.getUserId());
+        Integer promotion = isPromotion(orderTaxi.getUserId(), driver.getPlaceOfEmployment());
         if(promotion!=null){
             orderTaxi.setPromotion(2);
             Driver driver1 = driverService.selectById(promotion);
@@ -251,18 +251,20 @@
             orderTaxi.setTravelId(travelItinerary);
         }else{
             //改派抢单
-            Company company1 = companyService.selectById(driver.getCompanyId());
-            //中台修改订单状态
-            ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
-            request1.setOrderId(orderTaxi.getTravelId());
-            request1.setStatus(orderTaxi.getState());
-            request1.setDriverId(driver.getEmpId().toString());
-            if(2 == orderTaxi.getPromotion()){
-                Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
-                request1.setPromoterId(driver1.getEmpId().toString());
+            if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){
+                Company company1 = companyService.selectById(driver.getCompanyId());
+                //中台修改订单状态
+                ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
+                request1.setOrderId(orderTaxi.getTravelId());
+                request1.setStatus(orderTaxi.getState());
+                request1.setDriverId(driver.getEmpId().toString());
+                if(2 == orderTaxi.getPromotion()){
+                    Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
+                    request1.setPromoterId(driver1.getEmpId().toString());
+                }
+                request1.setSupplierShopId(company1.getEnterCode());
+                OrderUtil.modifyTravelItinerary(request1);
             }
-            request1.setSupplierShopId(company1.getEnterCode());
-            OrderUtil.modifyTravelItinerary(request1);
         }
         this.updateById(orderTaxi);
 
@@ -336,11 +338,11 @@
 
         return ResultUtil.success(orderTaxi.getId());
     }
-    private Integer isPromotion(Integer userId){
+    private Integer isPromotion(Integer userId, String code){
         UserInfo userInfo = userInfoMapper.selectById(userId);
         if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){
-            String registAreaCode = userInfo.getRegistAreaCode();
-            TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1).eq("districtCode", registAreaCode).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1"));
+            TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1)
+                    .eq("districtCode", code).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1"));
             if(tDriverPromotionActivity!=null){
                 return userInfo.getBindDriverId();
             }
@@ -379,6 +381,7 @@
         orderTaxi.setOrderType(orderPrivateCar.getOrderType());
         orderTaxi.setOrderSource(orderPrivateCar.getOrderSource());
         orderTaxi.setIsDelete(1);
+        orderTaxi.setIsReassign(1);
         return orderTaxi;
     }
 
@@ -531,19 +534,21 @@
         }
         this.updateById(orderTaxi);
     
-        Driver driver = driverService.selectById(orderTaxi.getDriverId());
-        Company company = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
-        request.setOrderId(orderTaxi.getTravelId());
-        request.setStatus(orderTaxi.getState());
-        request.setDriverId(driver.getEmpId().toString());
-        if(2 == orderTaxi.getPromotion()){
-            Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
-            request.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){
+            Driver driver = driverService.selectById(orderTaxi.getDriverId());
+            Company company = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
+            request.setOrderId(orderTaxi.getTravelId());
+            request.setStatus(orderTaxi.getState());
+            request.setDriverId(driver.getEmpId().toString());
+            if(2 == orderTaxi.getPromotion()){
+                Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
+                request.setPromoterId(driver1.getEmpId().toString());
+            }
+            request.setSupplierShopId(company.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request);
         }
-        request.setSupplierShopId(company.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request);
 
         // TODO: 2020/6/5 推送状态
         new Thread(new Runnable() {
@@ -589,18 +594,20 @@
         this.updateById(orderTaxi);
     
         Driver driver = driverService.selectById(orderTaxi.getDriverId());
-        Company company = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
-        request.setOrderId(orderTaxi.getTravelId());
-        request.setStatus(orderTaxi.getState());
-        request.setDriverId(driver.getEmpId().toString());
-        if(2 == orderTaxi.getPromotion()){
-            Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
-            request.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){
+            Company company = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
+            request.setOrderId(orderTaxi.getTravelId());
+            request.setStatus(orderTaxi.getState());
+            request.setDriverId(driver.getEmpId().toString());
+            if(2 == orderTaxi.getPromotion()){
+                Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
+                request.setPromoterId(driver1.getEmpId().toString());
+            }
+            request.setSupplierShopId(company.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request);
         }
-        request.setSupplierShopId(company.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request);
 
         //回滚司机状态为空闲
         driver.setState(2);
@@ -642,18 +649,20 @@
         this.updateById(orderTaxi);
     
         Driver driver = driverService.selectById(orderTaxi.getDriverId());
-        Company company1 = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
-        request1.setOrderId(orderTaxi.getTravelId());
-        request1.setStatus(orderTaxi.getState());
-        request1.setDriverId(driver.getEmpId().toString());
-        if(2 == orderTaxi.getPromotion()){
-            Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
-            request1.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){
+            Company company1 = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
+            request1.setOrderId(orderTaxi.getTravelId());
+            request1.setStatus(orderTaxi.getState());
+            request1.setDriverId(driver.getEmpId().toString());
+            if(2 == orderTaxi.getPromotion()){
+                Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId());
+                request1.setPromoterId(driver1.getEmpId().toString());
+            }
+            request1.setSupplierShopId(company1.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request1);
         }
-        request1.setSupplierShopId(company1.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request1);
 
         //回滚司机状态为空闲
         driver.setState(2);

--
Gitblit v1.7.1