fix(task): 校验任务节点执行参数并记录异常日志

- 添加对任务代码参数的非空校验,避免空指针异常
- 在任务节点执行失败时记录详细的错误日志
- 优化异常处理流程,确保错误信息准确传递
This commit is contained in:
2025-10-27 13:54:11 +08:00
parent f08f1828c5
commit 591810899f
@@ -45,6 +45,9 @@ public class TaskJobBean extends QuartzJobBean implements InterruptableJob {
private Thread workThread = null;
private String getBeanAlias(String code) {
if (StrUtil.isBlank(code)) {
throw new ServerException("参数code必填");
}
// node_init
String[] s = code.split("_");
return Arrays.stream(s).map(StrUtil::upperFirst).collect(Collectors.joining());
@@ -172,6 +175,7 @@ public class TaskJobBean extends QuartzJobBean implements InterruptableJob {
executor.execute(codeIdMap.getOrDefault(code, null), dataMap, taskTemplateNodeVo);
taskInstanceDetailService.fastSuccessWithInfo(id, code, null);
} catch (Exception e) {
log.error("任务节点执行失败", e);
taskInstanceDetailService.fastFailWithInfo(id, code, e.getMessage());
throw new ServerException(e);
}