Search in sources :

Example 6 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getBasePath.

@SuppressWarnings("unchecked")
public static String getBasePath(String sysId, HttpServletRequest request) {
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
    if (StringUtils.isBlank(sysId)) {
        return basePath;
    }
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return basePath;
        }
        sys = result.getValue();
        basePath = request.getScheme() + "://" + sys.getHost() + "/" + sys.getContextPath() + "/";
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return basePath;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 7 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getContextPath.

@SuppressWarnings("unchecked")
public static String getContextPath(String sysId) {
    String contextPath = "";
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return contextPath;
        }
        sys = result.getValue();
        contextPath = sys.getContextPath();
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return contextPath;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 8 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method checkLoginUrlWithAllSysHostConfig.

@SuppressWarnings("unchecked")
public static boolean checkLoginUrlWithAllSysHostConfig(HttpServletRequest request) {
    boolean pathSuccess = true;
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    try {
        List<TbSys> sysList = sysService.findListByParams(null);
        for (int i = 0; sysList != null && i < sysList.size() && pathSuccess; i++) {
            TbSys sys = sysList.get(i);
            pathSuccess = !checkCrossSite(sys.getHost().toLowerCase(), request);
            if (pathSuccess) {
                pathSuccess = checkTestConnection(sys.getHost(), sys.getContextPath(), request);
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return pathSuccess;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 9 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getHost.

@SuppressWarnings("unchecked")
public static String getHost(String sysId) {
    String host = "";
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return "";
        }
        sys = result.getValue();
        host = sys.getHost();
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return host;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 10 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class MenuSupportUtils method loadSysProgData.

protected static List<TbSysProg> loadSysProgData(String system) throws ServiceException, Exception {
    List<TbSysProg> progList = null;
    TbSys sys = new TbSys();
    sys.setSysId(system);
    if (sysService.countByEntityUK(sys) != 1) {
        // 必需要有 TB_SYS 資料
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    Map<String, Object> params = new HashMap<String, Object>();
    Map<String, String> oderParams = new HashMap<String, String>();
    params.put("progSystem", system);
    oderParams.put("name", "asc");
    progList = sysProgService.findListByParams(params, null, oderParams);
    if (progList == null) {
        progList = new ArrayList<TbSysProg>();
    }
    return progList;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) TbSysProg(com.netsteadfast.greenstep.po.hbm.TbSysProg)

Aggregations

TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)14 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)11 JsonParseException (com.fasterxml.jackson.core.JsonParseException)6 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)6 ISysService (com.netsteadfast.greenstep.service.ISysService)6 SysVO (com.netsteadfast.greenstep.vo.SysVO)6 HashMap (java.util.HashMap)3 TbSysProg (com.netsteadfast.greenstep.po.hbm.TbSysProg)2 SysMenuVO (com.netsteadfast.greenstep.vo.SysMenuVO)2 LinkedList (java.util.LinkedList)2 MenuResultObj (com.netsteadfast.greenstep.model.MenuResultObj)1 TbSysIcon (com.netsteadfast.greenstep.po.hbm.TbSysIcon)1 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Subject (org.apache.shiro.subject.Subject)1