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

This commit is contained in:
zhangqinbin
2023-03-29 09:26:55 +08:00
parent aac230b48e
commit deb7a12515
3 changed files with 12 additions and 8 deletions

View File

@ -19,6 +19,7 @@ import com.chinaunicom.mall.ebtp.project.projectentrust.entity.inquiryentity.Inq
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -33,6 +34,7 @@ import java.util.List;
* @date 2029/10/23 * @date 2029/10/23
* @version 1.0 * @version 1.0
*/ */
@Slf4j
@RestController @RestController
@Api(tags = "项目委托表") @Api(tags = "项目委托表")
@RequestMapping("/v1/projectEntrust") @RequestMapping("/v1/projectEntrust")
@ -102,9 +104,11 @@ 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){
return BaseResponse.success(projectEntrustService.getPage(projectEntrust)); log.info("查询分页数据 currentRoleCode:"+currentRoleCode);
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); IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust,String currentRoleCode);
/** /**
* 分派项目经理 * 分派项目经理

View File

@ -105,14 +105,14 @@ public class ProjectEntrustServiceImpl extends BaseServiceImpl<ProjectEntrustMap
* @param projectEntrust 查询条件 * @param projectEntrust 查询条件
* @return 返回查询条件 * @return 返回查询条件
*/ */
private QueryWrapper<ProjectEntrust> getProjectEntrustQueryWrapper(ProjectEntrustVO projectEntrust) { private QueryWrapper<ProjectEntrust> getProjectEntrustQueryWrapper(ProjectEntrustVO projectEntrust,String currentRoleCode) {
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(); //String currentRoleCode = cacheUserService.getCacheUser().getCurrentRoleCode();
//采购经理查 采购经理 //采购经理查 采购经理
if("ebtp-purchase".equals(currentRoleCode)){ if("ebtp-purchase".equals(currentRoleCode)){
@ -166,9 +166,9 @@ public class ProjectEntrustServiceImpl extends BaseServiceImpl<ProjectEntrustMap
} }
@Override @Override
public IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust) { public IPage<ProjectEntrustVO> getPage(ProjectEntrustVO projectEntrust,String currentRoleCode) {
QueryWrapper<ProjectEntrust> query = getProjectEntrustQueryWrapper(projectEntrust); QueryWrapper<ProjectEntrust> query = getProjectEntrustQueryWrapper(projectEntrust,currentRoleCode);
query.orderByDesc("id"); query.orderByDesc("id");