예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see com.changpeng.common.action.AbstractAction#go()
   */
  @Override
  protected String go() throws Exception {

    DetachedCriteria detachedCriteria =
        DetachedCriteria.forClass(SysUser.class).add(Restrictions.eq("roleid", 1));

    // 这里要判断出登录帐号所属的group
    // 如果是admin,看所有的,如果不是admin,则根据登录人员的所属角色,判断角色对用户和对部门的可见性

    if (loginname != null && !"".equals(loginname))
      detachedCriteria.add(Restrictions.like("loginname", loginname, MatchMode.ANYWHERE));
    if (username != null && !"".equals(username))
      detachedCriteria.add(Restrictions.like("username", username, MatchMode.ANYWHERE));
    if (systemno != null && !"".equals(systemno))
      detachedCriteria.add(Restrictions.like("systemno", systemno, MatchMode.ANYWHERE));
    // 必须是没有删除的啊
    detachedCriteria.add(Restrictions.eq("delflag", false));
    // 取消掉自己的显示
    detachedCriteria.add(Restrictions.ne("userid", getLoginUser().getUserid()));
    SysUser sysUser = getLoginUser();
    SysGroup group = sysUser.getSysGroup();
    // 如果没有所属的group,则能查看所有的数据信息,否则只能看本部门和下级部门的数据
    if (group != null && group.getGroupid() != 1) { // 不是深圳律协的人上来的话
      int groupid = group.getGroupid();
      GroupTree tree = new GroupTree();
      List groupidlist = tree.getChildGroupIds(groupid);
      detachedCriteria
          .createAlias("sysGroup", "sysGroup")
          .add(Restrictions.in("sysGroup.groupid", groupidlist));
      if (groupname != null && !"".equals(groupname)) {
        detachedCriteria.add(
            Restrictions.like("sysGroup.groupname", groupname, MatchMode.ANYWHERE));
      }

      // detachedCriteria.add(Restrictions.in("groupid", groupidlist));
    } else if (groupname != null && !"".equals(groupname)) {
      detachedCriteria
          .createAlias("sysGroup", "sysGroup")
          .add(Restrictions.like("sysGroup.groupname", groupname, MatchMode.ANYWHERE));
    }
    detachedCriteria.setFetchMode("sysGroup", FetchMode.JOIN);

    // 按userid逆序排序
    detachedCriteria.addOrder(Order.desc("userid"));
    BasicService service = (BasicService) getBean("basicService");
    this.page = service.findPageByCriteria(detachedCriteria, pageSize, pageNo);
    // TODO Auto-generated method stub
    return SUCCESS;
  }
예제 #2
0
  @Override
  public String input() throws Exception {
    SysUser sysUser = service.getUser(userid);
    SysUser loginUser = super.getLoginUser();

    if (loginUser.getLoginname().equals("admin")) this.isadminer = true;
    else {
      Iterator<SysRole> roles = loginUser.getSysRoles().iterator();
      short maxroleid = 0;
      while (roles.hasNext()) {
        SysRole role = roles.next();
        if (maxroleid <= role.getRoleid()) maxroleid = role.getRoleid();
      }
      if (maxroleid == 3) { // 3的角色id是律协管理员
        isadminer = true;
      }
    }

    /*
     * if (loginUser.getSysGroup() == null) { this.message = "您没有所属的部门,不能进行修改"; this.nextPage = "lawyerList.pl"; return "message"; }
     */

    if (userid == 0) { // 修改自己的
      userid = loginUser.getUserid();
    }

    if (sysUser.getSysGroup() != null) {
      this.groupid = sysUser.getSysGroup().getGroupid();
      this.groupname = sysUser.getSysGroup().getGroupname();
    } else {
      this.groupname = "该律师没有所属的事务所";
    }

    set("sysUser", sysUser);

    return INPUT;
  }
예제 #3
0
  /*
   * (non-Javadoc)
   *
   * @see com.changpeng.common.action.AbstractAction#go()
   */
  @Override
  protected String go() throws Exception {
    // TODO Auto-generated method stub
    BasicService basicService = (BasicService) this.getBean("basicService");

    if (groupid == 0) {
      this.message = "对不起,您没有选择具体律师事务所。";
      return "message";
    }

    if (service.getSysUser(sysUser.getLawerno(), sysUser.getUserid()) != null) {
      this.message = "对不起,您输入的律师执业证号【" + sysUser.getLawerno() + "】已经被他人使用。";
      return "message";
    }

    SysGroup group = (SysGroup) basicService.get(SysGroup.class, groupid);
    if (group.getParentid() == 0) {
      this.message = "对不起,您没有选择具体律师事务所。";
      return "message";
    }
    sysUser.setSysGroup(group);

    _LOG.debug("主键值:::" + sysUser.getUserid());

    if (upload != null && upload.length() != 0) {
      try {
        if (upload.length() > 100 * 1024) {
          _LOG.info("删除上传图片成功否:" + upload.delete());
          this.message = "上传的图片大小超出了规定的最大大小100K,请重新选择";
          // this.nextPage="lawyerEditSelfPre.pl";
          return "message";
        }

        int index = fileName.lastIndexOf(".");
        String name = System.currentTimeMillis() + fileName.substring(index);
        sysUser.setPhoto(name);

        String indexDir = ServletActionContext.getServletContext().getRealPath("/lawyerphotos");
        // try {
        if (sysUser.getPhoto() != null && !"".equals(sysUser.getPhoto())) {
          // 删除掉之前的照片
          File oldfile =
              new File(indexDir + System.getProperty("file.separator") + sysUser.getPhoto());
          _LOG.info("老照片是否删除成功:" + oldfile.getAbsoluteFile() + ":::" + oldfile.delete());
        }
        // }
        // catch (Exception e) {
        // debug("之前的照片删除失败..." + e);
        // throw e;
        // }
        File file = new File(indexDir + System.getProperty("file.separator") + name);
        upload.renameTo(file);

        debug("=================" + indexDir);
      } catch (Exception e) {
        debug("照片上传失败..." + e);
        throw e;
      }
    }

    // 登录名与执行证号保持一致
    sysUser.setLoginname(sysUser.getLawerno().trim());
    sysUser.setLawerno(sysUser.getLawerno().trim());

    service.updateUser(sysUser);

    this.message = "律师信息修改成功,请确认";
    this.nextPage = "lawyerList.pl";
    return SUCCESS;
  }
예제 #4
0
  public String requestService(org.dom4j.Element rootElement) {

    StringBuilder result = new StringBuilder();
    StringBuilder temp = new StringBuilder();
    StringBuilder lawyertemp = new StringBuilder();
    result.append("<response>");
    try {
      BasicService userservice = (BasicService) globals.getBean("basicService");
      DetachedCriteria detachedCriteria =
          DetachedCriteria.forClass(SysUser.class)
              .add(Restrictions.eq("roleid", 1))
              .add(Restrictions.eq("delflag", false));
      detachedCriteria.setFetchMode("sysGroup", FetchMode.JOIN);
      List list = userservice.findAllByCriteria(detachedCriteria);
      int lawersize = list == null ? 0 : list.size();
      temp.append("<respcode>").append(lawersize).append("</respcode>");
      temp.append("<respmsg>").append("有" + lawersize + "个律师").append("</respmsg>");

      lawyertemp.append("<lawyers>");
      for (int i = 0; i < lawersize; i++) {
        SysUser lawyer = (SysUser) list.get(i);
        // 有事务所并且不是离职的律师了
        String cardno = lawyer.getCardno();
        if (lawyer.getSysGroup() != null
            && lawyer.getSysGroup().getGroupid() != -1
            && cardno != null
            && !cardno.trim().equals("")) {
          lawyertemp.append("<lawyer>");
          lawyertemp.append("<userid>").append(lawyer.getUserid()).append("</userid>");
          lawyertemp
              .append("<cardno>")
              .append(lawyer.getCardno() == null ? "" : lawyer.getCardno())
              .append("</cardno>");
          lawyertemp
              .append("<username>")
              .append(lawyer.getUsername() == null ? "" : lawyer.getUsername())
              .append("</username>");

          lawyertemp
              .append("<officename>")
              .append(lawyer.getSysGroup().getGroupname())
              .append("</officename>");

          lawyertemp
              .append("<mobile>")
              .append(lawyer.getSystemno() == null ? "" : lawyer.getSystemno())
              .append("</mobile>");
          //					lawyertemp.append("<mobile>").append(lawyer.getMobile() == null ? "" :
          // lawyer.getMobile()).append("</mobile>");
          lawyertemp.append("<lawyerno>").append(lawyer.getLawerno()).append("</lawyerno>");
          lawyertemp
              .append("<photo>")
              .append(lawyer.getPhoto() == null ? "" : lawyer.getPhoto())
              .append("</photo>");
          lawyertemp.append("</lawyer>\r\n");
        } else {
          LOG.info(lawyer.getUsername() + "所在的事务所为空,忽略");
        }
      }
      lawyertemp.append("</lawyers>");

    } catch (Exception e) {
      LOG.error(e);
      result.append("<respcode>").append(-1).append("</respcode>");
      result.append("<respmsg>获取律师信息异常:").append(e.getMessage()).append("</respmsg>");
    }
    result.append(temp);
    result.append(lawyertemp);
    result.append("</response>");
    return result.toString();
  }