From 2e9c61a7e8f1e56e43a42175fa3e36ca07b9f600 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 14 一月 2025 11:29:19 +0800
Subject: [PATCH] 司机确认费用

---
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java |   43 +++++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
index 3de1ab6..b43b3ab 100644
--- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -34,6 +34,8 @@
 
     @Autowired
     private IDriverService driverService;
+    @Autowired
+    private ICompanyService companyService;
 
     @Autowired
     private IUserRedPacketRecordService userRedPacketRecordService;
@@ -75,6 +77,12 @@
     @Resource
     private UserInfoMapper userInfoMapper;
 
+    @Resource
+    private TUseMoneyMapper useMoneyMapper;
+
+
+    @Autowired
+    private TransactionDetailsMapper transactionDetailsMapper;
 
 
 
@@ -196,10 +204,11 @@
 //        String track = gdFalconUtil.createTrack(s);
 //        orderTaxi.setTrackId(track);
         if (orderTaxi.getAudioLinkUrl()!=null){
-            List<TUseMoney> money = useMoneyMapper.selectList(null);
+//            List<TUseMoney> money = useMoneyMapper.selectList(null);
+            Company company = companyService.selectById(driver.getCompanyId());
             orderTaxi.setState(9);
             driver.setState(2);
-            driver.setBalance(driver.getBalance() - money.get(0).getMoney());
+            driver.setBalance(driver.getBalance() - company.getFixedDeduction());
 
             driverService.updateById(driver);
             Car car = carService.selectById(driver.getCarId());
@@ -393,13 +402,6 @@
     public Map<String, Object> queryOrderInfo(Integer orderId) throws Exception {
         return orderTaxiMapper.queryOrderInfo(orderId);
     }
-
-    @Resource
-    private TUseMoneyMapper useMoneyMapper;
-
-
-    @Autowired
-    private TransactionDetailsMapper transactionDetailsMapper;
     /**
      * 走订单流程操作
      * @param orderId
@@ -439,15 +441,23 @@
                 orderTaxi.setState(6);
                 orderTaxi.setEndServiceTime(new Date());
 
-                List<TUseMoney> money = useMoneyMapper.selectList(null);
+//                List<TUseMoney> money = useMoneyMapper.selectList(null);
                 Driver driver = driverService.selectById(orderTaxi.getDriverId());
-                driver.setBalance(driver.getBalance() - money.get(0).getMoney());
-                // 新增扣除使用费记录
+                Company company = companyService.selectById(driver.getCompanyId());
                 TransactionDetails transactionDetails = new TransactionDetails();
+                if(orderTaxi.getOrderSource() == 2 || orderTaxi.getOrderSource() == 3){
+                    double v = company.getPercentageDeduction() / 100;
+                    v = v * orderTaxi.getOrderMoney();
+                    driver.setBalance(driver.getBalance() - v);
+                    transactionDetails.setMoney(v);
+                }else {
+                    driver.setBalance(driver.getBalance() - company.getFixedDeduction());
+                    transactionDetails.setMoney(company.getFixedDeduction());
+                }
+                // 新增扣除使用费记录
                 transactionDetails.setUserId(driver.getId());
                 transactionDetails.setInsertTime(new Date());
                 transactionDetails.setRemark("软件使用费");
-                transactionDetails.setMoney(money.get(0).getMoney());
                 transactionDetails.setState(2);
                 transactionDetails.setType(1);
                 transactionDetails.setUserType(2);
@@ -808,19 +818,16 @@
      * @throws Exception
      */
     public OrderTaxi setMoney2(OrderTaxi orderTaxi, Double parkingFee, Double crossingFee) throws Exception {
-        Map<String, Object> query1 = systemPriceMapper.query1(orderTaxi.getCompanyId(), 1);
+        Map<String, Object> query1 = systemPriceMapper.query1(orderTaxi.getCompanyId(), 2);
         //开始根据不同的方式计算金额
         double amount = 0;
         JSONObject jsonObject = JSON.parseObject(String.valueOf(query1.get("content")));
-
-        JSONObject contentExclusive = JSON.parseObject(query1.get("contentExclusive").toString());//独享
-        System.out.println("独享内容"+contentExclusive);
         //乘车类型(1=独享,2=一口价,3=拼车)
         double d = (null == orderTaxi.getMileage() ? 0D : orderTaxi.getMileage());
         System.out.println("行驶里程数"+d);
         //在价格区间按照一口价算,不在区间按实时价格算
         System.out.println("不在区间====================");
-        orderTaxi = calculationPrice(orderTaxi,contentExclusive,jsonObject.getLongValue("num1"),jsonObject.getDouble("num2"),parkingFee,crossingFee);
+        orderTaxi = calculationPrice(orderTaxi,jsonObject,jsonObject.getLongValue("num29"),jsonObject.getDouble("num30"),parkingFee,crossingFee);
         System.out.println("返回订单数据"+orderTaxi);
         return orderTaxi;
     }

--
Gitblit v1.7.1