コード例 #1
0
 @Override
 public List<EmployeeBankInfo> getEmployeeBankAccounts(Employee employee)
     throws InstanceNotFoundException {
   logger.debug(" in getEmployeeBankAccounts ... ");
   List<EmployeeBankInfo> bankInfos = new ArrayList<>();
   EmployeeBankInfo bankInfo = null;
   for (EmployeeBankAccount bankAccount :
       employeeBankAccountDao.getEmployeeBankAccounts(employee)) {
     bankInfo = new EmployeeBankInfo();
     bankInfo.setAccountNumber(bankAccount.getAccountNumber());
     bankInfo.setAccountType(bankAccount.getAccountType());
     bankInfo.setBankName(bankAccount.getBankName());
     bankInfo.setDepositValue(bankAccount.getDepositValue());
     bankInfo.setDepositValueType(bankAccount.getDepositValueType());
     bankInfo.setId(bankAccount.getId());
     bankInfo.setRoutingNumber(bankAccount.getRoutingNumber());
     bankInfos.add(bankInfo);
   }
   return bankInfos;
 }
コード例 #2
0
  @Override
  @Transactional
  public void saveEmployeeBankInfo(EmployeeBankInfoForm bankInfoForm, Employee employee)
      throws CommonException {
    logger.debug(" >> saveEmployeeBankInfo");
    try {
      for (EmployeeBankInfo employeeBankAccount : bankInfoForm.getEmployeeBankInfos()) {
        EmployeeBankAccount bankAccount = null;
        logger.debug("employeeBankAccount.id:" + employeeBankAccount.getId());
        if (employeeBankAccount.getId() != null) {
          bankAccount = employeeBankAccountDao.find(employeeBankAccount.getId());
        } else {
          bankAccount = new EmployeeBankAccount();
        }
        bankAccount.setEmployee(employee);
        bankAccount.setAccountNumber(employeeBankAccount.getAccountNumber());
        bankAccount.setAccountType(employeeBankAccount.getAccountType());
        bankAccount.setBankName(employeeBankAccount.getBankName());
        bankAccount.setDepositValue(employeeBankAccount.getDepositValue());
        bankAccount.setDepositValueType(employeeBankAccount.getDepositValueType());
        bankAccount.setRoutingNumber(employeeBankAccount.getRoutingNumber());

        if (employeeBankAccount.getId() == null) {
          employeeBankAccountDao.save(bankAccount);
        }
      }
    } catch (InstanceNotFoundException e) {
      logger.error("Error in saveEmployeeBankInfo", e.getLocalizedMessage());
    }
    logger.debug(" saveEmployeeBankInfo >> ");
  }