| | |
| | | @Autowired |
| | | IMasterAuthorDetailService authorDetailService; |
| | | @Autowired |
| | | ITUserRoleService userRoleService; |
| | | @Autowired |
| | | ISysMenuService menuService; |
| | | @Autowired |
| | | ISysFieldService fieldService; |
| | |
| | | TableInfoMapper tableInfoMapper; |
| | | @Autowired |
| | | RedisClient redisClient; |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据权限获取分页对象 |
| | | * @param user 用户 |
| | | * @param masterAuthor 权限对象 |
| | | * @param maintain 数据版本 |
| | | * @return: 获取分页对象 |
| | | * |
| | | */ |
| | | @Override |
| | | public Page getInitPageInfo(MasterAuthor masterAuthor, Maintain maintain, TUser user, boolean getIncrement) { |
| | | String realRedisKey = RedisClient.getRealRedisKey(user.getUserId() + "-" + maintain.getId() + "-" + getIncrement); |
| | |
| | | redisClient.putRedisValObj(realRedisKey, page); |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据角色id获取混合后的权限 |
| | | * @param roleIds 角色id |
| | | * @return: 混合后的权限 |
| | | * |
| | | */ |
| | | @Override |
| | | public HashMap<String, MasterAuthor> merageRoleAuthor(Set<String> roleIds) { |
| | | List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds)); |
| | |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户获取有权限的主题 |
| | | * @param character 用户 |
| | | * @return: 主题列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysMenu> getMenu(Character character) { |
| | | return getMenu(character, false); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户获取有权限的主题 不包括父主题 |
| | | * @param character 用户 |
| | | * @return: 不包括夫主题的主题列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysMenu> getMenuUnParent(Character character) { |
| | | return getMenuUnParent(character, false); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户获取有权限的主题 不包括父主题 |
| | | * @param character 用户 |
| | | * @param isTableMenu 是否已存在表的主题 |
| | | * @return: 不包括夫主题的主题列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysMenu> getMenuUnParent(Character character, boolean isTableMenu) { |
| | | String key = DbUtils.StrJoinLink(Constant.UnderLine,character.getId(),"menuUnParent", String.valueOf(isTableMenu)); |
| | |
| | | redisClient.putRedisList(key, (sysMenus)); |
| | | return sysMenus; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户获取有权限的主题 |
| | | * @param character 用户 |
| | | * @param isTableMenu 是否为已经生成表的主题 |
| | | * @return: 主题列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysMenu> getMenu(Character character, boolean isTableMenu) { |
| | | |
| | |
| | | redisClient.putRedisList(key, (sysMenus)); |
| | | return sysMenus; |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取权限列表 |
| | | * @param characterId 用户id |
| | | * @param maintainField 字段版本 |
| | | * @return: 不包括夫主题的主题列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<MasterAuthor> getUserAuthor(String characterId, MaintainField maintainField) { |
| | | return getUserAuthor(characterId, maintainField, null); |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取权限列表 |
| | | * @param characterId 用户id |
| | | * @param maintainField 字段版本 |
| | | * @param uuid 日志使用 |
| | | * @return: 权限列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<MasterAuthor> getUserAuthor(String characterId, MaintainField maintainField, String uuid) { |
| | | Date startDate = new Date(); |
| | |
| | | masterAuthors.addAll(groupAuthors); |
| | | return masterAuthors; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据角色,字段版本获取权限列表 |
| | | * @param characterId 角色id |
| | | * @param maintainField 字段版本 |
| | | * @return: 权限列表 |
| | | * |
| | | */ |
| | | private List<MasterAuthor> getRoleAuthors(String characterId, MaintainField maintainField) { |
| | | Wrapper<MasterAuthor> roleWrapper = new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).eq(MasterAuthorController.character_id, characterId); |
| | | if (maintainField != null) { |
| | |
| | | return selectList(roleWrapper); |
| | | } |
| | | |
| | | private List<MasterAuthor> getUserGroupAuthor(String userId, MaintainField maintainField) { |
| | | return getUserGroupAuthor(userId, maintainField, null); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取权限列表 |
| | | * @param userId 用户id |
| | | * @param maintainField 字段版本 |
| | | * @param uuid 日志使用 |
| | | * @return: 权限列表 |
| | | * |
| | | */ |
| | | private List<MasterAuthor> getUserGroupAuthor(String userId, MaintainField maintainField, String uuid) { |
| | | Set<String> groupIdList = DbUtils.getGroupByUser(userId, uuid); |
| | | List<MasterAuthor> result = new ArrayList<>(); |
| | |
| | | |
| | | return result; |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户组,字段版本获取权限列表 |
| | | * @param groupId 用户组id |
| | | * @param maintainField 字段版本 |
| | | * @return: 权限列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<MasterAuthor> getOneGroupAuthors(String groupId, MaintainField maintainField) { |
| | | return getOneGroupAuthors(groupId, maintainField, null); |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户组,字段版本获取权限列表 |
| | | * @param groupId 用户组id |
| | | * @param maintainField 字段版本 |
| | | * @param uuid 日志使用 |
| | | * @return: 权限列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<MasterAuthor> getOneGroupAuthors(String groupId, MaintainField maintainField, String uuid) { |
| | | Date startDate = new Date(); |
| | |
| | | } |
| | | return groupAuthors; |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取字段列表 |
| | | * @param character 用户 |
| | | * @param maintainId 数据版本id |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysField> getField(Character character, String maintainId) { |
| | | return getField(character, maintainId, null); |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取字段列表 |
| | | * @param character 用户 |
| | | * @param maintainId 数据版本id |
| | | * @param uuid 日志使用 |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public List<SysField> getField(Character character, String maintainId, String uuid) { |
| | | String key = DbUtils.StrJoinLink(Constant.UnderLine, character.getId(),"field", maintainId); |
| | |
| | | redisClient.putRedisList(key, ((fieldList))); |
| | | return fieldList; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 检测是否需要筛选数据 |
| | | * @param character 用户 |
| | | * @param tableName 表名 |
| | | * @param uuid 日志使用 |
| | | * @return: 是否需要筛选数据 |
| | | * |
| | | */ |
| | | private boolean checkUnFilterAuthor(Character character, String tableName, String uuid) { |
| | | String key = DbUtils.StrJoinLink(Constant.UnderLine, character.getId(),"checkUnFilterAuthor", tableName); |
| | | String redisVal = redisClient.getRedisVal(key); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 检验用户是否拥有数据版本的权限 |
| | | * @param character 用户 |
| | | * @param maintainId 数据版本id |
| | | * @return: 是否有权限 |
| | | * |
| | | */ |
| | | @Override |
| | | public boolean checkMaintainAuthor(Character character, String maintainId) { |
| | | return checkMaintainAuthor(character, maintainId, null); |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取筛选条件 |
| | | * @param character 用户 |
| | | * @param maintainId 数据版本id |
| | | * @return: 筛选条件 |
| | | * |
| | | */ |
| | | @Override |
| | | public String getFilter(Character character, String maintainId) { |
| | | |
| | | return getFilter(character, maintainId, null); |
| | | } |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取筛选条件 |
| | | * @param character 用户 |
| | | * @param maintainId 数据版本id |
| | | * @param uuid 日志使用 |
| | | * @return: 筛选条件 |
| | | * |
| | | */ |
| | | @Override |
| | | public String getFilter(Character character, String maintainId, String uuid) { |
| | | String key = DbUtils.StrJoinLink(Constant.UnderLine, character.getId(),"filter",maintainId); |
| | |
| | | redisClient.putRedisVal(key, filter); |
| | | return filter; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户获取最大权限的数据版本 |
| | | * @param character 用户 |
| | | * @param tableName 表名 |
| | | * @return: 最大权限的数据版本 |
| | | * |
| | | */ |
| | | @Override |
| | | public Maintain getMaxVersionMaintain(Character character, String tableName) { |
| | | List<Maintain> maintainList = maintainService.selectList(new EntityWrapper<Maintain>().eq("table_name", tableName).orderBy("order_no desc")); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 根据用户,字段版本获取数据版本列表 |
| | | * @param user 用户 |
| | | * @param tableName 数据版本id |
| | | * @return: 数据版本列表 |
| | | * |
| | | */ |
| | | @Override |
| | | public LinkedHashSet<Maintain> getMaintainSet(String tableName, TUser user) { |
| | | List<MasterAuthor> userAuthor = this.getUserAuthor(user.getUserId(), null); |
| | |
| | | } |
| | | return maintainSet; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 生成版本的需要检测哪些需要自动加上权限 |
| | | * @param status 流程状态 |
| | | * @param maintainId 数据版本id |
| | | * @return: |
| | | * |
| | | */ |
| | | public void dealFlow(String maintainId, ActivitiStatus status) { |
| | | Maintain maintain = maintainService.selectById(maintainId); |
| | | MaintainField maintainFieldByMaintain = fieldService.getMaintainFieldByMaintain(maintainId); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 两个权限混合 |
| | | * @param preMerageMasterAuthor 混合前 |
| | | * @param masterAuthor 待混合 |
| | | * @return: 混合后的权限 |
| | | * |
| | | */ |
| | | private MasterAuthor merage(MasterAuthor preMerageMasterAuthor, MasterAuthor masterAuthor) { |
| | | // table name masterField 一样 只有字段不同了 |
| | | List<MasterAuthorDetail> preFields = preMerageMasterAuthor.getFields(); |