Merge branch 'develop/oprlog_modify/221014' into 'dev'
modify query,use ouType&workspaceId&ouId See merge request infra/xlog!62
This commit is contained in:
commit
dedfc5e237
@ -1,6 +1,7 @@
|
||||
package cn.axzo.log.platform.server.controller.api;
|
||||
|
||||
import cn.axzo.log.platform.server.dto.*;
|
||||
import cn.axzo.log.platform.server.enums.OuTypeEnums;
|
||||
import cn.axzo.log.platform.server.service.OperateLogService;
|
||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
@ -65,20 +66,29 @@ public class OperateLogController {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return CommonResponse.fail(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||
}
|
||||
//todo 时间跨度校验。 后续如果切换ES 需要再确定
|
||||
/* if (DateUtil.betweenDay(req.getStartTime(), req.getEndTime(), true) > 7) {
|
||||
logger.error("start and end date interval greater than 7.");
|
||||
return CommonResponse.fail("the time span is greater than 7");
|
||||
}*/
|
||||
//20221022 定制,根据ouType判断, 总包的时候从header获取 workspaceId进行查询,分包(2\3\4\5)从header workspaceId+ouId查询。
|
||||
//当请求体中存在值时 则不从请求头中获取值进行替换
|
||||
try {
|
||||
// 20221022 定制,从请求头获取 ouId、workspaceId。sally B 需求。如果请求体中这个值有了则不替换。
|
||||
String ouId = request.getHeader("ouId");
|
||||
String workspaceId = request.getHeader("workspaceId");
|
||||
if ((req.getOuId() == null || req.getOuId() == 0) && StringUtils.hasText(ouId)) {
|
||||
req.setOuId(Long.valueOf(ouId));
|
||||
}
|
||||
if ((req.getWorkspaceId() == null || req.getWorkspaceId() == 0) && StringUtils.hasText(workspaceId)) {
|
||||
req.setWorkspaceId(Long.valueOf(workspaceId));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
CommonPageResponse<OperateLogQueryRespDTO> resp = operateLogService.queryBasicInfoForPage(req);
|
||||
return CommonResponse.success(resp);
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
package cn.axzo.log.platform.server.enums;
|
||||
|
||||
import cn.axzo.pudge.core.service.ServiceException;
|
||||
|
||||
/***
|
||||
* @author: pepsi
|
||||
* @description: TODO
|
||||
* @date: 2022/10/22
|
||||
*/
|
||||
public enum OuTypeEnums {
|
||||
/**
|
||||
* 默认单位,位为65535
|
||||
*/
|
||||
ALL_TYPE(0, "默认单位"),
|
||||
/**
|
||||
* 总包单位
|
||||
*/
|
||||
PRIMARY_CONTRACTING_UNIT(1, "总包单位"),
|
||||
|
||||
/**
|
||||
* 建设单位
|
||||
*/
|
||||
CONSTRUCTION_UNIT(2, "建设单位"),
|
||||
|
||||
/**
|
||||
* 监理单位
|
||||
*/
|
||||
SUPERVISION_UNIT(3, "监理单位"),
|
||||
|
||||
/**
|
||||
* 劳务分包
|
||||
*/
|
||||
LABOR_SUBCONTRACTING(4, "劳务分包"),
|
||||
|
||||
/**
|
||||
* 专业分包
|
||||
*/
|
||||
PROFESSIONAL_SUBCONTRACTING(5, "专业分包"),
|
||||
|
||||
/**
|
||||
* 项目外班组
|
||||
*/
|
||||
PROJECT_OUT_TEAM(6, "班组"),
|
||||
|
||||
/**
|
||||
* 安心筑平台
|
||||
*/
|
||||
AXZ_PLATFORM(7, "安心筑平台");
|
||||
|
||||
private int code;
|
||||
private String value;
|
||||
|
||||
OuTypeEnums(int code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static OuTypeEnums getOuType(Integer typeCode) {
|
||||
OuTypeEnums[] values = values();
|
||||
for (OuTypeEnums item : values) {
|
||||
if (item.getCode() == typeCode) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
throw new ServiceException("班组类型不匹配 code:" + typeCode);
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 总包
|
||||
*
|
||||
* @param typeCode
|
||||
* @return
|
||||
*/
|
||||
public static boolean isPrimaryContractinUnit(int typeCode) {
|
||||
return OuTypeEnums.PRIMARY_CONTRACTING_UNIT.getCode() == typeCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包
|
||||
*
|
||||
* @param typeCode
|
||||
* @return
|
||||
*/
|
||||
public static boolean isSubcontracting(int typeCode) {
|
||||
return OuTypeEnums.CONSTRUCTION_UNIT.getCode() == typeCode
|
||||
|| OuTypeEnums.SUPERVISION_UNIT.getCode() == typeCode
|
||||
|| OuTypeEnums.LABOR_SUBCONTRACTING.getCode() == typeCode
|
||||
|| OuTypeEnums.PROFESSIONAL_SUBCONTRACTING.getCode() == typeCode;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user