From 1bc12efc03f4fcad9fd197f35921e14fc2e9a7d9 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 25 六月 2025 19:03:46 +0800 Subject: [PATCH] bug修改 --- DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 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..cb6156e 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; @@ -364,6 +365,9 @@ try { String[] split = orderId.split(","); Double aDouble = orderService.queryReassignMoney(Integer.valueOf(split[0]), orderType); + if(Objects.isNull(aDouble)){ + return ResultUtil.error("未设置改派金额",null); + } BaseWarpper baseWarpper = new BaseWarpper(); if(orderType == 3){ aDouble = aDouble * split.length; @@ -448,6 +452,8 @@ private IPaymentRecordService paymentRecordService; @Autowired private ITransactionDetailsService transactionDetailsService; + @Autowired + private UserCouponRecordMapper userCouponRecordMapper; /** * 司机手动确认收款 * @param orderId @@ -497,7 +503,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 +513,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 +545,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