feat(REQ-2924) - 新版日志处理
This commit is contained in:
parent
252a8e278f
commit
9f11bd21ab
@ -20,11 +20,10 @@ import org.springframework.core.Ordered;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.context.request.RequestAttributes;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import org.springframework.web.context.request.ServletWebRequest;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -85,13 +84,13 @@ public class ErrorReportAspect implements Ordered {
|
|||||||
if (!signature.toShortString().contains("ExtAxApiLogServiceImpl")) {
|
if (!signature.toShortString().contains("ExtAxApiLogServiceImpl")) {
|
||||||
String type = getType(joinPoint);
|
String type = getType(joinPoint);
|
||||||
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
||||||
signature.toShortString(),
|
signature.toShortString(),
|
||||||
Objects.isNull(getOriginRequest()) ? "" : getOriginRequest().getHeader(HEADER_SERVER_NAME),
|
Objects.isNull(getOriginRequest()) ? "" : getOriginRequest().getHeader(HEADER_SERVER_NAME),
|
||||||
Objects.isNull(getOriginRequest()) ? "" : getOriginRequest().getHeader(HEADER_API_VERSION),
|
Objects.isNull(getOriginRequest()) ? "" : getOriginRequest().getHeader(HEADER_API_VERSION),
|
||||||
Objects.equals(type, "Controller") ? joinPoint.getArgs() : null,
|
Objects.equals(type, "Controller") ? joinPoint.getArgs() : null,
|
||||||
Objects.equals(type, "Controller") ? result : null,
|
Objects.equals(type, "Controller") ? result : null,
|
||||||
watch.getTotalTimeSeconds(),
|
watch.getTotalTimeSeconds(),
|
||||||
type);
|
type);
|
||||||
|
|
||||||
applicationEventPublisher.publishEvent(event);
|
applicationEventPublisher.publishEvent(event);
|
||||||
}
|
}
|
||||||
@ -137,14 +136,27 @@ public class ErrorReportAspect implements Ordered {
|
|||||||
if (workflowProperties.getFilterSendDingTalk().contains(operation.summary())) {
|
if (workflowProperties.getFilterSendDingTalk().contains(operation.summary())) {
|
||||||
filterSendDingTalk = false;
|
filterSendDingTalk = false;
|
||||||
}
|
}
|
||||||
ServletWebRequest request= (ServletWebRequest) RequestContextHolder.getRequestAttributes();
|
|
||||||
|
log.error("request header server name: {}", getHeader());
|
||||||
envConfig.type().executeAction(profile, operation.summary(), filterSendDingTalk, joinPoint.getArgs(), joinPoint.getSignature().toShortString(), e,
|
envConfig.type().executeAction(profile, operation.summary(), filterSendDingTalk, joinPoint.getArgs(), joinPoint.getSignature().toShortString(), e,
|
||||||
workflowProperties.getFilterOperations().contains(operation.summary()));
|
workflowProperties.getFilterOperations().contains(operation.summary()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getHeader() {
|
||||||
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
if (Objects.isNull(attributes)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
// 获取指定请求头的值
|
||||||
|
String headerValue = request.getHeader(HEADER_SERVER_NAME);
|
||||||
|
return StringUtils.hasText(headerValue) ? headerValue : "";
|
||||||
|
}
|
||||||
|
|
||||||
private HttpServletRequest getOriginRequest() {
|
private HttpServletRequest getOriginRequest() {
|
||||||
try {
|
try {
|
||||||
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
|||||||
@ -199,8 +199,8 @@ public abstract class AbstractBpmnTaskAssigneeSelector implements BpmnTaskAssign
|
|||||||
return assigners;
|
return assigners;
|
||||||
}
|
}
|
||||||
List<Long> personIds = assigners.stream()
|
List<Long> personIds = assigners.stream()
|
||||||
// .filter(e -> !StringUtils.hasText(e.getAvatar()) && StringUtils.hasText(e.getPersonId()))
|
|
||||||
.map(BpmnTaskDelegateAssigner::getPersonId)
|
.map(BpmnTaskDelegateAssigner::getPersonId)
|
||||||
|
.filter(StringUtils::hasText)
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
.distinct().collect(Collectors.toList());
|
.distinct().collect(Collectors.toList());
|
||||||
Map<Long, PersonProfileResp> personProfileMap = parseApiResult(() -> flowSupportApi.listPersons(PersonProfileQueryReq.builder().personIds(personIds).build()),
|
Map<Long, PersonProfileResp> personProfileMap = parseApiResult(() -> flowSupportApi.listPersons(PersonProfileQueryReq.builder().personIds(personIds).build()),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user