|
|
@@ -207,6 +207,14 @@ public class PaymentService extends BaseService<RecPay> {
|
|
|
MoneyAccount moneyAccountUpdate = new MoneyAccount();
|
|
|
moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtPay().negate()))
|
|
|
.setMacId(moneyAccountForUpdate.getMacId());
|
|
|
+
|
|
|
+ // 如果账户不允许为负数
|
|
|
+ if (!moneyAccountForUpdate.getFlgNegative()) {
|
|
|
+ // 如果余额小于0 ,则提示余额不足
|
|
|
+ if (moneyAccountUpdate.getBalance().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
moneyAccountService.updateByUuid(moneyAccountUpdate);
|
|
|
}
|
|
|
}
|
|
|
@@ -271,7 +279,7 @@ public class PaymentService extends BaseService<RecPay> {
|
|
|
// }
|
|
|
// 可用金额为负数,则不能保存
|
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
|
|
|
}
|
|
|
accountService.updateByUuid(accountUpdate);
|
|
|
}
|
|
|
@@ -348,7 +356,7 @@ public class PaymentService extends BaseService<RecPay> {
|
|
|
// }
|
|
|
// 可用金额为负数,则不能保存
|
|
|
if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
|
|
|
}
|
|
|
accountService.updateByUuid(accountUpdate);
|
|
|
|