package com.ruoyi.order.service.impl; import java.math.BigDecimal; final class ChargingPaymentSupport { private ChargingPaymentSupport() { } static int resolvePayMethod(BigDecimal balancePayAmount, BigDecimal thirdPayAmount, int fallback) { boolean hasBalance = balancePayAmount != null && balancePayAmount.compareTo(BigDecimal.ZERO) > 0; boolean hasThirdPay = thirdPayAmount != null && thirdPayAmount.compareTo(BigDecimal.ZERO) > 0; if (hasBalance && hasThirdPay) { return 2; } if (hasBalance) { return 1; } if (hasThirdPay) { return 3; } return fallback; } }