Ejemplo n.º 1
0
  @Override
  public void prepare() throws Exception {
    if (userid == null || "".equals(userid)) {
      user = new User();

    } else {
      user = userService.find(userid);
    }
  }
Ejemplo n.º 2
0
  /*
   * 统计销售
   */
  public String salespeople() {
    PageView<User> pageView = new PageView<User>(12, this.getPage());
    LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
    orderby.put("realname", "desc");
    StringBuilder sb = new StringBuilder();
    List<Object> params = new ArrayList<Object>();
    sb.append("o.proxy=?").append(params.size() + 1);
    params.add(((User) session.get("user")).getProxy());
    sb.append(" and o.role=?").append(params.size() + 1);
    params.add(Role.SALESPEOPLE);
    if ("true".equals(this.getQuery())) {
      if (user.getNumber() != null && !"".equals(user.getNumber().trim())) {
        sb.append(" and ");
        sb.append(" o.number=?").append(params.size() + 1);
        params.add(user.getNumber());
      }
      if (user.getRealname() != null && !"".equals(user.getRealname().trim())) {
        if (params.size() > 0) sb.append(" and ");
        sb.append(" o.realname like ?").append(params.size() + 1);
        params.add("%" + user.getRealname() + "%");
      }
      pageView.setQueryResult(
          userService.getScrollData(
              pageView.getFirstResult(),
              pageView.getMaxresult(),
              sb.toString(),
              params.toArray(),
              orderby));

    } else {
      pageView.setQueryResult(
          userService.getScrollData(
              pageView.getFirstResult(),
              pageView.getMaxresult(),
              sb.toString(),
              params.toArray(),
              orderby));
    }
    request.setAttribute("pageView", pageView);
    return "salespeople";
  }
Ejemplo n.º 3
0
  @SuppressWarnings("unchecked")
  @Override
  public String execute() throws Exception {
    if (user.getNumber() != null
        && !"".equals(user.getNumber().trim())
        && user.getPassword() != null
        && !"".equals(user.getPassword())) {
      if (userService.checkUser(user.getNumber(), user.getPassword())) {
        user = userService.findByNumber(user.getNumber().trim());
        session.put("user", user);

        if (user.getVisible() == false) {
          request.setAttribute("message", "对不起您的账号已被禁用,无法登陆系统!");
          return INPUT;
        }
        if (user.getRole().toString().equals("SALESMANAGER")) return "salesmanager";
        else if (user.getRole().toString().equals("SALESPEOPLE")) {
          return "salespeople";
        } else if (user.getRole().toString().equals("PRESALES")) {
          return "presales";
        } else if (user.getRole().toString().equals("BOSS")) {
          return "boss";
        } else if (user.getRole().toString().equals("STOCKANALYST")) {
          return "stockanalyst";
        } else if (user.getRole().toString().equals("SERVICE")) {
          return "service";
        } else if (user.getRole().toString().equals("PROXY")) {
          return "proxy";
        } else if (user.getRole().toString().equals("CHANNEL")) {
          return "channel";
        } else {
          return SUCCESS;
        }
      } else {
        request.setAttribute("message", "用户名或密码错误!");
        return INPUT;
      }
    }
    return INPUT;
  }