Merge remote-tracking branch 'origin/feature/bpm' into feature/bpm

# Conflicts:
#	yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmTaskEventListener.java
#	yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java
#	yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
This commit is contained in:
jason 2025-02-25 22:26:25 +08:00
commit 3f1cd80573
12 changed files with 117 additions and 76 deletions

View File

@ -14,7 +14,8 @@ import lombok.Getter;
public enum BpmBoundaryEventTypeEnum {
USER_TASK_TIMEOUT(1, "用户任务超时"),
DELAY_TIMER_TIMEOUT(2, "延迟器超时");
DELAY_TIMER_TIMEOUT(2, "延迟器超时"),
CHILD_PROCESS_TIMEOUT(3, "子流程超时");
private final Integer type;
private final String name;

View File

@ -30,8 +30,7 @@ public enum BpmSimpleModelNodeTypeEnum implements ArrayValuable<Integer> {
DELAY_TIMER_NODE(14, "延迟器", "receiveTask"),
TRIGGER_NODE(15, "触发器", "serviceTask"),
CHILD_PROCESS(20, "子流程", "callActivity"), // TODO @lesanCHILD_PROCESSASYNC_CHILD_PROCESS 可以合并为一个么
ASYNC_CHILD_PROCESS(21, "异步子流程", "callActivity"),
CHILD_PROCESS(20, "子流程", "callActivity"),
// 50 ~ 条件分支
CONDITION_NODE(50, "条件", "sequenceFlow"), // 用于构建流转条件的表达式

View File

@ -423,35 +423,35 @@ public class BpmSimpleModelNodeVO {
@Valid
public static class ChildProcessSetting {
// TODO @lesancalledElement => calledProcessDefinitionKey ? 这样更容易理解不过如果一个流程多次发起key 变了好像会有问题
@Schema(description = "被调用流程", requiredMode = Schema.RequiredMode.REQUIRED, example = "xxx")
@NotEmpty(message = "被调用流程不能为空")
private String calledElement;
private String calledProcessDefinitionKey;
@Schema(description = "被调用流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "xxx")
@NotEmpty(message = "被调用流程名称不能为空")
private String calledElementName;
private String calledProcessDefinitionName;
@Schema(description = "是否异步", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
@NotNull(message = "是否异步不能为空")
private Boolean async;
// TODO @lesaninVariables
@Schema(description = "输入参数(主->子)", requiredMode = Schema.RequiredMode.REQUIRED, example = "[]")
private List<IOParameter> inVariable;
@Schema(description = "输入参数(主->子)", example = "[]")
private List<IOParameter> inVariables;
// TODO @lesanoutVariables
@Schema(description = "输出参数(子->主)", example = "[]")
private List<IOParameter> outVariable;
private List<IOParameter> outVariables;
@Schema(description = "是否自动跳过子流程发起节点", example = "false")
@Schema(description = "是否自动跳过子流程发起节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
@NotNull(message = "是否自动跳过子流程发起节点不能为空")
private Boolean skipStartUserNode;
@Schema(description = "子流程发起人配置", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
// TODO @lesan这个应该也必须填写
@NotNull(message = "子流程发起人配置不能为空")
private StartUserSetting startUserSetting;
@Schema(description = "超时设置", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
private TimeoutSetting timeoutSetting;
@Schema(description = "子流程发起人配置")
@Data
@Valid
@ -465,11 +465,28 @@ public class BpmSimpleModelNodeVO {
@Schema(description = "表单", example = "xxx")
private String formField;
// TODO @lesanemptyHandleType => emptyType type 对上
@Schema(description = "当子流程发起人为空时类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "当子流程发起人为空时类型不能为空")
@InEnum(BpmChildProcessStartUserEmptyTypeEnum.class)
private Integer emptyHandleType;
private Integer emptyType;
}
@Schema(description = "超时设置")
@Data
@Valid
public static class TimeoutSetting {
@Schema(description = "是否开启超时设置", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
@NotNull(message = "是否开启超时设置不能为空")
private Boolean enable;
@Schema(description = "时间类型", example = "1")
@InEnum(BpmDelayTimerTypeEnum.class)
private Integer type;
@Schema(description = "时间表达式", example = "PT1H,2025-01-01T00:00:00")
private String timeExpression;
}

View File

@ -110,6 +110,10 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
} else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT)) {
String taskKey = boundaryEvent.getAttachedToRefId();
taskService.triggerTask(event.getProcessInstanceId(), taskKey);
// 2.3 子流程超时处理
} else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.CHILD_PROCESS_TIMEOUT)) {
String taskKey = boundaryEvent.getAttachedToRefId();
taskService.processChildProcessTimeout(event.getProcessInstanceId(), taskKey);
}
}

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
@ -244,8 +244,7 @@ public class FlowableUtils {
return formFieldsMap.entrySet().stream()
.limit(3)
.map(entry -> new KeyValue<>(entry.getValue().getTitle(),
// TODO @lesan MapUtil.getStr 可以更简单
StrUtil.toStringOrEmpty(processVariables.getOrDefault(entry.getValue().getField(), ""))))
MapUtil.getStr(processVariables, entry.getValue().getField(), "")))
.collect(Collectors.toList());
}

View File

@ -48,7 +48,7 @@ public class SimpleModelUtils {
new StartUserNodeConvert(), new ApproveNodeConvert(), new CopyNodeConvert(), new TransactorNodeConvert(),
new DelayTimerNodeConvert(), new TriggerNodeConvert(),
new ConditionBranchNodeConvert(), new ParallelBranchNodeConvert(), new InclusiveBranchNodeConvert(), new RouteBranchNodeConvert(),
new ChildProcessConvert(), new AsyncChildProcessConvert());
new ChildProcessConvert());
converts.forEach(convert -> NODE_CONVERTS.put(convert.getType(), convert));
}
@ -416,6 +416,7 @@ public class SimpleModelUtils {
private BoundaryEvent buildUserTaskTimeoutBoundaryEvent(UserTask userTask,
BpmSimpleModelNodeVO.TimeoutHandler timeoutHandler) {
// 1.1 定时器边界事件
// TODO @lesan一些 BoundaryEvent timeout 可以做一些基础的设置么
BoundaryEvent boundaryEvent = new BoundaryEvent();
boundaryEvent.setId("Event-" + IdUtil.fastUUID());
boundaryEvent.setCancelActivity(false); // 设置关联的任务为不会被中断
@ -723,6 +724,7 @@ public class SimpleModelUtils {
// 2. 添加接收任务的 Timer Boundary Event
if (node.getDelaySetting() != null) {
// 2.1 定时器边界事件
// TODO @lesan一些 BoundaryEvent timeout 可以做一些基础的设置么
BoundaryEvent boundaryEvent = new BoundaryEvent();
boundaryEvent.setId("Event-" + IdUtil.fastUUID());
boundaryEvent.setCancelActivity(false);
@ -816,48 +818,41 @@ public class SimpleModelUtils {
private static class ChildProcessConvert implements NodeConvert {
@Override
public CallActivity convert(BpmSimpleModelNodeVO node) {
public List<FlowElement> convertList(BpmSimpleModelNodeVO node) {
List<FlowElement> flowElements = new ArrayList<>(2);
BpmSimpleModelNodeVO.ChildProcessSetting childProcessSetting = node.getChildProcessSetting();
List<IOParameter> inVariable = childProcessSetting.getInVariable() == null ?
new ArrayList<>() : new ArrayList<>(childProcessSetting.getInVariable());
List<IOParameter> inVariables = childProcessSetting.getInVariables() == null ?
new ArrayList<>() : new ArrayList<>(childProcessSetting.getInVariables());
CallActivity callActivity = new CallActivity();
callActivity.setId(node.getId());
callActivity.setName(node.getName());
callActivity.setCalledElementType("key"); // TODO @lesan这里为啥是 key
callActivity.setCalledElementType("key");
// 1. 是否异步
callActivity.setAsynchronous(node.getChildProcessSetting().getAsync());
// 2. 调用的子流程
callActivity.setCalledElement(childProcessSetting.getCalledElement());
callActivity.setProcessInstanceName(childProcessSetting.getCalledElementName());
// 3. 是否自动跳过子流程发起节点
// TODO @lesan貌似只有 SourceExpression 的区别直接通过 valueOf childProcessSetting.getSkipStartUserNode()
if (Boolean.TRUE.equals(childProcessSetting.getSkipStartUserNode())) {
IOParameter ioParameter = new IOParameter();
ioParameter.setSourceExpression("true");
ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE);
inVariable.add(ioParameter);
} else {
IOParameter ioParameter = new IOParameter();
ioParameter.setSourceExpression("false");
ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE);
inVariable.add(ioParameter);
if (node.getChildProcessSetting().getAsync()) {
// TODO @lesan: 这里目前测试没有跳过执行call activity 后面的节点
callActivity.setAsynchronous(true);
}
// 4. 子变量传递
// 4.1 默认需要传递的一些变量流程状态
// TODO @lesan4.1 这个要不单独一个序号类似 3. 这个然后下面就是把 子变量传递主变量传递这样逻辑连贯点哈
// 2. 调用的子流程
callActivity.setCalledElement(childProcessSetting.getCalledProcessDefinitionKey());
callActivity.setProcessInstanceName(childProcessSetting.getCalledProcessDefinitionName());
// 3. 是否自动跳过子流程发起节点
IOParameter ioParameter = new IOParameter();
ioParameter.setSourceExpression(childProcessSetting.getSkipStartUserNode().toString());
ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE);
inVariables.add(ioParameter);
// 4. 默认需要传递的一些变量流程状态
ioParameter = new IOParameter();
ioParameter.setSource(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS);
ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS);
inVariable.add(ioParameter);
callActivity.setInParameters(inVariable);
inVariables.add(ioParameter);
// 5. 主变量传递
// TODO @lesan通过 isNotEmpty 这种哈
if (childProcessSetting.getOutVariable() != null && !childProcessSetting.getOutVariable().isEmpty()) {
callActivity.setOutParameters(childProcessSetting.getOutVariable());
// 5. 子变量传递->主变量传递
callActivity.setInParameters(inVariables);
if (ArrayUtil.isNotEmpty(childProcessSetting.getOutVariables()) && ObjUtil.notEqual(childProcessSetting.getAsync(), Boolean.TRUE)) {
callActivity.setOutParameters(childProcessSetting.getOutVariables());
}
// 6. 子流程发起人配置
@ -873,9 +868,28 @@ public class SimpleModelUtils {
executionListeners.add(flowableListener);
callActivity.setExecutionListeners(executionListeners);
// 7. 超时设置
if (childProcessSetting.getTimeoutSetting() != null) {
// TODO @lesan一些 BoundaryEvent timeout 可以做一些基础的设置么
BoundaryEvent boundaryEvent = new BoundaryEvent();
boundaryEvent.setId("Event-" + IdUtil.fastUUID());
boundaryEvent.setCancelActivity(false);
boundaryEvent.setAttachedToRef(callActivity);
TimerEventDefinition eventDefinition = new TimerEventDefinition();
if (childProcessSetting.getTimeoutSetting().getType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) {
eventDefinition.setTimeDuration(childProcessSetting.getTimeoutSetting().getTimeExpression());
} else if (childProcessSetting.getTimeoutSetting().getType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) {
eventDefinition.setTimeDate(childProcessSetting.getTimeoutSetting().getTimeExpression());
}
boundaryEvent.addEventDefinition(eventDefinition);
addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventTypeEnum.CHILD_PROCESS_TIMEOUT.getType());
flowElements.add(boundaryEvent);
}
// 添加节点类型
addNodeType(node.getType(), callActivity);
return callActivity;
flowElements.add(callActivity);
return flowElements;
}
@Override
@ -885,16 +899,6 @@ public class SimpleModelUtils {
}
private static class AsyncChildProcessConvert extends ChildProcessConvert {
@Override
public BpmSimpleModelNodeTypeEnum getType() {
return BpmSimpleModelNodeTypeEnum.ASYNC_CHILD_PROCESS;
}
}
private static String buildGatewayJoinId(String id) {
return id + "_join";
}
@ -925,7 +929,6 @@ public class SimpleModelUtils {
|| nodeType == BpmSimpleModelNodeTypeEnum.TRANSACTOR_NODE
|| nodeType == BpmSimpleModelNodeTypeEnum.COPY_NODE
|| nodeType == BpmSimpleModelNodeTypeEnum.CHILD_PROCESS
|| nodeType == BpmSimpleModelNodeTypeEnum.ASYNC_CHILD_PROCESS
|| nodeType == BpmSimpleModelNodeTypeEnum.END_NODE) {
// 添加元素
resultNodes.add(currentNode);

View File

@ -320,7 +320,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
// 遍历 tasks 列表只处理已结束的 UserTask
// 为什么不通过 activities 因为加签场景下它只存在于 tasks没有 activities导致如果遍历 activities
// 的话它无法成为一个节点
// TODO @芋艿子流程只有activity这里获取不到已结束的子流程TODO @lesan这个会有啥影响微信聊
// TODO @芋艿子流程只有activity这里获取不到已结束的子流程TODO @lesan这个会导致timeline不会展示已结束的子流程
List<HistoricTaskInstance> endTasks = filterList(tasks, task -> task.getEndTime() != null);
List<ActivityNode> approvalNodes = convertList(endTasks, task -> {
FlowElement flowNode = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
@ -414,7 +414,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
// 处理每个任务的 tasks 属性
for (HistoricActivityInstance activity : taskActivities) {
HistoricTaskInstance task = taskMap.get(activity.getTaskId());
// TODO @lesan这里为啥 continue
// TODO @lesan这里为啥 continue @芋艿子流程的 activity task 是null 下面的方法会报错TODO @lesan写个注释
if (task == null) {
continue;
}
@ -510,8 +510,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
}
// 4. 子流程节点
if (BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType().equals(node.getType()) ||
BpmSimpleModelNodeTypeEnum.ASYNC_CHILD_PROCESS.getType().equals(node.getType())) {
if (BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType().equals(node.getType())) {
return activityNode;
}
return null;

View File

@ -276,6 +276,13 @@ public interface BpmTaskService {
*/
void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer handlerType);
/**
* 处理 ChildProcess 子流程的审批超时事件
*
* @param processInstanceId 流程示例编号
* @param taskDefineKey 任务 Key
*/
void processChildProcessTimeout(String processInstanceId, String taskDefineKey);
/**
* 触发流程任务 (ReceiveTask) 的执行

View File

@ -41,6 +41,7 @@ import org.flowable.engine.ManagementService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.DelegationState;
@ -1230,7 +1231,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
if (userTaskElement.getId().equals(START_USER_NODE_ID)
&& (skipStartUserNodeFlag == null // 目的一般是主流程发起人节点自动通过审核
|| Boolean.TRUE.equals(skipStartUserNodeFlag)) // 目的一般是子流程发起人节点按配置自动通过审核
&& !Boolean.TRUE.equals(returnTaskFlag)) { // TODO @lesanObjUtil.notEqual(returnTaskFlag, Boolean.TRUE) 改成这个有问题么尽量不用 ! 取反
&& ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) {
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
.setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_SKIP_START_USER_NODE.getReason()));
return;
@ -1322,6 +1323,16 @@ public class BpmTaskServiceImpl implements BpmTaskService {
}));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void processChildProcessTimeout(String processInstanceId, String taskDefineKey) {
List<ActivityInstance> activityInstances = runtimeService.createActivityInstanceQuery()
.processInstanceId(processInstanceId)
.activityId(taskDefineKey).list();
activityInstances.forEach(activityInstance -> FlowableUtils.execute(activityInstance.getTenantId(),
() -> moveTaskToEnd(activityInstance.getCalledProcessInstanceId(), BpmReasonEnum.TIMEOUT_APPROVE.getReason())));
}
@Override
public void triggerTask(String processInstanceId, String taskDefineKey) {
Execution execution = runtimeService.createExecutionQuery()

View File

@ -59,19 +59,19 @@ public class BpmCallActivityListener implements ExecutionListener {
// 2.1 当表单值为空时
if (StrUtil.isEmpty(formFieldValue)) {
// 2.1.1 来自主流程发起人
if (startUserSetting.getEmptyHandleType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER.getType())) {
if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER.getType())) {
FlowableUtils.setAuthenticatedUserId(Long.parseLong(parent.getStartUserId()));
return;
}
// 2.1.2 来自子流程管理员
if (startUserSetting.getEmptyHandleType().equals(BpmChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN.getType())) {
if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN.getType())) {
BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(execution.getProcessDefinitionId());
List<Long> managerUserIds = processDefinition.getManagerUserIds();
FlowableUtils.setAuthenticatedUserId(managerUserIds.get(0));
return;
}
// 2.1.3 来自主流程管理员
if (startUserSetting.getEmptyHandleType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN.getType())) {
if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN.getType())) {
BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(parent.getProcessDefinitionId());
List<Long> managerUserIds = processDefinition.getManagerUserIds();
FlowableUtils.setAuthenticatedUserId(managerUserIds.get(0));
@ -82,7 +82,8 @@ public class BpmCallActivityListener implements ExecutionListener {
try {
FlowableUtils.setAuthenticatedUserId(Long.parseLong(formFieldValue));
} catch (Exception e) {
// todo @lesan打个日志方便排查
log.error("[notify][监听器:{},子流程监听器设置流程的发起人字符串转 Long 失败,字符串:{}]",
DELEGATE_EXPRESSION, formFieldValue);
FlowableUtils.setAuthenticatedUserId(Long.parseLong(parent.getStartUserId()));
}
}

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.infra.service.logger;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
@ -35,8 +35,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
@Override
public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
apiAccessLog.setRequestParams(StrUtils.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
apiAccessLog.setResultMsg(StrUtils.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
if (TenantContextHolder.getTenantId() != null) {
apiAccessLogMapper.insert(apiAccessLog);
} else {

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.infra.service.logger;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
@ -39,7 +39,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
if (TenantContextHolder.getTenantId() != null) {
apiErrorLogMapper.insert(apiErrorLog);
} else {