登录返回店铺授权过期日期

This commit is contained in:
谭凯凯
2024-12-11 17:07:50 +08:00
committed by Tankaikai
parent e4d2d1e34e
commit d8410469e9

View File

@@ -325,22 +325,23 @@ public class TbCreditBuyerOrderServiceImpl extends ServiceImpl<TbCreditBuyerOrde
record.setCreateTime(new Date());
tbCreditPaymentRecordMapper.insert(record);
dto = baseMapper.getOne(params);
if (NumberUtil.equals(dto.getPayAmount(), BigDecimal.ZERO) && NumberUtil.isGreater(dto.getPaidAmount(), BigDecimal.ZERO) && NumberUtil.isLess(dto.getUnpaidAmount(), BigDecimal.ZERO)) {
BigDecimal sub = NumberUtil.sub(refundAmount, dto.getUnpaidAmount());
if (NumberUtil.isGreater(sub, BigDecimal.ZERO)) {
TbCreditPaymentRecord flow = new TbCreditPaymentRecord();
flow.setCreditBuyerId(creditBuyerId);
flow.setOrderId(orderId);
flow.setRepaymentAmount(dto.getUnpaidAmount());
flow.setRepaymentAmount(NumberUtil.sub(BigDecimal.ZERO, sub));
flow.setPaymentMethod("挂账退款");
flow.setPaymentTime(new Date());
flow.setRemark(StrUtil.format("挂账订单:{},申请退款¥{}元,由于此挂账订单已提前还款,溢出部分¥{}元将转储至账户余额。", orderInfo.getOrderNo(), refundAmount, dto.getUnpaidAmount().abs()));
flow.setRemark(StrUtil.format("挂账订单:{},申请退款¥{}元,由于此挂账订单已提前还款,溢出部分¥{}元将转储至账户余额。", orderInfo.getOrderNo(), refundAmount, sub));
flow.setCreateTime(new Date());
tbCreditPaymentRecordMapper.insert(flow);
tbCreditBuyerOrderMapper.update(Wrappers.<TbCreditBuyerOrder>lambdaUpdate()
.eq(TbCreditBuyerOrder::getId, dto.getId())
.set(TbCreditBuyerOrder::getPaidAmount, NumberUtil.add(dto.getPaidAmount(), dto.getUnpaidAmount()))
.set(TbCreditBuyerOrder::getPaidAmount, NumberUtil.sub(dto.getPaidAmount(), sub))
);
// 退回余额
creditBuyer.setAccountBalance(NumberUtil.add(creditBuyer.getAccountBalance(), dto.getUnpaidAmount().abs()));
creditBuyer.setAccountBalance(NumberUtil.add(creditBuyer.getAccountBalance(), sub));
tbCreditBuyerService.updateById(creditBuyer);
}
return true;