From 818937959bb19d3669585fa87a526bffe9ce77a4 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 24 四月 2025 09:28:41 +0800
Subject: [PATCH] 修改默认验证码

---
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java |  159 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 125 insertions(+), 34 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 b43b3ab..197c81d 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
@@ -46,7 +46,8 @@
 
     @Autowired
     private GDMapElectricFenceUtil gdMapElectricFenceUtil;
-
+    @Autowired
+    private ITransactionDetailsService transactionDetailsService;
     @Autowired
     private GDFalconUtil gdFalconUtil;
 
@@ -208,7 +209,22 @@
             Company company = companyService.selectById(driver.getCompanyId());
             orderTaxi.setState(9);
             driver.setState(2);
-            driver.setBalance(driver.getBalance() - company.getFixedDeduction());
+//            driver.setBalance(driver.getBalance() - company.getFixedDeduction());
+
+            if(Objects.isNull(company)){
+                company = companyService.selectById(driver.getCompanyId());
+            }
+            // 平台收入
+            double money;
+            if(orderTaxi.getOrderSource() == 2 || orderTaxi.getOrderSource() == 3){
+                double v = company.getPercentageDeduction() / 100;
+                money = v * orderTaxi.getOrderMoney();
+            }else {
+                money = company.getFixedDeduction();
+            }
+            driver.setBalance(driver.getBalance() - money);
+            // 新增扣除使用费记录
+            transactionDetailsService.saveData(driver.getId(), "软件使用费", money, 2, 1, 2, 6, orderTaxi.getId(),company.getId());
 
             driverService.updateById(driver);
             Car car = carService.selectById(driver.getCarId());
@@ -438,33 +454,57 @@
                 orderTaxi.setGetoffLat(lat);
                 orderTaxi.setGetoffAddress(address);
                 orderTaxi.setGetoffTime(new Date());
-                orderTaxi.setState(6);
+                if(orderTaxi.getPayManner()==3){
+                    orderTaxi.setState(9);
+                    Driver driver = driverService.selectById(orderTaxi.getDriverId());
+
+                    Company company = companyService.selectById(driver.getFranchiseeId());
+                    if(Objects.isNull(company)){
+                        company = companyService.selectById(driver.getCompanyId());
+                    }
+                    TransactionDetails transactionDetails = new TransactionDetails();
+                    driver.setBalance(driver.getBalance() - company.getFixedDeduction());
+                    transactionDetails.setMoney(company.getFixedDeduction());
+                    // 新增扣除使用费记录
+                    transactionDetails.setUserId(driver.getId());
+                    transactionDetails.setInsertTime(new Date());
+                    transactionDetails.setRemark("软件使用费");
+                    transactionDetails.setState(2);
+                    transactionDetails.setType(1);
+                    transactionDetails.setUserType(2);
+                    transactionDetails.setOrderType(6);
+                    transactionDetails.setOrderId(orderTaxi.getId());
+                    transactionDetailsMapper.insert(transactionDetails);
+                    driverService.updateById(driver);
+                }else {
+                    orderTaxi.setState(6);
+                }
                 orderTaxi.setEndServiceTime(new Date());
 
 //                List<TUseMoney> money = useMoneyMapper.selectList(null);
-                Driver driver = driverService.selectById(orderTaxi.getDriverId());
-                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.setState(2);
-                transactionDetails.setType(1);
-                transactionDetails.setUserType(2);
-                transactionDetails.setOrderType(6);
-                transactionDetails.setOrderId(orderTaxi.getId());
-                transactionDetailsMapper.insert(transactionDetails);
-                driverService.updateById(driver);
+//                Driver driver = driverService.selectById(orderTaxi.getDriverId());
+//                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.setState(2);
+//                transactionDetails.setType(1);
+//                transactionDetails.setUserType(2);
+//                transactionDetails.setOrderType(6);
+//                transactionDetails.setOrderId(orderTaxi.getId());
+//                transactionDetailsMapper.insert(transactionDetails);
+//                driverService.updateById(driver);
                 pushUtil.removeTask(orderId, 2);//删除定时任务,结束推送数据
                 systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderTaxi.getUserId());
                 break;
@@ -499,10 +539,12 @@
         orderTaxi.setPayManner(type);
         if(type == 2){//其他支付,不需要操作,直接完成订单
             orderTaxi = this.setMoney1(orderTaxi, travelFee, parkingFee, crossingFee);
-            orderTaxi.setState(8);
-        }else{
+            orderTaxi.setState(7);
+        }else if (type == 1){
             orderTaxi = this.setMoney2(orderTaxi, parkingFee, crossingFee);
             orderTaxi.setState(7);
+        }else {
+            orderTaxi.setState(8);
         }
         this.updateById(orderTaxi);
 
@@ -722,6 +764,9 @@
             System.err.println("订单数据异常:" + orderId);
             return false;
         }
+        if(orderTaxi.getState() != 5){
+            return false;
+        }
         OrderPosition orderPosition = orderPositionService.queryNew(orderId, 2);
         String now = lon + "," + lat;
         String old = null;
@@ -769,6 +814,52 @@
     public List<OrderTaxi> taskMidAxbUnBindSend() throws Exception {
         return orderTaxiMapper.taskMidAxbUnBindSend();
     }
+
+    @Override
+    public Map<String, Object> queryMoneyInfo(Integer orderId) throws Exception {
+        OrderTaxi orderTaxi = this.selectById(orderId);
+        if(orderTaxi.getState() == 5 || orderTaxi.getState() == 6){//服务中的时候获取实时费用数据
+            if(orderTaxi.getPayManner() == 2){//其他支付,不需要操作,直接完成订单
+                orderTaxi = this.setMoney1(orderTaxi, 0D, 0D, 0D);
+            }else if(orderTaxi.getPayManner() == 1){
+                orderTaxi = this.setMoney2(orderTaxi, 0D, 0D);
+            }else {
+                // 无
+            }
+        }
+
+        // 查询平台服务费
+        TransactionDetails transactionDetails = transactionDetailsService.selectOne(new EntityWrapper<TransactionDetails>()
+                .eq("orderId", orderId)
+                .eq("orderType", 6)
+                .last("LIMIT 1"));
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("orderMoney", orderTaxi.getOrderMoney());//订单金额
+        map.put("startMileage", orderTaxi.getStartMileage());//起步价
+        map.put("startMoney", orderTaxi.getStartMoney());//起步价
+        map.put("mileageKilometers", orderTaxi.getMileageKilometers());//里程费
+        map.put("mileageMoney", orderTaxi.getMileageMoney());//里程费
+        map.put("duration", orderTaxi.getDuration());//时长费
+        map.put("durationMoney", orderTaxi.getDurationMoney());//时长费
+        map.put("wait", orderTaxi.getWait());//等待费
+        map.put("waitMoney", orderTaxi.getWaitMoney());//等待费
+        map.put("longDistance", orderTaxi.getLongDistance());//远途费
+        map.put("longDistanceMoney", orderTaxi.getLongDistanceMoney());//远途费
+        map.put("parkMoney", orderTaxi.getParkMoney());//停车费
+        map.put("roadTollMoney", orderTaxi.getRoadTollMoney());//过路费
+        map.put("redPacketMoney", orderTaxi.getRedPacketMoney());//红包抵扣金额
+        map.put("couponMoney", orderTaxi.getCouponMoney());//优惠券抵扣金额
+        map.put("discountMoney", orderTaxi.getDiscountMoney());//折扣抵扣金额
+        map.put("discount", orderTaxi.getDiscount());//折扣
+        if(Objects.isNull(transactionDetails)){
+            map.put("platformFee", 0);//折扣
+        }else {
+            map.put("platformFee", transactionDetails.getMoney());//折扣
+        }
+        return map;
+    }
+
     /**
      * 计算价格
      * @param orderTaxi
@@ -887,8 +978,8 @@
 //            OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
             OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
             OrderTaxi.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
-            OrderTaxi.setParkMoney(parkingFee);//停车费
-            OrderTaxi.setRoadTollMoney(crossingFee);//过路费
+            OrderTaxi.setParkMoney(Objects.isNull(parkingFee)?0D:parkingFee);//停车费
+            OrderTaxi.setRoadTollMoney(Objects.isNull(crossingFee)?0D:crossingFee);//过路费
             OrderTaxi.setRedPacketMoney(0D);//红包抵扣
             OrderTaxi.setCouponMoney(0D);//优惠券抵扣
             OrderTaxi.setDiscount(0D);//优惠抵扣
@@ -945,8 +1036,8 @@
 //                OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                 OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                 OrderTaxi.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
-                OrderTaxi.setParkMoney(parkingFee);//停车费
-                OrderTaxi.setRoadTollMoney(crossingFee);//过路费
+                OrderTaxi.setParkMoney(Objects.isNull(parkingFee)?0D:parkingFee);//停车费
+                OrderTaxi.setRoadTollMoney(Objects.isNull(crossingFee)?0D:crossingFee);//过路费
                 OrderTaxi.setRedPacketMoney(0D);//红包抵扣
                 OrderTaxi.setCouponMoney(0D);//优惠券抵扣
                 OrderTaxi.setDiscount(0D);//优惠抵扣
@@ -989,8 +1080,8 @@
 //                OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                 OrderTaxi.setLongDistance(new BigDecimal((d > rule.getDouble("num6")) ? d - rule.getDouble("num6") : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                 OrderTaxi.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());//远途费
-                OrderTaxi.setParkMoney(parkingFee);//停车费
-                OrderTaxi.setRoadTollMoney(crossingFee);//过路费
+                OrderTaxi.setParkMoney(Objects.isNull(parkingFee)?0D:parkingFee);//停车费
+                OrderTaxi.setRoadTollMoney(Objects.isNull(crossingFee)?0D:crossingFee);//过路费
                 OrderTaxi.setRedPacketMoney(0D);//红包抵扣
                 OrderTaxi.setCouponMoney(0D);//优惠券抵扣
                 OrderTaxi.setDiscount(0D);//优惠抵扣

--
Gitblit v1.7.1