public void autoInterestRate() {

    List<AccountInfo> accInfoList = accountInfoService.getListAccountInfo();

    for (AccountInfo item : accInfoList) {

      boolean isMonthEnd = checkIsMonthEnd();
      boolean isDueDate = checkIsDueDate(item.getDateDue());

      int repeatable = item.getRepeatable();
      double balanceAmount = item.getBalanceAmount();
      double amount = item.getAmount();
      double interest_rate = item.getInterestRate();
      int duration = item.getDuration();

      // check accountInfo is repeatable ?, repeatable = 0 : AccountInfo Indefinite, repeatable = 1
      // : AccountInfo definite time
      if (repeatable == 0) {
        // check is end of month
        if (isMonthEnd) {
          // interest rates indefinitely
          balanceAmount += amount * interest_rate / 12;
          // update balanceAmount
          updateBalanceAmount(balanceAmount, item);
        }
      } else {
        // checks is due date
        if (isDueDate) {
          balanceAmount += (amount * interest_rate) / (100 * 12) * duration;
          // update balanceAmount
          updateBalanceAmountAndRepeatable(balanceAmount, 0, null, item);
        }
      }
    }
  }
  public void updateBalanceAmount(double balanceAmount, AccountInfo accInfo) {

    accInfo.setBalanceAmount(balanceAmount);

    boolean result = accountInfoService.updateAccountInfo(accInfo);
    if (result) {
      System.out.println("Update Balance Amount is successfully");
    } else {
      System.out.println("Update Balance Amount is error");
    }
  }
  public void updateBalanceAmountAndRepeatable(
      double balanceAmount, int repeatable, Date duedate, AccountInfo accInfo) {

    accInfo.setBalanceAmount(balanceAmount);
    accInfo.setRepeatable(repeatable);
    accInfo.setDateDue(duedate);

    boolean result = accountInfoService.updateAccountInfo(accInfo);
    if (result) {
      System.out.println("Update Balance Amount is successfully");
    } else {
      System.out.println("Update Balance Amount is error");
    }
  }