新增方法、枚举
This commit is contained in:
@ -12,29 +12,122 @@ package com.chinaunicom.mall.ebtp.common.log.enums;
|
|||||||
public enum EbtpLogBusinessModule {
|
public enum EbtpLogBusinessModule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统日志
|
* 项目委托
|
||||||
*/
|
*/
|
||||||
SYSTEM("system"),
|
PROJECT_ENTRUST_INIT("project_entrust_init"),
|
||||||
|
/**
|
||||||
|
* 询价项目委托
|
||||||
|
*/
|
||||||
|
PROJECT_ENTRUST_INQUIRY_INIT("project_entrust_inquiry_init"),
|
||||||
|
/**
|
||||||
|
* 询价项目发布
|
||||||
|
*/
|
||||||
|
PROJECT_INQUIRY_UPDATE("project_inquiry_update"),
|
||||||
|
/**
|
||||||
|
* 项目重评审批
|
||||||
|
*/
|
||||||
|
PROJECT_RE_EVALUATION_TASK("project_re_evaluation_task"),
|
||||||
|
/**
|
||||||
|
* 项目异常项目失败
|
||||||
|
*/
|
||||||
|
PROJECT_INVITATION_FAIL("project_invitation_fail"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用程序日志
|
* 审批
|
||||||
*/
|
*/
|
||||||
APPLICATION("application"),
|
BID_APPROVE("bid_approve"),
|
||||||
|
/**
|
||||||
|
* 媒体发布
|
||||||
|
*/
|
||||||
|
BID_SEND_TO_MEDIA("bid_send_to_media"),
|
||||||
|
/**
|
||||||
|
* 推送至公告中心
|
||||||
|
*/
|
||||||
|
BID_PUSH_NOTICE_INFO("bid_push_notice_info"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拦截器日志
|
* 供应商报名
|
||||||
*/
|
*/
|
||||||
AOP("aop"),
|
TENDER_SAVE("tender_save"),
|
||||||
|
/**
|
||||||
|
* 修改中标状态
|
||||||
|
*/
|
||||||
|
TENDER_BID_STATUS("tender_bid_status"),
|
||||||
|
/**
|
||||||
|
* 开启下一轮复制供应商
|
||||||
|
*/
|
||||||
|
TENDER_COPY_ROUND("tender_copy_round"),
|
||||||
|
/**
|
||||||
|
* 招募报名
|
||||||
|
*/
|
||||||
|
TENDER_RECRUIT_SAVE("tender_recruit_save"),
|
||||||
|
/**
|
||||||
|
* 招募修改中标状态
|
||||||
|
*/
|
||||||
|
TENDER_RECRUIT_BID_STATUS("tender_recruit_bid_status"),
|
||||||
|
/**
|
||||||
|
* 下载记录
|
||||||
|
*/
|
||||||
|
TENDER_UPLOAD_RECORD("tender_upload_record"),
|
||||||
|
/**
|
||||||
|
* 上传记录
|
||||||
|
*/
|
||||||
|
TENDER_DOWNLOAD_RECORD("tender_download_record"),
|
||||||
|
/**
|
||||||
|
* 修改支付状态
|
||||||
|
*/
|
||||||
|
TENDER_PAY_STATUS("tender_pay_status"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务日志
|
* 上传解压缩
|
||||||
*/
|
*/
|
||||||
BUSINESS("business"),
|
DECRYPT_UPLOAD_UNZIP("decrypt_upload_unzip"),
|
||||||
|
/**
|
||||||
|
* 开标解密
|
||||||
|
*/
|
||||||
|
DECRYPT("decrypt"),
|
||||||
|
/**
|
||||||
|
* 更新解密状态
|
||||||
|
*/
|
||||||
|
DECRYPT_STATUS("decrypt_status"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 垃圾收集器日志
|
* 招募更新解密状态
|
||||||
*/
|
*/
|
||||||
GC("gc"),
|
DECRYPT_RECRUIT_STATUS("decrypt_recruit_status"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定标推送数据评审室/评审结果/推送通知
|
||||||
|
*/
|
||||||
|
CALIBRATION_PUSH("calibration_push"),
|
||||||
|
/**
|
||||||
|
* 定标接收数据确认结果/冻结/终止
|
||||||
|
*/
|
||||||
|
CALIBRATION_RECEIVE("calibration_receive"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 询价报名
|
||||||
|
*/
|
||||||
|
INQUIRY_REGISTER("inquiry_register"),
|
||||||
|
/**
|
||||||
|
* 询价报价
|
||||||
|
*/
|
||||||
|
INQUIRY_OFFER("inquiry_offer"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付请求/查询
|
||||||
|
*/
|
||||||
|
PAY_PUSH("pay_push"),
|
||||||
|
/**
|
||||||
|
* 支付结果回调
|
||||||
|
*/
|
||||||
|
PAY_RECEIVE("pay_receive"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他
|
* 其他
|
||||||
@ -47,7 +140,7 @@ public enum EbtpLogBusinessModule {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EbtpLogBusinessModule(String s) {
|
EbtpLogBusinessModule(String value) {
|
||||||
this.value = s;
|
this.value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,20 @@ public interface OperationLogService {
|
|||||||
* @param businessModule 所属模块
|
* @param businessModule 所属模块
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
* @param detail 描述
|
* @param detail 描述
|
||||||
|
* @param transactionId 链路id
|
||||||
*/
|
*/
|
||||||
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String detail);
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String detail, String transactionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
* @param type 类型
|
||||||
|
* @param transactionId 链路id
|
||||||
|
*/
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String transactionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存日志
|
* 保存日志
|
||||||
@ -42,5 +53,23 @@ public interface OperationLogService {
|
|||||||
*/
|
*/
|
||||||
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type);
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
*/
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
* @param transactionId 链路id
|
||||||
|
*/
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, String transactionId);
|
||||||
}
|
}
|
@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chinaunicom.mall.ebtp.cloud.security.starter.common.Constants.AUTHORIZATION_HEADER;
|
import static com.chinaunicom.mall.ebtp.cloud.security.starter.common.Constants.AUTHORIZATION_HEADER;
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ public class OperationLogServiceImpl implements OperationLogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
operationLog.setId(PropertyUtils.getSnowflakeId())
|
operationLog.setId(PropertyUtils.getSnowflakeId())
|
||||||
.setTransactionId(MDC.get(CommonConstants.TRANSACTION_ID))
|
.setTransactionId(Optional.ofNullable(operationLog.getTransactionId()).orElseGet(() -> MDC.get(CommonConstants.TRANSACTION_ID)))
|
||||||
.setServiceName(serviceName);
|
.setServiceName(serviceName);
|
||||||
kafkaProducer.send(JsonUtils.objectToJson(operationLog));
|
kafkaProducer.send(JsonUtils.objectToJson(operationLog));
|
||||||
}
|
}
|
||||||
@ -80,17 +81,22 @@ public class OperationLogServiceImpl implements OperationLogService {
|
|||||||
* 保存日志
|
* 保存日志
|
||||||
*
|
*
|
||||||
* @param message 日志内容
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
* @param businessModule 所属模块
|
* @param businessModule 所属模块
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
* @param detail 描述
|
* @param detail 描述
|
||||||
|
* @param transactionId 链路id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String detail) {
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String detail, String transactionId) {
|
||||||
this.addOperationLog(new OperationLog()
|
this.addOperationLog(new OperationLog()
|
||||||
.setCreateTime(DateUtil.now())
|
.setCreateTime(DateUtil.now())
|
||||||
.setContent(message)
|
.setContent(message)
|
||||||
|
.setResult(result)
|
||||||
|
.setBusinessModule(businessModule.getValue())
|
||||||
.setLevel("business")
|
.setLevel("business")
|
||||||
.setDescribe(detail)
|
.setDescribe(detail)
|
||||||
|
.setTransactionId(transactionId)
|
||||||
.setOperationType(type.getValue()));
|
.setOperationType(type.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +104,21 @@ public class OperationLogServiceImpl implements OperationLogService {
|
|||||||
* 保存日志
|
* 保存日志
|
||||||
*
|
*
|
||||||
* @param message 日志内容
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
* @param type 类型
|
||||||
|
* @param transactionId 链路id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type, String transactionId) {
|
||||||
|
addOperationLog(message, result, businessModule, type, null, transactionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
* @param businessModule 所属模块
|
* @param businessModule 所属模块
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
*/
|
*/
|
||||||
@ -105,4 +126,30 @@ public class OperationLogServiceImpl implements OperationLogService {
|
|||||||
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type) {
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, EbtpLogType type) {
|
||||||
addOperationLog(message, result, businessModule, type, null);
|
addOperationLog(message, result, businessModule, type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule) {
|
||||||
|
addOperationLog(message, result, businessModule, EbtpLogType.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日志
|
||||||
|
*
|
||||||
|
* @param message 日志内容
|
||||||
|
* @param result 执行结果
|
||||||
|
* @param businessModule 所属模块
|
||||||
|
* @param transactionId 链路id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addOperationLog(String message, boolean result, EbtpLogBusinessModule businessModule, String transactionId) {
|
||||||
|
addOperationLog(message, result, businessModule, EbtpLogType.UNKNOWN, transactionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user