From a631f03399ed9b2cb7d509fffb7177200f883c17 Mon Sep 17 00:00:00 2001 From: limqhz Date: Tue, 28 Feb 2023 17:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90CHG=E3=80=91=E8=BF=98=E6=AC=BE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/quinn/controller/wx/WxBillController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/quinn/controller/wx/WxBillController.java b/src/main/java/com/quinn/controller/wx/WxBillController.java index 2973577..7bc41b8 100644 --- a/src/main/java/com/quinn/controller/wx/WxBillController.java +++ b/src/main/java/com/quinn/controller/wx/WxBillController.java @@ -206,13 +206,19 @@ public class WxBillController extends BaseWxController{ private double modifyBalance(boolean isBack,AccBill accBill){ AccBillType billType = accBill.getBillType(); double money = isBack ? - accBill.getMoney() : accBill.getMoney(); - accSettingService.updateBalance(accBill.getAccount(),AccBillType.EXPEND.equals(billType) ? -money : money); + AccSetting byId = accSettingService.getById(accBill.getAccount()); + AccSettingType settingType = byId.getSettingType(); + boolean isOwe = false; + if (AccSettingType.OWE_SETTING.equals(settingType)){ + isOwe = true; + } + accSettingService.updateBalance(accBill.getAccount(),AccBillType.EXPEND.equals(billType) && !isOwe ? -money : money); if (AccBillType.REPAYMENT.equals(billType) || AccBillType.TRANSFER.equals(billType)){ accSettingService.updateBalance(accBill.getFromAccount(),-money); } if (AccBillType.INCOME.equals(billType) || AccBillType.EXPEND.equals(billType)){ - AccSetting byId = accSettingService.getById(accBill.getAccount()); - return byId.getBalance(); + AccSetting after = accSettingService.getById(accBill.getAccount()); + return after.getBalance(); } return 0; }