From 9ef2e272c6ef99d152c5d6afc95af70a3822c57d Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 09 九月 2023 18:12:28 +0800
Subject: [PATCH] 修改bug

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java |  118 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 55 insertions(+), 63 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
index 4dcd9a2..78b11d2 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -25,6 +25,8 @@
 import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
 import java.util.*;
 
 
@@ -65,13 +67,7 @@
     private GDMapElectricFenceUtil gdMapElectricFenceUtil;
 
     @Autowired
-    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
-
-    @Autowired
     private IOrderTaxiService orderTaxiService;
-
-    @Value("${pushMinistryOfTransport}")
-    private boolean pushMinistryOfTransport;
 
 
     @Resource
@@ -82,6 +78,12 @@
 
     @Autowired
     private IIncomeService incomeService;
+
+    @Autowired
+    private IPaymentRecordService paymentRecordService;
+
+    @Autowired
+    private ITransactionDetailsService transactionDetailsService;
 
 
     @Value("${filePath}")
@@ -99,8 +101,8 @@
      * @throws Exception
      */
     @Override
-    public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId) throws Exception {
-        return orderPrivateCarMapper.queryOrderList(state, driverId);
+    public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId, Integer language) throws Exception {
+        return orderPrivateCarMapper.queryOrderList(state, driverId, language);
     }
 
     /**
@@ -111,8 +113,8 @@
      * @throws Exception
      */
     @Override
-    public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid) throws Exception {
-        return orderPrivateCarMapper.queryMyAllOrder(state, uid);
+    public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid, Integer language) throws Exception {
+        return orderPrivateCarMapper.queryMyAllOrder(state, uid, language);
     }
 
 
@@ -123,8 +125,8 @@
      * @throws Exception
      */
     @Override
-    public Map<String, Object> queryPushOrder(Integer orderId) throws Exception {
-        return orderPrivateCarMapper.queryPushOrder(orderId);
+    public Map<String, Object> queryPushOrder(Integer orderId, Integer language) throws Exception {
+        return orderPrivateCarMapper.queryPushOrder(orderId, language);
     }
 
 
@@ -137,7 +139,7 @@
      * @throws Exception
      */
     @Override
-    public synchronized ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception {
+    public synchronized ResultUtil grabOrder(Integer orderId, Integer uid, Integer language) throws Exception {
         OrderPrivateCar orderPrivateCar = this.selectById(orderId);
         //处理摆渡车的情况
         if(orderPrivateCar.getType() == 2){
@@ -159,15 +161,15 @@
                             .eq("place", orderPrivateCar.getPlace())
             );
             if(list.size() > 0 || list1.size() > 0){
-                return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
+                return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "A little slow. The order's been taken" : "La main est un peu lente oh l’ordre a été volé");
             }
         }
 
         if(orderPrivateCar.getState() == 9){
-            return ResultUtil.error("订单已取消");
+            return ResultUtil.error(language == 1 ? "订单已取消" : language == 2 ? "Order cancelled" : "Commande annulée");
         }
         if(orderPrivateCar.getState() != 1){
-            return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
+            return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "A little slow. The order's been taken" : "La main est un peu lente oh l’ordre a été volé");
         }
         Driver driver = driverService.selectById(uid);
         orderPrivateCar.setDriverId(uid);
@@ -219,20 +221,12 @@
             }
         }).start();
 
-        systemNoticeService.addSystemNotice(2, "您已成功抢得专车订单,请及时联系客户!", orderPrivateCar.getDriverId());
-        systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getName().substring(0, 1) + "师傅,请保持电话畅通!", orderPrivateCar.getUserId());
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                if(pushMinistryOfTransport){
-                    //上传数据
-                    pushMinistryOfTransportUtil.orderCreate(orderId);
-                    pushMinistryOfTransportUtil.orderMatch(orderId);
-                }
-            }
-        }).start();
-
+        systemNoticeService.addSystemNotice(2, language == 1 ? "您已成功抢得打车订单,请及时联系客户!" :
+                language == 2 ? "You have successfully grabbed a taxi order, please contact the customer in time!"
+                        : "Vous avez saisi avec succès une commande de taxi, veuillez contacter le client à temps!", orderPrivateCar.getDriverId());
+        systemNoticeService.addSystemNotice(1, language == 1 ? "您的订单已指派给" + driver.getFirstName() + "师傅,请保持电话畅通!" :
+                language == 2 ? "Your order has been assigned to " + driver.getFirstName() + " master, please keep the phone open!"
+                        : "Votre commande a été attribuée à " + driver.getFirstName() + " master, veuillez garder le téléphone ouvert!", orderPrivateCar.getUserId());
         return ResultUtil.success();
     }
 
@@ -259,19 +253,19 @@
      * @throws Exception
      */
     @Override
-    public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone) throws Exception {
+    public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone, Integer language) throws Exception {
         OrderPrivateCar orderPrivateCar = this.selectById(orderId);
-        if(state==5){
-            UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId());
-            if(!userInfo.getPhone().substring(7, userInfo.getPhone().length()).equals(phone)){
-                return ResultUtil.error("手机号错误");
-            }
-        }
+//        if(state==5){
+//            UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId());
+//            if(!userInfo.getPhone().substring(7, userInfo.getPhone().length()).equals(phone)){
+//                return ResultUtil.error("手机号错误");
+//            }
+//        }
         if(state==3 && orderPrivateCar.getState()!=2){
-            return ResultUtil.error("当前订单不能触发前往预约地点");
+            return ResultUtil.error(language == 1 ? "当前订单不能触发前往预约地点" : language == 2 ? "The current order cannot trigger travel to the reservation" : "La commande en cours ne peut pas déclencher une visite au lieu de rendez-vous");
         }
         if(state==4 && orderPrivateCar.getState()!=3){
-            return ResultUtil.error("当前订单不能到达预约地点");
+            return ResultUtil.error(language == 1 ? "当前订单不能到达预约地点" : language == 2 ? "The current order cannot arrive at the reservation" : "La commande en cours ne peut pas atteindre le rendez-vous");
         }
         /*if(state==5 && orderPrivateCar.getState()!=4){
             return ResultUtil.error("当前订单不能开始服务");
@@ -280,12 +274,12 @@
             case 3://出发前往预约点
                 orderPrivateCar.setState(3);
                 orderPrivateCar.setSetOutTime(new Date());
-                systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderPrivateCar.getUserId());
+                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "he driver has left, please wait patiently" : "Le chauffeur est parti, soyez patient", orderPrivateCar.getUserId());
                 break;
             case 4://到达预约点,等待客户上车
                 orderPrivateCar.setState(4);
                 orderPrivateCar.setArriveTime(new Date());
-                systemNoticeService.addSystemNotice(1, "司机已到达您设置的预约地点,请及时上车", orderPrivateCar.getUserId());
+                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点,请及时上车" : language == 2 ? "The driver has arrived at the reservation place you set, please get on the bus in time" : "Le chauffeur est arrivé au lieu de rendez-vous que vous avez fixé, s’il vous plaît embarquez à temps", orderPrivateCar.getUserId());
                 break;
             case 5://开始服务
                 orderPrivateCar.setBoardingLon(lon);
@@ -297,14 +291,6 @@
 
                 pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位
 
-                new Thread(new Runnable() {
-                    @Override
-                    public void run() {
-                        if(pushMinistryOfTransport){//上传数据
-                            pushMinistryOfTransportUtil.operateDepart(orderId);
-                        }
-                    }
-                }).start();
                 OrderPosition orderPosition = new OrderPosition();
                 orderPosition.setOrderId(orderId);
                 orderPosition.setOrderType(1);
@@ -394,7 +380,7 @@
                     }
                     if(company.getIsSpeFixedOrProportional() == 1){//比例
                         Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney();
-                        d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                        d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
                         c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                     }
                     incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue());
@@ -443,19 +429,6 @@
                 pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
             }
         }).start();
-
-        OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                if(pushMinistryOfTransport){//上传交通数据
-                    pushMinistryOfTransportUtil.baseInfoVehicleTotalMile(finalOrderPrivateCar.getCarId());
-                    pushMinistryOfTransportUtil.operateArrive(orderId);
-                }
-            }
-        }).start();
-
-
         return ResultUtil.success();
     }
 
@@ -760,4 +733,23 @@
     public List<OrderPrivateCar> getSmsOrderList() {
         return this.baseMapper.getSmsOrderList();
     }
+
+
+    @Override
+    public void payOrderPrivateCarCallback(Integer id, String order_id, Integer language) throws Exception {
+        OrderPrivateCar orderPrivateCar = this.selectById(id);
+        PaymentRecord query = paymentRecordService.query(1, orderPrivateCar.getDriverId(), 2, id, 1, null, 1);
+        if(null != query){
+            //添加交易明细
+            transactionDetailsService.saveData(orderPrivateCar.getDriverId(), language == 1 ? "现金收款代付" : language == 2 ? "Cash collection on behalf of payment" : "Paiement en espèces", query.getAmount(), 2, 1, 2, 1, id);
+            orderPrivateCar.setDriverPay(2);
+            this.updateById(orderPrivateCar);
+
+            query.setState(2);
+            query.setCode(order_id);
+            paymentRecordService.updateById(query);
+        }else{
+            System.err.println("预支付数据异常(orderId = "  + id + ")");
+        }
+    }
 }

--
Gitblit v1.7.1