mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:同步2.1版本
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.orange.demo.common.log.annotation;
|
||||
package com.orangeforms.common.log.annotation;
|
||||
|
||||
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.orange.demo.common.log.aop;
|
||||
package com.orangeforms.common.log.aop;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||
import com.orange.demo.common.core.object.ResponseResult;
|
||||
import com.orange.demo.common.core.object.TokenData;
|
||||
import com.orange.demo.common.core.util.ContextUtil;
|
||||
import com.orange.demo.common.core.util.IpUtil;
|
||||
import com.orange.demo.common.core.util.MyCommonUtil;
|
||||
import com.orange.demo.common.log.annotation.OperationLog;
|
||||
import com.orange.demo.common.log.config.OperationLogProperties;
|
||||
import com.orange.demo.common.log.model.SysOperationLog;
|
||||
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.constant.ApplicationConstant;
|
||||
import com.orangeforms.common.core.object.ResponseResult;
|
||||
import com.orangeforms.common.core.object.TokenData;
|
||||
import com.orangeforms.common.core.util.ContextUtil;
|
||||
import com.orangeforms.common.core.util.IpUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.config.OperationLogProperties;
|
||||
import com.orangeforms.common.log.model.SysOperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
@@ -63,7 +63,7 @@ public class OperationLogAspect {
|
||||
/**
|
||||
* 所有controller方法。
|
||||
*/
|
||||
@Pointcut("execution(public * com.orange.demo..controller..*(..))")
|
||||
@Pointcut("execution(public * com.orangeforms..controller..*(..))")
|
||||
public void operationLogPointCut() {
|
||||
// 空注释,避免sonar警告
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class OperationLogAspect {
|
||||
response.setHeader(ApplicationConstant.HTTP_HEADER_TRACE_ID, traceId);
|
||||
MDC.put(ApplicationConstant.HTTP_HEADER_TRACE_ID, traceId);
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
// 为log4j2日志设定变量,使日志可以输出更多有价值的信息。
|
||||
// 为日志框架设定变量,使日志可以输出更多有价值的信息。
|
||||
if (tokenData != null) {
|
||||
MDC.put("sessionId", tokenData.getSessionId());
|
||||
MDC.put("userId", tokenData.getUserId().toString());
|
||||
@@ -129,6 +129,11 @@ public class OperationLogAspect {
|
||||
operationLog.setElapse(System.currentTimeMillis() - start);
|
||||
kafkaTemplate.send(properties.getKafkaTopic(), JSON.toJSONString(operationLog));
|
||||
}
|
||||
MDC.remove(ApplicationConstant.HTTP_HEADER_TRACE_ID);
|
||||
if (tokenData != null) {
|
||||
MDC.remove("sessionId");
|
||||
MDC.remove("userId");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orange.demo.common.log.config;
|
||||
package com.orangeforms.common.log.config;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orange.demo.common.log.config;
|
||||
package com.orangeforms.common.log.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.common.log.dao;
|
||||
package com.orangeforms.common.log.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.log.model.SysOperationLog;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.log.model.SysOperationLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.common.log.dao.SysOperationLogMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.common.log.model.SysOperationLog">
|
||||
<mapper namespace="com.orangeforms.common.log.dao.SysOperationLogMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.common.log.model.SysOperationLog">
|
||||
<id column="log_id" jdbcType="BIGINT" property="logId"/>
|
||||
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||
<result column="operation_type" jdbcType="INTEGER" property="operationType"/>
|
||||
@@ -87,7 +87,7 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getSysOperationLogList" resultMap="BaseResultMap" parameterType="com.orange.demo.common.log.model.SysOperationLog">
|
||||
<select id="getSysOperationLogList" resultMap="BaseResultMap" parameterType="com.orangeforms.common.log.model.SysOperationLog">
|
||||
SELECT * FROM zz_sys_operation_log
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.common.log.model;
|
||||
package com.orangeforms.common.log.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.TenantFilterColumn;
|
||||
import com.orangeforms.common.core.annotation.TenantFilterColumn;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orange.demo.common.log.model.constant;
|
||||
package com.orangeforms.common.log.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -86,23 +86,27 @@ public final class SysOperationLogType {
|
||||
/**
|
||||
* 启动流程。
|
||||
*/
|
||||
public static final int START_PROCESS = 100;
|
||||
public static final int START_FLOW = 100;
|
||||
/**
|
||||
* 停止流程。
|
||||
*/
|
||||
public static final int STOP_PROCESS = 105;
|
||||
public static final int STOP_FLOW = 105;
|
||||
/**
|
||||
* 删除流程。
|
||||
*/
|
||||
public static final int DELETE_PROCESS = 110;
|
||||
public static final int DELETE_FLOW = 110;
|
||||
/**
|
||||
* 取消流程。
|
||||
*/
|
||||
public static final int CANCEL_PROCESS = 115;
|
||||
public static final int CANCEL_FLOW = 115;
|
||||
/**
|
||||
* 提交任务。
|
||||
*/
|
||||
public static final int SUBMIT_TASK = 120;
|
||||
/**
|
||||
* 催办任务。
|
||||
*/
|
||||
public static final int REMIND_TASK = 125;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(15);
|
||||
static {
|
||||
@@ -124,11 +128,12 @@ public final class SysOperationLogType {
|
||||
DICT_MAP.put(UNPUBLISH, "取消发布");
|
||||
DICT_MAP.put(SUSPEND, "暂停");
|
||||
DICT_MAP.put(RESUME, "恢复");
|
||||
DICT_MAP.put(START_PROCESS, "启动流程");
|
||||
DICT_MAP.put(STOP_PROCESS, "停止流程");
|
||||
DICT_MAP.put(DELETE_PROCESS, "删除流程");
|
||||
DICT_MAP.put(CANCEL_PROCESS, "取消流程");
|
||||
DICT_MAP.put(START_FLOW, "启动流程");
|
||||
DICT_MAP.put(STOP_FLOW, "停止流程");
|
||||
DICT_MAP.put(DELETE_FLOW, "删除流程");
|
||||
DICT_MAP.put(CANCEL_FLOW, "取消流程");
|
||||
DICT_MAP.put(SUBMIT_TASK, "提交任务");
|
||||
DICT_MAP.put(REMIND_TASK, "催办任务");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.common.log.service;
|
||||
package com.orangeforms.common.log.service;
|
||||
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
import com.orange.demo.common.log.model.SysOperationLog;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.log.model.SysOperationLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.orange.demo.common.log.service.impl;
|
||||
package com.orangeforms.common.log.service.impl;
|
||||
|
||||
import com.orange.demo.common.core.annotation.MyDataSource;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||
import com.orange.demo.common.log.dao.SysOperationLogMapper;
|
||||
import com.orange.demo.common.log.model.SysOperationLog;
|
||||
import com.orange.demo.common.log.service.SysOperationLogService;
|
||||
import com.orangeforms.common.core.annotation.MyDataSource;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.constant.ApplicationConstant;
|
||||
import com.orangeforms.common.log.dao.SysOperationLogMapper;
|
||||
import com.orangeforms.common.log.model.SysOperationLog;
|
||||
import com.orangeforms.common.log.service.SysOperationLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.orange.demo.common.log.config.CommonLogAutoConfig
|
||||
com.orangeforms.common.log.config.CommonLogAutoConfig
|
||||
Reference in New Issue
Block a user