(七)Struts_admin.xml

  <!-- 2012年07月31日 atip-15 异议信息管理action 团长 -->
  <action name="dissent_*" method="{1}" class="dissentAction">
    <result name="success" type="json" />
  </action>

七、复杂应用实例清单

下述清单中是一个复杂应用的实例。代码位于svn://10.10.114.15/netsale/code/ATIP3/branches/atip-11/src/java/com/sinosig/atip/punishiment包下。完整代码中有比较充分的注释,此清单只提供主要的功能代码。红色字体是类名,蓝色字体是方法名。

(一)Action

  public class InnerPunishAction extends SimplePagedAction<InnerPunishment> {
    protected String checkForSeachSingleInfo(InnerPunishment param) {
      if (null != param.getPunishId()) {
        return CheckUtil.CHECKSUCCESS();
      } else {
        return "请选择一条数据进行操作!";
      }
    }
  }

(二)Service

  public class InnerPunishServiceImpl extends
      AbstractPagedInfoServImpl<InnerPunishment> implements
      InnerPunishService {
    public Integer queryCount(InnerPunishment param) throws SAABException {
      return dao.getCountByQuery("innerPunish.queryTotalCount", param);
    }
  
  protected InnerPunishment parseMap(Map<String, Object> map) {
      InnerPunishment inner = new InnerPunishment();
  
      BigDecimal punishId = (BigDecimal) map.get("PUNISHID");
      if (null != punishId) {
        inner.setPunishId(punishId.intValue());
      }
  
      String temp = (String) map.get("DISPATCHUNIT");
      if (StringUtils.isNotBlank(temp)) {
        inner.setDispatchUnit(temp);
      }
  
      temp = (String) map.get("PENALTYNUMBER");
      if (StringUtils.isNotBlank(temp)) {
        inner.setPenaltyNumber(temp);
      }
  
      Date dispatchDate = (Date) map.get("DISPATCHDATE");
      if (null != dispatchDate) {
        inner.setDispatchDate(dispatchDate);
      }

      inner.setSubList(queryPunishSubList(inner));

      return inner;
    }
  
    public InnerPunishment querySingleData(String statementId,
        InnerPunishment param) throws SAABException {
      param.setPunishmentType("01");
      InnerPunishment result = (InnerPunishment) dao.getObjectByQuery(
          "innerPunish.queryById", param);
      result.setSubList(queryPunishSubList(result));
      return result;
    }
  
    private List<BLPunishmentSub> queryPunishSubList(InnerPunishment param) {
  
      List<BLPunishmentSub> subList = new ArrayList<BLPunishmentSub>();
  
      try {
        subList = dao.getObjectsByQuery("innerPunish.querySubByPunishID",
            param);
      } catch (SAABException e) {
        // 如果发生异常,仅记录日志。关联子表设置为空表
        logger.error("关联查询内部处罚管理信息子表时发生异常。参数是:" + param + ",异常是:" + e
            + ",异常原因是:" + e.getCause() + ",异常信息是:" + e.getMessage());
      }
  
      return subList;
    }
  }