fix api访问/异常日志和操作日志写入数据表,创建人和修改人的信息为空
parent
f8a8538b04
commit
9194e094e6
|
@ -37,6 +37,11 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
|
||||||
ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
|
ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
|
||||||
apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
||||||
apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
|
apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
|
||||||
|
if(apiAccessLog.getUserId() != null){
|
||||||
|
String userIdStr = apiAccessLog.getUserId().toString();
|
||||||
|
apiAccessLog.setCreator(userIdStr);
|
||||||
|
apiAccessLog.setUpdater(userIdStr);
|
||||||
|
}
|
||||||
if (TenantContextHolder.getTenantId() != null) {
|
if (TenantContextHolder.getTenantId() != null) {
|
||||||
apiAccessLogMapper.insert(apiAccessLog);
|
apiAccessLogMapper.insert(apiAccessLog);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,6 +40,11 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
||||||
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
|
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
|
||||||
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
||||||
|
if(apiErrorLog.getUserId() != null){
|
||||||
|
String userIdStr = apiErrorLog.getUserId().toString();
|
||||||
|
apiErrorLog.setCreator(userIdStr);
|
||||||
|
apiErrorLog.setUpdater(userIdStr);
|
||||||
|
}
|
||||||
if (TenantContextHolder.getTenantId() != null) {
|
if (TenantContextHolder.getTenantId() != null) {
|
||||||
apiErrorLogMapper.insert(apiErrorLog);
|
apiErrorLogMapper.insert(apiErrorLog);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -28,6 +28,11 @@ public class OperateLogServiceImpl implements OperateLogService {
|
||||||
@Override
|
@Override
|
||||||
public void createOperateLog(OperateLogCreateReqDTO createReqDTO) {
|
public void createOperateLog(OperateLogCreateReqDTO createReqDTO) {
|
||||||
OperateLogDO log = BeanUtils.toBean(createReqDTO, OperateLogDO.class);
|
OperateLogDO log = BeanUtils.toBean(createReqDTO, OperateLogDO.class);
|
||||||
|
if(log.getUserId() != null){
|
||||||
|
String userIdStr = log.getUserId().toString();
|
||||||
|
log.setCreator(userIdStr);
|
||||||
|
log.setUpdater(userIdStr);
|
||||||
|
}
|
||||||
operateLogMapper.insert(log);
|
operateLogMapper.insert(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue