Browse Source

Merge branch 'master' of http://192.168.1.220:10080/esb/esb

Airhead 8 years ago
parent
commit
cb76497475

+ 11 - 1
src/main/java/com/yihu/hos/ESBApplication.java

@ -1,20 +1,30 @@
package com.yihu.hos;
import com.yihu.hos.interceptor.WebMvcInterceptor;
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;
import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import javax.jms.Queue;
@SpringBootApplication
public class ESBApplication {
public class ESBApplication extends WebMvcConfigurerAdapter {
    public static void main(String[] args) throws Exception {
        SpringApplication application = new SpringApplication(ESBApplication.class);
        application.run(args);
    }
    // 增加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new WebMvcInterceptor());
    }
    @Bean
    public Queue queue() {
        return new ActiveMQQueue(ServiceFlowConstant.FLOW_EVENT_QUEUE);

+ 5 - 1
src/main/java/com/yihu/hos/common/CommonPageController.java

@ -1,6 +1,8 @@
package com.yihu.hos.common;
import com.yihu.hos.common.constants.ContextAttributes;
import com.yihu.hos.system.model.SystemUser;
import com.yihu.hos.tenant.model.TenantSession;
import com.yihu.hos.tenant.service.AuthenticateService;
import com.yihu.hos.web.framework.util.controller.BaseController;
import org.apache.commons.io.IOUtils;
@ -114,8 +116,10 @@ public class CommonPageController extends BaseController {
        HttpSession session = request.getSession();
        SystemUser user = (SystemUser) session.getAttribute("userInfo");
        model.addAttribute("userName", user.getUserName());
        TenantSession tenantSession = (TenantSession) session.getAttribute(ContextAttributes.TENANT_SESSION);
        model.addAttribute("userName", user.getUserName());
        model.addAttribute("tenant",tenantSession.getTenant());
        //获取菜单
        String menu = "[{id: 1, text: '任务管理',icon:'${staticRoot}/images/index/menu2_icon.png'},\n" +
                "        {id: 11, pid: 1, text: '任务跟踪', url: '${contextRoot}/datacollect/trackJob',targetType:'1'},\n" +

+ 31 - 0
src/main/java/com/yihu/hos/interceptor/WebMvcInterceptor.java

@ -0,0 +1,31 @@
package com.yihu.hos.interceptor;
import com.yihu.hos.common.constants.ContextAttributes;
import com.yihu.hos.tenant.model.TenantSession;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
 *  web 请求拦截
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/12/26.
 */
public class WebMvcInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        HttpSession session = request.getSession();
        TenantSession tenantSession = (TenantSession) session.getAttribute(ContextAttributes.TENANT_SESSION);
        if (tenantSession!=null) {
            LocalContext.getContext().setAttachment(ContextAttributes.SCHEMA, tenantSession.getSchema());
            LocalContext.getContext().setAttachment(ContextAttributes.TENANT_NAME, tenantSession.getTenant());
        }
        return true;
    }
}

+ 1 - 1
src/main/webapp/WEB-INF/ehr/jsp/common/index.jsp

@ -33,7 +33,7 @@
    <div position="top">
        <div class="m-index-top">
            <div style="float: right;padding-right: 8px">
                <div class="m-index-top-name">欢迎您! ${userName}</div>
                <div class="m-index-top-name">欢迎您! ${userName} 【tenant: ${tenant}】</div>
                <div style="height:40px;">
                    <div id="btnIndexLogout"></div>
                    <div id="btnIndexPassword"></div>

+ 15 - 6
src/main/webapp/WEB-INF/ehr/jsp/common/indexJs.jsp

@ -64,11 +64,6 @@
            var tenantManager = {} ;
            var userRole = localStorage.getItem("userRole");
            if(userRole=="admin"){
                //是管理中心用户,则添加租户管理模块
//                menu = menu.concat(tenantManager);
                tenantManager =  {id: 75, pid: 7, text: '租户管理', url: '${contextRoot}/tenant/initial'};
            }
            //菜单列表
            var menu = [
                //标准管理
@ -105,6 +100,15 @@
                {id: 37, pid: 3, text: '维度类别配置', url: '${contextRoot}/dimension/dimensioncatetory'},
                //用户安全中心
                {id: 7, text: '用户安全', icon: '${staticRoot}/images/index/menu5_icon.png'},
            ];
            if(userRole=="admin"){
                //是管理中心用户,则添加租户管理模块
//                menu = menu.concat(tenantManager);
                 menu.push({id: 70, pid: 7, text: '租户管理', url: '${contextRoot}/tenant/initial'});
            }
            var menu_1 = [
                {id: 71, pid: 7, text: '机构管理', url: '${contextRoot}/org/initial'},
                {id: 72, pid: 7, text: '用户管理', url: '${contextRoot}/user/initial'},
                {id: 73, pid: 7, text: '角色管理', url: '${contextRoot}/role/initial'},
@ -116,7 +120,12 @@
                {id: 93, pid: 9, text: '菜单配置', url: '${contextRoot}/menu/initial'},
                {id: 94, pid: 9, text: '菜单按钮配置', url: '${contextRoot}/menu/menuAction/initial'},
                {id: 95, pid: 9, text: '数据源配置', url: '${contextRoot}/datasource/configSources'},
            ];
            ]
            menu =  menu.concat(menu_1);
            debugger
            me.menuTree = $('#ulTree').ligerTree({
                data: menu,
                idFieldName: 'id',