自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-10-31 0eae1862c35e7bf79a5a212e058218174d551477
#
6个文件已修改
46 ■■■■ 已修改文件
src/main/java/com/zy/common/web/AuthController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/BaseController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/controller/PermissionController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/permission/permission.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/role/rolePower.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/AuthController.java
@@ -22,6 +22,7 @@
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created by vincent on 2019-07-30
@@ -273,6 +274,7 @@
        if (!Cools.isEmpty(powers)){
            List<PowerDto> dtos = JSON.parseArray(powers, PowerDto.class);
            for (PowerDto dto : dtos) {
                if (isNumber(dto.getTwo())) {
                Resource resource = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2));
                if (!Cools.isEmpty(resource)) {
                    // 校验上级权限
@@ -286,6 +288,7 @@
                    roleResource.setRoleId(roleId);
                    roleResource.setResourceId(resource.getId());
                    roleResourceService.insert(roleResource);
                    }
                } else {
                    Permission permission = permissionService.selectOne(new EntityWrapper<Permission>().eq("action", dto.getTwo()));
                    if (!Cools.isEmpty(permission)){
@@ -302,7 +305,7 @@
                        if (leaderId != null) {
                            RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource1.getId()));
                            if (null == roleResource) {
                                throw new CoolException(resource.getName().concat("的").concat(resource1.getName().concat("无法授权给").concat(role.getName())));
                                throw new CoolException(resource1.getName().concat("无法授权给").concat(role.getName()));
                            }
                        }
                        RoleResource roleResource = new RoleResource();
@@ -375,4 +378,23 @@
        return R.ok("激活成功,有效期至"+DateUtils.convert(exprTime));
    }
    @RequestMapping("/menu/pda/auth")
    @ManagerAuth
    public R menuPda(){
        Long userId = getUserId();
        List<RolePermission> rolePermissions;
        if (userId == 9527L) {
            rolePermissions = rolePermissionService.selectList(new EntityWrapper<>());
        } else {
            Long roleId = getUser().getRoleId();
            rolePermissions = rolePermissionService.selectList(new EntityWrapper<RolePermission>().eq("role_id", roleId));
        }
        if (Cools.isEmpty(rolePermissions)) {
            return R.ok();
        }
        List<Long> collect = rolePermissions.stream().map(RolePermission::getPermissionId).distinct().collect(Collectors.toList());
        List<Permission> permissions = permissionService.selectBatchIds(collect);
        return R.ok().add(permissions.stream().map(Permission::getAction).distinct().collect(Collectors.toList()));
    }
}
src/main/java/com/zy/common/web/BaseController.java
@@ -157,4 +157,14 @@
            }
        }
    }
    public static boolean isNumber(String str){
        for (int i = str.length();--i>=0;){
            if (!Character.isDigit(str.charAt(i))){
                return false;
            }
        }
        return true;
    }
}
src/main/java/com/zy/system/controller/PermissionController.java
@@ -71,6 +71,7 @@
    @RequestMapping(value = "/permission/add/auth")
    @ManagerAuth
    public R add(Permission permission) {
        permission.setStatus((short) 1);
        permissionService.insert(permission);
        return R.ok();
    }
src/main/resources/application.yml
@@ -11,8 +11,8 @@
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#    url: jdbc:sqlserver://10.10.10.100:1433;databasename=bfasrs
#    url: jdbc:sqlserver://localhost:1433;databasename=bfasrs
    url: jdbc:sqlserver://192.168.4.15:1433;databasename=bfasrs
    url: jdbc:sqlserver://localhost:1433;databasename=bfasrs
#    url: jdbc:sqlserver://192.168.4.15:1433;databasename=bfasrs
    username: sa
#    password: Zoneyung@zy56$
    password: sa@123
src/main/webapp/static/js/permission/permission.js
@@ -18,11 +18,11 @@
        cellMinWidth: 50,
        cols: [[
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            ,{field: 'name', align: 'center',title: '权限名称'}
            ,{field: 'action', align: 'center',title: '接口地址'}
            ,{field: 'resourceName', align: 'center',title: '所属菜单',event: 'Resource', style: 'text-decoration: underline;cursor:pointer'}
            ,{field: 'status$', align: 'center',title: '状态'}
            // ,{field: 'status$', align: 'center',title: '状态'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
src/main/webapp/static/js/role/rolePower.js
@@ -41,11 +41,12 @@
        var checkData = tree.getChecked('powerTree');
        checkData.map(function (obj) {
            obj.children.map(function (resource) {
                var childrens = [];
                if (resource.children) {
                resource.children.map(function (resource) {
                    childrens.push(resource.id);
                });
                }
                var one = {
                    'two': resource.id,
                    'three': childrens