From 8f39e870ca9519d8a8190c038d15a030149de98e Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期二, 27 八月 2024 09:13:33 +0800
Subject: [PATCH] 修改2.0 bug

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java |  164 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 120 insertions(+), 44 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
index 3bbc7cf..e74f5ff 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -209,7 +209,7 @@
     private ICarService carService;
     
     @Resource
-    private DriverWorkMapper driverWorkMapper;
+    private IDriverWorkService driverWorkService;
 
 
 
@@ -264,7 +264,8 @@
             baseWarpper.setId(orderPrivateCars.get(0).getId());
             return ResultUtil.success(baseWarpper);
         }
-
+    
+        String tripId = redisUtil.getValue("trip" + uid);
         startAddress = startAddress.replaceAll("& #40;", "(");
         startAddress = startAddress.replaceAll("& #41;", ")");
         endAddress = endAddress.replaceAll("& #40;", "(");
@@ -281,7 +282,7 @@
         orderPrivateCar.setPlacementLon(Double.valueOf(placementLon));
         orderPrivateCar.setPlacementLat(Double.valueOf(placementLat));
 
-        ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon));
+        ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon), tripId);
         orderPrivateCar.setPlacementAddress(reverseGeocode.getAddress());
         orderPrivateCar.setStartLon(Double.valueOf(startLon));
         orderPrivateCar.setStartLat(Double.valueOf(startLat));
@@ -346,7 +347,7 @@
                 String value = redisUtil.getValue("DRIVER" + driver.getId());
                 if(ToolUtil.isNotEmpty(value)) {
                     String[] split = value.split(",");
-                    DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]));
+                    DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId);
                     //超时时间
                     long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000);
                     orderPrivateCar.setEstimateArriveTime(new Date(timeOut));
@@ -359,8 +360,8 @@
 
         orderPrivateCar.setIsReassign(1);
         orderPrivateCar.setIsDelete(1);
-        orderPrivateCar.setTripId(UUIDUtil.getRandomCode());
-        DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon());
+        orderPrivateCar.setTripId(tripId);
+        DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon(), tripId);
         Long distance1 = distancematrix1.getDistance();
         orderPrivateCar.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
         this.insert(orderPrivateCar);
@@ -449,14 +450,14 @@
 
         // TODO: 2021/5/11 修改,根据后台设定的派单范围查询范围内有无司机,将单子指派给距离最近的司机(距离相同随机取),范围内没有司机再进行推单流程
         if(orderPrivateCar.getState() == 1){
-            Company query = companyCityService.query1(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString());
+            Company query = companyCityService.query1(uid, orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString());
             if(null == query){
                 return ResultUtil.error(language == 1 ? "起点暂未企业提供服务" : language == 2 ? "Starting point no enterprise to provide services" : "Point de départ pas encore disponible pour les entreprises");
             }
             AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1));
             if(null != assignOrder && assignOrder.getPeople() > 0){//配置了指派规则才处理
                 //获取空闲司机
-                List<Driver> drivers = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机
+                List<Driver> drivers = driverService.queryIdleDriver(orderPrivateCar.getUserId(), 1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机
                 if(drivers.size() > 0){//有司机,直接指派给司机
                     Driver dr = null;
                     if(drivers.size() > 1){
@@ -469,7 +470,7 @@
                                 String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId());
                                 if(null != value){
                                     String[] split = value.split(",");
-                                    DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]));
+                                    DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId);
                                     Long distance = distancematrix.getDistance();
                                     if((0 == m && null == driver) || (distance < m)){
                                         driver = drivers.get(j);
@@ -488,7 +489,7 @@
                             String value = redisUtil.getValue("DRIVER" + driver.getId());
                             if(null != value){
                                 String[] split = value.split(",");
-                                DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]));
+                                DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId);
                                 Long d = distancematrix.getDistance();
                                 if((0 == m && null == dr) || (d.intValue() < m.intValue())){
                                     dr = driver;
@@ -501,8 +502,8 @@
                     }
     
                     Driver driver = driverService.selectById(dr.getId());
-                    DriverWork driverWork = driverWorkMapper.selectOne(new EntityWrapper<DriverWork>().eq("driverId", dr.getId())
-                            .eq("state", 1).like("type", "1").getEntity());
+                    DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", dr.getId())
+                            .eq("state", 1).like("type", "1"));
                     if(driver.getState() == 2 && null != driverWork){
                         orderPrivateCar.setDriverId(dr.getId());
                         orderPrivateCar.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : (
@@ -740,7 +741,7 @@
         if(null == orderPrivateCar){
             return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande.");
         }
-        if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 12){
+        if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11 && orderPrivateCar.getState() != 12){
             return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale.");
         }
         
@@ -839,7 +840,7 @@
         }
         
         //修改行程信息
-        if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){
+        if((orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12) && null != orderPrivateCar.getDriverId()){
             fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null);
         }
         
@@ -1016,12 +1017,12 @@
                     if(ToolUtil.isNotEmpty(vehicle)){
                         integers = JSON.parseArray(vehicle).toJavaList(Integer.class);
                     }
-                    Company query = companyCityService.query1(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司
+                    Company query = companyCityService.query1(orderPrivateCar.getUserId(), String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司
                     List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数
                     for(int i = 1; i <= querys.size(); i++){
                         PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0);
                         //获取空闲司机
-                        List<Driver> list = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机
+                        List<Driver> list = driverService.queryIdleDriver(orderPrivateCar.getUserId(), 1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机
                         System.err.println("【" + orderPrivateCar.getId() + "】空闲司机:" + JSON.toJSONString(list));
                         if(list.size() > 0){
                             double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数
@@ -1040,8 +1041,8 @@
                                 }
     
                                 Driver driver1 = driverService.selectById(driver.getId());
-                                DriverWork driverWork = driverWorkMapper.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId())
-                                        .eq("state", 1).like("type", "1").getEntity());
+                                DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId())
+                                        .eq("state", 1).like("type", "1"));
                                 if(driver1.getState() != 2 || null == driverWork){
                                     continue;
                                 }
@@ -1435,7 +1436,7 @@
                             if(null != orderPrivateCar.getDriverId()){
                                 aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId());
                             }
-                            Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000);
+                            Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                             if(1 == language){
                                 document.getElementById("english").remove();
                                 document.getElementById("french").remove();
@@ -1506,6 +1507,12 @@
                                 pay_type_chinese.text("余额支付");
                                 Element pay_money_chinese = document.getElementById("pay_money_chinese");
                                 pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_chinese = document.getElementById("dispute_chinese");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_chinese.remove();
+                                }
                                 Element pdf_chinese = document.getElementById("pdf_chinese");
                                 pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_chinese = document.getElementById("lost_item_chinese");
@@ -1607,6 +1614,12 @@
                                 pay_type_english.text("I-GO Wallet");
                                 Element pay_money_english = document.getElementById("pay_money_english");
                                 pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_english = document.getElementById("dispute_english");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_english.remove();
+                                }
                                 Element pdf_english = document.getElementById("pdf_english");
                                 pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_english = document.getElementById("lost_item_english");
@@ -1708,6 +1721,12 @@
                                 pay_type_french.text("Portefeuille I-GO");
                                 Element pay_money_french = document.getElementById("pay_money_french");
                                 pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_french = document.getElementById("dispute_french");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_french.remove();
+                                }
                                 Element pdf_french = document.getElementById("pdf_french");
                                 pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_french = document.getElementById("lost_item_french");
@@ -1952,7 +1971,7 @@
                             if(null != orderPrivateCar.getDriverId()){
                                 aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId());
                             }
-                            Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000);
+                            Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                             Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
                             if(1 == language){
                                 document.getElementById("english").remove();
@@ -2024,6 +2043,12 @@
                                 pay_type_chinese.text("现金");
                                 Element pay_money_chinese = document.getElementById("pay_money_chinese");
                                 pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_chinese = document.getElementById("dispute_chinese");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_chinese.remove();
+                                }
                                 Element pdf_chinese = document.getElementById("pdf_chinese");
                                 pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_chinese = document.getElementById("lost_item_chinese");
@@ -2125,6 +2150,12 @@
                                 pay_type_english.text("Cash");
                                 Element pay_money_english = document.getElementById("pay_money_english");
                                 pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_english = document.getElementById("dispute_english");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_english.remove();
+                                }
                                 Element pdf_english = document.getElementById("pdf_english");
                                 pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_english = document.getElementById("lost_item_english");
@@ -2226,6 +2257,12 @@
                                 pay_type_french.text("En espèces");
                                 Element pay_money_french = document.getElementById("pay_money_french");
                                 pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_french = document.getElementById("dispute_french");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_french.remove();
+                                }
                                 Element pdf_french = document.getElementById("pdf_french");
                                 pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1");
                                 Element lost_item_french = document.getElementById("lost_item_french");
@@ -2439,7 +2476,7 @@
                     Element user_french = document.getElementById("user_french");
                     user_french.text("Bonjour " + userInfo.getNickName() + ",");
                     Element time_french = document.getElementById("time_french");
-                    time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails.");
+                    time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme I-GO pour plus de détails.");
                 }
 
                 EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus",  document.html());
@@ -2629,7 +2666,7 @@
                             if(null != orderPrivateCar.getDriverId()){
                                 aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId());
                             }
-                            Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000);
+                            Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                             if(1 == language){
                                 document.getElementById("english").remove();
                                 document.getElementById("french").remove();
@@ -2700,6 +2737,12 @@
                                 pay_type_chinese.text(orderPrivateCar.getPayType() == 1 ? "手机支付" : (orderPrivateCar.getPayType() == 2?"银行卡支付":(orderPrivateCar.getPayType() == 3?"余额支付":"现金支付")));
                                 Element pay_money_chinese = document.getElementById("pay_money_chinese");
                                 pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_chinese = document.getElementById("dispute_chinese");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_chinese.remove();
+                                }
                                 Element pdf_chinese = document.getElementById("pdf_chinese");
                                 pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1");
                                 Element lost_item_chinese = document.getElementById("lost_item_chinese");
@@ -2801,6 +2844,12 @@
                                 pay_type_english.text(orderPrivateCar.getPayType() == 1 ? "Mobile money" :(orderPrivateCar.getPayType() == 2?"Bank card":(orderPrivateCar.getPayType() == 3?"I-GO Wallet":"Cash")));
                                 Element pay_money_english = document.getElementById("pay_money_english");
                                 pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_english = document.getElementById("dispute_english");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_english.remove();
+                                }
                                 Element pdf_english = document.getElementById("pdf_english");
                                 pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1");
                                 Element lost_item_english = document.getElementById("lost_item_english");
@@ -2902,6 +2951,12 @@
                                 pay_type_french.text(orderPrivateCar.getPayType() == 1 ? "Argent mobile" : (orderPrivateCar.getPayType() == 2?"Carte bancaire":(orderPrivateCar.getPayType() == 3?"Portefeuille I-GO":"En espèces")));
                                 Element pay_money_french = document.getElementById("pay_money_french");
                                 pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+                                Element dispute_french = document.getElementById("dispute_french");
+                                if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){
+                                    dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")");
+                                }else{
+                                    dispute_french.remove();
+                                }
                                 Element pdf_french = document.getElementById("pdf_french");
                                 pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1");
                                 Element lost_item_french = document.getElementById("lost_item_french");
@@ -3040,18 +3095,29 @@
             }
     
             OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId);
-            long timeOutCancel = 0L;
-            if(null != orderPrivateCar.getEstimateArriveTime()){
-                CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderPrivateCar.getCompanyId()));
-                JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
-                int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000;
-                if(orderPrivateCar.getOrderType() == 1){
-                    timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout;
-                }else{
-                    timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout;
+            Integer driverTimeOutTime = 0;
+            Integer driverTimeOut = 0;
+            CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderPrivateCar.getCompanyId()));
+            JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
+            int driverTimeout1 = jsonObject.getIntValue("driverTimeout");
+            if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){
+                long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L;
+                if(System.currentTimeMillis() > time){
+                    driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
+                    driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
+                    driverTimeOut = 1;
+                }
+            }else{
+                long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L;
+                if(System.currentTimeMillis() >= time){
+                    driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
+                    driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
+                    driverTimeOut = 1;
                 }
             }
-            map.put("timeOutCancel", timeOutCancel);
+    
+            map.put("driverTimeOutTime", driverTimeOutTime);
+            map.put("driverTimeOut", driverTimeOut);
         }
         return maps;
     }
@@ -3062,7 +3128,7 @@
         endTime = dateUtil.getStartOrEndDate(endTime, "end");
         List<Map<String, Object>> list = orderPrivateCarMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid);
         for (Map<String, Object> map : list) {
-            map.put("orderName", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course");
+            map.put("orderName", language == 1 ? "打车" : language == 2 ? "Ride" : "Course");
             if(null != map.get("time")){
                 String time = map.get("time").toString();
                 map.put("time", DateUtil.conversionFormat(language, time));
@@ -3127,21 +3193,30 @@
             companyId = Integer.valueOf(String.valueOf(map.get("companyId")));
         }
         
-        long timeOutCancel = 0L;
-        long driverTimeOut = 0L;
+        Integer driverTimeOutTime = 0;
+        Integer driverTimeOut = 0;
         CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId));
         JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
-        int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000;
+        int driverTimeout1 = jsonObject.getIntValue("driverTimeout");
         if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){
-            timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout;
-            driverTimeOut = orderPrivateCar.getEstimateArriveTime().getTime();
+            long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L;
+            if(System.currentTimeMillis() > time){
+                driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
+                driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
+                driverTimeOut = 1;
+            }
         }else{
-            timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout;
-            driverTimeOut = orderPrivateCar.getTravelTime().getTime();
+            long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L;
+            if(System.currentTimeMillis() >= time){
+                driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
+                driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
+                driverTimeOut = 1;
+            }
         }
         
-        map.put("timeOutCancel", timeOutCancel);
+        map.put("driverTimeOutTime", driverTimeOutTime);
         map.put("driverTimeOut", driverTimeOut);
+        map.put("isDispute", orderPrivateCar.getIsDispute());
         return map;
     }
 
@@ -3196,10 +3271,11 @@
 
         String lnt = "0";
         String lat = "0";
+        String tripId = redisUtil.getValue("trip" + uid);
         if(ToolUtil.isNotEmpty(value)){
             lnt = value.split(",")[0];
             lat = value.split(",")[1];
-            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(lat), Double.valueOf(lnt));
+            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(lat), Double.valueOf(lnt), tripId);
 
             if(null == distancematrix){
                 System.err.println("查询距离出错了");
@@ -3227,7 +3303,7 @@
             orderServerWarpper.setLaveTime("0");
         }
         if(orderPrivateCar.getState() == 5 || orderPrivateCar.getState() == 6){//服务中
-            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon());
+            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon(), tripId);
             if(null == distancematrix){
                 System.err.println("查询距离出错了");
             }else if(distancematrix.getDistance() == 0){
@@ -3270,7 +3346,7 @@
     public List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception {
         List<Map<String, Object>> list = orderPrivateCarMapper.queryRedEnvelope(uid);
         for (Map<String, Object> map : list) {
-            map.put("name", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course");
+            map.put("name", language == 1 ? "打车" : language == 2 ? "Ride" : "Course");
             if(null != map.get("time")){
                 String time = map.get("time").toString();
                 map.put("time", DateUtil.conversionFormat(language, time));

--
Gitblit v1.7.1