⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rightmenu.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.saas.biz.rightMgr;

import java.util.*;

import net.sf.json.JSONArray;

import uk.ltd.getahead.dwr.WebContext;

import com.saas.sys.buffer.Buffers;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.*;
import com.saas.biz.dao.rightsDAO.*;
import com.saas.biz.dao.rolerightDAO.RoleRightExt;
import com.saas.biz.JavaScriptObject.TreeNode;
import com.saas.biz.JavaScriptObject.TreeObject;
import com.saas.biz.commen.*;
import com.saas.biz.dao.commenDAO.*;

public class RightMenu {

	Logger log;

	ArrayList queryResult = new ArrayList();

	commMethodMgr commen;

	public RightMenu() {

		log = new Logger(this);
		commen = new commMethodMgr();
	}

	public ArrayList getQueryResult() {

		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult) {

		this.queryResult = queryResult;
	}

	/**
	 * 获取产品列表
	 * 
	 * @param inbuffer
	 */
	public void genSuperRightMenuList(Buffers inbuffer) {

		log.LOG_INFO("进入genSuperRightMenuList方法...");
		String staffId = inbuffer.getString("SESSION_USER_NAME");
		String strUserClass = inbuffer.getString("SESSION_CUST_CLASS");
		String iClass = inbuffer.getString("MENU_CLASS");
		String subsys_code = inbuffer.getString("SUBSYS_CODE");
		String staff_Id = inbuffer.getString("SESSION_USER_ID");
		String role_code = "";
		if (inbuffer.getString("SESSION_ROLE_CODE") != "")
			role_code = inbuffer.getString("SESSION_ROLE_CODE");

		String user_type = inbuffer.getString("SESSION_USER_TYPE");
		try {
			this.queryResult = genSuperRightMenuList(staff_Id, staffId, iClass, strUserClass, subsys_code, user_type, role_code);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("退出genRightMenuList方法...");
	}

	/**
	 * 获取产品列表
	 * 
	 * @param inbuffer
	 */
	public ArrayList genSuperRightMenuList(String staff_Id, String Staffid, String iclass, String user_class, String subsys, String user_type, String role_code) throws SaasApplicationException {

		if (staff_Id == null)
			throw new SaasApplicationException("登陆用户名为空,无法获取权限菜单!");
		ArrayList menuList = new ArrayList();
		ArrayList menuInfoList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VSTAFF_ID", staff_Id);
		menuInfoExt.setParam(":VSTAFFID", Staffid);
		menuInfoExt.setParam(":VUSER_CLASS", user_class);
		menuInfoExt.setParam(":VRIGHT_TYPE", "0");
		menuInfoExt.setParam(":VCLASS", iclass);
		menuInfoExt.setParam(":VROLE_CODE", role_code);
		menuInfoExt.setParam(":VUSER_TYPE", user_type);
		menuInfoExt.setParam(":VSUBSYS_CODE", subsys);
		menuInfoList = menuInfoExt.selByList("SEL_BY_CLASS_SYS");
		/***********************************************************************
		 * if (menuInfoList == null) { String errorMsg = "请先选择服务"; HashMap
		 * menuListMap = new HashMap(); menuListMap.put("text", errorMsg);
		 * menuListMap.put("var", ""); menuList.add(menuListMap); return
		 * menuList; } for (Iterator it = menuInfoList.iterator();
		 * it.hasNext();) { HashMap menuInfo = (HashMap) it.next(); String
		 * menuId = ""; String images = ""; String menuName = ""; String
		 * menudesc = ""; HashMap menuListMap = new HashMap(); if
		 * (menuInfo.get("menu_id") != null) menuId =
		 * menuInfo.get("menu_id").toString(); if (menuInfo.get("menu_name") !=
		 * null) menuName = menuInfo.get("menu_name").toString(); if
		 * (menuInfo.get("rsrv_str9") != null) images =
		 * menuInfo.get("rsrv_str9").toString(); if (menuInfo.get("rsrv_str4") !=
		 * null) menudesc = menuInfo.get("rsrv_str4").toString(); String
		 * menuString = menuName; menuListMap.put("text", menuString);
		 * menuListMap.put("var", menuId); menuListMap.put("image", images);
		 * menuListMap.put("desc", menudesc); menuList.add(menuListMap); }
		 **********************************************************************/
		return menuInfoList;
	}

	/**
	 * 获取 服务列表
	 * 
	 * @param inbuffer
	 */
	public void genchildRightMenuList(Buffers inbuffer) {

		log.LOG_INFO("进入genchildRightMenuList方法...");
		String staffId = inbuffer.getString("SESSION_USER_NAME");
		String iClass = inbuffer.getString("MENU_CLASS");
		String UpItemId = inbuffer.getString("UP_MENU_ID");
		String cust_class = inbuffer.getString("SESSION_CUST_CLASS");
		String role_code = "";
		if (inbuffer.getString("SESSION_ROLE_CODE") != "")
			role_code = inbuffer.getString("SESSION_ROLE_CODE");

		String user_type = inbuffer.getString("SESSION_USER_TYPE");
		try {
			this.queryResult = genchildRightMenuList(staffId, iClass, UpItemId, cust_class, role_code, user_type);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("退出genchildRightMenuList方法...");
	}

	public ArrayList genchildRightMenuList(String Staff_id, String iclass, String UpItemId, String cust_class, String role_code, String user_type) throws SaasApplicationException {

		if (Staff_id == null)
			throw new SaasApplicationException("登陆用户名为空,无法获取权限菜单!");
		ArrayList menuList = new ArrayList();
		ArrayList menuInfoList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VCUST_CLASS", cust_class);
		menuInfoExt.setParam(":VSTAFF_ID", Staff_id);
		menuInfoExt.setParam(":VSTAFFID", Staff_id);
		menuInfoExt.setParam(":VCLASS", iclass);
		menuInfoExt.setParam(":VROLE_CODE", role_code);
		menuInfoExt.setParam(":VUSER_TYPE", user_type);
		menuInfoExt.setParam(":VUP_ITEM_ID", UpItemId);
		menuInfoList = menuInfoExt.selByList("SEL_BY_CLASS_STAFF_UP");
		/***********************************************************************
		 * if (menuInfoList == null) { String errorMsg = ""; HashMap menuListMap =
		 * new HashMap(); menuListMap.put("text",
		 * commen.convetStrToWeb(errorMsg)); menuListMap.put("var", "");
		 * menuList.add(menuListMap); return menuList; } for (Iterator it =
		 * menuInfoList.iterator(); it.hasNext();) { HashMap menuInfo =
		 * (HashMap) it.next(); String menuId = ""; String menuName = ""; String
		 * remark = ""; String images = ""; String menudesc = ""; HashMap
		 * menuListMap = new HashMap(); if (menuInfo.get("menu_id") != null)
		 * menuId = menuInfo.get("menu_id").toString(); if
		 * (menuInfo.get("menu_name") != null) menuName =
		 * menuInfo.get("menu_name").toString(); String menuString = menuName;
		 * if (menuInfo.get("remark") != null) { remark =
		 * menuInfo.get("remark").toString(); } if (menuInfo.get("rsrv_str9") !=
		 * null) images = menuInfo.get("rsrv_str9").toString(); if
		 * (menuInfo.get("rsrv_str4") != null) menudesc =
		 * menuInfo.get("rsrv_str4").toString(); menuListMap.put("text",
		 * menuString); menuListMap.put("var", menuId);
		 * menuListMap.put("remark", remark); menuListMap.put("image", images);
		 * menuListMap.put("desc", menudesc); menuList.add(menuListMap); }
		 **********************************************************************/
		return menuInfoList;
	}

	public void genRightMenuOneList(Buffers inbuffer) {

		log.LOG_INFO("进入genchildRightMenuList方法...");
		try {
			this.queryResult = genRightMenuOneList();
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("退出genchildRightMenuList方法...");
	}

	public ArrayList genRightMenuOneList() throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VMENU_CLASS", "1");
		menuList = menuInfoExt.selByList("SEL_BY_CLASSONE");
		return menuList;
	}

	/**
	 * 获取单前用户的菜单
	 * 
	 * @param inbuffer
	 */
	public ArrayList genMenuRight(String sys_code, String menu_class) throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VMENU_CLASS", "1");
		menuInfoExt.setParam(":VSUBSYS_CODE", sys_code);
		menuList = menuInfoExt.selByList("SEL_BY_CLASSONE");
		return menuList;
	}

	public ArrayList genDownMenu(String sys_code, String menu_id) throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VUP_MENU_ID", menu_id);
		menuInfoExt.setParam(":VSUBSYS_CODE", sys_code);
		menuList = menuInfoExt.selByList("SEL_BY_DOWN");
		return menuList;
	}

	public String getfirstMenuId(String menu_id) throws SaasApplicationException {

		MenuinfoDAO menuinfoDAO = new MenuinfoDAO();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		MenuinfoDAO menuinfoDAO2 = new MenuinfoDAO();
		MenuinfoExt menuInfoExt2 = new MenuinfoExt();
		MenuinfoDAO menuinfoDAO3 = new MenuinfoDAO();
		MenuinfoExt menuInfoExt3 = new MenuinfoExt();
		String out_menu_id = "";
		String inmenuId = "";
		String inmenuClass = "";

		String upmenuId = "";
		menuInfoExt.setParam(":VMENU_ID", menu_id);
		menuinfoDAO = menuInfoExt.selByInfo("SEL_BY_PK");
		if (menuinfoDAO != null) {
			inmenuClass = menuinfoDAO.getMenu_class();
			upmenuId = menuinfoDAO.getUp_menu_id();
			if (inmenuClass.equals("2")) {
				out_menu_id = upmenuId;
			} else if (inmenuClass.equals("3")) {
				menuInfoExt2.setParam(":VMENU_ID", menuinfoDAO.getMenu_id());
				menuinfoDAO2 = menuInfoExt2.selByInfo("SEL_BY_PK");
				if (menuinfoDAO2 != null) {
					menuInfoExt3.setParam(":VMENU_ID", menuinfoDAO2.getUp_menu_id());
					menuinfoDAO3 = menuInfoExt3.selByInfo("SEL_BY_PK");
					if (menuinfoDAO3 != null) {
						out_menu_id = menuinfoDAO3.getUp_menu_id();
					}
				}
			}
		}
		return out_menu_id;
	}

	public ArrayList getMenuInfo(String menu_id) throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VMENU_ID", menu_id);
		menuList = menuInfoExt.selByList("SEL_BY_PK");
		return menuList;
	}

	// 取出菜单名字
	public String getMenuNameById(String menu_id) throws SaasApplicationException {

		String menu_name = "";
		ArrayList menuList = getMenuInfo(menu_id);
		if (menuList != null && menuList.size() > 0) {
			HashMap map = (HashMap) menuList.get(0);
			if (map.get("menu_name") != null) {
				menu_name = map.get("menu_name").toString();
			}
		}
		return menu_name;
	}

	public ArrayList genSysServ(String sub_code) throws SaasApplicationException {

		CommparaExt commparaExt = new CommparaExt();
		ArrayList commparaList = new ArrayList();
		commparaExt.setParam(":VSUBSYS_CODE", sub_code);
		commparaExt.setParam(":VPARAM_ATTR", "41");
		commparaList = commparaExt.selByList("SEL_BY_ATTR");
		return commparaList;
	}

	public ArrayList genSysServ() throws SaasApplicationException {
		CommparaExt commparaExt = new CommparaExt();
		ArrayList commparaList = new ArrayList();
		commparaExt.setParam(":VSUBSYS_CODE", "SYS");
		commparaExt.setParam(":VPARAM_ATTR", "41");
		commparaList = commparaExt.selByList("SEL_BY_ATTR");
		return commparaList;
	}

	public ArrayList genSysServByCust(String cust_id, String admin) throws SaasApplicationException {

		CommparaExt commparaExt = new CommparaExt();
		ArrayList commparaList = new ArrayList();
		commparaExt.setParam(":VSUBSYS_CODE", "SYS");
		commparaExt.setParam(":VCUST_ID", cust_id);
		commparaExt.setParam(":VADMIN", admin);
		commparaExt.setParam(":VPARAM_ATTR", "41");
		commparaList = commparaExt.selByList("SEL_BY_ATTR_CUST");
		return commparaList;
	}

	// 取出所有菜单
	public HashMap getMenuByCodeAndClass(String sysCode, String menu_Class, String role, String cust_id) throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		ArrayList hashMenuList = getRoleRightInfoByRole(cust_id, role);
		HashMap<String, String> menuMap = new HashMap<String, String>();
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VSUBSYS_CODE", sysCode);
		menuInfoExt.setParam(":VMENU_CLASS", menu_Class);
		menuList = menuInfoExt.selByList("SEL_BY_CLASSONE");
		if (menuList != null && menuList.size() > 0) {
			for (int i = 0; i < menuList.size(); i++) {
				HashMap map = (HashMap) menuList.get(i);
				if (map.get("rsrv_str1") != null && map.get("rsrv_str1").equals("sys")) {
					continue;
				} else {
					String menu_id = map.get("menu_id").toString();
					String menu_name = map.get("menu_name").toString();
					if (hashMenuList.contains(menu_id)) {
						menu_name = menu_name + "[已分配]";
					}
					menuMap.put(menu_id, menu_name);
				}
			}
		}
		return menuMap;
	}

	// 找出下级菜单
	public HashMap getMenuByUpmenId(String sysCode, String upMenuId, String cust_id, String role) throws SaasApplicationException {

		ArrayList menuList = new ArrayList();
		HashMap<String, String> menuMap = new HashMap<String, String>();
		ArrayList hashMenuList = getRoleRightInfoByRole(cust_id, role);
		MenuinfoExt menuInfoExt = new MenuinfoExt();
		menuInfoExt.setParam(":VSUBSYS_CODE", sysCode);
		menuInfoExt.setParam(":VUP_MENU_ID", upMenuId);
		menuList = menuInfoExt.selByList("SEL_BY_DOWN");
		if (menuList != null && menuList.size() > 0) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -