/**
  * 方法描述:新增会员级别配置
  *
  * @return
  * @throws Exception
  */
 public String insert() throws Exception {
   if (!ValidateUtil.isRequired(memberlevel.getMenu_right())) {
     String menu_right = this.memberlevel.getMenu_right();
     menu_right = menu_right.replace(" ", "");
     memberlevel.setMenu_right(menu_right);
   }
   if (memberlevel.getOper_right() != null && !memberlevel.getOper_right().equals("")) {
     String oper_right = this.memberlevel.getOper_right();
     oper_right = oper_right.replace(" ", "");
     memberlevel.setOper_right(oper_right);
   }
   if (memberlevel.getModule_attr() != null && !memberlevel.getModule_attr().equals("")) {
     String mod_attr = memberlevel.getModule_attr();
     mod_attr = mod_attr.replace(" ", "");
     memberlevel.setModule_attr(mod_attr);
   }
   memberlevel.setSyslevel("1"); // 1:会员自定义级别
   // 发布条数信息控制串
   String troStr = backcontrolList();
   this.memberlevel.setNum_control(troStr);
   // 字段验证
   super.commonValidateField(memberlevel);
   if (super.ifvalidatepass) {
     return add();
   }
   this.memberlevelService.insert(memberlevel);
   this.addActionMessage("新增会员级别成功");
   return add();
 }
 /**
  * 方法描述:修改会员级别配置信息
  *
  * @return
  * @throws Exception
  */
 public String update() throws Exception {
   String mlid = memberlevel.getLevel_id();
   if (ValidateUtil.isDigital(mlid)) {
     return list();
   }
   if (!ValidateUtil.isRequired(nameright)) {
     String menu_right = nameright;
     menu_right = menu_right.replace(" ", "");
     memberlevel.setMenu_right(menu_right);
   } else {
     memberlevel.setMenu_right("");
   }
   String oper_right = this.memberlevel.getOper_right();
   if (oper_right != null && !oper_right.equals("")) {
     oper_right = oper_right.replace(" ", "");
     memberlevel.setOper_right(oper_right);
   }
   if (memberlevel.getModule_attr() != null && !memberlevel.getModule_attr().equals("")) {
     String mod_attr = memberlevel.getModule_attr();
     mod_attr = mod_attr.replace(" ", "");
     memberlevel.setModule_attr(mod_attr);
   }
   // 发布条数信息控制串
   String troStr = backcontrolList();
   this.memberlevel.setNum_control(troStr);
   // 字段验证
   super.commonValidateField(memberlevel);
   if (super.ifvalidatepass) {
     return view();
   }
   this.memberlevelService.update(memberlevel);
   this.addActionMessage("修改会员级别成功");
   return list();
 }
 /**
  * 方法描述:根据主键找出会员级别
  *
  * @return
  * @throws Exception
  */
 public String view() throws Exception {
   setcode(); // 取得会员后台菜单
   getModattr();
   if (troname == null) {
     getcontrolList();
     String troStr = "";
     if (memberlevel.getNum_control() != null) {
       troStr = memberlevel.getNum_control();
     }
     for (int i = 0; i < controlList.size(); i++) {
       Map listMap = new HashMap();
       listMap = (HashMap) controlList.get(i);
       if (listMap.get("para_value") != null) {
         String troname = listMap.get("para_value").toString();
         // 找出该模块是否有被设置过发过条数
         if (troStr != null && !troStr.equals("") || troStr.indexOf(troname + "-") > -1) {
           int len = troStr.indexOf(troname);
           // 截取单个模块的键值对
           if (len > -1) {
             if (len < troStr.length()) {
               String tros = troStr.substring(len, troStr.length());
               int posLen = tros.indexOf(",");
               String tro = "";
               if (posLen > -1) {
                 tro = tros.substring(0, posLen);
               } else {
                 tro = tros.substring(0, tros.length());
               }
               // tro得到  模块名-值
               int lineLen = tro.indexOf("-");
               String cval = "";
               if (lineLen > -1 && lineLen + 1 < tro.length()) {
                 cval = tro.substring(lineLen + 1, tro.length());
               }
               listMap.put("troval", cval);
               controlList.set(i, listMap);
             }
           }
         }
       }
     }
   }
   return goUrl(VIEW);
 }