Exemplo n.º 1
0
 public BigDecimal computeBalance(String customerAccountCode, Date dueDate)
     throws BusinessException {
   CustomerAccountServiceRemote customerAccountService;
   BigDecimal balance = BigDecimal.ZERO;
   try {
     String serviceName = OudayaConfig.getCustomerAccountServiceName();
     String providerURL = OudayaConfig.getServiceProviderUrl();
     logger.info("computeBalance serviceName=" + serviceName + ",serviceName=" + serviceName);
     customerAccountService =
         (CustomerAccountServiceRemote) EjbUtils.getRemoteInterface(serviceName, providerURL);
     balance =
         customerAccountService.customerAccountBalanceDue(null, customerAccountCode, dueDate);
     logger.info(
         "computeBalance customerAccountCode="
             + customerAccountCode
             + ",dureDAte="
             + dueDate
             + ",balance="
             + balance);
     return balance;
   } catch (Exception e) {
     e.printStackTrace();
     balance = null;
   }
   return balance;
 }
Exemplo n.º 2
0
 public static String round(BigDecimal amount) {
   if (amount == null) {
     amount = BigDecimal.ZERO;
   }
   amount = amount.setScale(2, RoundingMode.HALF_UP);
   return NumberUtils.format(amount, OudayaConfig.getDecimalFormat());
 }