渗透检测-委托用户角色校验,角色编号获取

This commit is contained in:
zhangqinbin
2023-03-29 09:48:45 +08:00
parent deb7a12515
commit 35c6fdc282
3 changed files with 10 additions and 10 deletions

View File

@ -104,11 +104,9 @@ public class ProjectEntrustController{
@ApiOperation("查询分页数据") @ApiOperation("查询分页数据")
@PostMapping("/getPage") @PostMapping("/getPage")
@PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-sub-admin','ebtp-agency-admin','ebtp-agency-project-manager')") @PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-sub-admin','ebtp-agency-admin','ebtp-agency-project-manager')")
public BaseResponse<IPage<ProjectEntrustVO>> getPage(@ApiParam(value = "对象数据", required = true) @RequestBody ProjectEntrustVO projectEntrust, public BaseResponse<IPage<ProjectEntrustVO>> getPage(@ApiParam(value = "对象数据", required = true) @RequestBody ProjectEntrustVO projectEntrust){
@RequestHeader(name = "currentRoleCode", required = false) String currentRoleCode){
log.info("查询分页数据 currentRoleCode:"+currentRoleCode); return BaseResponse.success(projectEntrustService.getPage(projectEntrust));
return BaseResponse.success(projectEntrustService.getPage(projectEntrust,currentRoleCode));
} }

View File

@ -22,7 +22,7 @@ public interface IProjectEntrustService extends IBaseService<ProjectEntrust>{
* @param projectEntrust 委托单查询信息 * @param projectEntrust 委托单查询信息
* @return 返回结果 * @return 返回结果
*/ */
IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust,String currentRoleCode); IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust);
/** /**
* 分派项目经理 * 分派项目经理

View File

@ -105,13 +105,15 @@ public class ProjectEntrustServiceImpl extends BaseServiceImpl<ProjectEntrustMap
* @param projectEntrust 查询条件 * @param projectEntrust 查询条件
* @return 返回查询条件 * @return 返回查询条件
*/ */
private QueryWrapper<ProjectEntrust> getProjectEntrustQueryWrapper(ProjectEntrustVO projectEntrust,String currentRoleCode) { private QueryWrapper<ProjectEntrust> getProjectEntrustQueryWrapper(ProjectEntrustVO projectEntrust) {
QueryWrapper<ProjectEntrust> query = new QueryWrapper<>(); QueryWrapper<ProjectEntrust> query = new QueryWrapper<>();
//项目名称 //项目名称
if(StringUtils.isNotBlank(projectEntrust.getProjectName())){ if(StringUtils.isNotBlank(projectEntrust.getProjectName())){
query.like("project_name", projectEntrust.getProjectName()); query.like("project_name", projectEntrust.getProjectName());
} }
log.info("查询分页数据 currentRoleCode2:"+cacheUserService.getCacheUser().getCurrentRoleCode());
String currentRoleCode = cacheUserService.getCacheUser().getCurrentRoleCode();
log.info("查询分页数据 currentRoleCode2:"+currentRoleCode);
//String currentRoleCode = cacheUserService.getCacheUser().getCurrentRoleCode(); //String currentRoleCode = cacheUserService.getCacheUser().getCurrentRoleCode();
//采购经理查 采购经理 //采购经理查 采购经理
@ -123,7 +125,7 @@ public class ProjectEntrustServiceImpl extends BaseServiceImpl<ProjectEntrustMap
query.eq("agency_company", cacheUserService.getCacheUser().getOrganizationId()); query.eq("agency_company", cacheUserService.getCacheUser().getOrganizationId());
} }
//代理机构业务经理 查 项目经理 //代理机构业务经理 查 项目经理
if("ebtp-agency-project-manager ".equals(currentRoleCode)){ if("ebtp-agency-project-manager".equals(currentRoleCode)){
query.eq("project_manager", cacheUserService.getCacheUser().getUserId()); query.eq("project_manager", cacheUserService.getCacheUser().getUserId());
} }
@ -166,9 +168,9 @@ public class ProjectEntrustServiceImpl extends BaseServiceImpl<ProjectEntrustMap
} }
@Override @Override
public IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust,String currentRoleCode) { public IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust) {
QueryWrapper<ProjectEntrust> query = getProjectEntrustQueryWrapper(projectEntrust,currentRoleCode); QueryWrapper<ProjectEntrust> query = getProjectEntrustQueryWrapper(projectEntrust);
query.orderByDesc("id"); query.orderByDesc("id");