更新10.16
This commit is contained in:
parent
dc8d178882
commit
9ad6fcb18d
@ -415,6 +415,7 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
|
|||||||
public int payFleet(String orderId, Double money) {
|
public int payFleet(String orderId, Double money) {
|
||||||
AllOrderInfo allOrderInfo = allOrderInfoMapper.selectOne(new LambdaQueryWrapper<AllOrderInfo>()
|
AllOrderInfo allOrderInfo = allOrderInfoMapper.selectOne(new LambdaQueryWrapper<AllOrderInfo>()
|
||||||
.eq(AllOrderInfo::getId, orderId));
|
.eq(AllOrderInfo::getId, orderId));
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
if (ObjectUtil.isEmpty(allOrderInfo)) {
|
if (ObjectUtil.isEmpty(allOrderInfo)) {
|
||||||
throw new RuntimeException("订单不存在");
|
throw new RuntimeException("订单不存在");
|
||||||
}
|
}
|
||||||
@ -432,6 +433,14 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
|
|||||||
throw new RuntimeException("支付金额超过当前余额");
|
throw new RuntimeException("支付金额超过当前余额");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查找车队成员
|
||||||
|
FleetMember fleetMember = fleetMemberMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
|
||||||
|
.eq(FleetMember::getId, fleetConsumeRecord.getFleetMemberId()));
|
||||||
|
//判断成员的余额是否足够支付
|
||||||
|
if (money > fleetMember.getRemainingCreditLimit()) {
|
||||||
|
throw new RuntimeException("支付金额超过当前余额");
|
||||||
|
}
|
||||||
|
|
||||||
//更新时间
|
//更新时间
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
|
|
||||||
@ -444,13 +453,22 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
|
|||||||
fleetInfo.setRechargeAmount(fleetInfo.getRechargeAmount() - (money * recharge));
|
fleetInfo.setRechargeAmount(fleetInfo.getRechargeAmount() - (money * recharge));
|
||||||
fleetInfo.setGiveAmount(fleetInfo.getGiveAmount() - (money * give));
|
fleetInfo.setGiveAmount(fleetInfo.getGiveAmount() - (money * give));
|
||||||
fleetInfo.setUpdateTime(now);
|
fleetInfo.setUpdateTime(now);
|
||||||
|
fleetInfo.setUpdateBy(nowAccountInfo.getId().toString());
|
||||||
//更新车队卡余额
|
//更新车队卡余额
|
||||||
baseMapper.updateById(fleetInfo);
|
baseMapper.updateById(fleetInfo);
|
||||||
|
|
||||||
|
//计算车队成员剩余额度和已用额度
|
||||||
|
fleetMember.setRemainingCreditLimit(fleetMember.getRemainingCreditLimit() - money);
|
||||||
|
fleetMember.setUsedCreditLimit(fleetMember.getUsedCreditLimit() + money);
|
||||||
|
fleetMember.setUpdateTime(now);
|
||||||
|
fleetMember.setUpdateBy(nowAccountInfo.getId().toString());
|
||||||
|
fleetMemberMapper.updateById(fleetMember);
|
||||||
|
|
||||||
//更新订单状态
|
//更新订单状态
|
||||||
allOrderInfo.setStatus("paid");
|
allOrderInfo.setStatus("paid");
|
||||||
allOrderInfo.setPayTime(now);
|
allOrderInfo.setPayTime(now);
|
||||||
allOrderInfo.setUpdateTime(now);
|
allOrderInfo.setUpdateTime(now);
|
||||||
|
allOrderInfo.setUpdateBy(nowAccountInfo.getId().toString());
|
||||||
|
|
||||||
allOrderInfoMapper.updateById(allOrderInfo);
|
allOrderInfoMapper.updateById(allOrderInfo);
|
||||||
|
|
||||||
@ -458,6 +476,7 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper, FleetInfo
|
|||||||
fleetConsumeRecord.setOrderStatus("paid");
|
fleetConsumeRecord.setOrderStatus("paid");
|
||||||
fleetConsumeRecord.setPaymentTime(now);
|
fleetConsumeRecord.setPaymentTime(now);
|
||||||
fleetConsumeRecord.setUpdateTime(now);
|
fleetConsumeRecord.setUpdateTime(now);
|
||||||
|
fleetConsumeRecord.setUpdateBy(nowAccountInfo.getId().toString());
|
||||||
//计算扣完款后的余额
|
//计算扣完款后的余额
|
||||||
fleetConsumeRecord.setAfterTheChange(fleetInfo.getTotalBalance());
|
fleetConsumeRecord.setAfterTheChange(fleetInfo.getTotalBalance());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user