| | |
| | | IMasterAuthorService authorService; |
| | | @Autowired |
| | | IMasterAuthorDetailService authorDetailService; |
| | | @Autowired |
| | | ITUserRoleService userRoleService; |
| | | |
| | | @Autowired |
| | | IMenuMappingService menuMappingService; |
| | | @Autowired |
| | |
| | | private String maintainFieldId = "maintainFieldId"; |
| | | private String maintain_field_id = "maintain_field_id"; |
| | | |
| | | /** |
| | | * |
| | | * @description: 添加或者更新权限 |
| | | * @return 权限数据 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/addOrUpdate", method = RequestMethod.POST) |
| | | public Result deleteModel(@RequestBody MasterAuthor masterAuthor) { |
| | | if (StringUtils.isEmpty(masterAuthor.getMaintainFieldId())) { |
| | |
| | | return Result.error(CodeMsg.UPDATE_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过系统用户获取权限 |
| | | * @param characterId 系统用户 |
| | | * @param isGroup 是否为用户组数据 |
| | | * @param type 用户类型 |
| | | * @return 具体数据 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/get/{characterId}", method = RequestMethod.GET) |
| | | public Result get(@PathVariable String characterId,@RequestParam boolean isGroup, @RequestParam MasterAuthorType type, HttpServletRequest request){ |
| | | List<MasterAuthor> masterAuthorList = authorService.selectList(new EntityWrapper<MasterAuthor>().eq("user_group", isGroup).eq("type", type.name()).eq("character_id", characterId)); |
| | |
| | | object.fluentPut("audit",sysMenus); |
| | | return Result.success(object); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过系统用户删除权限 |
| | | * @param characterId 系统用户 |
| | | * @param type 用户类型 |
| | | * @return 是否删除成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/delete/{characterId}", method = RequestMethod.GET) |
| | | public Result delete(@PathVariable String characterId, @RequestParam MasterAuthorType type){ |
| | | List<MasterAuthor> masterAuthorList = authorService.selectList(new EntityWrapper<MasterAuthor>() |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过主题删除权限 |
| | | * @param characterId 系统用户 |
| | | * @param menuId 主题id |
| | | * @param type 用户类型 |
| | | * @return 具体数据 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/delete/menu/{menuId}", method = RequestMethod.GET) |
| | | public Result deleteTable(@PathVariable String menuId, @RequestParam String characterId, @RequestParam MasterAuthorType type, HttpServletRequest request){ |
| | | String maintainFieldId = request.getParameter(this.maintainFieldId); |
| | |
| | | return Result.error(CodeMsg.DELETE_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 用户组添加角色关联 |
| | | * @param groupId 用户组id |
| | | * @param roleId 角色id |
| | | * @return 是否添加成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/groupAddRole/{roleId}", method = RequestMethod.GET) |
| | | public Result addGroupRole(@PathVariable String roleId, @RequestParam String groupId, HttpServletRequest request){ |
| | | TUser user = DbUtils.getUser(request); |
| | |
| | | } |
| | | return Result.success(tableMasterAuthor.values()); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 用户添加角色关联 |
| | | * @param userId 用户id |
| | | * @param roleId 角色id |
| | | * @return 是否添加成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/userAddRole/{roleId}", method = RequestMethod.GET) |
| | | public Result addRole(@PathVariable String roleId, @RequestParam String userId, HttpServletRequest request){ |
| | | TUser user = DbUtils.getUserById(userId); |
| | |
| | | return Result.success(tableMasterAuthor.values()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 用户删除角色关联 |
| | | * @param userId 用户id |
| | | * @param roleId 角色id |
| | | * @return 是否删除成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/userDelRole/{roleId}", method = RequestMethod.GET) |
| | | public Result delRole(@PathVariable String roleId, @RequestParam String userId, HttpServletRequest request){ |
| | | ArrayList<String> delRoleList = new ArrayList<>(); |
| | |
| | | } |
| | | return Result.success(tableMasterAuthor.values()); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 用户组删除角色关联 |
| | | * @param groupId 用户组id |
| | | * @param roleId 角色id |
| | | * @return 是否删除成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/groupDelRole/{roleId}", method = RequestMethod.GET) |
| | | public Result delGroupRole(@PathVariable String roleId, @RequestParam String groupId, HttpServletRequest request){ |
| | | ArrayList<String> delRoleList = new ArrayList<>(); |
| | |
| | | return Result.success(tableMasterAuthor.values()); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过用户id获取已经注册list |
| | | * @param userId 用户id |
| | | * @return 已注册list |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/subscribeList/{userId}", method = RequestMethod.GET) |
| | | public Result subscribeList(@PathVariable String userId, HttpServletRequest request){ |
| | | TUser user = DbUtils.getUserById(userId); |
| | |
| | | // } |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过userid获取有权限的主题 |
| | | * @param userId 用户id |
| | | * @return 主题列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/menu/{userId}", method = RequestMethod.GET) |
| | | public Result<List<SysMenu>> menuList(@PathVariable String userId, HttpServletRequest request) { |
| | | TUser user = DbUtils.getUserById(userId); |
| | |
| | | return Result.success(menu) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过userid获取有权限的主题数据 |
| | | * @param userId 用户id |
| | | * @return 获取有权限的数据数 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/getCnt/{userId}", method = RequestMethod.GET) |
| | | public Result cnt(@PathVariable String userId, HttpServletRequest request) { |
| | | //TODO active |
| | |
| | | object.fluentPut("subscribeCnt", subscribeCnt); |
| | | return Result.success(object); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过版本获取激活的主题 |
| | | * @param maintainId 主题id |
| | | * @param userId 用户id |
| | | * @param active 激活状态 |
| | | * @return 已激活的主题数 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/active/{maintainId}", method = RequestMethod.GET) |
| | | public Result active(@PathVariable String maintainId, @RequestParam String userId, @RequestParam Boolean active) { |
| | | TUser user = DbUtils.getUserById(userId); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 获取有权限的list和用户map |
| | | * @return list和用户map列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/cntList", method = RequestMethod.GET) |
| | | public Result cntList() { |
| | | HashMap<String, Long> result = new HashMap<>(); |
| | |
| | | String maintainFieldId = masterAuthor.getMaintainFieldId(); |
| | | String tableName = masterAuthor.getTableName(); |
| | | List<Maintain> maintainByMaintainField = maintainFieldService.getMaintainByMaintainField(maintainFieldId, tableName); |
| | | if (maintainByMaintainField != null && !maintainByMaintainField.isEmpty()) { |
| | | maintainSet.addAll(maintainByMaintainField); |
| | | } |
| | | maintainSet.addAll(maintainByMaintainField); |
| | | } |
| | | int unActiveCnt = masterAuthorUnactiveService.selectCount(new EntityWrapper<MasterAuthorUnactive>().in("maintain_id", maintainSet).eq("user_id", user.getUserId())); |
| | | if (maintainSet.size() != unActiveCnt) { |
| | |
| | | } |
| | | return Result.success(result); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过表名获取有权限的版本list |
| | | * @param userId 用户id |
| | | * @param tableName 表名 |
| | | * @return 获取有权限的版本list |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/maintainList/{userId}", method = RequestMethod.GET) |
| | | public Result maintainList(@PathVariable String userId, @RequestParam String tableName) { |
| | | TUser user = DbUtils.getUserById(userId); |
| | |
| | | return Result.success(maintainSet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过版本获取激活的主题 |
| | | * @param result 组装用户id, 数据的 map |
| | | * @param masterUserMapList 视图的数据list map |
| | | * @return result 用户id, 权限数据量的 map |
| | | * |
| | | */ |
| | | private void merageUserCnt(HashMap<String, Long> result, List<Map<String, Object>> masterUserMapList) { |
| | | for (Map<String, Object> stringStringMap : masterUserMapList) { |
| | | String user = stringStringMap.get(Constant.USERID).toString(); |