From 46a9e15466ed29133dcf130fb0b529dc8f9d80d3 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 30 四月 2025 15:04:22 +0800
Subject: [PATCH] 更换短信供应商

---
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 578f7e7..7176f91 100644
--- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -4,6 +4,7 @@
 import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
 import com.stylefeng.guns.modular.system.dao.DriverWorkMapper;
 import com.stylefeng.guns.modular.system.dao.TUseMoneyMapper;
+import com.stylefeng.guns.modular.system.dao.UserCouponRecordMapper;
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.ChinaMobileUtil;
@@ -448,6 +449,8 @@
     private IPaymentRecordService paymentRecordService;
     @Autowired
     private ITransactionDetailsService transactionDetailsService;
+    @Autowired
+    private UserCouponRecordMapper userCouponRecordMapper;
     /**
      * 司机手动确认收款
      * @param orderId
@@ -497,7 +500,7 @@
             // 平台收入
             double money;
             Driver driver = driverService.selectById(orderTaxi.getDriverId());
-            Company company = companyService.selectById(driver.getFranchiseeId());
+            Company company = companyService.selectById(driver.getCompanyId());
 
             if(orderTaxi.getOrderSource() == 2 || orderTaxi.getOrderSource() == 3){
                 double v = company.getPercentageDeduction() / 100;
@@ -507,6 +510,31 @@
                 money = company.getFixedDeduction();
                 moneyTwo = orderTaxi.getOrderMoney()-money;
             }
+            Double orderMoney = orderTaxi.getOrderMoney();
+            if (orderTaxi.getCouponId()!=null){
+                UserCouponRecord userCouponRecord = userCouponRecordMapper.selectById(orderTaxi.getCouponId());
+//                    if(userCouponRecord.getCompanyId() != orderTaxi.getCompanyId()){
+//                        return ResultUtil.error("优惠券不能用于此订单", "");
+//                    }
+//                    if(userCouponRecord.getState() == 2){
+//                        return ResultUtil.error("优惠券已使用", "");
+//                    }
+//                    if(userCouponRecord.getState() == 3){
+//                        return ResultUtil.error("优惠券已过期", "");
+//                    }
+//                    if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 2){
+//                        return ResultUtil.error("优惠券不能用于此类型订单", "");
+//                    }
+//                    if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
+//                        return ResultUtil.error("优惠券不能用于此订单", "");
+//                    }
+                    orderMoney = orderMoney - userCouponRecord.getMoney();
+                    orderTaxi.setCouponMoney(userCouponRecord.getMoney());
+                    orderTaxi.setCouponId(orderTaxi.getCouponId());
+            }
+            orderTaxi.setPayMoney(orderMoney);
+            orderTaxiService.updateById(orderTaxi);
+
             driver.setBalance(driver.getBalance() + moneyTwo);
             // 新增扣除使用费记录
             transactionDetailsService.saveDataTaxi(driver.getId(), "软件使用费", money, 2, 1, 2, 6, orderTaxi.getId(),placeOrderWay,company.getId());
@@ -514,6 +542,9 @@
             transactionDetailsService.saveDataTaxi(driver.getId(), "完成订单", moneyTwo, 1, 1, 2, 2, orderTaxi.getId(),placeOrderWay,company.getId());
 
             driverService.updateById(driver);
+
+            pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState());
+
             return ResultUtil.success();
         }catch (Exception e){
             e.printStackTrace();

--
Gitblit v1.7.1