更新10.16

This commit is contained in:
许允枞 2024-10-16 13:58:42 +08:00
parent c7f624f62a
commit e28039b063

View File

@ -428,20 +428,24 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
if (ObjectUtil.isEmpty(fleetConsumeRecord)) { if (ObjectUtil.isEmpty(fleetConsumeRecord)) {
throw new RuntimeException("车队订单不存在"); throw new RuntimeException("车队订单不存在");
} }
// 获取当前车队卡 //根据用户id查询车队信息
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
.eq(FleetInfo::getId, fleetConsumeRecord.getFleetId()));
//判断支付金额是否超过当前余额
if (money > fleetInfo.getTotalBalance()){
throw new RuntimeException("支付金额超过当前余额");
}
//查找车队成员 //查找车队成员
FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>() FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getId, fleetConsumeRecord.getFleetMemberId())); .eq(FleetMember::getUserId, allOrderInfo.getUserId())
.orderBy(true,true,FleetMember::getCreateTime)
.last("limit 1"));
// 获取当前车队卡
FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
.eq(FleetInfo::getId, fleetMember.getFleetId()));
//判断支付金额是否超过当前余额
if (money > fleetInfo.getTotalBalance()){
throw new RuntimeException("支付金额超过当前车队余额");
}
//判断成员的余额是否足够支付 //判断成员的余额是否足够支付
if (money > fleetMember.getRemainingCreditLimit()) { if (money > fleetMember.getRemainingCreditLimit()) {
throw new RuntimeException("支付金额超过当前余额"); throw new RuntimeException("支付金额超过当前余额");
} }
//更新时间 //更新时间