From 0001861cc63fc670646a103284b9eaefb193e91f Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期六, 10 八月 2024 17:31:48 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/IgoTravel into 2.0

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java |  613 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 474 insertions(+), 139 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index cc9ef4f..29e067b 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -208,6 +208,9 @@
     @Autowired
     private ICarService carService;
     
+    @Resource
+    private DriverWorkMapper driverWorkMapper;
+    
     
     @Value("${filePath}")
     private String filePath;
@@ -559,6 +562,13 @@
                                 if(bo){
                                     continue;
                                 }
+    
+                                Driver driver1 = driverService.selectById(driver.getId());
+                                DriverWork driverWork = driverWorkMapper.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId())
+                                        .eq("state", 1).like("type", "4").getEntity());
+                                if(null == driverWork || driver1.getState() != 2){
+                                    continue;
+                                }
                                 String text = "";
                                 Integer language1 = driver.getLanguage();
                                 switch (language1){
@@ -574,8 +584,9 @@
         
                                 }
                                 String audioUrl = "";
+                                String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3";
                                 try {
-                                    audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3");
+                                    audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName);
                                 } catch (Exception e) {
                                     throw new RuntimeException(e);
                                 }
@@ -585,7 +596,7 @@
                                     public void run() {
                                         Process process = null;
                                         try {
-                                            process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3");
+                                            process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName);
                                         } catch (IOException e) {
                                             throw new RuntimeException(e);
                                         }
@@ -643,12 +654,12 @@
          * 1.下了即时单就不能下预约单和即时单
          * 2.下了预约单和再下一张即时单不能再下预约单
          */
-        List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 1, 2, 3, 4, 5, 6,  11);
+        List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 1, 2, 3, 4, 5, 6, 7, 11, 12);
         if(orderPrivateCars.size() > 0){
             return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)");
         }
         int selectCount = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1)
-                .in("state", Arrays.asList(1, 2, 3, 4, 5, 7, 11, 12)));
+                .in("state", Arrays.asList(1, 2, 3, 4, 5, 6, 7, 11, 12)));
         if(0 < selectCount){
             return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "Uncompleted order(s)" : "Commande(s) non complétée(s)");
         }
@@ -744,6 +755,10 @@
         orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
         this.insert(orderLogistics);
     
+        UserInfo userInfo = userInfoService.selectById(uid);
+        userInfo.setLanguage(language);
+        userInfoService.updateById(userInfo);
+        
         new Thread(() -> {
             try {
                 String vehicleId = null;
@@ -789,8 +804,9 @@
         
             }
             String audioUrl = "";
+            String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3";
             try {
-                audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3");
+                audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -800,7 +816,7 @@
                 public void run() {
                     Process process = null;
                     try {
-                        process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3");
+                        process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName);
                     } catch (IOException e) {
                         throw new RuntimeException(e);
                     }
@@ -873,62 +889,68 @@
                         dr = drivers.get(0);
                     }
     
-                    orderLogistics.setDriverId(dr.getId());
-                    orderLogistics.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : (
-                            dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1));
-                    orderLogistics.setState(2);
-                    orderLogistics.setCarId(dr.getCarId());
-                    CarService query1 = carServiceMapper.query(1, dr.getCarId());
-                    orderLogistics.setServerCarModelId(query1.getServerCarModelId());
-                    orderLogistics.setSnatchOrderTime(new Date());
-                
-                    dr.setState(3);
-                    driverService.updateById(dr);
-                    this.updateById(orderLogistics);
+                    Driver driver1 = driverService.selectById(dr.getId());
+                    DriverWork driverWork = driverWorkMapper.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId())
+                            .eq("state", 1).like("type", "4").getEntity());
+                    if(driver1.getState() == 2 || null != driverWork){
+                        orderLogistics.setDriverId(dr.getId());
+                        orderLogistics.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : (
+                                dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1));
+                        orderLogistics.setState(2);
+                        orderLogistics.setCarId(dr.getCarId());
+                        CarService query1 = carServiceMapper.query(1, dr.getCarId());
+                        orderLogistics.setServerCarModelId(query1.getServerCarModelId());
+                        orderLogistics.setSnatchOrderTime(new Date());
     
-                    String text = "";
-                    Integer language1 = dr.getLanguage();
-                    switch (language1){
-                        case 1:
-                            text = "收到新的包裹订单,从" + orderLogistics.getStartAddress() + "出发,全程约" + orderLogistics.getEstimatedMileage() + "公里";
-                            break;
-                        case 2:
-                            text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre";
-                            break;
-                        case 3:
-                            text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage";
-                            break;
+                        dr.setState(3);
+                        driverService.updateById(dr);
+                        this.updateById(orderLogistics);
+    
+                        String text = "";
+                        Integer language1 = dr.getLanguage();
+                        switch (language1){
+                            case 1:
+                                text = "收到新的包裹订单,从" + orderLogistics.getStartAddress() + "出发,全程约" + orderLogistics.getEstimatedMileage() + "公里";
+                                break;
+                            case 2:
+                                text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre";
+                                break;
+                            case 3:
+                                text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage";
+                                break;
         
-                    }
-                    String audioUrl = "";
-                    try {
-                        audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3");
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                    //定时任务删除语音文件
-                    new Timer().schedule(new TimerTask() {
-                        @Override
-                        public void run() {
-                            Process process = null;
-                            try {
-                                process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3");
-                            } catch (IOException e) {
-                                throw new RuntimeException(e);
-                            }
-                            if (process != null) {
-                                process.destroy();
-                            }
                         }
-                    }, 30000);
-                    String finalAudioUrl = audioUrl;
-                    new Thread(new Runnable() {
-                        @Override
-                        public void run() {
-                            pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, "");
-                            pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl);
+                        String audioUrl = "";
+                        String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3";
+                        try {
+                            audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName);
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
                         }
-                    }).start();
+                        //定时任务删除语音文件
+                        new Timer().schedule(new TimerTask() {
+                            @Override
+                            public void run() {
+                                Process process = null;
+                                try {
+                                    process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName);
+                                } catch (IOException e) {
+                                    throw new RuntimeException(e);
+                                }
+                                if (process != null) {
+                                    process.destroy();
+                                }
+                            }
+                        }, 30000);
+                        String finalAudioUrl = audioUrl;
+                        new Thread(new Runnable() {
+                            @Override
+                            public void run() {
+                                pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, "");
+                                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl);
+                            }
+                        }).start();
+                    }
                 }
             }
         }
@@ -937,22 +959,6 @@
         //推单操作
         if(orderLogistics.getState() == 1){
             this.pushOrder(orderLogistics);
-        }else{
-//            //接单后定时任务判断司机是否去接乘客,没有则推送提醒
-//            CancleOrder cancleOrder = cancleOrderService.query(orderLogistics.getCompanyId());
-//            if(null != cancleOrder){
-//                JSONObject object = JSON.parseObject(cancleOrder.getContent());
-//                long time = object.getInteger("driverTimeout") * 60000L;
-//                new Timer().schedule(new TimerTask() {
-//                    @Override
-//                    public void run() {
-//                        OrderLogistics orderLogistics1 = OrderLogisticsServiceImpl.this.selectById(orderLogistics.getId());
-//                        if(orderLogistics1.getState() == 2){
-//                            pushUtil.pushDriverTimeOut(1, orderLogistics1.getUserId(), orderLogistics1.getId(), 4);
-//                        }
-//                    }
-//                }, time);
-//            }
         }
     
     
@@ -983,7 +989,7 @@
             return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", "");
         }
         Integer uid = orderLogistics.getUserId();
-        Double orderMoney = orderLogistics.getOrderMoney();
+        BigDecimal orderMoney = new BigDecimal(orderLogistics.getOrderMoney());
         if(orderLogistics.getUrgent() == 2){
 //            orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0;
         }
@@ -997,9 +1003,9 @@
                 Double special = query2.getLogistics();
                 if(null != special){
                     orderLogistics.setDiscount(special);
-                    double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+                    BigDecimal v = orderMoney.multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                     if(orderMoney.compareTo(v) > 0){
-                        orderLogistics.setDiscountMoney(orderMoney - v);
+                        orderLogistics.setDiscountMoney(orderMoney.subtract(v).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                         orderLogistics.setActivityId(query2.getId());
                         orderMoney = v;
                     }
@@ -1027,10 +1033,10 @@
             if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 4){
                 return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", "");
             }
-            if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
+            if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(new BigDecimal(userCouponRecord.getFullMoney())) < 0){
                 return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", "");
             }
-            orderMoney = orderMoney - userCouponRecord.getMoney();
+            orderMoney = orderMoney.subtract(new BigDecimal(userCouponRecord.getMoney())).setScale(2, RoundingMode.HALF_EVEN);
             orderLogistics.setCouponMoney(userCouponRecord.getMoney());
             orderLogistics.setCouponId(couponId);
         }
@@ -1044,10 +1050,10 @@
                         .eq("state", 1).eq("companyId", orderLogistics.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false));
     
                 BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio();
-                BigDecimal multiply1 = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN);
-                if(total.compareTo(multiply1.doubleValue()) >= 0){
+                BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN);
+                if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){
                     orderLogistics.setRedPacketMoney(multiply1.doubleValue());
-                    orderMoney = orderMoney - multiply1.doubleValue();
+                    orderMoney = orderMoney.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN);
                 
                     //获取红包id
                     JSONArray jsonArray = new JSONArray();
@@ -1055,6 +1061,9 @@
                         JSONObject jsonObject = new JSONObject();
                         jsonObject.put("id", userRedPacketRecord.getId());
                         BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount());
+                        if(multiply1.compareTo(BigDecimal.ZERO) == 0){
+                            break;
+                        }
                         if(multiply1.compareTo(remainingAmount) >= 0){
                             userRedPacketRecord.setRemainingAmount(0D);
                             userRedPacketRecord.setEndTime(new Date());
@@ -1063,18 +1072,19 @@
                             jsonObject.put("money", remainingAmount);
                             jsonArray.add(jsonObject);
                             userRedPacketRecordService.updateById(userRedPacketRecord);
-                        }else{
+                        }else if(remainingAmount.compareTo(multiply1) > 0){
                             userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
                             jsonObject.put("money", multiply1);
                             jsonArray.add(jsonObject);
                             userRedPacketRecordService.updateById(userRedPacketRecord);
-                            break;
+                            multiply1 = BigDecimal.ZERO;
                         }
                     }
                     orderLogistics.setRedPacketId(jsonArray.toJSONString());
-                }else{
+                }
+                if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){
                     orderLogistics.setRedPacketMoney(total);
-                    orderMoney = orderMoney - total;
+                    orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN);
                     //获取红包id
                     JSONArray jsonArray = new JSONArray();
                     BigDecimal multiply = new BigDecimal(total);
@@ -1082,6 +1092,9 @@
                         JSONObject jsonObject = new JSONObject();
                         jsonObject.put("id", userRedPacketRecord.getId());
                         BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount());
+                        if(multiply.compareTo(BigDecimal.ZERO) == 0){
+                            break;
+                        }
                         if(multiply.compareTo(remainingAmount) >= 0){
                             userRedPacketRecord.setRemainingAmount(0D);
                             userRedPacketRecord.setEndTime(new Date());
@@ -1090,12 +1103,12 @@
                             jsonObject.put("money", remainingAmount);
                             jsonArray.add(jsonObject);
                             userRedPacketRecordService.updateById(userRedPacketRecord);
-                        }else{
+                        }else if(remainingAmount.compareTo(multiply) > 0){
                             userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
                             jsonObject.put("money", multiply);
                             jsonArray.add(jsonObject);
                             userRedPacketRecordService.updateById(userRedPacketRecord);
-                            break;
+                            multiply = BigDecimal.ZERO;
                         }
                     }
                     orderLogistics.setRedPacketId(jsonArray.toJSONString());
@@ -1103,8 +1116,6 @@
             }
         }
         
-        orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
-
         if(payType == 1) {//手机支付
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
             String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId;
@@ -1114,7 +1125,7 @@
             checkoutRequest.setAccountNumber(userInfo.getPhone());
             checkoutRequest.setCustomerFirstName(userInfo.getFirstName());
             checkoutRequest.setCustomerLastName(userInfo.getLastName());
-            checkoutRequest.setRequestAmount(orderMoney);
+            checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue());
             checkoutRequest.setMerchantTransactionId(merchantTransactionId);
             checkoutRequest.setRequestDescription("Travel completion payment");
             checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi");
@@ -1123,7 +1134,8 @@
             checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html");
             resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest);
             if(resultUtil.getCode()==200){
-                paymentRecordService.saveData(1, null, null, orderId, 4, 1, orderMoney, null, 1);//添加预支付数据
+                paymentRecordService.saveData(1, null, null, orderId, 4, 1,
+                        orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据
             }else{
                 resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", "");
             }
@@ -1140,7 +1152,7 @@
             checkoutRequest.setAccountNumber(bankCard.getCode());
             checkoutRequest.setCustomerFirstName(bankCard.getFirstName());
             checkoutRequest.setCustomerLastName(bankCard.getLastName());
-            checkoutRequest.setRequestAmount(orderMoney);
+            checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue());
             checkoutRequest.setMerchantTransactionId(merchantTransactionId);
             checkoutRequest.setRequestDescription("Travel completion payment");
             checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi");
@@ -1150,7 +1162,8 @@
             resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest);
 
             if(resultUtil.getCode()==200){
-                paymentRecordService.saveData(1, null, null, orderId, 4, 2, orderMoney, null, 1);//添加预支付数据
+                paymentRecordService.saveData(1, null, null, orderId, 4, 2,
+                        orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据
             }else{
                 resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", "");
             }
@@ -1158,11 +1171,11 @@
         }
 
         if(payType == 3){//余额支付
-            if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
+            if(userInfo.getBalance() == null || new BigDecimal(userInfo.getBalance()).compareTo(orderMoney) < 0){
                 return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant", "");
             }
 
-            userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+            userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
 
             SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
             userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
@@ -1175,12 +1188,13 @@
             }
 
             //添加交易明细
-            transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId);
+            transactionDetailsService.saveData(uid, "包裹下单支付",
+                    orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 2, 1, 1, 4, orderId);
             userInfoService.updateById(userInfo);
 
             orderLogistics.setState(8);
             orderLogistics.setPayType(3);
-            orderLogistics.setPayMoney(orderMoney);
+            orderLogistics.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue());
     
             //处理优惠券和红包
             if(null != userCouponRecord){
@@ -1270,8 +1284,43 @@
                     document.getElementsByTag("title").get(0).text("I-GO电子收据");
                     Element title_chinese = document.getElementById("title_chinese");
                     title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
-                    Element xcf_chinese = document.getElementById("xcf_chinese");
-                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_chinese = document.getElementById("qbj_chinese");
+                    qbj_chinese.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_chinese = document.getElementById("scf_chinese");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_chinese.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_chinese_div = document.getElementById("scf_chinese_div");
+                        scf_chinese_div.remove();
+                    }
+                    Element lcf_chinese = document.getElementById("lcf_chinese");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_chinese_div = document.getElementById("lcf_chinese_div");
+                        lcf_chinese_div.remove();
+                    }
+                    Element ddf_chinese = document.getElementById("ddf_chinese");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_chinese.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_chinese_div = document.getElementById("ddf_chinese_div");
+                        ddf_chinese_div.remove();
+                    }
+                    Element glf_chinese = document.getElementById("glf_chinese");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_chinese.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_chinese_div = document.getElementById("glf_chinese_div");
+                        glf_chinese_div.remove();
+                    }
+                    Element tcf_chinese = document.getElementById("tcf_chinese");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_chinese_div = document.getElementById("tcf_chinese_div");
+                        tcf_chinese_div.remove();
+                    }
                     Element bcj_chinese = document.getElementById("bcj_chinese");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1337,8 +1386,43 @@
                     document.getElementsByTag("title").get(0).text("Receipt");
                     Element title_english = document.getElementById("title_english");
                     title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
-                    Element xcf_english = document.getElementById("xcf_english");
-                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_english = document.getElementById("qbj_english");
+                    qbj_english.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_english = document.getElementById("scf_english");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_english.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_english_div = document.getElementById("scf_english_div");
+                        scf_english_div.remove();
+                    }
+                    Element lcf_english = document.getElementById("lcf_english");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_english.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_english_div = document.getElementById("lcf_english_div");
+                        lcf_english_div.remove();
+                    }
+                    Element ddf_english = document.getElementById("ddf_english");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_english.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_english_div = document.getElementById("ddf_english_div");
+                        ddf_english_div.remove();
+                    }
+                    Element glf_english = document.getElementById("glf_english");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_english.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_english_div = document.getElementById("glf_english_div");
+                        glf_english_div.remove();
+                    }
+                    Element tcf_english = document.getElementById("tcf_english");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_english.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_english_div = document.getElementById("tcf_english_div");
+                        tcf_english_div.remove();
+                    }
                     Element bcj_english = document.getElementById("bcj_english");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1404,8 +1488,43 @@
                     document.getElementsByTag("title").get(0).text("Reçu");
                     Element title_french = document.getElementById("title_french");
                     title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
-                    Element xcf_french = document.getElementById("xcf_french");
-                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_french = document.getElementById("qbj_french");
+                    qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_french = document.getElementById("scf_french");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_french.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_french_div = document.getElementById("scf_french_div");
+                        scf_french_div.remove();
+                    }
+                    Element lcf_french = document.getElementById("lcf_french");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_french.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_french_div = document.getElementById("lcf_french_div");
+                        lcf_french_div.remove();
+                    }
+                    Element ddf_french = document.getElementById("ddf_french");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_french.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_french_div = document.getElementById("ddf_french_div");
+                        ddf_french_div.remove();
+                    }
+                    Element glf_french = document.getElementById("glf_french");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_french.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_french_div = document.getElementById("glf_french_div");
+                        glf_french_div.remove();
+                    }
+                    Element tcf_french = document.getElementById("tcf_french");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_french.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_french_div = document.getElementById("tcf_french_div");
+                        tcf_french_div.remove();
+                    }
                     Element bcj_french = document.getElementById("bcj_french");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1526,13 +1645,14 @@
             userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
 
             //添加交易明细
-            transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId);
+            transactionDetailsService.saveData(uid, "包裹下单支付",
+                    orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 2, 1, 1, 4, orderId);
             userInfoService.updateById(userInfo);
 
             orderLogistics.setState(8);//小件物流先支付后司机抢单
             orderLogistics.setDriverPay(1);
             orderLogistics.setPayType(4);
-            orderLogistics.setPayMoney(orderMoney);
+            orderLogistics.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue());
     
             //处理优惠券和红包
             if(null != userCouponRecord){
@@ -1625,7 +1745,7 @@
                                     settlementRecord.setInsertTime(new Date());
                                     settlementRecordService.insert(settlementRecord);
                                 }else{
-                                    settlementRecord.setPayMoney(total.doubleValue());
+                                    settlementRecord.setPayMoney(settlementRecord.getPayMoney() + total.doubleValue());
                                     settlementRecordService.updateById(settlementRecord);
                                 }
                                 for (SettlementDetail detail : settlementDetailList) {
@@ -1647,7 +1767,7 @@
                 public void run() {
                     pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
                     pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
-                    pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4);
+                    pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getPayMoney());
                 }
             }).start();
 
@@ -1681,8 +1801,43 @@
                     document.getElementsByTag("title").get(0).text("I-GO电子收据");
                     Element title_chinese = document.getElementById("title_chinese");
                     title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
-                    Element xcf_chinese = document.getElementById("xcf_chinese");
-                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_chinese = document.getElementById("qbj_chinese");
+                    qbj_chinese.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_chinese = document.getElementById("scf_chinese");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_chinese.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_chinese_div = document.getElementById("scf_chinese_div");
+                        scf_chinese_div.remove();
+                    }
+                    Element lcf_chinese = document.getElementById("lcf_chinese");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_chinese_div = document.getElementById("lcf_chinese_div");
+                        lcf_chinese_div.remove();
+                    }
+                    Element ddf_chinese = document.getElementById("ddf_chinese");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_chinese.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_chinese_div = document.getElementById("ddf_chinese_div");
+                        ddf_chinese_div.remove();
+                    }
+                    Element glf_chinese = document.getElementById("glf_chinese");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_chinese.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_chinese_div = document.getElementById("glf_chinese_div");
+                        glf_chinese_div.remove();
+                    }
+                    Element tcf_chinese = document.getElementById("tcf_chinese");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_chinese_div = document.getElementById("tcf_chinese_div");
+                        tcf_chinese_div.remove();
+                    }
                     Element bcj_chinese = document.getElementById("bcj_chinese");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1748,8 +1903,43 @@
                     document.getElementsByTag("title").get(0).text("Receipt");
                     Element title_english = document.getElementById("title_english");
                     title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
-                    Element xcf_english = document.getElementById("xcf_english");
-                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_english = document.getElementById("qbj_english");
+                    qbj_english.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_english = document.getElementById("scf_english");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_english.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_english_div = document.getElementById("scf_english_div");
+                        scf_english_div.remove();
+                    }
+                    Element lcf_english = document.getElementById("lcf_english");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_english.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_english_div = document.getElementById("lcf_english_div");
+                        lcf_english_div.remove();
+                    }
+                    Element ddf_english = document.getElementById("ddf_english");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_english.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_english_div = document.getElementById("ddf_english_div");
+                        ddf_english_div.remove();
+                    }
+                    Element glf_english = document.getElementById("glf_english");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_english.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_english_div = document.getElementById("glf_english_div");
+                        glf_english_div.remove();
+                    }
+                    Element tcf_english = document.getElementById("tcf_english");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_english.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_english_div = document.getElementById("tcf_english_div");
+                        tcf_english_div.remove();
+                    }
                     Element bcj_english = document.getElementById("bcj_english");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1815,8 +2005,43 @@
                     document.getElementsByTag("title").get(0).text("Reçu");
                     Element title_french = document.getElementById("title_french");
                     title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
-                    Element xcf_french = document.getElementById("xcf_french");
-                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_french = document.getElementById("qbj_french");
+                    qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_french = document.getElementById("scf_french");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_french.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_french_div = document.getElementById("scf_french_div");
+                        scf_french_div.remove();
+                    }
+                    Element lcf_french = document.getElementById("lcf_french");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_french.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_french_div = document.getElementById("lcf_french_div");
+                        lcf_french_div.remove();
+                    }
+                    Element ddf_french = document.getElementById("ddf_french");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_french.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_french_div = document.getElementById("ddf_french_div");
+                        ddf_french_div.remove();
+                    }
+                    Element glf_french = document.getElementById("glf_french");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_french.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_french_div = document.getElementById("glf_french_div");
+                        glf_french_div.remove();
+                    }
+                    Element tcf_french = document.getElementById("tcf_french");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_french.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_french_div = document.getElementById("tcf_french_div");
+                        tcf_french_div.remove();
+                    }
                     Element bcj_french = document.getElementById("bcj_french");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2193,8 +2418,43 @@
                     document.getElementsByTag("title").get(0).text("I-GO电子收据");
                     Element title_chinese = document.getElementById("title_chinese");
                     title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
-                    Element xcf_chinese = document.getElementById("xcf_chinese");
-                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_chinese = document.getElementById("qbj_chinese");
+                    qbj_chinese.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_chinese = document.getElementById("scf_chinese");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_chinese.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_chinese_div = document.getElementById("scf_chinese_div");
+                        scf_chinese_div.remove();
+                    }
+                    Element lcf_chinese = document.getElementById("lcf_chinese");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_chinese_div = document.getElementById("lcf_chinese_div");
+                        lcf_chinese_div.remove();
+                    }
+                    Element ddf_chinese = document.getElementById("ddf_chinese");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_chinese.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_chinese_div = document.getElementById("ddf_chinese_div");
+                        ddf_chinese_div.remove();
+                    }
+                    Element glf_chinese = document.getElementById("glf_chinese");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_chinese.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_chinese_div = document.getElementById("glf_chinese_div");
+                        glf_chinese_div.remove();
+                    }
+                    Element tcf_chinese = document.getElementById("tcf_chinese");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_chinese_div = document.getElementById("tcf_chinese_div");
+                        tcf_chinese_div.remove();
+                    }
                     Element bcj_chinese = document.getElementById("bcj_chinese");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2260,8 +2520,43 @@
                     document.getElementsByTag("title").get(0).text("Receipt");
                     Element title_english = document.getElementById("title_english");
                     title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
-                    Element xcf_english = document.getElementById("xcf_english");
-                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_english = document.getElementById("qbj_english");
+                    qbj_english.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_english = document.getElementById("scf_english");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_english.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_english_div = document.getElementById("scf_english_div");
+                        scf_english_div.remove();
+                    }
+                    Element lcf_english = document.getElementById("lcf_english");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_english.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_english_div = document.getElementById("lcf_english_div");
+                        lcf_english_div.remove();
+                    }
+                    Element ddf_english = document.getElementById("ddf_english");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_english.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_english_div = document.getElementById("ddf_english_div");
+                        ddf_english_div.remove();
+                    }
+                    Element glf_english = document.getElementById("glf_english");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_english.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_english_div = document.getElementById("glf_english_div");
+                        glf_english_div.remove();
+                    }
+                    Element tcf_english = document.getElementById("tcf_english");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_english.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_english_div = document.getElementById("tcf_english_div");
+                        tcf_english_div.remove();
+                    }
                     Element bcj_english = document.getElementById("bcj_english");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2327,8 +2622,43 @@
                     document.getElementsByTag("title").get(0).text("Reçu");
                     Element title_french = document.getElementById("title_french");
                     title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
-                    Element xcf_french = document.getElementById("xcf_french");
-                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element qbj_french = document.getElementById("qbj_french");
+                    qbj_french.text("GHS " + new BigDecimal(orderLogistics.getStartMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    Element scf_french = document.getElementById("scf_french");
+                    if(null != orderLogistics.getDurationMoney() && orderLogistics.getDurationMoney() > 0){
+                        scf_french.text("GHS " + new BigDecimal(orderLogistics.getDurationMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element scf_french_div = document.getElementById("scf_french_div");
+                        scf_french_div.remove();
+                    }
+                    Element lcf_french = document.getElementById("lcf_french");
+                    if(null != orderLogistics.getMileageMoney() && orderLogistics.getMileageMoney() > 0){
+                        lcf_french.text("GHS " + new BigDecimal(orderLogistics.getMileageMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element lcf_french_div = document.getElementById("lcf_french_div");
+                        lcf_french_div.remove();
+                    }
+                    Element ddf_french = document.getElementById("ddf_french");
+                    if(null != orderLogistics.getWaitMoney() && orderLogistics.getWaitMoney() > 0){
+                        ddf_french.text("GHS " + new BigDecimal(orderLogistics.getWaitMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element ddf_french_div = document.getElementById("ddf_french_div");
+                        ddf_french_div.remove();
+                    }
+                    Element glf_french = document.getElementById("glf_french");
+                    if(null != orderLogistics.getRoadTollMoney() && orderLogistics.getRoadTollMoney() > 0){
+                        glf_french.text("GHS " + new BigDecimal(orderLogistics.getRoadTollMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element glf_french_div = document.getElementById("glf_french_div");
+                        glf_french_div.remove();
+                    }
+                    Element tcf_french = document.getElementById("tcf_french");
+                    if(null != orderLogistics.getParkMoney() && orderLogistics.getParkMoney() > 0){
+                        tcf_french.text("GHS " + new BigDecimal(orderLogistics.getParkMoney()).setScale(2, RoundingMode.HALF_EVEN));
+                    }else{
+                        Element tcf_french_div = document.getElementById("tcf_french_div");
+                        tcf_french_div.remove();
+                    }
                     Element bcj_french = document.getElementById("bcj_french");
                     if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                         bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2584,12 +2914,15 @@
     
             OrderLogistics orderLogistics = this.selectById(orderId);
             long timeOutCancel = 0L;
+            long driverTimeOut = 0L;
             if(null != orderLogistics.getEstimateArriveTime()){
                 CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId()));
                 JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
                 int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000;
                 timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout;
+                driverTimeOut = orderLogistics.getEstimateArriveTime().getTime();
             }
+            map.put("driverTimeOut", driverTimeOut);
             map.put("timeOutCancel", timeOutCancel);
         }
         return maps;
@@ -2648,7 +2981,7 @@
         if(null == orderLogistics){
             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(orderLogistics.getState() > 5 && orderLogistics.getState() != 11){
+        if(orderLogistics.getState() > 5 && orderLogistics.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.");
         }
     
@@ -2699,13 +3032,13 @@
                     String audioUrl = "";
                     switch (language1){
                         case 1:
-                            audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-CN.mp3";
+                            audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-CN.mp3";
                             break;
                         case 2:
-                            audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-EN.mp3";
+                            audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-EN.mp3";
                             break;
                         case 3:
-                            audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-FR.mp3";
+                            audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-FR.mp3";
                             break;
                     }
                     pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, "");
@@ -2812,6 +3145,11 @@
         if(state == 11){
             map.put("state", map.get("oldState"));
         }
+        if(state == 12){
+            OrderCancel query = orderCancelService.query(orderId, 4, null, null, 1);
+            map.put("cancelPayMoney", null == query ? 0 : query.getMoney());
+            map.put("cancelMoney", null == query ? 0 : query.getMoney());
+        }
         if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){
             map.put("redPacketMoney", null);
             map.put("couponMoney", null);
@@ -2822,6 +3160,7 @@
                 Integer orderNum=this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
                 if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){
                     Double special = query2.getLogistics();
+                    map.put("discount", special);
                     orderLogistics.setDiscount(special);
                     Double orderMoney = orderLogistics.getOrderMoney();
                     double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
@@ -2832,17 +3171,11 @@
             
             }
         }
-//        Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString());
-//        map.put("startCity", geocode.get("city"));
-//        geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString());
-//        map.put("endCity", geocode.get("city"));
-//        GoogleMapUtil.getReverseGeocode()
-        
 
         String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId"));
         map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1);
         map.put("orderType", orderLogistics.getType());
-        if(state == 8){
+        if(state == 8 || state == 9){
             map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html");
         }else{
             map.put("receipt", "");
@@ -2852,12 +3185,14 @@
             companyId = Integer.valueOf(String.valueOf(map.get("companyId")));
         }
         map.put("timeOutCancel", 0);
+        map.put("driverTimeOut", 0);
         if(null != orderLogistics.getEstimateArriveTime()){
             CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId));
             JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
             int driverTimeout = jsonObject.getIntValue("driverTimeout");
             long timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout;
             map.put("timeOutCancel", timeOutCancel);
+            map.put("driverTimeOut", orderLogistics.getEstimateArriveTime().getTime());
         }
         return map;
     }
@@ -2980,7 +3315,7 @@
         if(null == orderLogistics){
             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(orderLogistics.getState() != 13){
+        if(orderLogistics.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.", "");
         }
         OrderCancel orderCancel = null;
@@ -2990,7 +3325,7 @@
             orderCancel = orderCancelService.selectById(cancleId);
         }
         
-        Double amount = queryCancleAmount(id, language).getData().getAmount();
+        Double amount = orderCancel.getMoney();
         if(0 < amount){
             if(payType == 1){//手机支付
                 orderCancel.setPayType(1);
@@ -3212,13 +3547,13 @@
             String audioUrl = "";
             switch (language1){
                 case 1:
-                    audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-CN.mp3";
+                    audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-CN.mp3";
                     break;
                 case 2:
-                    audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-EN.mp3";
+                    audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-EN.mp3";
                     break;
                 case 3:
-                    audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-FR.mp3";
+                    audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-FR.mp3";
                     break;
             }
             pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 4, 1, audioUrl);
@@ -3315,7 +3650,7 @@
                     Element user_chinese = document.getElementById("user_chinese");
                     user_chinese.text("您好 " + userInfo.getNickName() + ",");
                     Element time_chinese = document.getElementById("time_chinese");
-                    time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",详情请查看I-GO平台");
+                    time_chinese.text("此活动有效期在 " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " 至 " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",详情请查看I-GO平台");
                 }
                 if(2 == language){
                     document.getElementById("chinese").remove();
@@ -3324,7 +3659,7 @@
                     Element user_english = document.getElementById("user_english");
                     user_english.text("Hello " + userInfo.getNickName() + ",");
                     Element time_english = document.getElementById("time_english");
-                    time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEnable())) + ",check more details on the app.");
+                    time_english.text("You could use it from " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " to " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ",check more details on the app.");
                 }
                 if(3 == language){
                     document.getElementById("chinese").remove();
@@ -3333,7 +3668,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.getEnable())) + ". 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());

--
Gitblit v1.7.1