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; }