diff --git a/scaleph-api/src/main/java/cn/sliew/scaleph/api/controller/workflow/WorkflowController.java b/scaleph-api/src/main/java/cn/sliew/scaleph/api/controller/workflow/WorkflowController.java
index 8c0d124de..4c776a26b 100644
--- a/scaleph-api/src/main/java/cn/sliew/scaleph/api/controller/workflow/WorkflowController.java
+++ b/scaleph-api/src/main/java/cn/sliew/scaleph/api/controller/workflow/WorkflowController.java
@@ -21,8 +21,6 @@
import cn.sliew.scaleph.api.annotation.Logging;
import cn.sliew.scaleph.system.model.ResponseVO;
import cn.sliew.scaleph.workflow.service.WorkflowDefinitionService;
-import cn.sliew.scaleph.workflow.service.WorkflowInstanceService;
-import cn.sliew.scaleph.workflow.service.WorkflowTaskInstanceService;
import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskDefinitionDTO;
import cn.sliew.scaleph.workflow.service.param.WorkflowDefinitionListParam;
@@ -48,10 +46,6 @@ public class WorkflowController {
@Autowired
private WorkflowDefinitionService workflowDefinitionService;
- @Autowired
- private WorkflowInstanceService workflowInstanceService;
- @Autowired
- private WorkflowTaskInstanceService workflowTaskInstanceService;
@Logging
@GetMapping
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstance.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstance.java
deleted file mode 100644
index 60a3dc1d4..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstance.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.entity.master.workflow;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.dao.entity.BaseDO;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-@TableName("workflow_instance")
-public class WorkflowInstance extends BaseDO {
-
- private static final long serialVersionUID = 1L;
-
- @TableField("workflow_definition_id")
- private Long workflowDefinitionId;
-
- @TableField("dag_id")
- private Long dagId;
-
- @TableField("task_id")
- private String taskId;
-
- @TableField("state")
- private WorkflowInstanceState state;
-
- @TableField("start_time")
- private Date startTime;
-
- @TableField("end_time")
- private Date endTime;
-
- @TableField("message")
- private String message;
-
-}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstanceVO.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstanceVO.java
deleted file mode 100644
index 729e9b480..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowInstanceVO.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.entity.master.workflow;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.dao.entity.BaseDO;
-import com.baomidou.mybatisplus.annotation.TableField;
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-public class WorkflowInstanceVO extends BaseDO {
-
- private static final long serialVersionUID = 1L;
-
- @TableField(value = "workflow_definition_id", exist = false)
- private WorkflowDefinition workflowDefinition;
-
- @TableField("dag_id")
- private Long dagId;
-
- @TableField("task_id")
- private String taskId;
-
- @TableField("state")
- private WorkflowInstanceState state;
-
- @TableField("start_time")
- private Date startTime;
-
- @TableField("end_time")
- private Date endTime;
-
- @TableField("message")
- private String message;
-
-}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstance.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstance.java
deleted file mode 100644
index 3d633aef4..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstance.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.entity.master.workflow;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowTaskInstanceStage;
-import cn.sliew.scaleph.dao.entity.BaseDO;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- *
- * workflow task instance
- *
- */
-@Data
-@TableName("workflow_task_instance")
-public class WorkflowTaskInstance extends BaseDO {
-
- private static final long serialVersionUID = 1L;
-
- @TableField("workflow_instance_id")
- private Long workflowInstanceId;
-
- @TableField("step_id")
- private Long stepId;
-
- @TableField("task_id")
- private String taskId;
-
- @TableField("stage")
- private WorkflowTaskInstanceStage stage;
-
- @TableField("start_time")
- private Date startTime;
-
- @TableField("end_time")
- private Date endTime;
-
- @TableField("message")
- private String message;
-
-}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstanceVO.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstanceVO.java
deleted file mode 100644
index 283aab289..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/workflow/WorkflowTaskInstanceVO.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.entity.master.workflow;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-/**
- *
- * workflow task instance
- *
- */
-@Data
-@TableName("workflow_task_instance")
-public class WorkflowTaskInstanceVO extends WorkflowTaskInstance {
-
- private static final long serialVersionUID = 1L;
-
- @TableField(value = "workflow_instance", exist = false)
- private WorkflowInstanceVO workflowInstance;
-}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.java
deleted file mode 100644
index 40296e1a3..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.mapper.master.workflow;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstance;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstanceVO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Repository;
-
-/**
- *
- * workflow instance Mapper 接口
- *
- */
-@Repository
-public interface WorkflowInstanceMapper extends BaseMapper {
-
- Page list(Page page,
- @Param("workflowDefinitionId") Long workflowDefinitionId,
- @Param("state") WorkflowInstanceState state);
-
- WorkflowInstanceVO get(@Param("id") Long id);
-
-}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.java
deleted file mode 100644
index 5862a040c..000000000
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.dao.mapper.master.workflow;
-
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstance;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstanceVO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Repository;
-
-/**
- *
- * workflow task instance Mapper 接口
- *
- */
-@Repository
-public interface WorkflowTaskInstanceMapper extends BaseMapper {
-
- Page list(Page page, @Param("stepId") Long stepId);
-
- WorkflowTaskInstanceVO get(@Param("id") Long id);
-
-}
diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.xml
deleted file mode 100644
index d48029ee3..000000000
--- a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowInstanceMapper.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- id, creator, create_time, editor, update_time,
- workflow_definition_id, dag_id, task_id, `state`, start_time, end_time, message
-
-
-
-
-
-
diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.xml
deleted file mode 100644
index ebbe429d1..000000000
--- a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/workflow/WorkflowTaskInstanceMapper.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- id
- , creator, create_time, editor, update_time,
- workflow_instance_id, step_id, task_id, stage, start_time, end_time, message
-
-
-
-
-
-
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/manager/WorkflowInstanceManager.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/manager/WorkflowInstanceManager.java
index d19f46e64..956206fda 100644
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/manager/WorkflowInstanceManager.java
+++ b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/manager/WorkflowInstanceManager.java
@@ -20,7 +20,7 @@
public interface WorkflowInstanceManager {
- void deploy(Long id);
+ void deploy(Long workflowDefinitionId);
void shutdown(Long id);
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowInstanceService.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowInstanceService.java
deleted file mode 100644
index e3fbf28ca..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowInstanceService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
-import cn.sliew.scaleph.workflow.service.param.WorkflowInstanceListParam;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
-public interface WorkflowInstanceService {
-
- Page list(WorkflowInstanceListParam param);
-
- WorkflowInstanceDTO get(Long id);
-
- void updateState(Long id, WorkflowInstanceState state, WorkflowInstanceState nextState, String message);
-
- void updateSuccess(Long id);
-
- void updateFailure(Long id, Throwable throwable);
-
- void updateTaskId(Long id, String taskId);
-
- void deploy(WorkflowDefinitionDTO workflowDefinitionDTO);
-
- void shutdown(Long id);
-
- void suspend(Long id);
-
- void resume(Long id);
-
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowTaskInstanceService.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowTaskInstanceService.java
deleted file mode 100644
index 3280039b0..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/WorkflowTaskInstanceService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowTaskInstanceStage;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskDefinitionDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskInstanceDTO;
-import cn.sliew.scaleph.workflow.service.param.WorkflowTaskInstanceListParam;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.google.common.graph.Graph;
-
-import java.util.List;
-
-public interface WorkflowTaskInstanceService {
-
- Page list(WorkflowTaskInstanceListParam param);
-
- List list(Long workflowInstanceId);
-
- Graph getDag(Long workflowInstanceId, Graph dag);
-
- WorkflowTaskInstanceDTO get(Long id);
-
- void updateState(Long id, WorkflowTaskInstanceStage stage, WorkflowTaskInstanceStage nextStage, String message);
-
- void updateSuccess(Long id);
-
- void updateFailure(Long id, Throwable throwable);
-
- void updateTaskId(Long id, String taskId);
-
- Graph initialize(Long workflowInstanceId, Graph graph);
-
- void deploy(Long id);
-
- void shutdown(Long id);
-
- void suspend(Long id);
-
- void resume(Long id);
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceConvert.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceConvert.java
deleted file mode 100644
index 76de58965..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceConvert.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.convert;
-
-import cn.sliew.scaleph.common.convert.BaseConvert;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstance;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.ReportingPolicy;
-import org.mapstruct.factory.Mappers;
-import org.springframework.beans.BeanUtils;
-
-@Deprecated
-@Mapper(uses = {}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
-public interface WorkflowInstanceConvert extends BaseConvert {
- WorkflowInstanceConvert INSTANCE = Mappers.getMapper(WorkflowInstanceConvert.class);
-
- @Override
- default WorkflowInstance toDo(WorkflowInstanceDTO dto) {
- WorkflowInstance entity = new WorkflowInstance();
- BeanUtils.copyProperties(dto, entity);
- entity.setWorkflowDefinitionId(dto.getWorkflowDefinition().getId());
- return entity;
- }
-
- @Override
- default WorkflowInstanceDTO toDto(WorkflowInstance entity) {
- WorkflowInstanceDTO dto = new WorkflowInstanceDTO();
- BeanUtils.copyProperties(entity, dto);
- WorkflowDefinitionDTO workflowDefinitionDTO = new WorkflowDefinitionDTO();
- workflowDefinitionDTO.setId(entity.getWorkflowDefinitionId());
- dto.setWorkflowDefinition(workflowDefinitionDTO);
- return dto;
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceVOConvert.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceVOConvert.java
deleted file mode 100644
index f4eba4bee..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowInstanceVOConvert.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.convert;
-
-import cn.sliew.scaleph.common.convert.BaseConvert;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstanceVO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.ReportingPolicy;
-import org.mapstruct.factory.Mappers;
-import org.springframework.beans.BeanUtils;
-
-@Deprecated
-@Mapper(uses = {}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
-public interface WorkflowInstanceVOConvert extends BaseConvert {
- WorkflowInstanceVOConvert INSTANCE = Mappers.getMapper(WorkflowInstanceVOConvert.class);
-
- @Override
- default WorkflowInstanceVO toDo(WorkflowInstanceDTO dto) {
- WorkflowInstanceVO entity = new WorkflowInstanceVO();
- BeanUtils.copyProperties(dto, entity);
- entity.setWorkflowDefinition(WorkflowDefinitionConvert.INSTANCE.toDo(dto.getWorkflowDefinition()));
- return entity;
- }
-
- @Override
- default WorkflowInstanceDTO toDto(WorkflowInstanceVO entity) {
- WorkflowInstanceDTO dto = new WorkflowInstanceDTO();
- BeanUtils.copyProperties(entity, dto);
- dto.setWorkflowDefinition(WorkflowDefinitionConvert.INSTANCE.toDto(entity.getWorkflowDefinition()));
- return dto;
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceConvert.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceConvert.java
deleted file mode 100644
index 6ebec85f0..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceConvert.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.convert;
-
-import cn.sliew.scaleph.common.convert.BaseConvert;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstance;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskInstanceDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.ReportingPolicy;
-import org.mapstruct.factory.Mappers;
-import org.springframework.beans.BeanUtils;
-
-@Deprecated
-@Mapper(uses = {}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
-public interface WorkflowTaskInstanceConvert extends BaseConvert {
- WorkflowTaskInstanceConvert INSTANCE = Mappers.getMapper(WorkflowTaskInstanceConvert.class);
-
- @Override
- default WorkflowTaskInstance toDo(WorkflowTaskInstanceDTO dto) {
- WorkflowTaskInstance entity = new WorkflowTaskInstance();
- BeanUtils.copyProperties(dto, entity);
- return entity;
- }
-
- @Override
- default WorkflowTaskInstanceDTO toDto(WorkflowTaskInstance entity) {
- WorkflowTaskInstanceDTO dto = new WorkflowTaskInstanceDTO();
- BeanUtils.copyProperties(entity, dto);
- WorkflowInstanceDTO workflowInstanceDTO = new WorkflowInstanceDTO();
- workflowInstanceDTO.setId(entity.getWorkflowInstanceId());
- return dto;
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceVOConvert.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceVOConvert.java
deleted file mode 100644
index 54d189b67..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/convert/WorkflowTaskInstanceVOConvert.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.convert;
-
-import cn.sliew.scaleph.common.convert.BaseConvert;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstanceVO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskInstanceDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.ReportingPolicy;
-import org.mapstruct.factory.Mappers;
-import org.springframework.beans.BeanUtils;
-
-@Deprecated
-@Mapper(uses = {}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
-public interface WorkflowTaskInstanceVOConvert extends BaseConvert {
- WorkflowTaskInstanceVOConvert INSTANCE = Mappers.getMapper(WorkflowTaskInstanceVOConvert.class);
-
- @Override
- default WorkflowTaskInstanceVO toDo(WorkflowTaskInstanceDTO dto) {
- WorkflowTaskInstanceVO entity = new WorkflowTaskInstanceVO();
- BeanUtils.copyProperties(dto, entity);
- return entity;
- }
-
- @Override
- default WorkflowTaskInstanceDTO toDto(WorkflowTaskInstanceVO entity) {
- WorkflowTaskInstanceDTO dto = new WorkflowTaskInstanceDTO();
- BeanUtils.copyProperties(entity, dto);
- return dto;
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowInstanceDTO.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowInstanceDTO.java
deleted file mode 100644
index 358a507f7..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowInstanceDTO.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.dto;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.system.model.BaseDTO;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-
-@Data
-@EqualsAndHashCode
-public class WorkflowInstanceDTO extends BaseDTO {
-
- @Schema(description = "workflow definition")
- private WorkflowDefinitionDTO workflowDefinition;
-
- @Schema(description = "dag id")
- private Long dagId;
-
- @Schema(description = "task id")
- private String taskId;
-
- @Schema(description = "workflow instance state")
- private WorkflowInstanceState state;
-
- @Schema(description = "workflow instance start time")
- private Date startTime;
-
- @Schema(description = "workflow instance end time")
- private Date endTime;
-
- @Schema(description = "workflow instance message")
- private String message;
-
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowTaskInstanceDTO.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowTaskInstanceDTO.java
deleted file mode 100644
index 2f61e8596..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/dto/WorkflowTaskInstanceDTO.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.dto;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowTaskInstanceStage;
-import cn.sliew.scaleph.system.model.BaseDTO;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-
-@Data
-@EqualsAndHashCode
-public class WorkflowTaskInstanceDTO extends BaseDTO {
-
-
- @Schema(description = "step id")
- private Long stepId;
-
-
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowInstanceServiceImpl.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowInstanceServiceImpl.java
deleted file mode 100644
index 83cd41afb..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowInstanceServiceImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.impl;
-
-import cn.sliew.milky.common.exception.ThrowableTraceFormater;
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstance;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowInstanceVO;
-import cn.sliew.scaleph.dao.mapper.master.workflow.WorkflowInstanceMapper;
-import cn.sliew.scaleph.workflow.manager.WorkflowInstanceManager;
-import cn.sliew.scaleph.workflow.service.WorkflowInstanceService;
-import cn.sliew.scaleph.workflow.service.convert.WorkflowInstanceVOConvert;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
-import cn.sliew.scaleph.workflow.service.param.WorkflowInstanceListParam;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.List;
-
-import static cn.sliew.milky.common.check.Ensures.checkState;
-
-@Service
-public class WorkflowInstanceServiceImpl implements WorkflowInstanceService {
-
- @Autowired
- private WorkflowInstanceMapper workflowInstanceMapper;
- @Autowired
- private WorkflowInstanceManager workflowInstanceManager;
-
- @Override
- public Page list(WorkflowInstanceListParam param) {
- Page page = new Page<>(param.getCurrent(), param.getPageSize());
- Page workflowInstancePage = workflowInstanceMapper.list(page, param.getWorkflowDefinitionId(), param.getState());
- Page result = new Page<>(workflowInstancePage.getCurrent(), workflowInstancePage.getSize(), workflowInstancePage.getTotal());
- List workflowDefinitionDTOS = WorkflowInstanceVOConvert.INSTANCE.toDto(workflowInstancePage.getRecords());
- result.setRecords(workflowDefinitionDTOS);
- return result;
- }
-
- @Override
- public WorkflowInstanceDTO get(Long id) {
- WorkflowInstanceVO vo = workflowInstanceMapper.get(id);
- checkState(vo != null, () -> "workflow instance not exists for id: " + id);
- return WorkflowInstanceVOConvert.INSTANCE.toDto(vo);
- }
-
- @Override
- public void updateState(Long id, WorkflowInstanceState state, WorkflowInstanceState nextState, String message) {
- LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(WorkflowInstance.class)
- .eq(WorkflowInstance::getId, id)
- .eq(WorkflowInstance::getState, state);
- WorkflowInstance record = new WorkflowInstance();
- record.setState(nextState);
- record.setMessage(message);
- workflowInstanceMapper.update(record, updateWrapper);
- }
-
- @Override
- public void updateSuccess(Long id) {
- WorkflowInstance record = new WorkflowInstance();
- record.setId(id);
- record.setState(WorkflowInstanceState.SUCCESS);
- record.setEndTime(new Date());
- workflowInstanceMapper.updateById(record);
- }
-
- @Override
- public void updateFailure(Long id, Throwable throwable) {
- WorkflowInstance record = new WorkflowInstance();
- record.setId(id);
- record.setState(WorkflowInstanceState.FAILURE);
- record.setEndTime(new Date());
- if (throwable != null) {
- String throwableMessage = ThrowableTraceFormater.readStackTrace(throwable);
- record.setMessage(throwableMessage.length() > 255 ? throwableMessage.substring(0, 255) : throwableMessage);
- }
- workflowInstanceMapper.updateById(record);
- }
-
- @Override
- public void updateTaskId(Long id, String taskId) {
- WorkflowInstance record = new WorkflowInstance();
- record.setId(id);
- record.setTaskId(taskId);
- workflowInstanceMapper.updateById(record);
- }
-
- @Override
- public void deploy(WorkflowDefinitionDTO workflowDefinitionDTO) {
- WorkflowInstance record = new WorkflowInstance();
- record.setDagId(workflowDefinitionDTO.getDag().getId());
- record.setWorkflowDefinitionId(workflowDefinitionDTO.getId());
- record.setState(WorkflowInstanceState.PENDING);
- workflowInstanceMapper.insert(record);
- workflowInstanceManager.deploy(record.getId());
- }
-
- @Override
- public void shutdown(Long id) {
- workflowInstanceManager.shutdown(id);
- }
-
- @Override
- public void suspend(Long id) {
- workflowInstanceManager.suspend(id);
- }
-
- @Override
- public void resume(Long id) {
- workflowInstanceManager.resume(id);
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowTaskInstanceServiceImpl.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowTaskInstanceServiceImpl.java
deleted file mode 100644
index cb03aac6e..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/impl/WorkflowTaskInstanceServiceImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.impl;
-
-import cn.sliew.milky.common.exception.ThrowableTraceFormater;
-import cn.sliew.scaleph.common.dict.workflow.WorkflowTaskInstanceStage;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstance;
-import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowTaskInstanceVO;
-import cn.sliew.scaleph.dao.mapper.master.workflow.WorkflowTaskInstanceMapper;
-import cn.sliew.scaleph.workflow.manager.WorkflowTaskInstanceManager;
-import cn.sliew.scaleph.workflow.service.WorkflowTaskInstanceService;
-import cn.sliew.scaleph.workflow.service.convert.WorkflowTaskInstanceConvert;
-import cn.sliew.scaleph.workflow.service.convert.WorkflowTaskInstanceVOConvert;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskDefinitionDTO;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowTaskInstanceDTO;
-import cn.sliew.scaleph.workflow.service.param.WorkflowTaskInstanceListParam;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.google.common.graph.EndpointPair;
-import com.google.common.graph.Graph;
-import com.google.common.graph.GraphBuilder;
-import com.google.common.graph.MutableGraph;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static cn.sliew.milky.common.check.Ensures.checkState;
-
-@Service
-public class WorkflowTaskInstanceServiceImpl implements WorkflowTaskInstanceService {
-
- @Autowired
- private WorkflowTaskInstanceMapper workflowTaskInstanceMapper;
- @Autowired
- private WorkflowTaskInstanceManager workflowTaskInstanceManager;
-
- @Override
- public Page list(WorkflowTaskInstanceListParam param) {
- Page page = new Page<>(param.getCurrent(), param.getPageSize());
- Page taskInstanceVOPage = workflowTaskInstanceMapper.list(page, param.getWorkflowTaskDefinitionId());
- Page result = new Page<>(taskInstanceVOPage.getCurrent(), taskInstanceVOPage.getSize(), taskInstanceVOPage.getTotal());
- List workflowTaskInstanceDTOS = WorkflowTaskInstanceVOConvert.INSTANCE.toDto(taskInstanceVOPage.getRecords());
- result.setRecords(workflowTaskInstanceDTOS);
- return result;
- }
-
- @Override
- public List list(Long workflowInstanceId) {
- LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(WorkflowTaskInstance.class)
- .eq(WorkflowTaskInstance::getWorkflowInstanceId, workflowInstanceId);
- List workflowTaskInstances = workflowTaskInstanceMapper.selectList(queryWrapper);
- return WorkflowTaskInstanceConvert.INSTANCE.toDto(workflowTaskInstances);
- }
-
- @Override
- public Graph getDag(Long workflowInstanceId, Graph dag) {
- List workflowTaskInstanceDTOS = list(workflowInstanceId);
- MutableGraph graph = GraphBuilder.directed().build();
- Map stepMap = new HashMap<>();
- for (WorkflowTaskInstanceDTO workflowTaskInstanceDTO : workflowTaskInstanceDTOS) {
- stepMap.put(workflowTaskInstanceDTO.getStepId(), workflowTaskInstanceDTO);
- graph.addNode(workflowTaskInstanceDTO);
- }
- for (EndpointPair edge : dag.edges()) {
- WorkflowTaskDefinitionDTO source = edge.source();
- WorkflowTaskDefinitionDTO target = edge.target();
- graph.putEdge(stepMap.get(source.getId()), stepMap.get(target.getId()));
- }
- return graph;
- }
-
- @Override
- public WorkflowTaskInstanceDTO get(Long id) {
- WorkflowTaskInstanceVO vo = workflowTaskInstanceMapper.get(id);
- checkState(vo != null, () -> "workflow task instance not exists for id: " + id);
- return WorkflowTaskInstanceVOConvert.INSTANCE.toDto(vo);
- }
-
- @Override
- public void updateState(Long id, WorkflowTaskInstanceStage stage, WorkflowTaskInstanceStage nextStage, String message) {
- LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(WorkflowTaskInstance.class)
- .eq(WorkflowTaskInstance::getId, id)
- .eq(WorkflowTaskInstance::getStage, stage);
- WorkflowTaskInstance record = new WorkflowTaskInstance();
- record.setStage(nextStage);
- record.setMessage(message);
- workflowTaskInstanceMapper.update(record, updateWrapper);
- }
-
- @Override
- public void updateSuccess(Long id) {
- WorkflowTaskInstance record = new WorkflowTaskInstance();
- record.setId(id);
- record.setStage(WorkflowTaskInstanceStage.SUCCESS);
- record.setEndTime(new Date());
- workflowTaskInstanceMapper.updateById(record);
- }
-
- @Override
- public void updateFailure(Long id, Throwable throwable) {
- WorkflowTaskInstance record = new WorkflowTaskInstance();
- record.setId(id);
- record.setStage(WorkflowTaskInstanceStage.FAILURE);
- record.setEndTime(new Date());
- if (throwable != null) {
- String throwableMessage = ThrowableTraceFormater.readStackTrace(throwable);
- record.setMessage(throwableMessage.length() > 255 ? throwableMessage.substring(0, 255) : throwableMessage);
- }
- workflowTaskInstanceMapper.updateById(record);
- }
-
- @Override
- public void updateTaskId(Long id, String taskId) {
- WorkflowTaskInstance record = new WorkflowTaskInstance();
- record.setId(id);
- record.setTaskId(taskId);
- workflowTaskInstanceMapper.updateById(record);
- }
-
- @Override
- public Graph initialize(Long workflowInstanceId, Graph graph) {
- try {
- for (WorkflowTaskDefinitionDTO node : graph.nodes()) {
- createWorkflowTaskInstance(workflowInstanceId, node);
- }
- return getDag(workflowInstanceId, graph);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private WorkflowTaskInstanceDTO createWorkflowTaskInstance(Long workflowInstanceId, WorkflowTaskDefinitionDTO node) {
- WorkflowTaskInstance record = new WorkflowTaskInstance();
- record.setWorkflowInstanceId(workflowInstanceId);
- record.setStepId(node.getId());
- record.setStage(WorkflowTaskInstanceStage.PENDING);
- workflowTaskInstanceMapper.insert(record);
- return get(record.getId());
- }
-
- @Override
- public void deploy(Long id) {
- workflowTaskInstanceManager.deploy(id);
- }
-
- @Override
- public void shutdown(Long id) {
- workflowTaskInstanceManager.shutdown(id);
- }
-
- @Override
- public void suspend(Long id) {
- workflowTaskInstanceManager.suspend(id);
- }
-
- @Override
- public void resume(Long id) {
- workflowTaskInstanceManager.resume(id);
- }
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowInstanceListParam.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowInstanceListParam.java
deleted file mode 100644
index 9ea311a14..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowInstanceListParam.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.param;
-
-import cn.sliew.scaleph.common.dict.workflow.WorkflowInstanceState;
-import cn.sliew.scaleph.system.model.PaginationParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import javax.validation.constraints.NotNull;
-
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class WorkflowInstanceListParam extends PaginationParam {
-
- @NotNull
- @Schema(description = "workflow definition id")
- private Long workflowDefinitionId;
-
- @Schema(description = "workflow instance state")
- private WorkflowInstanceState state;
-}
diff --git a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowTaskInstanceListParam.java b/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowTaskInstanceListParam.java
deleted file mode 100644
index 025facaa7..000000000
--- a/scaleph-workflow/scaleph-workflow-api/src/main/java/cn/sliew/scaleph/workflow/service/param/WorkflowTaskInstanceListParam.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cn.sliew.scaleph.workflow.service.param;
-
-import cn.sliew.scaleph.system.model.PaginationParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import javax.validation.constraints.NotNull;
-
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class WorkflowTaskInstanceListParam extends PaginationParam {
-
- @NotNull
- @Schema(description = "workflow task definition id")
- private Long workflowTaskDefinitionId;
-
-}
diff --git a/scaleph-workflow/scaleph-workflow-quartz/src/main/java/cn/sliew/scaleph/workflow/scheduler/quartz/QuartzJobHandler.java b/scaleph-workflow/scaleph-workflow-quartz/src/main/java/cn/sliew/scaleph/workflow/scheduler/quartz/QuartzJobHandler.java
index d599b192a..ac81214c6 100644
--- a/scaleph-workflow/scaleph-workflow-quartz/src/main/java/cn/sliew/scaleph/workflow/scheduler/quartz/QuartzJobHandler.java
+++ b/scaleph-workflow/scaleph-workflow-quartz/src/main/java/cn/sliew/scaleph/workflow/scheduler/quartz/QuartzJobHandler.java
@@ -20,9 +20,7 @@
import cn.sliew.milky.common.util.JacksonUtil;
import cn.sliew.scaleph.dao.entity.master.workflow.WorkflowSchedule;
-import cn.sliew.scaleph.workflow.service.WorkflowDefinitionService;
-import cn.sliew.scaleph.workflow.service.WorkflowInstanceService;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
+import cn.sliew.scaleph.workflow.manager.WorkflowInstanceManager;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
@@ -34,9 +32,7 @@
public class QuartzJobHandler extends QuartzJobBean {
@Autowired
- private WorkflowDefinitionService workflowDefinitionService;
- @Autowired
- private WorkflowInstanceService workflowInstanceService;
+ private WorkflowInstanceManager workflowInstanceManager;
/**
* 路由分发任务
@@ -49,7 +45,6 @@ protected void executeInternal(JobExecutionContext context) throws JobExecutionE
JobDataMap dataMap = context.getMergedJobDataMap();
String json = dataMap.getString(QuartzUtil.WORKFLOW_SCHEDULE);
WorkflowSchedule workflowSchedule = JacksonUtil.parseJsonString(json, WorkflowSchedule.class);
- WorkflowDefinitionDTO workflowDefinitionDTO = workflowDefinitionService.get(workflowSchedule.getWorkflowDefinitionId());
- workflowInstanceService.deploy(workflowDefinitionDTO);
+ workflowInstanceManager.deploy(workflowSchedule.getWorkflowDefinitionId());
}
}
diff --git a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/listener/workflowinstance/WorkflowInstanceDeployEventListener.java b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/listener/workflowinstance/WorkflowInstanceDeployEventListener.java
index c074dc1c6..f9ce2dff0 100644
--- a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/listener/workflowinstance/WorkflowInstanceDeployEventListener.java
+++ b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/listener/workflowinstance/WorkflowInstanceDeployEventListener.java
@@ -21,14 +21,12 @@
import cn.sliew.scaleph.dag.service.DagConfigComplexService;
import cn.sliew.scaleph.dag.service.DagInstanceComplexService;
import cn.sliew.scaleph.dag.service.DagInstanceService;
-import cn.sliew.scaleph.dag.service.DagStepService;
import cn.sliew.scaleph.dag.service.dto.DagConfigStepDTO;
import cn.sliew.scaleph.dag.service.dto.DagInstanceDTO;
import cn.sliew.scaleph.dag.service.dto.DagStepDTO;
import cn.sliew.scaleph.queue.MessageListener;
-import cn.sliew.scaleph.workflow.service.WorkflowDefinitionService;
+import cn.sliew.scaleph.workflow.manager.WorkflowTaskInstanceManager;
import cn.sliew.scaleph.workflow.simple.statemachine.WorkflowInstanceStateMachine;
-import cn.sliew.scaleph.workflow.simple.statemachine.WorkflowTaskInstanceStateMachine;
import com.google.common.graph.Graph;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.annotation.RInject;
@@ -73,7 +71,7 @@ public static class DeployRunner implements Runnable, Serializable {
@Autowired
private WorkflowInstanceStateMachine stateMachine;
@Autowired
- private WorkflowTaskInstanceStateMachine taskInstanceStateMachine;
+ private WorkflowTaskInstanceManager workflowTaskInstanceManager;
public DeployRunner(WorkflowInstanceEventDTO event) {
this.event = event;
@@ -102,7 +100,7 @@ public void run() {
for (DagStepDTO dagStep : nodes) {
// root 节点
if (dagStepGraph.inDegree(dagStep) == 0) {
- taskInstanceStateMachine.deploy(dagStep);
+ workflowTaskInstanceManager.deploy(dagStep.getId());
}
}
}
diff --git a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/manager/SimpleWorkflowInstanceManager.java b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/manager/SimpleWorkflowInstanceManager.java
index f7539f256..7304f84e0 100644
--- a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/manager/SimpleWorkflowInstanceManager.java
+++ b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/manager/SimpleWorkflowInstanceManager.java
@@ -18,9 +18,11 @@
package cn.sliew.scaleph.workflow.simple.manager;
-import cn.sliew.scaleph.dag.service.DagInstanceService;
+import cn.sliew.scaleph.dag.service.DagInstanceComplexService;
import cn.sliew.scaleph.dag.service.dto.DagInstanceDTO;
import cn.sliew.scaleph.workflow.manager.WorkflowInstanceManager;
+import cn.sliew.scaleph.workflow.service.WorkflowDefinitionService;
+import cn.sliew.scaleph.workflow.service.dto.WorkflowDefinitionDTO;
import cn.sliew.scaleph.workflow.simple.statemachine.WorkflowInstanceStateMachine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -29,13 +31,18 @@
public class SimpleWorkflowInstanceManager implements WorkflowInstanceManager {
@Autowired
- private DagInstanceService dagInstanceService;
+ private WorkflowDefinitionService workflowDefinitionService;
+ @Autowired
+ private DagInstanceComplexService dagInstanceComplexService;
@Autowired
private WorkflowInstanceStateMachine stateMachine;
@Override
- public void deploy(Long id) {
- stateMachine.deploy(get(id));
+ public void deploy(Long workflowDefinitionId) {
+ WorkflowDefinitionDTO workflowDefinitionDTO = workflowDefinitionService.get(workflowDefinitionId);
+ workflowDefinitionDTO.getDag().getId();
+ Long dagInstanceId = dagInstanceComplexService.initialize(workflowDefinitionDTO.getDag().getId());
+ stateMachine.deploy(get(dagInstanceId));
}
@Override
@@ -54,6 +61,6 @@ public void resume(Long id) {
}
private DagInstanceDTO get(Long id) {
- return dagInstanceService.selectOne(id);
+ return dagInstanceComplexService.selectSimpleOne(id);
}
}
diff --git a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/statemachine/WorkflowInstanceStateMachine.java b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/statemachine/WorkflowInstanceStateMachine.java
index 2622fd8d2..8d9e4eefa 100644
--- a/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/statemachine/WorkflowInstanceStateMachine.java
+++ b/scaleph-workflow/scaleph-workflow-simple/src/main/java/cn/sliew/scaleph/workflow/simple/statemachine/WorkflowInstanceStateMachine.java
@@ -26,7 +26,6 @@
import cn.sliew.scaleph.queue.Queue;
import cn.sliew.scaleph.queue.QueueFactory;
import cn.sliew.scaleph.queue.util.FuryUtil;
-import cn.sliew.scaleph.workflow.service.dto.WorkflowInstanceDTO;
import cn.sliew.scaleph.workflow.simple.listener.workflowinstance.*;
import com.alibaba.cola.statemachine.Action;
import com.alibaba.cola.statemachine.StateMachine;
diff --git a/tools/docker/mysql/init.d/scaleph-workflow-mysql.sql b/tools/docker/mysql/init.d/scaleph-workflow-mysql.sql
index f57122f42..a748a974e 100644
--- a/tools/docker/mysql/init.d/scaleph-workflow-mysql.sql
+++ b/tools/docker/mysql/init.d/scaleph-workflow-mysql.sql
@@ -63,47 +63,4 @@ INSERT INTO `workflow_definition` (`id`, `type`, `name`, `execute_type`, `status
VALUES (3, '0', 'DorisOperatorInstanceStatusSyncJob', '1', '0', NULL, NULL, 6, 'sys', 'sys');
INSERT INTO `workflow_definition` (`id`, `type`, `name`, `execute_type`, `status`, `param`, `remark`, `dag_id`,
`creator`, `editor`)
-VALUES (4, '0', 'FlinkJobStatusSyncJob2', '1', '0', NULL, NULL, 7, 'sys', 'sys');
-
-DROP TABLE IF EXISTS `workflow_instance`;
-CREATE TABLE `workflow_instance`
-(
- `id` BIGINT NOT NULL AUTO_INCREMENT,
- `parent_workflow_instance_id` BIGINT,
- `workflow_definition_id` BIGINT NOT NULL,
- `dag_id` BIGINT NOT NULL,
- `trigger` VARCHAR(255) COMMENT '触发原因',
- `task_id` VARCHAR(128),
- `state` VARCHAR(4) NOT NULL,
- `start_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `end_time` DATETIME,
- `outputs` TEXT,
- `message` TEXT,
- `creator` VARCHAR(32),
- `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `editor` VARCHAR(32),
- `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- KEY `idx_workflow_definition` (`workflow_definition_id`)
-) ENGINE = InnoDB COMMENT ='workflow instance';
-
-DROP TABLE IF EXISTS `workflow_task_instance`;
-CREATE TABLE `workflow_task_instance`
-(
- `id` BIGINT NOT NULL AUTO_INCREMENT,
- `workflow_instance_id` BIGINT NOT NULL,
- `step_id` BIGINT NOT NULL,
- `task_id` VARCHAR(128),
- `stage` VARCHAR(4) NOT NULL,
- `start_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `end_time` DATETIME,
- `outputs` TEXT,
- `message` TEXT,
- `creator` VARCHAR(32),
- `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `editor` VARCHAR(32),
- `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- KEY `idx_workflow_instance` (`workflow_instance_id`),
- KEY `idx_step` (`step_id`)
-) ENGINE = InnoDB COMMENT ='workflow task instance';
+VALUES (4, '0', 'FlinkJobStatusSyncJob2', '1', '0', NULL, NULL, 7, 'sys', 'sys');
\ No newline at end of file