Browse Source

Fix: edge condition

wudi 2 years ago
parent
commit
556e3638cb
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/main/java/com/mokamrp/data/udj/FifoStatementJoin.java

+ 4 - 4
src/main/java/com/mokamrp/data/udj/FifoStatementJoin.java

@@ -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();