|
|
@@ -91,15 +91,15 @@ public class FifoStatementJoin extends UDJ {
|
|
|
} else {
|
|
|
fail = false;
|
|
|
outputRecord.setString(RESULT_TARGET, current.id);
|
|
|
- if (current.balance >= Math.abs(amount)) {
|
|
|
- // 该笔充值够用
|
|
|
+ if (current.balance > Math.abs(amount)) {
|
|
|
+ // 该笔充值多出
|
|
|
current.balance += amount; // amount is negative
|
|
|
outputRecord.setBigint(RESULT_AMOUNT, amount);
|
|
|
outputRecord.setBigint(RESULT_BALANCE, current.balance);
|
|
|
amount = 0;
|
|
|
} else {
|
|
|
- // 该笔充值不够用,继续
|
|
|
- amount += current.balance;
|
|
|
+ // 该笔充值全部用完
|
|
|
+ amount += current.balance; // 如果刚好用完,不继续
|
|
|
outputRecord.setBigint(RESULT_AMOUNT, -current.balance);
|
|
|
outputRecord.setBigint(RESULT_BALANCE, 0L);
|
|
|
recharges.remove();
|