📄 rightmenu.java
字号:
for (int i = 0; i < menuList.size(); i++) {
HashMap map = (HashMap) menuList.get(i);
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 ArrayList getRoleRightInfoByRole(String cust_id, String role_code) throws SaasApplicationException {
ArrayList roleList = new ArrayList();
ArrayList<String> list = new ArrayList<String>();
RoleRightExt rightExt = new RoleRightExt();
rightExt.setParam(":VCUST_ID", cust_id);
rightExt.setParam(":VROLE_CODE", role_code);
roleList = rightExt.selByList("SEL_BY_ROLE");
if (roleList != null && roleList.size() > 0) {
for (int i = 0; i < roleList.size(); i++) {
HashMap map = (HashMap) roleList.get(i);
String menu_id = map.get("menu_id").toString();
list.add(menu_id);
}
}
return list;
}
// 回收菜单权限菜单
public HashMap getRoleByCodeAndClass(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)) {
menuMap.put(menu_id, menu_name);
}
}
}
}
return menuMap;
}
// 回收菜单权限下级菜单
public HashMap getRoleByUpmenId(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) {
for (int i = 0; i < menuList.size(); i++) {
HashMap map = (HashMap) menuList.get(i);
String menu_id = map.get("menu_id").toString();
String menu_name = map.get("menu_name").toString();
if (hashMenuList.contains(menu_id)) {
menuMap.put(menu_id, menu_name);
}
}
}
return menuMap;
}
// 取出菜单名字
public String getMenupath(String menu_id) throws SaasApplicationException {
String menu_name = "";
String up_menu_id = "";
ArrayList menuList = getMenuInfo(menu_id);
if (menuList != null && menuList.size() > 0) {
HashMap map = (HashMap) menuList.get(0);
if (map.get("up_menu_id") != null) {
up_menu_id = map.get("up_menu_id").toString();
}
if (map.get("menu_name") != null) {
menu_name = getMenupath(up_menu_id) + " > " + map.get("menu_name").toString();
}
}
return menu_name;
}
/**
* 通过菜单级别、客户级别取出菜单
*/
public ArrayList getMeunByClass(String sub_code, String cust_class, String menu_class, boolean exists) throws SaasApplicationException {
ArrayList list = new ArrayList();
MenuinfoExt menuExt = new MenuinfoExt();
menuExt.setParam(":VSUBSYS_CODE", sub_code);
menuExt.setParam(":VCUST_CLASS", cust_class);
menuExt.setParam(":VMENU_CLASS", menu_class);
if (exists) {
list = menuExt.selByList("SEL_BY_IN_CLASS");
} else {
list = menuExt.selByList("SEL_BY_NOT_CLASS");
}
log.LOG_INFO(exists + "结束getMeunByClass=>>>list==");
return list;
}
/**
* 通过上级菜单、客户级别及菜单级别取出菜单
*/
public ArrayList getRightMenByUpMenu(String cust_class, String menu_class, String up_menu_id, boolean exists) throws SaasApplicationException {
ArrayList list = new ArrayList(0);
RightinfoExt rightExt = new RightinfoExt();
rightExt.setParam(":VCUST_CLASS", cust_class);
rightExt.setParam(":VMENU_CLASS", menu_class);
rightExt.setParam(":VUP_MENU_ID", up_menu_id);
if (exists) {
list = rightExt.selByList("SEL_BY_CLASSDOWN");
} else {
list = rightExt.selByList("SEL_BY_NOT_CLASSDOWN");
}
log.LOG_INFO(exists + "结束getRightMenByUpMenu=>>>up_menu_id=" + up_menu_id + "==========");
return list;
}
/**
* 取出所有已分配的菜单
*
* @param cust_class
* @param sub_code
* @param img
* @return json data
* @throws SaasApplicationException
*/
public HashMap getRefundMenuMap(String cust_class, String sub_code) throws SaasApplicationException {
HashMap menu_amp = new HashMap();
ArrayList rootList = getMeunByClass(sub_code, cust_class, "1", true);
if (rootList != null && rootList.size() > 0) {
for (int i = 0; i < rootList.size(); i++) {
HashMap map = (HashMap) rootList.get(i);
TreeObject tree = new TreeObject();
String text = map.get("menu_name").toString();
String id = map.get("menu_id").toString();
menu_amp.put(id, text);
}
}
log.LOG_INFO("结束getRefundMenuJson=>>>");
return menu_amp;
}
/**
* 取出所有已分配的菜单
*
* @param cust_class
* @param sub_code
* @param img
* @return json data
* @throws SaasApplicationException
*/
public HashMap getMapMenByUpMenu(String cust_class, String menu_class, String up_menu_id, boolean exists) throws SaasApplicationException {
HashMap menu_amp = new HashMap();
ArrayList rootList = new ArrayList(0);
RightinfoExt rightExt = new RightinfoExt();
rightExt.setParam(":VCUST_CLASS", cust_class);
rightExt.setParam(":VMENU_CLASS", menu_class);
rightExt.setParam(":VUP_MENU_ID", up_menu_id);
if (exists) {
rootList = rightExt.selByList("SEL_BY_CLASSDOWN");
} else {
rootList = rightExt.selByList("SEL_BY_NOT_CLASSDOWN");
}
if (rootList != null && rootList.size() > 0) {
for (int i = 0; i < rootList.size(); i++) {
HashMap map = (HashMap) rootList.get(i);
TreeObject tree = new TreeObject();
String text = map.get("menu_name").toString();
String id = map.get("menu_id").toString();
menu_amp.put(id, text);
}
}
return menu_amp;
}
/**
* @param cust_id
* @param root_id
* @param nextList
* @return children
* @throws SaasApplicationException
*/
public JSONArray getChildrenNodes(String cust_class, String menu_class, ArrayList nextList) throws SaasApplicationException {
JSONArray children = new JSONArray();
if (nextList != null && nextList.size() > 0) {
for (int i = 0; i < nextList.size(); i++) {
HashMap map = (HashMap) nextList.get(i);
TreeObject tree = new TreeObject();
String text = map.get("menu_name").toString();
String id = map.get("menu_id").toString();
tree.setId(id);
tree.setText(text);
TreeNode node = isRefundLeaf(cust_class, menu_class, id);
tree.setChildren(node.getChildren());
tree.setLeaf(node.isLeaf());
children.add(tree);
}
}
log.LOG_INFO("结束getChildrenNodes=>>>");
return children;
}
/**
* @param cust_id
* @param up_id
* @return TreeNode
* @throws SaasApplicationException
*/
public TreeNode isRefundLeaf(String cust_class, String menu_class, String up_menu_id) throws SaasApplicationException {
int m_class = Integer.parseInt(menu_class);
menu_class = String.valueOf(m_class + 1);
ArrayList nextList = getRightMenByUpMenu(cust_class, menu_class, up_menu_id, true);
TreeNode node = new TreeNode();
if (nextList != null && nextList.size() > 0) {
node.setLeaf(false);
JSONArray children = getChildrenNodes(cust_class, menu_class, nextList);
node.setChildren(children);
}
log.LOG_INFO("结束isRefundLeaf=>>>");
return node;
}
/**
* 取出所有未分配的菜单
*
* @param cust_class
* @param sub_code
* @param img
* @return json data
* @throws SaasApplicationException
*/
public HashMap getMenuForSend(String cust_class, String sub_code) throws SaasApplicationException {
HashMap map = new HashMap();
ArrayList rootList = getMeunByClass(sub_code, cust_class, "1", false);
if (rootList != null && rootList.size() > 0) {
for (int i = 0; i < rootList.size(); i++) {
HashMap menu_map = (HashMap) rootList.get(i);
String text = menu_map.get("menu_name").toString();
String id = menu_map.get("menu_id").toString();
map.put(id, text);
}
}
log.LOG_INFO("结束getSendMenuJson=>>>");
return map;
}
/**
* @param cust_id
* @param root_id
* @param nextList
* @return children
* @throws SaasApplicationException
*/
public JSONArray getSendChildrenNodes(String cust_class, String menu_class, ArrayList nextList) throws SaasApplicationException {
JSONArray children = new JSONArray();
if (nextList != null && nextList.size() > 0) {
for (int i = 0; i < nextList.size(); i++) {
HashMap map = (HashMap) nextList.get(i);
TreeObject tree = new TreeObject();
String text = map.get("menu_name").toString();
String id = map.get("menu_id").toString();
tree.setId(id);
tree.setText(text);
TreeNode node = isSendLeaf(cust_class, menu_class, id);
tree.setChildren(node.getChildren());
tree.setLeaf(node.isLeaf());
children.add(tree);
}
}
log.LOG_INFO("结束getSendChildrenNodes=>>>");
return children;
}
/**
* @param cust_id
* @param up_id
* @return TreeNode
* @throws SaasApplicationException
*/
public TreeNode isSendLeaf(String cust_class, String menu_class, String up_menu_id) throws SaasApplicationException {
int m_class = Integer.parseInt(menu_class);
menu_class = String.valueOf(m_class + 1);
ArrayList nextList = getRightMenByUpMenu(cust_class, menu_class, up_menu_id, false);
TreeNode node = new TreeNode();
if (nextList != null && nextList.size() > 0) {
node.setLeaf(false);
JSONArray children = getSendChildrenNodes(cust_class, menu_class, nextList);
node.setChildren(children);
}
log.LOG_INFO("结束isSendLeaf=>>>");
return node;
}
public ArrayList getOneClassMenuBySer(String up_menu_id,String server_id) throws SaasApplicationException {
//根据服务名称找出一级菜单
ArrayList menuList = new ArrayList();
MenuinfoExt menuExt = new MenuinfoExt();
menuExt.setParam(":VSERVER_ID", server_id);
menuExt.setParam(":VUP_MENU_ID", up_menu_id);
menuList = menuExt.selByList("SEL_All_ONE_CLASS_MENU");
return menuList;
}
public ArrayList getRightInfoMenuMessage(String cust_id, String role_code) throws SaasApplicationException {
ArrayList roleList = new ArrayList();
ArrayList list = new ArrayList();
RoleRightExt rightExt = new RoleRightExt();
rightExt.setParam(":VCUST_ID", cust_id);
rightExt.setParam(":VROLE_CODE", role_code);
roleList = rightExt.selByList("SEL_BY_ROLE");
return roleList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -