Exemple #1
0
  /**
   * To delete fun information page
   *
   * @return
   */
  public String toDeleteFun() {
    if (null != fun && null != fun.getId()) {
      setValueStack(funService.getFunById(fun.getId())); // call getFunById() method
    } else {
      log.error("FunAction!toUpdateFun() error!");
    }

    return "toDeleteFun";
  }
  /**
   * 处理用户登录时功能列表内容
   *
   * @param employeeCode
   * @return
   */
  private StringBuilder dealWithFunList(String employeeCode) {
    // 创建员工功能查询
    EmployeeFunQuery employeeFunQuery = new EmployeeFunQuery();
    employeeFunQuery.setEmployeeCode(employeeCode); // 设置员工账号
    List<EmployeeFun> employeeFunList =
        employeeFunManager.queryEmployeeFunListByQueryBean(employeeFunQuery);
    StringBuilder sbFunList = new StringBuilder();
    if (null != employeeFunList && employeeFunList.size() > 0) {
      Map<Integer, Integer> counter = new HashMap<Integer, Integer>();
      Map<Integer, Integer> recordsCounter = new HashMap<Integer, Integer>();

      for (EmployeeFun employeeFun : employeeFunList) {
        Fun fun = funManager.getFunByFunCode(employeeFun.getFunCode());
        Integer recordCounter = recordsCounter.get(fun.getFunSystem());
        if (null == recordCounter) {
          recordCounter = 1;
        } else {
          recordCounter++;
        }

        recordsCounter.put(fun.getFunSystem(), recordCounter);
      }
      for (EmployeeFun ef : employeeFunList) {

        Fun fun = funManager.getFunByFunCode(ef.getFunCode());
        if (null == fun) return null;
        Integer count = counter.get(fun.getFunSystem());

        if (null == count) {
          count = 1;
        } else {
          count++;
        }

        /** 如何count=1 将会设置所属模块 */
        if (1 == count) {
          sbFunList.append("<h1 class=\"type\">").append("<a href=\"javascript:void(0)\">");
          if (CommonConstant.SYSTEM_MODULE_ONE == fun.getFunSystem()) {
            sbFunList.append("员工&权限管理");
          } else if (CommonConstant.SYSTEM_MODULE_TWO == fun.getFunSystem()) {
            sbFunList.append("商品&商品类别管理");
          } else if (CommonConstant.SYSTEM_MODULE_THREE == fun.getFunSystem()) {
            sbFunList.append("用户&订单&消费记录管理");
          } else if (CommonConstant.SYSTEM_MODULE_FOUR == fun.getFunSystem()) {
            sbFunList.append("配送&配送类别管理");
          } else {

          }

          sbFunList.append("</a>");
          sbFunList.append("</h1>");
          sbFunList
              .append("<div class=\"content\">")
              .append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">")
              .append("<tr><td>")
              .append("<img src=\"images/menu_topline.gif\" width=\"182\" height=\"5\" />")
              .append("</td></tr></table>");
          sbFunList.append("<ul class=\"MM\">");
        }

        sbFunList.append(
            "<li><a href=\""
                + fun.getUrlName()
                + "\" target=\"main\">"
                + fun.getFunName()
                + "</a></li>");

        if (count == recordsCounter.get(fun.getFunSystem())) {
          sbFunList.append("</ul>");
          sbFunList.append("</div>");
        }

        counter.put(fun.getFunSystem(), count);
      }

      return sbFunList;

    } else {
      return null;
    }
  }