Пример #1
0
  /**
   * レートIDからレートマスタの情報を取得します.
   *
   * @return レートマスタ情報
   * @throws Exception
   */
  @Execute(validator = false, urlPattern = "getRateInfosByRateId/{rateId}")
  public String getRateInfosByRateId() throws Exception {

    if (!StringUtil.hasLength(commonRateForm.rateId)) {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    try {

      Rate rate = rateService.findById(commonRateForm.rateId);

      if (rate != null) {

        BeanMap map =
            Beans.createAndCopy(BeanMap.class, rate)
                .dateConverter(Constants.FORMAT.TIMESTAMP, "creDatetm", "updDatetm")
                .execute();

        BeanMap bmap = super.createBeanMapWithNullToEmpty(map);
        ResponseUtil.write(JSON.encode(bmap), "text/javascript");

      } else {
        ResponseUtil.write("", "text/javascript");
      }

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
Пример #2
0
  /**
   * 全通貨記号を取得します.
   *
   * @return 全通貨記号
   * @throws Exception
   */
  @Execute(validator = false)
  public String getAllRateSign() throws Exception {
    try {
      List<Rate> rateList = rateService.findAllRate();
      Map<String, Object> rateMap = new HashMap<String, Object>();
      for (Rate rate : rateList) {

        rateMap.put(Integer.toString(rate.rateId), rate.sign);
      }

      if (rateList.size() != 0) {
        BeanMap map = super.createBeanMapWithNullToEmpty(rateMap);
        ResponseUtil.write(JSON.encode(map), "text/javascript");
      } else {
        ResponseUtil.write("", "text/javascript");
      }
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    return null;
  }