From b5fb76606f4caea215e2f4ab6fbe0489e740e963 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 16 七月 2025 10:04:53 +0800 Subject: [PATCH] 防火墙修改 --- manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java | 130 ++++++++++++------------------------------- 1 files changed, 36 insertions(+), 94 deletions(-) diff --git a/manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java b/manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java index fa82bfe..daf7da6 100644 --- a/manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java +++ b/manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java @@ -15,17 +15,15 @@ import com.jilongda.manage.authority.dto.SecUserDTO; import com.jilongda.manage.authority.dto.SecUserRoleDTO; import com.jilongda.manage.authority.dto.SecUsersDTO; -import com.jilongda.manage.authority.model.SecResources; -import com.jilongda.manage.authority.model.SecRole; -import com.jilongda.manage.authority.model.SecUser; -import com.jilongda.manage.authority.model.SecUserRole; +import com.jilongda.manage.authority.mapper.SecRoleResourceMapper; +import com.jilongda.manage.authority.model.*; import com.jilongda.manage.authority.query.SecUserLowerQuery; -import com.jilongda.manage.authority.service.SecResourcesService; -import com.jilongda.manage.authority.service.SecRoleService; -import com.jilongda.manage.authority.service.SecUserRoleService; -import com.jilongda.manage.authority.service.SecUserService; +import com.jilongda.manage.authority.service.*; import com.jilongda.manage.authority.vo.SecResourceVO; import com.jilongda.manage.authority.vo.SecUsersVO; +import com.jilongda.manage.model.TOptometrist; +import com.jilongda.manage.query.RoleResourceNoLevelQuery; +import com.jilongda.manage.query.TOptometristQuery; import com.jilongda.manage.utils.LoginInfoUtil; import com.jilongda.manage.utils.UserUtil; import com.jilongda.common.basic.ApiResult; @@ -81,21 +79,21 @@ private final PasswordEncoder passwordEncoder; private final UserUtil userUtil; private final SecUserRoleService secUserRoleService; - private final TDeptService deptService; private final LoginInfoUtil loginInfoUtil; private final RedisAutoTemplate redisAutoTemplate; + private final SecRoleResourceService secRoleResourceService; @Autowired - public SecUserController(SecUserService secUserService, SecRoleService secRoleService, SecResourcesService secResourcesService, PasswordEncoder passwordEncoder, UserUtil userUtil, SecUserRoleService secUserRoleService, TDeptService deptService, LoginInfoUtil loginInfoUtil, RedisAutoTemplate redisAutoTemplate) { + public SecUserController(SecUserService secUserService, SecRoleService secRoleService, SecResourcesService secResourcesService, PasswordEncoder passwordEncoder, UserUtil userUtil, SecUserRoleService secUserRoleService, LoginInfoUtil loginInfoUtil, RedisAutoTemplate redisAutoTemplate, SecRoleResourceService secRoleResourceService) { this.secUserService = secUserService; this.secRoleService = secRoleService; this.secResourcesService = secResourcesService; this.passwordEncoder = passwordEncoder; this.userUtil = userUtil; this.secUserRoleService = secUserRoleService; - this.deptService = deptService; this.loginInfoUtil = loginInfoUtil; this.redisAutoTemplate = redisAutoTemplate; + this.secRoleResourceService = secRoleResourceService; } @@ -166,6 +164,14 @@ public ApiResult<String> addOrUpdateUser(@Validated @RequestBody SecUserDTO dto) { secUserService.addOrUpdateUser(dto); return ApiResult.success(); + } + + @ApiOperation(value = "通过门店id查询验光师列表") + @GetMapping(value = "/queryListByStoreId") + public ApiResult<List<SecUser>> queryListByStoreId(@RequestParam Integer storeId) { + List<SecUser> secUsers = secUserService.list(Wrappers.lambdaQuery(SecUser.class) + .eq(SecUser::getStoreId,storeId)); + return ApiResult.success(secUsers); } @OperationLog(operType = "重置", operDesc = "重置密码", operModul = "用户") @@ -319,89 +325,6 @@ } } - /** - * 人员新增列表 - */ - @ApiOperation(value = "人员新增列表",notes = "type 1=部门,2=用户") - @GetMapping("/userAddList") - public ApiResult userAddList(@RequestParam(required = false) String name) - { - UserAddListVO userAddListVO = new UserAddListVO(); - - // 获取当前用户所在部门 - SecUser loginUser = loginInfoUtil.getLoginUser(); - Long deptId = loginUser.getDeptId(); - List<TDept> deptList = new ArrayList<>(); - List<SecUser> userList = new ArrayList<>(); - List<UserLevelVO> userLevelVOS = new ArrayList<>(); - if(!loginUser.isAdmin()){ - userList = secUserService.selectListByNamePhoneDeptId(name,deptId); - if(CollectionUtils.isEmpty(userList)){ - return ApiResult.success(userAddListVO); - } - - TDept dept = deptService.getById(deptId); - UserLevelVO userLevelVO = new UserLevelVO(); - List<UserLevelVO> children = new ArrayList<>(); - for (SecUser user : userList) { - UserLevelVO userLevelVO1 = new UserLevelVO(); - userLevelVO1.setKey(user.getId()); - userLevelVO1.setTitle(user.getNickName()); - userLevelVO1.setAvatar(user.getAvatarUrl()); - userLevelVO1.setFlag(true); - userLevelVO1.setValue(CodeGenerateUtils.generateVolumeSn()); - children.add(userLevelVO1); - } - userLevelVO.setChildren(children); - userLevelVO.setKey(dept.getId()); - userLevelVO.setTitle(dept.getDeptName()); - userLevelVO.setValue(CodeGenerateUtils.generateVolumeSn()); - userLevelVOS.add(userLevelVO); - }else { - // 查询符合要求部门id - deptList = deptService.userAddListByDeptNameDeptIds(name,null); - List<Long> deptIds = deptList.stream().map(TDept::getId).collect(Collectors.toList()); - userList = secUserService.selectListByNamePhoneDeptIds(name,null); - deptIds.addAll(userList.stream().map(SecUser::getDeptId).collect(Collectors.toList())); - // 查询部门 - deptList = deptService.userAddListByDeptNameDeptIds(null,deptIds); - if(CollectionUtils.isEmpty(deptList)){ - return ApiResult.success(userAddListVO); - } - // 查询用户 - userList = secUserService.selectListByNamePhoneDeptIds(null,deptIds); - - for (TDept dept : deptList) { - List<SecUser> users; - if(StringUtils.hasLength(name) && !dept.getDeptName().contains(name)){ - users = userList.stream().filter(e -> dept.getId().equals(e.getDeptId()) - && (((StringUtils.hasLength(e.getNickName()) && e.getNickName().contains(name))) - || (StringUtils.hasLength(e.getPhone()) && e.getPhone().contains(name)))).collect(Collectors.toList()); - }else { - users = userList.stream().filter(e -> dept.getId().equals(e.getDeptId())).collect(Collectors.toList()); - } - UserLevelVO userLevelVO = new UserLevelVO(); - List<UserLevelVO> children = new ArrayList<>(); - for (SecUser user : users) { - UserLevelVO userLevelVO1 = new UserLevelVO(); - userLevelVO1.setKey(user.getId()); - userLevelVO1.setTitle(user.getNickName()); - userLevelVO1.setAvatar(user.getAvatarUrl()); - userLevelVO1.setFlag(true); - userLevelVO1.setValue(CodeGenerateUtils.generateVolumeSn()); - children.add(userLevelVO1); - } - userLevelVO.setChildren(children); - userLevelVO.setKey(dept.getId()); - userLevelVO.setTitle(dept.getDeptName()); - userLevelVO.setValue(CodeGenerateUtils.generateVolumeSn()); - userLevelVOS.add(userLevelVO); - } - } - userAddListVO.setUserLevelVOS(userLevelVOS); - return ApiResult.success(userAddListVO); - } - @ApiOperation(value = "用户导入") @PostMapping("/import-user") public ApiResult<String> importUser(@RequestParam("file") MultipartFile file) { @@ -479,5 +402,24 @@ return ApiResult.success(); } + + @ApiOperation(value = "获取所有资源(菜单及功能)", notes = "获取所有资源(菜单及功能)") + @GetMapping(value = "/listAll") + public ApiResult<List<SecResourceVO>> listAll() { + List<SecResourceVO> sysResourceVos = secResourcesService.selectResources(); + return ApiResult.success(sysResourceVos); + } + + @ApiOperation(value = "获取角色权限---无层级", notes = "获取角色权限无层级,传递角色id即可") + @PostMapping(value = "/noLevelList") + public ApiResult<List<SecResources>> roleResourceNoLevel(@RequestBody RoleResourceNoLevelQuery query) { + List<SecRoleResource> secRoleResources = secRoleResourceService.list(Wrappers.lambdaQuery(SecRoleResource.class).eq(SecRoleResource::getRoleId, query.getRid())); + List<SecResources> secResources = new ArrayList<>(); + if (!CollectionUtils.isEmpty(secRoleResources)) { + List<Long> resIds = secRoleResources.stream().map(SecRoleResource::getResourceId).collect(Collectors.toList()); + secResources = secResourcesService.list(Wrappers.lambdaQuery(SecResources.class).in(SecResources::getId, resIds)); + } + return ApiResult.success(secResources); + } } -- Gitblit v1.7.1