예제 #1
0
  /**
   * @param bean
   * @throws SystemException
   */
  public void insert(IndustryCalcView bean) throws SystemException {
    final String LOCATION = "insert(IndustryCalcView)";
    log.debug(LOCATION + ":: BEGIN");
    try {
      Map<String, Object> paramMap = new HashMap<String, Object>();
      paramMap.put(Field.INDUSTRY_CODE, bean.getIndustryCode());
      paramMap.put(Field.SECTOR_CODE, bean.getSectorCode());
      paramMap.put(Field.PE, bean.getPe());
      paramMap.put(Field.PB, bean.getPb());
      paramMap.put(Field.SCOPE_MAKET_CAP, bean.getScopeMaketCap());
      paramMap.put(Field.SCOPE_ASSET, bean.getScopeAsset());
      paramMap.put(Field.SCOPE_EQUITY, bean.getScopeEquity());
      paramMap.put(Field.GROWTH_ASSET, bean.getScopeAsset());
      paramMap.put(Field.GROWTH_REVENUE, bean.getGrowthRevenue());
      paramMap.put(Field.ROA, bean.getRoa());
      paramMap.put(Field.ROE, bean.getRoe());
      paramMap.put(Field.PROFIT_MARGIN, bean.getProfitMargin());
      paramMap.put(Field.DEBT_EQUITY, bean.getDebtEquity());
      paramMap.put(Field.CURRENT_RATIO, bean.getCurrentRatio());
      paramMap.put(Field.EBITDA, bean.getEbitda());

      OracleDAOHelper.update(this.getDataSource(), SQL_INSERT_INDUSTRY_CALC_VIEW, paramMap);
      log.debug(LOCATION + ":: END");
    } catch (SystemException syse) {
      throw syse;
    } catch (Exception e) {
      throw new SystemException(LOCATION, e);
    }
  }
예제 #2
0
  /**
   * @param searchObject
   * @return
   * @throws SystemException
   */
  public List fiscalYearList(IfoBalanceSheetSearch searchObject) throws SystemException {
    final String LOCATION = "fiscalYearList(criteriaObject:" + searchObject + " )";
    if (log.isDebugEnabled()) log.debug(LOCATION + ":: BEGIN");
    try {
      Map paramMap = new HashMap();
      StringBuffer sql =
          new StringBuffer(
              "SELECT DISTINCT TO_CHAR(FISCAL_DATE, 'YYYY') AS FISCAL_YEAR FROM IFO_INCOME_VIEW WHERE COMPANY_ID = :COMPANY_ID AND REPORT_TYPE IN ('QUARTER','ANNUAL')  ORDER BY FISCAL_YEAR DESC");
      paramMap.put("COMPANY_ID", searchObject.getCompanyId());
      SearchResult result =
          OracleDAOHelper.query(this.getDataSource(), sql.toString(), paramMap, fiscalYearMapper);

      if (log.isDebugEnabled()) log.debug(LOCATION + ":: END - result: " + result.size());
      return result;
    } catch (RuntimeException sysex) {
      throw new SystemException(LOCATION, sysex);
    } catch (Exception ex) {
      throw new SystemException(LOCATION, ex);
    }
  }
예제 #3
0
  /**
   * @param searchObject
   * @return
   * @throws SystemException
   */
  public String fiscalQuarter(IfoBalanceSheetSearch searchObject) throws SystemException {
    final String LOCATION = "fiscalQuarter(criteriaObject:" + searchObject + " )";
    if (log.isDebugEnabled()) log.debug(LOCATION + ":: BEGIN");
    try {
      Map paramMap = new HashMap();
      StringBuffer sql =
          new StringBuffer(
              "SELECT DECODE(TO_CHAR(FISCAL_DATE, 'MM'),'03', 'Q1','06', 'Q2','09', 'Q3','12', 'Q4') AS FISCAL_QUARTER FROM (SELECT FISCAL_DATE FROM IFO_INCOME_VIEW WHERE COMPANY_ID = :COMPANY_ID AND REPORT_TYPE = 'QUARTER'ORDER BY FISCAL_DATE DESC) WHERE ROWNUM =1");
      paramMap.put("COMPANY_ID", searchObject.getCompanyId());
      String result =
          (String)
              OracleDAOHelper.querySingle(
                  this.getDataSource(), sql.toString(), paramMap, fiscalQuarterMapper);

      if (log.isDebugEnabled()) log.debug(LOCATION + ":: END - result: " + result);
      return result == null ? "Q1" : result;
    } catch (RuntimeException sysex) {
      throw new SystemException(LOCATION, sysex);
    } catch (Exception ex) {
      throw new SystemException(LOCATION, ex);
    }
  }
예제 #4
0
  public List findByCurrentCompany(IfoBalanceSheetSearch searchObject) throws SystemException {
    final String LOCATION = "findByCurrentCompany(criteriaObject:" + searchObject + ")";
    if (log.isDebugEnabled()) log.debug(LOCATION + ":: BEGIN");

    // List result = new ArrayList();
    try {
      // List params = new ArrayList();
      Map paramMap = new HashMap();
      StringBuffer sql = new StringBuffer();
      sql.append("SELECT distinct t0.* FROM IFO_INCOME_VIEW t0 ");
      sql.append("WHERE t0.COMPANY_ID = :COMPANY_ID ");
      sql.append("AND t0.REPORT_TYPE = :REPORT_TYPE ");
      paramMap.put("REPORT_TYPE", searchObject.getReportType());
      sql.append("AND UPPER(t0.LOCALE) = :LOCALE ");
      paramMap.put("LOCALE", searchObject.getLocale().toUpperCase());

      Date fiscalDateTo;
      Date fiscalDateFrom;
      if (!searchObject.isAnnual()) {
        String fiscalDateToStr = "";
        if ("Q1".equals(searchObject.getFiscalQuarter())) {
          fiscalDateToStr = "31/03/" + searchObject.getFiscalYear();
        } else if ("Q2".equals(searchObject.getFiscalQuarter())) {
          fiscalDateToStr = "30/06/" + searchObject.getFiscalYear();
        } else if ("Q3".equals(searchObject.getFiscalQuarter())) {
          fiscalDateToStr = "30/09/" + searchObject.getFiscalYear();
        } else if ("Q4".equals(searchObject.getFiscalQuarter())) {
          fiscalDateToStr = "31/12/" + searchObject.getFiscalYear();
        }
        fiscalDateTo =
            VNDirectDateUtils.stringToDate(
                fiscalDateToStr, VNDirectDateUtils.Formats.STR_DATE_TIME_FORMAT_DDMMYYYY);
        fiscalDateFrom =
            VNDirectDateUtils.addMonth(fiscalDateTo, -3 * searchObject.getNumberTerm());
        fiscalDateFrom = VNDirectDateUtils.addDay(fiscalDateFrom, 2);
      } else {
        String fiscalDateToStr = "31/12/" + searchObject.getFiscalYear();
        fiscalDateTo =
            VNDirectDateUtils.stringToDate(
                fiscalDateToStr, VNDirectDateUtils.Formats.STR_DATE_TIME_FORMAT_DDMMYYYY);
        fiscalDateFrom = VNDirectDateUtils.addYear(fiscalDateTo, -searchObject.getNumberTerm());
        fiscalDateFrom = VNDirectDateUtils.addDay(fiscalDateFrom, 2);
      }

      sql.append(" AND t0.FISCAL_DATE BETWEEN :FISCAL_DATE_FROM AND :FISCAL_DATE_TO ");
      sql.append(" ORDER BY t0.DISPLAY_ORDER, t0.FISCAL_DATE DESC ");

      paramMap.put("COMPANY_ID", searchObject.getCompanyId());
      paramMap.put("FISCAL_DATE_FROM", fiscalDateFrom);
      paramMap.put("FISCAL_DATE_TO", fiscalDateTo);

      SearchResult result =
          OracleDAOHelper.query(
              this.getDataSource(), sql.toString(), paramMap, ifoIncomeViewRowMapper, null);

      if (log.isDebugEnabled()) log.debug(LOCATION + ":: END - result:" + result.size());
      return result;
    } catch (RuntimeException sysex) {
      throw new SystemException(LOCATION, sysex);
    } catch (Exception ex) {
      throw new SystemException(LOCATION, ex);
    }
  }