feat:(1.3.0-beta1.1): 优化job、工作流notify和场景的notifyIds

This commit is contained in:
opensnail 2025-01-10 23:26:13 +08:00
parent 34d3366278
commit bae6e39721
4 changed files with 3 additions and 7 deletions

View File

@ -37,6 +37,9 @@ public interface WorkflowConverter {
WorkflowConverter INSTANCE = Mappers.getMapper(WorkflowConverter.class);
@Mappings({
@Mapping(target = "notifyIds", expression = "java(WorkflowConverter.toNotifyIdsStr(workflowRequestVO.getNotifyIds()))")
})
Workflow convert(WorkflowRequestVO workflowRequestVO);
WorkflowNode convert(WorkflowRequestVO.NodeInfo nodeInfo);

View File

@ -151,7 +151,6 @@ public class JobServiceImpl implements JobService {
% systemProperties.getBucketTotal());
job.setNextTriggerAt(calculateNextTriggerAt(jobRequestVO, DateUtils.toNowMilli()));
job.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
job.setNotifyIds(JsonUtil.toJsonString(jobRequestVO.getNotifyIds()));
job.setOwnerId(jobRequestVO.getOwnerId());
job.setId(null);
return 1 == jobMapper.insert(job);
@ -166,7 +165,6 @@ public class JobServiceImpl implements JobService {
// 判断常驻任务
Job updateJob = JobConverter.INSTANCE.convert(jobRequestVO);
updateJob.setNotifyIds(JsonUtil.toJsonString(jobRequestVO.getNotifyIds()));
updateJob.setOwnerId(jobRequestVO.getOwnerId());
updateJob.setResident(isResident(jobRequestVO));
updateJob.setNamespaceId(job.getNamespaceId());

View File

@ -126,8 +126,6 @@ public class SceneConfigServiceImpl implements SceneConfigService {
retrySceneConfig.setCreateDt(LocalDateTime.now());
retrySceneConfig.setNamespaceId(namespaceId);
retrySceneConfig.setNotifyIds(JsonUtil.toJsonString(Optional.ofNullable(requestVO.getNotifyIds()).orElse(Sets.newHashSet())));
if (requestVO.getBackOff() == WaitStrategies.WaitStrategyEnum.DELAY_LEVEL.getType()) {
retrySceneConfig.setTriggerInterval(StrUtil.EMPTY);
}

View File

@ -128,8 +128,6 @@ public class WorkflowServiceImpl implements WorkflowService {
HashUtil.bkdrHash(workflowRequestVO.getGroupName() + workflowRequestVO.getWorkflowName())
% systemProperties.getBucketTotal());
workflow.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
workflow.setNotifyIds(JsonUtil.toJsonString(Optional.ofNullable(workflowRequestVO.getNotifyIds()).orElse(Sets.newHashSet())));
workflow.setId(null);
Assert.isTrue(1 == workflowMapper.insert(workflow), () -> new SnailJobServerException("新增工作流失败"));
@ -227,7 +225,6 @@ public class WorkflowServiceImpl implements WorkflowService {
workflow.setVersion(version);
workflow.setNextTriggerAt(calculateNextTriggerAt(workflowRequestVO, DateUtils.toNowMilli()));
workflow.setFlowInfo(JsonUtil.toJsonString(GraphUtils.serializeGraphToJson(graph)));
workflow.setNotifyIds(JsonUtil.toJsonString(Optional.ofNullable(workflowRequestVO.getNotifyIds()).orElse(Sets.newHashSet())));
// 不允许更新组
workflow.setGroupName(null);
Assert.isTrue(