修改指派司机接口

localizer
ljw 2025-10-20 13:41:27 +08:00
parent 040456e19a
commit cea51a8433
1 changed files with 11 additions and 1 deletions

View File

@ -636,7 +636,17 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
if (driverId == null) return;
Assert.isNull(orderInfo.getDriverId(), () -> Exceptions.clierr("当前订单已分配司机,无需重复分配"));
Assert.isTrue(orderInfo.getOrderStatus() == OrderStatus.DaiPaiDan, () -> Exceptions.clierr("当前订单状态,无法分配司机"));
// 查询订单及相关支付上下文
PaymentContextResult ctx = paymentContext(orderInfo.getId());
if (PaymentWay.COMPANY.getVal().equals(orderInfo.getPaymentCategory()) &&
SettlementWay.BALANCE.getVal().equals(ctx.getSettlementWay())) {
// 当该笔订单支付方式为公司支付,并且支付方式为余额支付时,需在分配之前查询当前清运公司余额是否充足,
// 如果不足则提示余额不足,不允许在派司机
if (ctx.getCompanyBalance().compareTo(BigDecimal.ZERO) < 0) {
// 已经是负数,禁止再次支付
throw Exceptions.clierr("公司账户余额不足");
}
}
baseMapper.busyDriver(driverId, Boolean.TRUE);
this.updateById(new OrderInfoEntity()