예제 #1
0
  /** 去修改用户页面 */
  @RequestMapping(value = "/goEditU")
  public ModelAndView goEditU() throws Exception {
    ModelAndView mv = this.getModelAndView();
    PageData pd = new PageData();
    pd = this.getPageData();

    // 顶部修改个人资料
    String fx = pd.getString("fx");

    // System.out.println(fx);

    if ("head".equals(fx)) {
      mv.addObject("fx", "head");
    } else {
      mv.addObject("fx", "user");
    }

    List<Role> roleList = roleService.listAllERRoles(); // 列出所有二级角色
    pd = userService.findByUiId(pd); // 根据ID读取
    mv.setViewName("system/user/user_edit");
    mv.addObject("msg", "editU");
    mv.addObject("pd", pd);
    mv.addObject("roleList", roleList);

    return mv;
  }
예제 #2
0
  /** 显示用户列表 */
  @RequestMapping(value = "/listUsers")
  public ModelAndView listUsers(Page page) {
    ModelAndView mv = this.getModelAndView();
    PageData pd = new PageData();
    try {
      pd = this.getPageData();

      String USERNAME = pd.getString("USERNAME");

      if (null != USERNAME && !"".equals(USERNAME)) {
        USERNAME = USERNAME.trim();
        pd.put("USERNAME", USERNAME);
      }

      page.setPd(pd);
      List<PageData> userList = appuserService.listPdPageUser(page); // 列出用户列表
      List<Role> roleList = roleService.listAllappERRoles(); // 列出所有会员二级角色

      mv.setViewName("system/appuser/appuser_list");
      mv.addObject("userList", userList);
      mv.addObject("roleList", roleList);
      mv.addObject("pd", pd);
      mv.addObject(Const.SESSION_QX, this.getHC()); // 按钮权限
    } catch (Exception e) {
      logger.error(e.toString(), e);
    }

    return mv;
  }
예제 #3
0
  /** 去新增用户页面 */
  @RequestMapping(value = "/goAddU")
  public ModelAndView goAddU() throws Exception {
    ModelAndView mv = this.getModelAndView();
    PageData pd = new PageData();
    pd = this.getPageData();
    List<Role> roleList;

    roleList = roleService.listAllERRoles(); // 列出所有二级角色

    mv.setViewName("system/user/user_edit");
    mv.addObject("msg", "saveU");
    mv.addObject("pd", pd);
    mv.addObject("roleList", roleList);

    return mv;
  }
예제 #4
0
 /** 去新增用户页面 */
 @RequestMapping(value = "/goAddU")
 public ModelAndView goAddU() {
   ModelAndView mv = this.getModelAndView();
   PageData pd = new PageData();
   pd = this.getPageData();
   try {
     List<Role> roleList;
     roleList = roleService.listAllappERRoles(); // 列出所有二级角色
     mv.setViewName("system/appuser/appuser_edit");
     mv.addObject("msg", "saveU");
     mv.addObject("pd", pd);
     mv.addObject("roleList", roleList);
   } catch (Exception e) {
     logger.error(e.toString(), e);
   }
   return mv;
 }
예제 #5
0
  /** 显示用户列表(用户组) */
  @RequestMapping(value = "/listUsers")
  public ModelAndView listUsers(Page page) throws Exception {
    ModelAndView mv = this.getModelAndView();
    PageData pd = new PageData();
    pd = this.getPageData();

    String USERNAME = pd.getString("USERNAME");

    if (null != USERNAME && !"".equals(USERNAME)) {
      USERNAME = USERNAME.trim();
      pd.put("USERNAME", USERNAME);
    }

    String lastLoginStart = pd.getString("lastLoginStart");
    String lastLoginEnd = pd.getString("lastLoginEnd");

    if (lastLoginStart != null && !"".equals(lastLoginStart)) {
      lastLoginStart = lastLoginStart + " 00:00:00";
      pd.put("lastLoginStart", lastLoginStart);
    }
    if (lastLoginEnd != null && !"".equals(lastLoginEnd)) {
      lastLoginEnd = lastLoginEnd + " 00:00:00";
      pd.put("lastLoginEnd", lastLoginEnd);
    }

    page.setPd(pd);
    List<PageData> userList = userService.listPdPageUser(page); // 列出用户列表
    List<Role> roleList = roleService.listAllERRoles(); // 列出所有二级角色

    mv.setViewName("system/user/user_list");
    mv.addObject("userList", userList);
    mv.addObject("roleList", roleList);
    mv.addObject("pd", pd);
    mv.addObject(Const.SESSION_QX, this.getHC()); // 按钮权限
    return mv;
  }
예제 #6
0
  /** 从EXCEL导入到数据库 */
  @RequestMapping(value = "/readExcel")
  public ModelAndView readExcel(@RequestParam(value = "excel", required = false) MultipartFile file)
      throws Exception {
    ModelAndView mv = this.getModelAndView();
    PageData pd = new PageData();
    if (!Jurisdiction.buttonJurisdiction(menuUrl, "add")) {
      return null;
    }
    if (null != file && !file.isEmpty()) {
      String filePath = PathUtil.getClasspath() + Const.FILEPATHFILE; // 文件上传路径
      String fileName = FileUpload.fileUp(file, filePath, "userexcel"); // 执行上传

      List<PageData> listPd =
          (List)
              ObjectExcelRead.readExcel(
                  filePath, fileName, 2, 0,
                  0); // 执行读EXCEL操作,读出的数据导入List 2:从第3行开始;0:从第A列开始;0:第0个sheet

      /*存入数据库操作======================================*/
      pd.put("RIGHTS", ""); // 权限
      pd.put("LAST_LOGIN", ""); // 最后登录时间
      pd.put("IP", ""); // IP
      pd.put("STATUS", "0"); // 状态
      pd.put("SKIN", "default"); // 默认皮肤

      List<Role> roleList = roleService.listAllERRoles(); // 列出所有二级角色

      pd.put("ROLE_ID", roleList.get(0).getROLE_ID()); // 设置角色ID为随便第一个
      /** var0 :编号 var1 :姓名 var2 :手机 var3 :邮箱 var4 :备注 */
      for (int i = 0; i < listPd.size(); i++) {
        pd.put("USER_ID", this.get32UUID()); // ID
        pd.put("NAME", listPd.get(i).getString("var1")); // 姓名

        String USERNAME = GetPinyin.getPingYin(listPd.get(i).getString("var1")); // 根据姓名汉字生成全拼
        pd.put("USERNAME", USERNAME);
        if (userService.findByUId(pd) != null) { // 判断用户名是否重复
          USERNAME = GetPinyin.getPingYin(listPd.get(i).getString("var1")) + Tools.getRandomNum();
          pd.put("USERNAME", USERNAME);
        }
        pd.put("BZ", listPd.get(i).getString("var4")); // 备注
        if (Tools.checkEmail(listPd.get(i).getString("var3"))) { // 邮箱格式不对就跳过
          pd.put("EMAIL", listPd.get(i).getString("var3"));
          if (userService.findByUE(pd) != null) { // 邮箱已存在就跳过
            continue;
          }
        } else {
          continue;
        }

        pd.put("NUMBER", listPd.get(i).getString("var0")); // 编号已存在就跳过
        pd.put("PHONE", listPd.get(i).getString("var2")); // 手机号

        pd.put("PASSWORD", new SimpleHash("SHA-1", USERNAME, "123").toString()); // 默认密码123
        if (userService.findByUN(pd) != null) {
          continue;
        }
        userService.saveU(pd);
      }
      /*存入数据库操作======================================*/

      mv.addObject("msg", "success");
    }

    mv.setViewName("save_result");
    return mv;
  }