コード例 #1
0
  public String detail() throws Exception {
    try {
      String username = (String) ActionContext.getContext().getSession().get("LOGINUSERNAME");
      String password = (String) ActionContext.getContext().getSession().get("LOGINPASSWORD");

      if (username == null || password == null) {
        return LOGIN;
      }
      if (headerSelectID == null) return ERROR;
      InquisitionHeaderSelectInfo info = inquisitionHeaderSelectInfoService.getInfo(headerSelectID);
      if (info != null) {
        ActionContext.getContext().put("ISELECTLIST", info);
        ActionContext.getContext().put("SELECTVALUE", QuestionTypeConstants.OptionValueDict);
      }

      InquisitionHeaderInfo ihi =
          inquisitionHeaderInfoService.getInquisitionHeaderInfo(info.getHeaderID());
      if (ihi != null && ihi.getFieldName() != null) {
        ActionContext.getContext().put("HEADEREDIT", ihi.getFieldName());
      }

      InquisitionInfo ii = inquisitionInfoService.getInquisitionInfo(info.getInquisitionID());
      OptionInfo oi = optionInfoService.getOptionInfo(info.getAlterID());
      if (oi != null && oi.getChinaOption() != null) {
        ActionContext.getContext().put("SELECTLIST", oi.getChinaOption());
      }
      if (ii != null && ii.getTitle() != null) {
        ActionContext.getContext().put("INQUISITIONLIST", ii.getTitle());
      }
    } catch (Exception e) {
      logger.error(e.getMessage(), e.getCause());
    }

    return SUCCESS;
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @Override
  public String execute() throws Exception {
    try {
      String username = (String) ActionContext.getContext().getSession().get("LOGINUSERNAME");
      String password = (String) ActionContext.getContext().getSession().get("LOGINPASSWORD");
      if (username == null || password == null) {
        return LOGIN;
      }
      int page = 1;
      if (num != null) {
        page = num.intValue();
      }

      // 先添加表头信息
      Long selectHeaderID = (Long) ActionContext.getContext().getSession().get("HEADERID");
      if (headerID != null) {
        selectHeaderID = headerID;
        ActionContext.getContext().getSession().put("HEADERID", selectHeaderID);
      }
      logger.debug("headerID:" + selectHeaderID);
      InquisitionHeaderInfo inquisitionHeaderInfo = null;
      if (selectHeaderID != null) {
        inquisitionHeaderInfo =
            inquisitionHeaderInfoService.getInquisitionHeaderInfo(selectHeaderID);
        ActionContext.getContext().getSession().put("HEADERLIST", inquisitionHeaderInfo);
        total = inquisitionHeaderSelectInfoService.getTotal(selectHeaderID);
      } else {
        total = inquisitionHeaderSelectInfoService.getTotal();
      }
      pu = new PaginationUtil(total, page, SmgkConstants.PAGE_MAX_RESULT);

      if (selectHeaderID != 0) {
        pageList =
            inquisitionHeaderSelectInfoService.findByPage(
                selectHeaderID, pu.getStartRecord(), SmgkConstants.PAGE_MAX_RESULT);
      } else {
        pageList =
            inquisitionHeaderSelectInfoService.findByPage(
                pu.getStartRecord(), SmgkConstants.PAGE_MAX_RESULT);
      }
      optionList.clear();
      selectList.clear();

      OptionInfo optionInfo = null;
      for (InquisitionHeaderSelectInfo info : pageList) {
        if (info.getOptionID() != null) {
          optionInfo = optionInfoService.getOptionInfo(info.getOptionID());
          if (optionInfo != null) {
            optionList.add("" + optionInfo.getChinaOption());
          }
        } else {
          optionList.add("");
        }
        if (info.getAlterID() != null) {
          optionInfo = optionInfoService.getOptionInfo(info.getAlterID());
          selectList.add("" + optionInfo.getChinaOption());
        } else {
          selectList.add("");
        }
      }
    } catch (Exception e) {
      logger.error("" + e.getMessage(), e.getCause());
    }
    return SUCCESS;
  }