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/specialTrain/server/impl/OrderPrivateCarServiceImpl.java |  120 ++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 69 insertions(+), 51 deletions(-)

diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
index 14e5aee..97df78d 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -232,7 +232,6 @@
                 driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1));
         orderPrivateCar.setState(2);
         orderPrivateCar.setSnatchOrderTime(new Date());
-
         //调用高德创建轨迹
 //        String s = gdFalconUtil.selectTerminal(driver.getPhone());
 //        String track = gdFalconUtil.createTrack(s);
@@ -248,7 +247,7 @@
 
 
         // 是否推广订单
-        Integer promotion = isPromotion(orderPrivateCar.getUserId());
+        Integer promotion = isPromotion(orderPrivateCar.getUserId(), driver.getPlaceOfEmployment());
         if(null != promotion){
             orderPrivateCar.setPromotion(2);
             Driver driver1 = driverService.selectById(promotion);
@@ -277,18 +276,20 @@
             orderPrivateCar.setTravelId(travelItinerary);
         }else{
             //改派抢单
-            Company company1 = companyService.selectById(driver.getCompanyId());
-            //中台修改订单状态
-            ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
-            request1.setOrderId(orderPrivateCar.getTravelId());
-            request1.setStatus(orderPrivateCar.getState());
-            request1.setDriverId(driver.getEmpId().toString());
-            if(2 == orderPrivateCar.getPromotion()){
-                Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
-                request1.setPromoterId(driver1.getEmpId().toString());
+            if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){
+                Company company1 = companyService.selectById(driver.getCompanyId());
+                //中台修改订单状态
+                ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
+                request1.setOrderId(orderPrivateCar.getTravelId());
+                request1.setStatus(orderPrivateCar.getState());
+                request1.setDriverId(driver.getEmpId().toString());
+                if(2 == orderPrivateCar.getPromotion()){
+                    Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
+                    request1.setPromoterId(driver1.getEmpId().toString());
+                }
+                request1.setSupplierShopId(company1.getEnterCode());
+                OrderUtil.modifyTravelItinerary(request1);
             }
-            request1.setSupplierShopId(company1.getEnterCode());
-            OrderUtil.modifyTravelItinerary(request1);
         }
         
         this.updateById(orderPrivateCar);
@@ -375,11 +376,11 @@
     }
 
 
-    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).last(" and  now() between  startTime and endTime AND FIND_IN_SET(" + 1 + ", bizType) limit 1"));
+            TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1)
+                    .eq("districtCode", code).last(" and  now() between  startTime and endTime AND FIND_IN_SET(" + 1 + ", bizType) limit 1"));
             if(tDriverPromotionActivity!=null){
                 return userInfo.getBindDriverId();
             }
@@ -570,19 +571,21 @@
         }
         this.updateById(orderPrivateCar);
     
-        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
-        Company company = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
-        request.setOrderId(orderPrivateCar.getTravelId());
-        request.setStatus(orderPrivateCar.getState());
-        request.setDriverId(driver.getEmpId().toString());
-        if(2 == orderPrivateCar.getPromotion()){
-            Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
-            request.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){
+            Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
+            Company company = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
+            request.setOrderId(orderPrivateCar.getTravelId());
+            request.setStatus(orderPrivateCar.getState());
+            request.setDriverId(driver.getEmpId().toString());
+            if(2 == orderPrivateCar.getPromotion()){
+                Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
+                request.setPromoterId(driver1.getEmpId().toString());
+            }
+            request.setSupplierShopId(company.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request);
         }
-        request.setSupplierShopId(company.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request);
 
         // TODO: 2020/6/5 推送状态
         OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
@@ -652,18 +655,20 @@
         this.updateById(orderPrivateCar);
         
         Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
-        Company company = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
-        request.setOrderId(orderPrivateCar.getTravelId());
-        request.setStatus(7);
-        request.setDriverId(driver.getEmpId().toString());
-        if(2 == orderPrivateCar.getPromotion()){
-            Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
-            request.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){
+            Company company = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest();
+            request.setOrderId(orderPrivateCar.getTravelId());
+            request.setStatus(7);
+            request.setDriverId(driver.getEmpId().toString());
+            if(2 == orderPrivateCar.getPromotion()){
+                Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
+                request.setPromoterId(driver1.getEmpId().toString());
+            }
+            request.setSupplierShopId(company.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request);
         }
-        request.setSupplierShopId(company.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request);
         
 
         pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
@@ -832,6 +837,9 @@
                 JSONObject jsonObject = jsonArray.getJSONObject(i);
                 Integer id = jsonObject.getInteger("id");
                 Double amount = jsonObject.getDouble("amount");
+                if(amount == 0){
+                    continue;
+                }
                 OrderAdditionalFee orderAdditionalFee = new OrderAdditionalFee();
                 orderAdditionalFee.setOrderType(1);
                 orderAdditionalFee.setOrderId(orderId);
@@ -846,18 +854,20 @@
         this.updateById(orderPrivateCar);
     
         Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
-        Company company1 = companyService.selectById(driver.getCompanyId());
-        //中台修改订单状态
-        ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
-        request1.setOrderId(orderPrivateCar.getTravelId());
-        request1.setStatus(orderPrivateCar.getState());
-        request1.setDriverId(driver.getEmpId().toString());
-        if(2 == orderPrivateCar.getPromotion()){
-            Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
-            request1.setPromoterId(driver1.getEmpId().toString());
+        if(ToolUtil.isNotEmpty(orderPrivateCar.getTravelId())){
+            Company company1 = companyService.selectById(driver.getCompanyId());
+            //中台修改订单状态
+            ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest();
+            request1.setOrderId(orderPrivateCar.getTravelId());
+            request1.setStatus(orderPrivateCar.getState());
+            request1.setDriverId(driver.getEmpId().toString());
+            if(2 == orderPrivateCar.getPromotion()){
+                Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId());
+                request1.setPromoterId(driver1.getEmpId().toString());
+            }
+            request1.setSupplierShopId(company1.getEnterCode());
+            OrderUtil.modifyTravelItinerary(request1);
         }
-        request1.setSupplierShopId(company1.getEnterCode());
-        OrderUtil.modifyTravelItinerary(request1);
 
         pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
         systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId(), 1);
@@ -933,7 +943,15 @@
         }
 
         Map<String, Object> map = new HashMap<>();
-        map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额
+        if(orderPrivateCar.getState() == 5){
+            map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额
+        }else{
+            if(orderPrivateCar.getAbnormal() == 2 && orderPrivateCar.getResponsibilityType() > 2 && orderPrivateCar.getAbnormalStatus() == 2){
+                map.put("orderMoney", orderPrivateCar.getResponsibilityMoney());
+            }else{
+                map.put("orderMoney", orderPrivateCar.getOrderMoney()==null?0:orderPrivateCar.getOrderMoney());//订单金额
+            }
+        }
         map.put("startMileage", orderPrivateCar.getStartMileage());//起步价
         map.put("startMoney", orderPrivateCar.getStartMoney());//起步价
         map.put("mileageKilometers", orderPrivateCar.getMileageKilometers());//里程费

--
Gitblit v1.7.1