Skip to content

Commit 02eee10

Browse files
committed
add buttons
1 parent 0a5fd5b commit 02eee10

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

example/example-infra-flow/src/main/java/com/codingapi/example/convert/FlowNodeConvertor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.codingapi.example.convert;
22

3+
import com.alibaba.fastjson.JSON;
34
import com.codingapi.example.entity.FlowNodeEntity;
45
import com.codingapi.springboot.flow.domain.FlowNode;
56
import com.codingapi.springboot.flow.em.ApprovalType;
@@ -30,6 +31,10 @@ public static FlowNodeEntity convert(FlowNode flowNode, long workId){
3031
entity.setOperatorMatcher(flowNode.getOperatorMatcher().getScript());
3132
entity.setUpdateTime(flowNode.getUpdateTime());
3233
entity.setWorkId(workId);
34+
if(flowNode.getButtons()!=null) {
35+
String json = JSON.toJSONString(flowNode.getButtons());
36+
entity.setButtons(json);
37+
}
3338
return entity;
3439
}
3540

@@ -50,7 +55,8 @@ public static FlowNode convert(FlowNodeEntity entity){
5055
entity.getCreateTime(),
5156
entity.getUpdateTime(),
5257
entity.getTimeout(),
53-
StringUtils.hasLength(entity.getErrTrigger())?new ErrTrigger(entity.getErrTrigger()):null);
58+
StringUtils.hasLength(entity.getErrTrigger())?new ErrTrigger(entity.getErrTrigger()):null,
59+
entity.toFlowButtons());
5460
}
5561

5662
}

example/example-infra-flow/src/main/java/com/codingapi/example/entity/FlowNodeEntity.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package com.codingapi.example.entity;
22

3+
import com.alibaba.fastjson.JSON;
4+
import com.codingapi.springboot.flow.domain.FlowButton;
35
import jakarta.persistence.Entity;
46
import jakarta.persistence.Id;
57
import jakarta.persistence.Lob;
68
import lombok.Getter;
79
import lombok.Setter;
10+
import org.springframework.util.StringUtils;
11+
12+
import java.util.List;
813

914
@Setter
1015
@Getter
@@ -81,4 +86,19 @@ public class FlowNodeEntity {
8186
*/
8287
@Lob
8388
private String errTrigger;
89+
90+
91+
/**
92+
* 自定义按钮
93+
*/
94+
@Lob
95+
private String buttons;
96+
97+
98+
public List<FlowButton> toFlowButtons(){
99+
if(StringUtils.hasText(buttons)) {
100+
return JSON.parseArray(buttons, FlowButton.class);
101+
}
102+
return null;
103+
}
84104
}

0 commit comments

Comments
 (0)