Merge branch 'develop/oprlog_modify/221014' into 'dev'
modify query,use ouType&workspaceId&ouId See merge request infra/xlog!64
This commit is contained in:
commit
9eb885a39e
@ -66,29 +66,10 @@ public class OperateLogController {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return CommonResponse.fail(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||
}
|
||||
//20221022 定制,根据ouType判断, 总包的时候从header获取 workspaceId进行查询,分包(2\3\4\5)从header workspaceId+ouId查询。
|
||||
//当请求体中存在值时 则不从请求头中获取值进行替换
|
||||
try {
|
||||
String ouTypeStr = request.getHeader("ouType");
|
||||
if (StringUtils.hasText(ouTypeStr)) {
|
||||
int ouType = Integer.parseInt(ouTypeStr);
|
||||
String ouId = request.getHeader("ouId");
|
||||
String workspaceId = request.getHeader("workspaceId");
|
||||
if (OuTypeEnums.isPrimaryContractinUnit(ouType)) {
|
||||
if ((req.getWorkspaceId() == null || req.getWorkspaceId() == 0) && StringUtils.hasText(workspaceId)) {
|
||||
req.setWorkspaceId(Long.valueOf(workspaceId));
|
||||
logger.info("total package, get workspaceId param from request header,workspaceId={},ouType={}.", workspaceId, ouTypeStr);
|
||||
}
|
||||
} else if (OuTypeEnums.isSubcontracting(ouType)) {
|
||||
if ((req.getOuId() == null || req.getOuId() == 0) && StringUtils.hasText(ouId)) {
|
||||
req.setOuId(Long.valueOf(ouId));
|
||||
logger.info("sub package,get ouId param from request header,ouId={},ouType={}.", ouId, ouTypeStr);
|
||||
}
|
||||
if ((req.getWorkspaceId() == null || req.getWorkspaceId() == 0) && StringUtils.hasText(workspaceId)) {
|
||||
req.setWorkspaceId(Long.valueOf(workspaceId));
|
||||
logger.info("sub package,get workspaceId param from request header,workspaceId={}.", workspaceId);
|
||||
}
|
||||
}
|
||||
handleRequestHeaderParam(Integer.parseInt(ouTypeStr), req, request);
|
||||
}
|
||||
CommonPageResponse<OperateLogQueryRespDTO> resp = operateLogService.queryBasicInfoForPage(req);
|
||||
return CommonResponse.success(resp);
|
||||
@ -98,6 +79,41 @@ public class OperateLogController {
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 20221022 定制,根据ouType判断,
|
||||
* 总包(ouType=1)的时候从header获取 workspaceId进行查询,分包(2\3\4\5)从header workspaceId+ouId查询。
|
||||
* 当请求体中存在值时 则不从请求头中获取值进行替换
|
||||
* @param ouType
|
||||
* @param req
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
private void handleRequestHeaderParam(int ouType, OperateLogQueryReqDTO req, HttpServletRequest request) throws Exception {
|
||||
String ouId = request.getHeader("ouId");
|
||||
String workspaceId = request.getHeader("workspaceId");
|
||||
if (OuTypeEnums.isPrimaryContractinUnit(ouType)) {
|
||||
if (!StringUtils.hasText(workspaceId)) {
|
||||
throw new Exception("can not find workspaceId from header");
|
||||
}
|
||||
if ((req.getWorkspaceId() == null || req.getWorkspaceId() == 0)) {
|
||||
req.setWorkspaceId(Long.valueOf(workspaceId));
|
||||
logger.info("total package, get workspaceId param from request header,workspaceId={},ouType={}.", workspaceId, ouType);
|
||||
}
|
||||
} else if (OuTypeEnums.isSubcontracting(ouType)) {
|
||||
if (!StringUtils.hasText(ouId) || !StringUtils.hasText(workspaceId)) {
|
||||
throw new Exception("can not find workspaceId or ouId from header");
|
||||
}
|
||||
if ((req.getOuId() == null || req.getOuId() == 0)) {
|
||||
req.setOuId(Long.valueOf(ouId));
|
||||
logger.info("sub package,get ouId param from request header,ouId={},ouType={}.", ouId, ouType);
|
||||
}
|
||||
if ((req.getWorkspaceId() == null || req.getWorkspaceId() == 0)) {
|
||||
req.setWorkspaceId(Long.valueOf(workspaceId));
|
||||
logger.info("sub package,get workspaceId param from request header,workspaceId={}.", workspaceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/operateLog/queryDetailForPage", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "操作日志分页查询(详情列表)")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user