修复数据总线访问日志无法显示状态码问题: http://172.16.46.63:31560/index.php?m=task&f=view&taskID=703. databus 新增 client 统一出口内容管理审计: http://172.16.46.63:31560/index.php?m=task&f=view&taskID=716

This commit is contained in:
ranke
2026-01-22 09:35:13 +08:00
parent bbc1081a47
commit 413ce4c1ef
16 changed files with 659 additions and 13 deletions

View File

@@ -0,0 +1,152 @@
package com.zt.plat.module.databus.api.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zt.plat.framework.common.util.json.databind.TimestampLocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 新增Databus API 访问日志请求体。
*/
@Data
@EqualsAndHashCode
public class ApiAccessLogCreateReq {
/**
* 主键
*/
@Schema(description = "主键")
private Long id;
/**
* HTTP 方法
*/
@Schema(description = "HTTP 方法")
@NotNull(message = "HTTP 方法不能为空")
private String requestMethod;
/**
* 请求路径
*/
@Schema(description = "请求路径")
@NotNull(message = "请求路径不能为空")
private String requestPath;
/**
* 调用使用的应用标识
*/
@Schema(description = "调用使用的应用标识")
@NotNull(message = "调用使用的应用标识不能为空")
private String credentialAppId;
/**
* 多租户编号
*/
@Schema(description = "多租户编号")
@NotNull(message = "多租户编号不能为空")
private Long tenantId;
/**
* 查询参数JSON 字符串)
*/
@Schema(description = "查询参数JSON 字符串)")
private String requestQuery;
/**
* 请求头信息JSON 字符串)
*/
@Schema(description = "请求头信息JSON 字符串)")
private String requestHeaders;
/**
* 请求体JSON 字符串)
*/
@Schema(description = "请求体JSON 字符串)")
private String requestBody;
/**
* 响应 HTTP 状态码
*/
@Schema(description = "响应 HTTP 状态码")
private Integer responseStatus;
/**
* 响应提示信息
*/
@Schema(description = "响应提示信息")
private String responseMessage;
/**
* 响应体JSON 字符串)
*/
@Schema(description = "响应体JSON 字符串)")
private String responseBody;
/**
* 访问状态0-成功 1-客户端错误 2-服务端错误 3-未知
*/
@Schema(description = "访问状态0-成功 1-客户端错误 2-服务端错误 3-未知")
@NotNull(message = "访问状态不能为空")
private Integer status;
/**
* 业务错误码
*/
@Schema(description = "业务错误码")
private String errorCode;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
/**
* 异常堆栈
*/
@Schema(description = "异常堆栈")
private String exceptionStack;
/**
* 客户端 IP
*/
@Schema(description = "客户端 IP")
private String clientIp;
/**
* User-Agent
*/
@Schema(description = "User-Agent")
private String userAgent;
/**
* 请求耗时(毫秒)
*/
@Schema(description = "请求耗时(毫秒)")
private Long duration;
/**
* 请求时间
*/
@Schema(description = "请求时间")
@JsonSerialize(using = TimestampLocalDateTimeSerializer.class)
private LocalDateTime requestTime;
/**
* 响应时间
*/
@Schema(description = "响应时间")
@JsonSerialize(using = TimestampLocalDateTimeSerializer.class)
private LocalDateTime responseTime;
/**
* 额外调试信息JSON 字符串)
*/
@Schema(description = "额外调试信息JSON 字符串)")
private String extra;
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.databus.api.provider;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.databus.api.dto.ApiAccessLogCreateReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.Map;
/**
* Databus API访问日志接口
* 2026/1/20 16:26
*/
@FeignClient(name = "${databus.provider.log.service:databus-server}")
@Tag(name = "RPC 服务 - Databus API访问日志接口")
public interface DatabusAccessLogProviderApi {
String PREFIX = "/databus/api/portal/access-log";
@PostMapping(PREFIX + "/add")
@Operation(summary = "新增访问日志")
CommonResult<Boolean> add(@RequestHeader Map<String, String> headers, @RequestBody ApiAccessLogCreateReq req);
}