/** 删除用户 */
 public void deleteUsers() throws Exception {
   HttpServletRequest request = ServletActionContext.getRequest();
   String ids = request.getParameter("ids");
   String[] sids = ids.split(",");
   String msg = "";
   try { // 删除成功
     baseUserInfoManager.deleteByKeys(sids);
     msg = "删除用户成功!";
     commonManagerImpl.log(request, "删除用户[主键:" + ids + "]成功!");
   } catch (Exception e) { // 删除失败
     msg = "删除用户成功\\!";
     commonManagerImpl.log(request, "删除用户[主键:" + ids + "]失败!");
   }
   Struts2Utils.renderText(msg);
 }
  /** 保存用户信息 */
  public String save() throws ServiceStartupException {
    HttpServletRequest request = Struts2Utils.getRequest();
    String msg = "";
    String usemd5 =
        PropertiesUtil.getInstance().getProperty("system.password.save.encry"); // 数据库保存密码是否需要md5加密
    String newpw = entity.getVcPassword();
    if (usemd5 != null && usemd5.equalsIgnoreCase("MD5")) {
      newpw = Utils.getMD5String(entity.getVcPassword());
    }

    try {
      entity.setVcPassword(newpw);
      baseUserInfoManager.save(entity);
      request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00101);
      msg = "添加用户信息[登录名:" + entity.getVcLoginName() + "]成功!";
      return SUCCESS;
    } catch (Exception e) {
      logger.error(e.getMessage());
      request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00004);
      msg = "添加用户信息[登录名:" + entity.getVcLoginName() + "]失败!";
      return ERROR;
    } finally {
      commonManagerImpl.log(request, msg);
    }
  }
  /** 数据导出 */
  public void export() throws ServletException, IOException {
    logger.info("businessName:" + businessName);
    logger.info("businessName:" + Common.convertToUTF8(businessName));
    List<CommonFlush> list =
        spaceDistributeBusinessManager.listData(
            Common.StringToInt(dataType_search),
            Integer.parseInt(spaceLevel_search),
            Common.convertToUTF8(businessName),
            Integer.parseInt(timeLevel_search),
            time_search);
    GridServerHandler gridServerHandler =
        new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse());

    String exportmsg =
        ExportMsg.EXPORT_FLUSH_BUSINESS_SPACE
            + Common.getTimeLevelCH(timeLevel_search)
            + "("
            + Common.convertToUTF8(businessName)
            + "|"
            + time_search
            + ")";
    commonManagerImpl.log(Struts2Utils.getRequest(), exportmsg);

    gridServerHandler.exportXLS(list, CommonFlush.class);
  }
 /** 更新密码 */
 public String updatePwd() throws ServiceStartupException {
   HttpServletRequest request = Struts2Utils.getRequest();
   String oldPwd = request.getParameter("oldPwd");
   String newPwd = request.getParameter("newPwd");
   String msg = "";
   if (baseUserInfoManager.updatePwd(oldPwd, newPwd, request)) {
     request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00106);
     msg = "更新用户密码[新密码:" + newPwd + "]成功!";
     commonManagerImpl.log(request, msg);
     return SUCCESS;
   } else {
     request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00008);
     request.setAttribute(VarConstants.URL, "/welcome.jsp.do?1=1");
     msg = "更新用户密码[新密码:" + newPwd + "]失败!";
     commonManagerImpl.log(request, msg);
     return ERROR;
   }
 }
 /** 删除用户 */
 public String delete() throws ServiceStartupException {
   HttpServletRequest request = Struts2Utils.getRequest();
   String[] sids = keys.split(",");
   String msg = null;
   try { // 删除成功
     baseUserInfoManager.deleteByKeys(sids);
     request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00008);
     request.setAttribute(VarConstants.URL, "/user_list.do?1=1");
     msg = "删除用户信息[用户主键:" + keys + "]成功!";
     commonManagerImpl.log(request, msg);
     return SUCCESS;
   } catch (Exception e) { // 删除失败
     request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00005);
     msg = "删除用户信息[用户主键:" + keys + "]失败!";
     commonManagerImpl.log(request, msg);
     return ERROR;
   }
 }
 /** 重置密码 */
 public String resetPwd() throws ServiceStartupException {
   HttpServletRequest request = Struts2Utils.getRequest();
   String sids = Common.FormatString(keys, "0");
   boolean updateBoolean = baseUserInfoManager.updatePwdReset(sids, request);
   String msg = "";
   if (updateBoolean) {
     request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00003);
     request.setAttribute(VarConstants.URL, "/user_list.do?1=1");
     msg = "重置用户密码[用户主键:" + keys + "]成功!";
     commonManagerImpl.log(request, msg);
     return SUCCESS;
   } else {
     request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00007);
     request.setAttribute(VarConstants.URL, "/user_list.do?1=1");
     msg = "重置用户密码[用户主键:" + keys + "]失败!";
     commonManagerImpl.log(request, msg);
     return ERROR;
   }
 }
  /** 插入用户权限 */
  public String insertPermis() throws ServiceStartupException {

    HttpServletRequest request = Struts2Utils.getRequest();
    String vcUserNo = request.getParameter("vcUserNo");
    String vcRoleNo = request.getParameter("vcRoleNo");
    String msg = "";
    boolean bo = baseUserInfoManager.inserUserRoles(vcUserNo, vcRoleNo, request);
    if (bo) {
      request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00104);
      msg = "插入角色权限[权限关联字段:" + "vcUserNo:" + vcUserNo + " vcRoleNo:" + vcRoleNo + "]成功!";
      commonManagerImpl.log(request, msg);
      return SUCCESS;
    } else {
      request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00009);
      request.setAttribute(VarConstants.URL, "/user_list.do?1=1");
      msg = "插入角色权限[权限关联字段:" + "vcUserNo:" + vcUserNo + " vcRoleNo:" + vcRoleNo + "]失败!";
      commonManagerImpl.log(request, msg);
      return ERROR;
    }
  }
 /** 导出 */
 public void export() throws ServletException, IOException {
   if (this.searchdate == null) {
     this.searchdate = CommonUtils.getSYestoday();
   }
   List<TopStat> list = null;
   GridServerHandler gridServerHandler =
       new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse());
   list = topFlushAndImsiManager.findTopStatImsi(raittype, stattype, searchdate);
   String exportmsg = ExportMsg.EXPORT_FLUSH_TOPUSER + "(" + searchdate + ")";
   commonManagerImpl.log(Struts2Utils.getRequest(), exportmsg);
   gridServerHandler.exportXLS(list, TopStat.class);
 }
 /** 保存用户信息 */
 public String update() throws ServiceStartupException {
   HttpServletRequest request = Struts2Utils.getRequest();
   String msg = "";
   try {
     baseUserInfoManager.save(entity);
     msg = " 编辑用户信息[登录名:" + entity.getVcLoginName() + "]成功!";
     request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00102);
     return SUCCESS;
   } catch (Exception e) {
     request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00004);
     msg = "编辑用户信息[登录名:" + entity.getVcLoginName() + "]失败!";
     return ERROR;
   } finally {
     commonManagerImpl.log(request, msg);
   }
 }