Skip to content

Commit a047a7a

Browse files
committed
feat(flow): 扩展流程实例响应信息
- 新增 FlowInstanceResponse 类用于封装流程实例详情 - 修改 findFlowInstanceList 方法返回扩展信息- 在流程实例列表中增加流程名称和流程键字段 - 添加 findByFlowDeployId 方法查询部署信息- 更新接口资源类导入包路径引用- 调整分页数据转换逻辑以包含附加属性
1 parent e3789f1 commit a047a7a

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

src/main/java/tech/wetech/flexmodel/application/FlowApplicationService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import tech.wetech.flexmodel.domain.model.flow.shared.common.FlowDeploymentStatus;
1919
import tech.wetech.flexmodel.query.Expressions;
2020
import tech.wetech.flexmodel.query.Predicate;
21+
import tech.wetech.flexmodel.shared.utils.JsonUtils;
2122
import tech.wetech.flexmodel.shared.utils.StringUtils;
2223

2324
import java.util.ArrayList;
@@ -91,7 +92,7 @@ public PageDTO<FlowModuleResponse> findFlowModuleList(FlowModuleListRequest requ
9192
/**
9293
* 获取流程实例列表
9394
*/
94-
public PageDTO<FlowInstance> findFlowInstanceList(FlowInstanceListRequest request) {
95+
public PageDTO<FlowInstanceResponse> findFlowInstanceList(FlowInstanceListRequest request) {
9596
log.info("获取流程实例列表,参数: {}", request);
9697
Predicate predicate = Expressions.TRUE;
9798
if (StringUtils.isNotBlank(request.getFlowInstanceId())) {
@@ -110,7 +111,14 @@ public PageDTO<FlowInstance> findFlowInstanceList(FlowInstanceListRequest reques
110111
if (count == 0) {
111112
return PageDTO.empty();
112113
}
113-
List<FlowInstance> list = flowInstanceService.find(predicate, request.getPage(), request.getSize());
114+
List<FlowInstanceResponse> list = flowInstanceService.find(predicate, request.getPage(), request.getSize()).stream()
115+
.map(entity -> {
116+
FlowInstanceResponse response = JsonUtils.getInstance().convertValue(entity, FlowInstanceResponse.class);
117+
FlowDeployment flowDeployment = flowDeploymentService.findByFlowDeployId(entity.getFlowDeployId());
118+
response.setFlowName(flowDeployment.getFlowName());
119+
response.setFlowKey(flowDeployment.getFlowKey());
120+
return response;
121+
}).toList();
114122
return new PageDTO<>(list, count);
115123
}
116124

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package tech.wetech.flexmodel.application.dto;
2+
3+
import lombok.Getter;
4+
import lombok.Setter;
5+
import tech.wetech.flexmodel.codegen.entity.FlowInstance;
6+
7+
/**
8+
* @author cjbi
9+
*/
10+
@Getter
11+
@Setter
12+
public class FlowInstanceResponse extends FlowInstance {
13+
private String flowName;
14+
private String flowKey;
15+
16+
}

src/main/java/tech/wetech/flexmodel/domain/model/flow/service/FlowDeploymentService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ public FlowDeployment findRecentByFlowModuleId(String flowKey) {
2323
return flowDeploymentRepository.findRecentByFlowModuleId(flowKey);
2424
}
2525

26+
public FlowDeployment findByFlowDeployId(String flowDeployId) {
27+
return flowDeploymentRepository.findByDeployId(flowDeployId);
28+
}
2629
}

src/main/java/tech/wetech/flexmodel/interfaces/rest/FlowResource.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
1717
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
1818
import tech.wetech.flexmodel.application.FlowApplicationService;
19-
import tech.wetech.flexmodel.application.dto.FlowInstanceListRequest;
20-
import tech.wetech.flexmodel.application.dto.FlowModuleListRequest;
21-
import tech.wetech.flexmodel.application.dto.FlowModuleResponse;
22-
import tech.wetech.flexmodel.application.dto.PageDTO;
19+
import tech.wetech.flexmodel.application.dto.*;
2320
import tech.wetech.flexmodel.codegen.entity.FlowInstance;
2421
import tech.wetech.flexmodel.domain.model.flow.dto.bo.ElementInstance;
2522
import tech.wetech.flexmodel.domain.model.flow.dto.bo.NodeInstance;
@@ -127,7 +124,7 @@ public PageDTO<FlowModuleResponse> findFlowList(
127124
)})
128125
@GET
129126
@Path("/instances")
130-
public PageDTO<FlowInstance> findFlowInstanceList(
127+
public PageDTO<FlowInstanceResponse> findFlowInstanceList(
131128
@Parameter(name = "flowInstanceId", description = "流程实例ID", in = ParameterIn.QUERY)
132129
@QueryParam("flowInstanceId") String flowInstanceId,
133130
@Parameter(name = "flowModuleId", description = "流程模块ID", in = ParameterIn.QUERY)

0 commit comments

Comments
 (0)