From 751097966dfbd04819c6f3522fce9bd8aef7b8f9 Mon Sep 17 00:00:00 2001
From: chenza <1579529175@qq.com>
Date: 星期二, 14 三月 2023 16:58:38 +0800
Subject: [PATCH] 对接支付转账退款地址

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java |  340 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 199 insertions(+), 141 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java
index ef4f6c1..bf2d89d 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java
@@ -21,7 +21,11 @@
 import com.stylefeng.guns.modular.system.service.IDriverService;
 import com.stylefeng.guns.modular.system.service.IOrderService;
 import com.stylefeng.guns.modular.system.service.ISystemNoticeService;
+import com.stylefeng.guns.modular.system.service.ITransactionDetailsService;
 import com.stylefeng.guns.modular.system.util.*;
+import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo;
+import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil;
+import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo;
 import com.stylefeng.guns.modular.system.warpper.OrderListWarpper;
 import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
 import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
@@ -77,11 +81,8 @@
     @Autowired
     private IOrderLogisticsService orderLogisticsService;
 
-    @Value("${pushMinistryOfTransport}")
-    private boolean pushMinistryOfTransport;
-
     @Autowired
-    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
+    private ITransactionDetailsService transactionDetailsService;
 
 
 
@@ -102,14 +103,14 @@
         pageNum = (pageNum - 1) * size;
         List<Map<String, Object>> datas = new ArrayList<>();
         //出租车
-        List<Map<String, Object>> list = orderTaxiService.queryOrderList(state, uid);
-        datas.addAll(list);
+//        List<Map<String, Object>> list = orderTaxiService.queryOrderList(state, uid);
+//        datas.addAll(list);
         //专车
         List<Map<String, Object>> list1 = orderPrivateCarService.queryOrderList(state, uid);
         datas.addAll(list1);
         //跨城
-        List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid);
-        datas.addAll(list2);
+//        List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid);
+//        datas.addAll(list2);
         //小件物流
         List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(uid);
         datas.addAll(list3);
@@ -183,14 +184,14 @@
         pageNum = (pageNum - 1) * size;
         List<Map<String, Object>> datas = new ArrayList<>();
         //出租车
-        List<Map<String, Object>> list = orderTaxiService.queryMyAllOrder(state, uid);
-        datas.addAll(list);
+//        List<Map<String, Object>> list = orderTaxiService.queryMyAllOrder(state, uid);
+//        datas.addAll(list);
         //专车
         List<Map<String, Object>> list1 = orderPrivateCarService.queryMyAllOrder(state, uid);
         datas.addAll(list1);
         //跨城
-        List<Map<String, Object>> list2 = orderCrossCityService.queryMyAllOrder(state, uid);
-        datas.addAll(list2);
+//        List<Map<String, Object>> list2 = orderCrossCityService.queryMyAllOrder(state, uid);
+//        datas.addAll(list2);
         //小件物流
         List<Map<String, Object>> list3 = orderLogisticsService.queryMyAllOrder(state, uid);
         datas.addAll(list3);
@@ -222,19 +223,17 @@
         switch (orderType){
             case 1://专车
                 map = orderPrivateCarService.queryPushOrder(orderId);
-                String order = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
-                String distance = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order, 1).get("distance");
-                map.put("startDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+                DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(lat), Double.valueOf(lon));
+                map.put("startDistance", null != distancematrix ? distancematrix.getDistance() / 1000 : 0);
 
                 //总距离
-                String end = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
-                distance = gdMapElectricFenceUtil.getDistance(end, order, 1).get("distance");
-                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+                distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(map.get("endLat").toString()), Double.valueOf(map.get("endLon").toString()));
+                map.put("totalDistance", null != distancematrix ? distancematrix.getDistance() / 1000 : 0);
 
                 Integer orderSource = Integer.valueOf(String.valueOf(map.get("orderSource")));
                 if(orderSource == 1 || orderSource == 2 || orderSource == 3){
                     if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "乘客下单");
+                        map.put("type", "乘客创建");
                     }
                     if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
                         map.put("type", "改派");
@@ -248,7 +247,7 @@
                 }
                 if(orderSource == 5){
                     if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "调度下单");
+                        map.put("type", "调度创建");
                     }
                     if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
                         map.put("type", "改派");
@@ -262,90 +261,88 @@
                 }
                 break;
             case 2://出租
-                map = orderTaxiService.queryPushOrder(orderId);
-                String order1 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
-                String distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order1, 1).get("distance");
-                map.put("startDistance", ToolUtil.isNotEmpty(distance1) ? Double.valueOf(distance1) / 1000 : 0);
-
-                //总距离
-                String end1 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
-                distance = gdMapElectricFenceUtil.getDistance(end1, order1, 1).get("distance");
-                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
-
-                Integer orderSource1 = Integer.valueOf(String.valueOf(map.get("orderSource")));
-                if(orderSource1 == 1 || orderSource1 == 2 || orderSource1 == 3){
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "乘客下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "预约");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
-                if(orderSource1 == 5){
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "调度下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "预约");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
+//                map = orderTaxiService.queryPushOrder(orderId);
+//                String order1 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
+//                String distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order1, 1).get("distance");
+//                map.put("startDistance", ToolUtil.isNotEmpty(distance1) ? Double.valueOf(distance1) / 1000 : 0);
+//
+//                //总距离
+//                String end1 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
+//                distance = gdMapElectricFenceUtil.getDistance(end1, order1, 1).get("distance");
+//                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+//
+//                Integer orderSource1 = Integer.valueOf(String.valueOf(map.get("orderSource")));
+//                if(orderSource1 == 1 || orderSource1 == 2 || orderSource1 == 3){
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "乘客下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "预约");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
+//                if(orderSource1 == 5){
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "调度下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "预约");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
                 break;
             case 3://城际
-                map = orderCrossCityService.queryPushOrder(orderId);
-                String order2 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
-                String distance2 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order2, 1).get("distance");
-                map.put("startDistance", ToolUtil.isNotEmpty(distance2) ? Double.valueOf(distance2) / 1000 : 0);
-
-                //总距离
-                String end2 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
-                distance = gdMapElectricFenceUtil.getDistance(end2, order2, 1).get("distance");
-                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
-
-                Integer orderSource2 = Integer.valueOf(String.valueOf(map.get("orderSource")));
-                if(orderSource2 == 1 || orderSource2 == 2 || orderSource2 == 3){
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "乘客下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
-                if(orderSource2 == 5){
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "调度下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
+//                map = orderCrossCityService.queryPushOrder(orderId);
+//                String order2 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
+//                String distance2 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order2, 1).get("distance");
+//                map.put("startDistance", ToolUtil.isNotEmpty(distance2) ? Double.valueOf(distance2) / 1000 : 0);
+//
+//                //总距离
+//                String end2 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
+//                distance = gdMapElectricFenceUtil.getDistance(end2, order2, 1).get("distance");
+//                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+//
+//                Integer orderSource2 = Integer.valueOf(String.valueOf(map.get("orderSource")));
+//                if(orderSource2 == 1 || orderSource2 == 2 || orderSource2 == 3){
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "乘客下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
+//                if(orderSource2 == 5){
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "调度下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
                 break;
-            case 4://同城小件物流
+            case 4://市内小件物流
                 map = orderLogisticsService.queryPushOrder(orderId);
-                String order3 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
-                String distance3 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order3, 1).get("distance");
-                map.put("startDistance", ToolUtil.isNotEmpty(distance3) ? Double.valueOf(distance3) / 1000 : 0);
+                DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(lat), Double.valueOf(lon));
+                map.put("startDistance", null != distancematrix1 ? distancematrix1.getDistance() / 1000 : 0);
 
                 //总距离
-                String end3 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
-                distance = gdMapElectricFenceUtil.getDistance(end3, order3, 1).get("distance");
-                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+                distancematrix1 = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(map.get("endLat").toString()), Double.valueOf(map.get("endLon").toString()));
+                map.put("totalDistance", null != distancematrix1 ? distancematrix1.getDistance() / 1000 : 0);
 
                 Integer orderSource3 = Integer.valueOf(String.valueOf(map.get("orderSource")));
                 if(orderSource3 == 1 || orderSource3 == 2 || orderSource3 == 3){
                     if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "乘客下单");
+                        map.put("type", "乘客创建");
                     }
                     if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
                         map.put("type", "改派");
@@ -353,7 +350,7 @@
                 }
                 if(orderSource3 == 5){
                     if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "调度下单");
+                        map.put("type", "调度创建");
                     }
                     if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
                         map.put("type", "改派");
@@ -361,33 +358,33 @@
                 }
                 break;
             case 5://跨城小件物流
-                map = orderLogisticsService.queryPushOrder(orderId);
-                String order4 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
-                String distance4 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order4, 1).get("distance");
-                map.put("startDistance", ToolUtil.isNotEmpty(distance4) ? Double.valueOf(distance4) / 1000 : 0);
-
-                //总距离
-                String end4 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
-                distance = gdMapElectricFenceUtil.getDistance(end4, order4, 1).get("distance");
-                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
-
-                Integer orderSource4 = Integer.valueOf(String.valueOf(map.get("orderSource")));
-                if(orderSource4 == 1 || orderSource4 == 2 || orderSource4 == 3){
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "乘客下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
-                if(orderSource4 == 5){
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
-                        map.put("type", "调度下单");
-                    }
-                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
-                        map.put("type", "改派");
-                    }
-                }
+//                map = orderLogisticsService.queryPushOrder(orderId);
+//                String order4 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat"));
+//                String distance4 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order4, 1).get("distance");
+//                map.put("startDistance", ToolUtil.isNotEmpty(distance4) ? Double.valueOf(distance4) / 1000 : 0);
+//
+//                //总距离
+//                String end4 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat"));
+//                distance = gdMapElectricFenceUtil.getDistance(end4, order4, 1).get("distance");
+//                map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0);
+//
+//                Integer orderSource4 = Integer.valueOf(String.valueOf(map.get("orderSource")));
+//                if(orderSource4 == 1 || orderSource4 == 2 || orderSource4 == 3){
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "乘客下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
+//                if(orderSource4 == 5){
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){
+//                        map.put("type", "调度下单");
+//                    }
+//                    if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){
+//                        map.put("type", "改派");
+//                    }
+//                }
                 break;
             case 6:
                 break;
@@ -410,13 +407,13 @@
             case 1://专车
                 return orderPrivateCarService.grabOrder(orderId, uid);
             case 2://出租
-                return orderTaxiService.grabOrder(orderId, uid);
+//                return orderTaxiService.grabOrder(orderId, uid);
             case 3://城际
                 return ResultUtil.success();//不作任何操作,跨城默认选择的司机
             case 4://同城小件
                 return orderLogisticsService.grabOrder(orderId, uid);
             case 5://跨城小件
-                return orderLogisticsService.grabOrder(orderId, uid);
+//                return orderLogisticsService.grabOrder(orderId, uid);
             case 6:
                 break;
         }
@@ -468,16 +465,16 @@
                 map = orderPrivateCarService.queryOrderInfo(orderId);
                 break;
             case 2://出租
-                map = orderTaxiService.queryOrderInfo(orderId);
+//                map = orderTaxiService.queryOrderInfo(orderId);
                 break;
             case 3://城际
-                map = orderCrossCityService.queryOrderCrossCityInfo(orderId);
+//                map = orderCrossCityService.queryOrderCrossCityInfo(orderId);
                 break;
             case 4://同城小件
                 map = orderLogisticsService.queryOrderInfo(orderId);
                 break;
             case 5://跨城小件
-                map = orderLogisticsService.queryOrderInfo(orderId);
+//                map = orderLogisticsService.queryOrderInfo(orderId);
                 break;
             case 6:
                 break;
@@ -532,19 +529,22 @@
      */
     @Override
     public ResultUtil process(Integer orderId, Integer orderType, Integer state, Integer uid, Double lon, Double lat,String phone) throws Exception {
-        Map<String, String> geocode = gdMapGeocodingUtil.geocode(String.valueOf(lon), String.valueOf(lat));
-        String address = geocode.get("address");
+        ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lon);
+        if(null == reverseGeocode){
+            return ResultUtil.error("无效的经纬度");
+        }
+        String address = reverseGeocode.getAddress();
         switch (orderType){
             case 1://专车
                 return orderPrivateCarService.process(orderId, state, lon, lat, address,phone);
             case 2://出租
-                return orderTaxiService.process(orderId, state, lon, lat, address);
+//                return orderTaxiService.process(orderId, state, lon, lat, address);
             case 3://城际
-                return orderCrossCityService.process(orderId, state, lon, lat, address);
+//                return orderCrossCityService.process(orderId, state, lon, lat, address);
             case 4://同城小件
                 return orderLogisticsService.process(orderId, state, lon, lat, address);
             case 5://跨城小件
-                return orderLogisticsService.process(orderId, state, lon, lat, address);
+//                return orderLogisticsService.process(orderId, state, lon, lat, address);
             case 6:
                 break;
         }
@@ -935,14 +935,6 @@
                 driverId = orderPrivateCar.getDriverId();
                 state = orderPrivateCar.getState();
 
-                new Thread(new Runnable() {
-                    @Override
-                    public void run() {
-                        if(pushMinistryOfTransport){//上传数据
-                            pushMinistryOfTransportUtil.operatePay(orderId);
-                        }
-                    }
-                }).start();
                 break;
             case 2:
                 OrderTaxi orderTaxi = orderTaxiService.selectById(orderId);
@@ -1054,7 +1046,73 @@
                 }
             }
         }
-        orderPrivateCarService.updateBatchById(orderList);
+        if(orderList.size() > 0){
+            orderPrivateCarService.updateBatchById(orderList);
+        }
+    }
+
+
+    @Override
+    public ResultUtil payOrder(Integer uid, Integer orderId, Integer orderType, Integer payType, Integer language) throws Exception {
+        Double money = 0D;
+        if(orderType == 1){//专车
+            OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
+            money = orderPrivateCar.getPayMoney();
+            if(orderPrivateCar.getPayType() != 4){
+                return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to pay" : "Impossibilité de procéder au paiement");
+            }
+            if(orderPrivateCar.getDriverPay() == 2){
+                return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Non-repeatable payment" : "Aucun paiement en double");
+            }
+            if(payType == 2){//余额支付
+                Driver driver = driverService.selectById(uid);
+                if(driver.getBalance().compareTo(money) < 0){
+                    return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde insuffisant du compte");
+                }
+            }
+            orderPrivateCar.setDriverPay(2);
+            orderPrivateCarService.updateById(orderPrivateCar);
+        }
+        if(orderType == 4){//小件
+            OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
+            money = orderLogistics.getPayMoney();
+            if(orderLogistics.getPayType() != 4){
+                return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to pay" : "Impossibilité de procéder au paiement");
+            }
+            if(orderLogistics.getDriverPay() == 2){
+                return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Non-repeatable payment" : "Aucun paiement en double");
+            }
+            if(payType == 2){//余额支付
+                Driver driver = driverService.selectById(uid);
+                if(driver.getBalance().compareTo(money) < 0){
+                    return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde insuffisant du compte");
+                }
+            }
+            orderLogistics.setDriverPay(2);
+            orderLogisticsService.updateById(orderLogistics);
+        }
+
+        if(0 < money){
+            if(payType == 1){//线上支付
+
+            }
+            if(payType == 2){//余额支付
+                Driver driver = driverService.selectById(uid);
+                driver.setBalance(driver.getBalance() - money);
+                if(driver.getLaveBusinessMoney().compareTo(money) < 0){
+                    double b = money - driver.getLaveBusinessMoney();
+                    driver.setLaveBusinessMoney(0D);
+                    driver.setLaveActivityMoney(driver.getLaveActivityMoney() - b);
+                    driverService.updateById(driver);
+                }else{
+                    driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - money);
+                    driverService.updateById(driver);
+                }
+            }
+
+            transactionDetailsService.saveData(uid, "现金收款代付", money, 2, 1, 2, orderType, orderId);
+        }
+        return ResultUtil.success();
     }
 }
 

--
Gitblit v1.7.1