feat: 2.6.0
1. 工作流新增/更新添加校验逻辑
This commit is contained in:
parent
fe9048ce8a
commit
f92c045119
@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -91,6 +92,7 @@ public class JobTaskBatchHandler {
|
||||
}
|
||||
}
|
||||
|
||||
jobTaskBatch.setUpdateDt(LocalDateTime.now());
|
||||
return 1 == jobTaskBatchMapper.update(jobTaskBatch,
|
||||
new LambdaUpdateWrapper<JobTaskBatch>()
|
||||
.eq(JobTaskBatch::getId, completeJobBatchDTO.getTaskBatchId())
|
||||
|
@ -4,6 +4,8 @@ import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.easy.retry.common.core.constant.SystemConstants;
|
||||
import com.aizuda.easy.retry.common.core.enums.WorkflowNodeTypeEnum;
|
||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||
import com.aizuda.easy.retry.server.common.dto.CallbackConfig;
|
||||
import com.aizuda.easy.retry.server.common.dto.DecisionConfig;
|
||||
import com.aizuda.easy.retry.server.common.dto.JobTaskConfig;
|
||||
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
||||
@ -142,16 +144,26 @@ public class WorkflowHandler {
|
||||
workflowNode.setVersion(version);
|
||||
if (WorkflowNodeTypeEnum.DECISION.getType() == nodeConfig.getNodeType()) {
|
||||
workflowNode.setJobId(SystemConstants.DECISION_JOB_ID);
|
||||
workflowNode.setNodeInfo(JsonUtil.toJsonString(nodeInfo.getDecision()));
|
||||
DecisionConfig decision = nodeInfo.getDecision();
|
||||
Assert.notNull(decision, () -> new EasyRetryServerException("【{}】配置信息不能为空", nodeInfo.getNodeName()));
|
||||
Assert.notBlank(decision.getNodeExpression(), ()-> new EasyRetryServerException("【{}】表达式不能为空", nodeInfo.getNodeName()));
|
||||
workflowNode.setNodeInfo(JsonUtil.toJsonString(decision));
|
||||
}
|
||||
|
||||
if (WorkflowNodeTypeEnum.CALLBACK.getType() == nodeConfig.getNodeType()) {
|
||||
workflowNode.setJobId(SystemConstants.CALLBACK_JOB_ID);
|
||||
workflowNode.setNodeInfo(JsonUtil.toJsonString(nodeInfo.getCallback()));
|
||||
CallbackConfig callback = nodeInfo.getCallback();
|
||||
Assert.notNull(callback, () -> new EasyRetryServerException("【{}】配置信息不能为空", nodeInfo.getNodeName()));
|
||||
Assert.notBlank(callback.getWebhook(), () -> new EasyRetryServerException("【{}】webhook不能为空", nodeInfo.getNodeName()));
|
||||
Assert.notNull(callback.getContentType(), () -> new EasyRetryServerException("【{}】请求类型不能为空", nodeInfo.getNodeName()));
|
||||
Assert.notBlank(callback.getSecret(), () -> new EasyRetryServerException("【{}】秘钥不能为空", nodeInfo.getNodeName()));
|
||||
workflowNode.setNodeInfo(JsonUtil.toJsonString(callback));
|
||||
}
|
||||
|
||||
if (WorkflowNodeTypeEnum.JOB_TASK.getType() == nodeConfig.getNodeType()) {
|
||||
JobTaskConfig jobTask = nodeInfo.getJobTask();
|
||||
Assert.notNull(jobTask, () -> new EasyRetryServerException("【{}】配置信息不能为空", nodeInfo.getNodeName()));
|
||||
Assert.notNull(jobTask.getJobId(), () -> new EasyRetryServerException("【{}】所属任务不能为空", nodeInfo.getNodeName()));
|
||||
workflowNode.setJobId(jobTask.getJobId());
|
||||
}
|
||||
|
||||
@ -163,8 +175,6 @@ public class WorkflowHandler {
|
||||
// 添加边
|
||||
graph.putEdge(parentId, workflowNode.getId());
|
||||
}
|
||||
log.info("workflowNodeId:[{}] parentIds:[{}]",
|
||||
workflowNode.getId(), JsonUtil.toJsonString(parentIds));
|
||||
WorkflowRequestVO.NodeConfig childNode = nodeInfo.getChildNode();
|
||||
if (Objects.nonNull(childNode) && !CollectionUtils.isEmpty(childNode.getConditionNodes())) {
|
||||
buildGraph(Lists.newArrayList(workflowNode.getId()), deque, groupName, workflowId, childNode,
|
||||
|
@ -17,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -48,13 +50,17 @@ public class JobLogServiceImpl implements JobLogService {
|
||||
List<JobLogMessage> records = selectPage.getRecords();
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
|
||||
Long count = jobTaskBatchMapper.selectCount(
|
||||
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectOne(
|
||||
new LambdaQueryWrapper<JobTaskBatch>()
|
||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskBatchStatusEnum.COMPLETED)
|
||||
.eq(JobTaskBatch::getId, queryVO.getTaskBatchId())
|
||||
);
|
||||
|
||||
JobLogResponseVO jobLogResponseVO = new JobLogResponseVO();
|
||||
if (count > 0) {
|
||||
|
||||
if (Objects.nonNull(jobTaskBatch) &&
|
||||
JobTaskBatchStatusEnum.COMPLETED.contains(jobTaskBatch.getTaskBatchStatus())
|
||||
&& jobTaskBatch.getUpdateDt().plusSeconds(15).isBefore(LocalDateTime.now())
|
||||
) {
|
||||
jobLogResponseVO.setFinished(Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
:scroll="{ x: 1500 }"
|
||||
>
|
||||
<span slot="serial" slot-scope="record">
|
||||
<a href="#" @click="handlerOpenDrawer(record)">{{ record.id }}</a>
|
||||
{{ record.id }}
|
||||
</span>
|
||||
<span slot="taskBatchStatus" slot-scope="text">
|
||||
<a-tag :color="taskBatchStatus[text].color">
|
||||
@ -100,19 +100,6 @@
|
||||
</template>
|
||||
</span>
|
||||
</s-table>
|
||||
|
||||
<Drawer
|
||||
title="任务详情"
|
||||
placement="right"
|
||||
:width="800"
|
||||
:visibleAmplify="true"
|
||||
:visible="openDrawer"
|
||||
@closeDrawer="onClose"
|
||||
@handlerAmplify="handleInfo"
|
||||
>
|
||||
<job-batch-info ref="jobBatchInfoRef" :showHeader="false" :column="2"/>
|
||||
</Drawer>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user