Search in sources :

Example 6 with SysMenuVO

use of com.netsteadfast.greenstep.vo.SysMenuVO in project bamboobsc by billchen198318.

the class SysMenuServiceImpl method findForMenuGenerator.

/**
	 * 找此帳戶有的選單 , 如果是 super 就把 account 帶入空白
	 * 
	 * @param progSystem
	 * @param account
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@Override
public DefaultResult<List<SysMenuVO>> findForMenuGenerator(String progSystem, String account) throws ServiceException, Exception {
    if (StringUtils.isBlank(progSystem)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<List<SysMenuVO>> result = new DefaultResult<List<SysMenuVO>>();
    List<SysMenuVO> searchList = this.sysMenuDAO.findForMenuGenerator(progSystem, account);
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 7 with SysMenuVO

use of com.netsteadfast.greenstep.vo.SysMenuVO in project bamboobsc by billchen198318.

the class MenuSupportUtils method getMenuTreeJsonData.

/**
	 * 取回Tree選單資料
	 * 
	 * @param basePath
	 * @param sysList
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
public static List<Map<String, Object>> getMenuTreeJsonData(String basePath, List<TbSys> sysList, String localeCode) throws ServiceException, Exception {
    if (LocaleLanguageUtils.getMap().get(localeCode) == null) {
        localeCode = LocaleLanguageUtils.getDefault();
    }
    List<Map<String, Object>> treeMenuList = new LinkedList<Map<String, Object>>();
    for (TbSys sys : sysList) {
        List<SysMenuVO> sysMenuList = loadSysMenuData(sys.getSysId());
        if (sysMenuList == null || sysMenuList.size() < 1) {
            continue;
        }
        // 改用去找多語言設定檔
        String multiSysName = getSystemMultiName(sys, localeCode);
        Map<String, Object> systemMap = new HashMap<String, Object>();
        systemMap.put("id", sys.getSysId());
        systemMap.put("progId", sys.getSysId());
        //systemMap.put("name", sys.getName());
        // 改用去找多語言設定檔
        systemMap.put("name", multiSysName);
        systemMap.put("type", MenuItemType.FOLDER);
        //systemMap.put("url", " ");
        systemMap.put("onclick", " ");
        //systemMap.put("label", IconUtils.getMenuIcon(basePath, sys.getIcon()) + StringEscapeUtils.escapeHtml4(sys.getName()) );
        // 改用去找多語言設定檔
        systemMap.put("label", IconUtils.getMenuIcon(basePath, sys.getIcon()) + StringEscapeUtils.escapeHtml4(multiSysName));
        List<Map<String, Object>> sysItemList = new LinkedList<Map<String, Object>>();
        List<SysMenuVO> folderList = searchFolder(sysMenuList);
        for (SysMenuVO sysMenu : folderList) {
            List<SysMenuVO> menuItemList = searchItem(sysMenu.getOid(), sysMenuList);
            if (menuItemList == null || menuItemList.size() < 1) {
                continue;
            }
            String menuProgMultiName = getProgramMultiName(sysMenu, localeCode);
            Map<String, Object> sysMenuMap = new HashMap<String, Object>();
            sysMenuMap.put("id", sysMenu.getOid());
            sysMenuMap.put("progId", sysMenu.getProgId());
            //sysMenuMap.put("name", sysMenu.getName());
            // 改用去找多語言設定檔
            sysMenuMap.put("name", menuProgMultiName);
            sysMenuMap.put("type", sysMenu.getItemType());
            //sysMenuMap.put("url", " ");
            sysMenuMap.put("onclick", " ");
            //sysMenuMap.put("label", IconUtils.getMenuIcon(basePath, sysMenu.getIcon()) + StringEscapeUtils.escapeHtml4(sysMenu.getName()) );
            // 改用去找多語言設定檔
            sysMenuMap.put("label", IconUtils.getMenuIcon(basePath, sysMenu.getIcon()) + StringEscapeUtils.escapeHtml4(menuProgMultiName));
            List<Map<String, Object>> childItemList = new LinkedList<Map<String, Object>>();
            for (SysMenuVO menuItem : menuItemList) {
                String menuItemProgMultiName = getProgramMultiName(menuItem, localeCode);
                Map<String, Object> itemMap = new HashMap<String, Object>();
                itemMap.put("id", menuItem.getOid());
                itemMap.put("progId", menuItem.getProgId());
                //itemMap.put("name", menuItem.getName());
                // 改用去找多語言設定檔
                itemMap.put("name", menuItemProgMultiName);
                itemMap.put("type", menuItem.getItemType());
                itemMap.put("parent", menuItem.getParentOid());
                //itemMap.put("url", getUrl(basePath, sys, menuItem) );			
                itemMap.put("onclick", menuItem.getProgId() + "_TabShow()");
                //itemMap.put("label", IconUtils.getMenuIcon(basePath, menuItem.getIcon()) + StringEscapeUtils.escapeHtml4(menuItem.getName()) );
                // 改用去找多語言設定檔
                itemMap.put("label", IconUtils.getMenuIcon(basePath, menuItem.getIcon()) + StringEscapeUtils.escapeHtml4(menuItemProgMultiName));
                childItemList.add(itemMap);
            }
            sysMenuMap.put("children", childItemList);
            sysItemList.add(sysMenuMap);
        }
        if (sysItemList.size() > 0) {
            systemMap.put("children", sysItemList);
            treeMenuList.add(systemMap);
        }
    }
    return treeMenuList;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) HashMap(java.util.HashMap) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) HashMap(java.util.HashMap) Map(java.util.Map) LinkedList(java.util.LinkedList)

Aggregations

SysMenuVO (com.netsteadfast.greenstep.vo.SysMenuVO)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)5 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)3 HashMap (java.util.HashMap)3 List (java.util.List)3 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)2 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)2 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)2 TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 TbSysProg (com.netsteadfast.greenstep.po.hbm.TbSysProg)1 Map (java.util.Map)1 Subject (org.apache.shiro.subject.Subject)1 Transactional (org.springframework.transaction.annotation.Transactional)1