mdms urms配置
工作中项目的配置,为了方便记录和使用,故记录在这里,如果不需要的还请忽略!!!
从no-urms到接入urms步骤:
pom shrio 依赖 no-urms:
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.2.3</version>
</dependency>
urms:
<dependency>
<groupId>com.chinaredstar</groupId>
<artifactId>p-urms-security-cas</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
1. 删除:
mdms.config.shiro.LoginHandlerInterceptor.java
shiro.SecurityRealm.java
shiro.ShiroConfiguration.java
2. 修改mdms下Application:
使用:
@ComponentScan(basePackages = { "com.chinaredstar.urms", "com.chinaredstar.uc" })
替换:
/* @ComponentScan(basePackages = { "com.chinaredstar.uc" })*/
3. 更改aop.LogsRecordAspect.java:
no-urms:LogsRecordAspect.java
4. 更改BaseController:
no-urms:
public String getRedirectPrefix(HttpServletRequest request, String url) {
/* String urmsPath= urmsProperties.getShiroServerUrlPrefix()
+ request.getContextPath();*/
String urmsPath="";
return UrlBasedViewResolver.REDIRECT_URL_PREFIX + urmsPath+ url;
}
urms:
public String getRedirectPrefix(HttpServletRequest request, String url) {
String urmsPath= urmsProperties.getShiroServerUrlPrefix()
+ request.getContextPath();
/*String urmsPath="";*/
return UrlBasedViewResolver.REDIRECT_URL_PREFIX + urmsPath+ url;
}
5. 更改urms-path.js的urmsPath:
no-urms:
var urmsPath = "/";
var kfPath="http://urms.dev.rs.com/";
urms:
var urmsPath = "/mdms/";
var kfPath="/";
6. 更改body.html:
no-urms:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="layout/head :: header" />
<!-- <body>
<div layout:fragment="content"></div>
</body>
</html> -->
<body>
<div th:fragment="body">
<div id="container" class="effect mainnav-lg">
<div th:include="layout/body-header :: body-header"></div>
<div class="boxed">
<div id="content-container">
<div id="page-content" style="margin-top: 1em;">
<div layout:fragment="content">
<div class="login-welcome">
<span>Hi:</span><span th:text="${session.ucEmployeeName}"></span>
<h2>欢迎登录会员管理系统!</h2>
</div>
</div>
</div>
</div>
<div th:include="layout/body-menu :: body-menu"></div>
<div th:include="layout/body-footer :: body-footer"></div>
</div>
<button id="scroll-top" class="btn">
<i class="fa fa-chevron-up"></i>
</button>
</div>
</div>
<script>
/*
*由二级页面 点击进去的 其他页面, 没有导航栏 问题解决
*
*/
var pageNav = {
"/member-level/level-save" : "/member-level/level-show", // 新增等级
"/member-level/level-modify" : "/member-level/level-show", // 修改等级
"/member-growth/rule-save" : "/member-growth/rule-show"//新建等级
};
//page title auto fill
var title = $('a[href|="' + window.location.pathname + '"]').children(
'span').text();
$('#page-title').text(title);
//end page title auto fill
//menu auto expand
var path = window.location.pathname;
if (typeof (activeMenu) != 'undefined') {
path = activeMenu;
}
if (undefined != pageNav[path]) {
path = pageNav[path];
}
var active_menu = $('a[href|="' + path + '"]', $('#mainnav-menu'))
.parent();
if (active_menu.parent().hasClass('isSubMenu')) {
active_menu.parent().addClass('in');
active_menu.parent().parent().addClass('active-sub active');
}
if (active_menu.parent().hasClass('isThirdMenu')) {
active_menu.parent().addClass('in');
active_menu.parent().parent().addClass('active-sub active');
active_menu.parent().parent().parent()
.addClass('active-sub active');
active_menu.parent().parent().parent().parent().addClass(
'active-sub active');
}
active_menu.addClass('active-link');
//end menu auto expand
</script>
</body>
</html>
urms:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="layout/head :: header" />
<body>
<div layout:fragment="content"></div>
</body>
</html>
7. dubbo-consume
applicationContext-consumer.xml文件
urms需要注释
<!--<dubbo:reference interface="com.chinaredstar.urms.security.service.api.UrmsEmployeeService"-->
<!--id="urmsEmployeeService" version="1.0.1"/>-->
<!--<dubbo:reference interface="com.chinaredstar.urms.security.service.api.SecurityUserService "-->
<!--id="securityUserService" version="1.0.1"/>-->
8. AuthorityInterceptor文件
urms
String urmsPath= urmsProperties.getShiroServerUrlPrefix()
+ request.getContextPath();
// String urmsPath = "";
local
// String urmsPath= urmsProperties.getShiroServerUrlPrefix()
// + request.getContextPath();
String urmsPath = "";
9. query.html文件
local
<!--<td><span style="display: none;" class="queryOpenId" th:text="${user.openId}"></span>-->
<!--<a shiro:hasPermission="MEM_M1F1-3" href="javascript:void(0);" class="a_common query-Linktab"> 详细资料</a></td>-->
<td><a shiro:hasPermission="MEM_M1F1-3" class="a_common"
th:href="@{/aggregation-info/show(openId=${user.openId})}" style="display: inline"> 详细资料</a>
</td>
urms
<td><span style="display: none;" class="queryOpenId" th:text="${user.openId}"></span>
<a shiro:hasPermission="MEM_M1F1-3" href="javascript:void(0);" class="a_common query-Linktab"> 详细资料</a></td>