예제 #1
0
  public String querylist() throws Exception {
    Gzdx setGzdx = new Gzdx();
    gzdx = (Gzdx) this.setClass(setGzdx, null);
    Map map = new HashMap();
    map.put("xm", gzdx.getXm());
    map.put("xb", gzdx.getXb());
    map.put("zjhm", gzdx.getZjhm());
    map.put("csrq", gzdx.getCsrq());
    map.put("csrq2", gzdx.getCsrq2());
    map.put("mzdm", gzdx.getMzdm());
    map.put("hjdxzqhdm", gzdx.getHjdxzqhdm());
    map.put("hylbdm", gzdx.getHylbdm());
    User user = (User) this.getRequest().getSession().getAttribute(Constants.userKey);
    if (user != null) {
      String dqdwbm = user.getDepartment().getDepartcode();
      int level = user.getDepartment().getDepartlevel().intValue();
      if (level >= 3) map.put("tbdabm", StringUtil.trimEven0(dqdwbm) + "%");
      map.put("dqdwbm", dqdwbm);
    }

    // 如果查询菜单是注销管理,则应该要加一个默认条件为未注销
    if ("cancel".equals(gzdx.getFlag())) {
      map.put("zxbz", "0");
    }
    // 如果选择了姓名拼音的同音查询,则需要得到姓名的拼音
    if ("1".equals(gzdx.getTyCheck())) {
      map.put("xmpy", PinYinUtil.getHanyuPingYin(gzdx.getXm()));
      map.put("xm", "");
    }
    Page page = gzdxService.getListForPage(map, pagesize, pagerow, sort, dir);
    totalpage = page.getTotalPages();
    totalrows = page.getTotalRows();
    lGzdx = page.getData();
    setTabledata(lGzdx);
    this.result = "success";
    return "success";
  }
예제 #2
0
  public String queryForExport() {
    ActionContext ctx = ActionContext.getContext();
    HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
    HttpSession session = request.getSession();
    session.removeAttribute("gzdxExportResult");
    // User user= (User)session.getAttribute(Constants.userKey);
    Globalpar glo = this.getCacheGlobalpar("exportmaxrows");
    String maxRows = glo.getGlobalparvalue();
    try {
      Gzdx setGzdx = new Gzdx();
      gzdx = (Gzdx) this.setClass(setGzdx, null);
      Map map = new HashMap();
      //			map.put("xm", gzdx.getXm());
      //			map.put("xb", gzdx.getXb());
      //			map.put("zjhm", gzdx.getZjhm());
      //			map.put("csrq", gzdx.getCsrq());
      //			map.put("csrq2", gzdx.getCsrq2());
      //			map.put("mzdm", gzdx.getMzdm());
      //			map.put("hjdxzqhdm", gzdx.getHjdxzqhdm());
      //			//如果选择了姓名拼音的同音查询,则需要得到姓名的拼音
      //			if("1".equals(gzdx.getTyCheck())){
      //				map.put("xmpy", PinYinUtil.getHanyuPingYin(gzdx.getXm()));
      //				map.put("xm", "");
      //			}
      map.put("xm", gzdx.getXm());
      map.put("xb", gzdx.getXb());
      map.put("zjhm", gzdx.getZjhm());
      map.put("csrq", gzdx.getCsrq());
      map.put("csrq2", gzdx.getCsrq2());
      map.put("mzdm", gzdx.getMzdm());
      map.put("hjdxzqhdm", gzdx.getHjdxzqhdm());
      map.put("hylbdm", gzdx.getHylbdm());
      User user = (User) this.getRequest().getSession().getAttribute(Constants.userKey);
      if (user != null) {
        String dqdwbm = user.getDepartment().getDepartcode();
        int level = user.getDepartment().getDepartlevel().intValue();
        if (level >= 3) map.put("tbdabm", StringUtil.trimEven0(dqdwbm) + "%");
        map.put("dqdwbm", dqdwbm);
      }

      // 如果查询菜单是注销管理,则应该要加一个默认条件为未注销
      if ("cancel".equals(gzdx.getFlag())) {
        map.put("zxbz", "0");
      }
      // 如果选择了姓名拼音的同音查询,则需要得到姓名的拼音
      if ("1".equals(gzdx.getTyCheck())) {
        map.put("xmpy", PinYinUtil.getHanyuPingYin(gzdx.getXm()));
        map.put("xm", "");
      }
      map.put("endRow", maxRows);
      // Excel输出
      lGzdx = gzdxService.getListExportGzdx(map, sort, dir);
      // ///cache 替换
      List lPro = new ArrayList();
      lPro.add("xm");
      lPro.add("zjhm");
      lPro.add("xb");
      lPro.add("csrq");
      lPro.add("minzu");
      lPro.add("whcd");
      lPro.add("hjdxzqh");
      lPro.add("hjdxz");
      List lcache = new ArrayList();
      /*List lcache_mz = this.getDictItemCacheList("minzu", "dm_mz", "0"); //民族替换  "0"为不加列  "1"替换列
      lcache.add(lcache_mz);
      List lcache_xb = this.getDictItemCacheList("xingbie", "dm_xb", "0"); // 性别  "0"为不加列  "1"替换列
      lcache.add(lcache_xb);*/
      Gzdx getGzdx = new Gzdx();
      lGzdx = this.getResultCache(getGzdx.getClass().getName(), lPro, lGzdx, lcache);
      session.setAttribute("gzdxExportResult", lGzdx);
      this.result = "success";
    } catch (IOException e) {
      e.printStackTrace();
      this.result = e.getMessage();
    } catch (Exception e) {
      e.printStackTrace();
      this.result = e.getMessage();
    }
    return "success";
  }