forked from kidgrow-microservices-platform

1.运营后台统一增加token过期自动跳转登录页
2.H端和运营平台同账户可根据权限自由登录.
28 files modified
123 ■■■■■ changed files
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysMenuServiceImpl.java 7 ●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysUserServiceImpl.java 3 ●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleMenuMapper.xml 3 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
kidgrow-commons/kidgrow-common-spring-boot-starter/src/main/java/com/kidgrow/common/constant/CommonConstant.java 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/assets/js/common.js 12 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/attestation/app.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/businessRecords.html 5 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/company.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/contract.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/dataNeed.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/diagnosisRecord.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html 2 ●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctorTemplete.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/feedback.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/org_form.html 2 ●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/product.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/product_form.html 2 ●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html 6 ●●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/sysOrganization.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/sysdictionaries.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/verifyRecharge.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/menus.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/sysArea.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/tokens.html 4 ●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/user.html 11 ●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysMenuServiceImpl.java
@@ -1,6 +1,7 @@
package com.kidgrow.usercenter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kidgrow.common.constant.CommonConstant;
import com.kidgrow.common.context.ClientContextHolder;
import com.kidgrow.common.model.ResultBody;
import com.kidgrow.common.model.SysMenu;
@@ -67,7 +68,11 @@
    @Override
    public List<SysMenu> findByRoleCodes(Set<String> roleCodes, Integer type) {
        return roleMenuService.findMenusByRoleCodes(roleCodes, type, ClientContextHolder.getClient());
        String tentid=ClientContextHolder.getClient();
        if (roleCodes.contains(CommonConstant.SYSTEM_ADMIN_ROLE_CODE)) {
            tentid="";
        }
        return roleMenuService.findMenusByRoleCodes(roleCodes, type,tentid);
    }
    /**
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysUserServiceImpl.java
@@ -165,7 +165,8 @@
    public SysUser selectByUsername(String username) {
        String clientId = ClientContextHolder.getClient();
        List<SysUser> users = baseMapper.selectList(
                new QueryWrapper<SysUser>().eq("username", username).eq("tenant_id", clientId)
                //new QueryWrapper<SysUser>().eq("username", username).eq("tenant_id", clientId)
                new QueryWrapper<SysUser>().eq("username", username)
        );
        return getUser(users);
    }
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleMenuMapper.xml
@@ -61,6 +61,9 @@
            <if test="type != null">
                and t.type = #{type}
            </if>
            <if test="tenantId != null and tenantId !=''">
                and t.tenant_id = #{tenantId}
            </if>
            and t.hidden = 0
            and t.enabled = 1
            ORDER BY sort ASC
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/resources/application.yml
@@ -53,7 +53,7 @@
        second: 1800
  #多租户配置
  tenant:
    enable: true
    enable: false
    #多租户隔离字段
    tenantid: tenant_id
    ignoreTables:
kidgrow-commons/kidgrow-common-spring-boot-starter/src/main/java/com/kidgrow/common/constant/CommonConstant.java
@@ -288,4 +288,8 @@
     * 自主注册的创建人名称
     */
    public static final String CREATE_USER_NAME= "自动创建";
    /**
     * 管理员医生角色code标识
     */
    public static final String SYSTEM_ADMIN_ROLE_CODE="ADMIN";
}
kidgrow-web/kidgrow-web-manager/src/main/resources/static/assets/js/common.js
@@ -282,7 +282,8 @@
    return theRequest;
}
    /**
 * 自动将没权限的按钮隐藏
     * 1.判断用户是否在登录状态
 * 2.自动将没权限的按钮隐藏
 * 如果页面有列表,则在列表的 done事件内调用
 * 如果页面没有列表,则在页面所有js执行的最后调用此函数
 * 
@@ -290,7 +291,14 @@
 * 同时在控件上增加permissions="user-btn-import"这样的自定义属性 
 * 其中引号内是菜单管理--里面对应的资源的菜单path
 */
function permissionsInput() {
function permissionsInput(res,config) {
    if(!strUtil.isEmpty(res)&&res.code==401){
        config.removeToken();
        layer.msg('登录过期', {icon: 2, time: 1500}, function () {
            location.replace('/login.html');
        }, 1000);
        return;
    }
    var needpPermissions = $(".permissions");
    var permissions = layui.sessionData('tempData')['permissions'];
    needpPermissions.each(function () {
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/attestation/app.html
@@ -87,8 +87,8 @@
                {field: 'authorizedGrantTypes',width:250, sort: true, title: 'oauth授权方式'},
                {align: 'center',width:150, toolbar: '#app-table-bar', title: '操作'}
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/businessRecords.html
@@ -126,7 +126,10 @@
                { field: 'recordTitle', width: 300, sort: true, title: '标题' },
                { field: 'id', width: 250, align: 'center', toolbar: '#businessRecords-table-bar', sort: true, title: '查看详情' },// 0就诊数据 1筛查
                { field: 'createTime', width: 250, sort: true, title: '时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd HH:mm')}}</div>" }
            ]]
            ]],
            done:function(res){
                permissionsInput(res,config);
            }
        });
        // 工具条点击事件
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/company.html
@@ -174,8 +174,8 @@
                { field: 'createTime', width: 250, title: '时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>" },
                { field: 'id', width: 250, align: 'center', toolbar: '#company-table-bar', title: '操作' },
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/contract.html
@@ -85,8 +85,8 @@
                    }},
                    { align: 'center', width: 150, toolbar: '#contract-table-bar', title: '操作' }
                ]],
                done:function(){
                    permissionsInput();
                done:function(res){
                    permissionsInput(res,config);
                }
            });
        }
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/dataNeed.html
@@ -150,8 +150,8 @@
                { field: 'needTags', width: 100, align: 'center', toolbar: '#app-table-bar', title: '需求标签' },
                { field: 'enabled', width: 200, toolbar: '#app-table-bar1', title: '处理状态', },
                { field: 'downTime', width: 250, title: '下载时间', templet: "<div>{{layui.util.toDateString(d.downTime, 'yyyy-MM-dd HH:mm')}}</div>" }
            ]],done:function(){
                permissionsInput();
            ]],done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/diagnosisRecord.html
@@ -103,8 +103,8 @@
                },
                { field: 'enabled', width: 100, templet: '#diagnostic-table-bar', title: '查看' }
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
        // 搜索按钮点击事件
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctor.html
@@ -497,7 +497,7 @@
                { width: 300, align: 'center', toolbar: '#doctor-table-bar', title: '操作' },
            ]],
            done: function (res, curr, count) {
                permissionsInput();
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/doctorTemplete.html
@@ -137,8 +137,8 @@
                { field: 'enabled', width: 100, sort: true, templet: '#doctor-templete-tpl-state', title: '状态' },
                { field: 'recordTitle', width: 300, toolbar: '#doctor-templete-table-bar', sort: true, title: '操作' },
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/feedback.html
@@ -70,8 +70,8 @@
                    return new Date(d.createTime).dateFormat("yyyy-MM-dd hh:mm");
                } },
                { align: 'center', width: 200, toolbar: '#feeedback-table-bar', title: '操作' }
            ]],done:function(){
                permissionsInput();
            ]],done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html
@@ -107,8 +107,8 @@
                { field: 'enabled', width: 100, templet: '#hospital-tpl-state',  title: '状态' },
                { field: 'hospitalId', width: 300, align: 'center', toolbar: '#businessRecords-table-bar', title: '操作', fixed: 'right' }
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
        //省份数据加载
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/org_form.html
@@ -65,7 +65,7 @@
        var tree = parent.layui.tree;
        var $ = parent.layui.jquery;
        permissionsInput();
        permissionsInput(res,config);
        //组织结构树
        var getData = function () {
            admin.req('api-user/sysorganization/getTree', { is_del: 0, enabled: 1 }, function (data) {
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/product.html
@@ -80,8 +80,8 @@
                    },
                    { align: 'center', width: 100, toolbar: '#product-table-bar', title: '操作' }
                ]],
                done: function () {
                    permissionsInput();
                done: function (res) {
                    permissionsInput(res,config);
                }
            });
        }
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/product_form.html
@@ -99,5 +99,5 @@
    });
        
        permissionsInput();
        permissionsInput(res,config);
</script>
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html
@@ -274,7 +274,10 @@
                },
                { field: 'isShare', fixed: 'right', align: 'center', width: 100, templet: '#product-tpl-isShare', title: '共享' },
                { field: 'id', fixed: 'right', align: 'center', width: 100, toolbar: '#product-tpl-bar', title: '操作' }
            ]]
            ]],
            done:function(res){
                permissionsInput(res,config);
            }
        });
        //待充值列表功能操作
        table.on('tool(product-table-temp)', function (obj) {
@@ -447,5 +450,4 @@
            return false;
        });
    });
                permissionsInput();
</script>
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/sysOrganization.html
@@ -150,8 +150,8 @@
                    { field: 'enabled', align: 'right', sort: true, templet: '#organization-tpl-state', title: '状态' },
                    { toolbar: '#organization-table-bar', align: 'right', align: 'center', title: '操作' }
                ]],
                done: function () {
                    permissionsInput();
                done: function (res) {
                    permissionsInput(res,config);
                }
            });
        };
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/sysdictionaries.html
@@ -125,8 +125,8 @@
                { field: 'createTime', width: 250, title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>" },
                { field: 'id', width: 250, align: 'center', toolbar: '#dictionaries-table-bar', title: '操作' },// 0就诊数据 1筛查
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/verifyRecharge.html
@@ -77,8 +77,8 @@
                    },
                    { field: 'enabled', width: 100, templet: '#product-tpl-state', sort: true, title: '审核' }
                ]],
                done:function(){
                permissionsInput();
                done:function(res){
                permissionsInput(res,config);
                }
            });
        }
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/menus.html
@@ -87,8 +87,8 @@
                    { field: 'enabled', width: 100, sort: true, templet: '#menu-tpl-state', title: '状态' },
                    { templet: '#menus-state', width: 120, align: 'center', title: '操作' }
                ]],
                done: function () {
                    permissionsInput();
                done: function (res) {
                    permissionsInput(res,config);
                }
            });
        };
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html
@@ -152,8 +152,8 @@
                { field: 'enabled', width: 100, sort: true, templet: '#role-tpl-state', title: '状态' },
                { align: 'center', toolbar: '#role-table-bar', title: '操作', width: 320 }
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/sysArea.html
@@ -87,9 +87,9 @@
                    { field: 'enabled', width: 100, sort: true, templet: '#area-tpl-state', title: '状态' },
                    { templet: '#area-table-bar', width: 120, align: 'center', title: '操作' }
                ]],
                done: function () {
                done: function (res) {
                    layer.closeAll('loading');
                    permissionsInput();
                    permissionsInput(res,config);
                }
            });
        };
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/tokens.html
@@ -53,8 +53,8 @@
                {field: 'clientId',width:180, sort: true, title: '所属应用'},
                {align: 'center',width:100, toolbar: '#tokens-table-bar', title: '操作'}
            ]],
            done:function(){
                permissionsInput();
            done:function(res){
                permissionsInput(res,config);
            }
        });
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/user.html
@@ -60,7 +60,7 @@
            elem: '#user-table',
            url: config.base_server + 'api-user/users',
            method: 'GET',
            headers: { 'Authorization': 'Bearer ' + config.getToken().access_token },
            headers: { 'Authorization': 'Bearer ' + config.getToken().access_token},
            page: true,
            cols: [[
                { field: 'id', sort: true, width: 200, title: '标识' },
@@ -82,14 +82,7 @@
                { fixed: 'right', align: 'center', toolbar: '#user-table-bar', title: '操作', width: 300 }
            ]],
            done:function(res){
                if(res.code==401){
                    config.removeToken();
                    layer.msg('登录过期', {icon: 2, time: 1500}, function () {
                        location.replace('/login.html');
                    }, 1000);
                    return;
                }
                permissionsInput();
                permissionsInput(res,config);
            }
        });