feat(sj_1.0.0): 避免更新覆盖组问题

This commit is contained in:
opensnail 2024-06-04 21:07:37 +08:00
parent 77dfd58182
commit 7fe706118b
3 changed files with 7 additions and 0 deletions

View File

@ -138,6 +138,9 @@ public class GroupConfigServiceImpl implements GroupConfigService {
groupConfig.setDescription(Optional.ofNullable(groupConfigRequestVO.getDescription()).orElse(StrUtil.EMPTY));
// 使用@TableField(value = "version", update= "%s+1") 进行更新version, 这里必须初始化一个值
groupConfig.setVersion(1);
// 不允许更新组
groupConfig.setGroupName(null);
// 不允许更新token
groupConfig.setToken(null);
Assert.isTrue(tablePartitionList.contains(groupConfigRequestVO.getGroupPartition()),
() -> new SnailJobServerException("分区不存在. [{}]", tablePartitionList));

View File

@ -173,6 +173,8 @@ public class JobServiceImpl implements JobService {
updateJob.setNextTriggerAt(DateUtils.toNowMilli());
}
// 禁止更新组
updateJob.setGroupName(null);
return 1 == jobMapper.updateById(updateJob);
}

View File

@ -225,6 +225,8 @@ public class WorkflowServiceImpl implements WorkflowService {
workflow.setVersion(version);
workflow.setNextTriggerAt(calculateNextTriggerAt(workflowRequestVO, DateUtils.toNowMilli()));
workflow.setFlowInfo(JsonUtil.toJsonString(GraphUtils.serializeGraphToJson(graph)));
// 不允许更新组
workflow.setGroupName(null);
Assert.isTrue(
workflowMapper.update(workflow,
new LambdaQueryWrapper<Workflow>()