|
9 | 9 | import com.codingapi.springboot.flow.error.ErrorResult; |
10 | 10 | import com.codingapi.springboot.flow.error.NodeResult; |
11 | 11 | import com.codingapi.springboot.flow.error.OperatorResult; |
| 12 | +import com.codingapi.springboot.flow.event.FlowApprovalEvent; |
12 | 13 | import com.codingapi.springboot.flow.record.FlowRecord; |
13 | 14 | import com.codingapi.springboot.flow.repository.FlowOperatorRepository; |
14 | 15 | import com.codingapi.springboot.flow.repository.FlowRecordRepository; |
15 | 16 | import com.codingapi.springboot.flow.user.IFlowOperator; |
| 17 | +import com.codingapi.springboot.framework.event.EventPusher; |
16 | 18 |
|
17 | 19 | import java.util.ArrayList; |
18 | 20 | import java.util.List; |
@@ -168,7 +170,37 @@ private FlowNode matcherNextNode(FlowNode flowNode, boolean back) { |
168 | 170 | * @return 流程记录 |
169 | 171 | */ |
170 | 172 | public List<FlowRecord> createRecord() { |
| 173 | + // 创建下一节点的流程记录 |
| 174 | + List<FlowRecord> records = this.createNextRecord(); |
171 | 175 |
|
| 176 | + // 检测流程是否为抄送节点 |
| 177 | + while (this.nextNodeIsCirculate()){ |
| 178 | + for (FlowRecord record : records) { |
| 179 | + record.circulate(); |
| 180 | + } |
| 181 | + flowRecordRepository.save(records); |
| 182 | + |
| 183 | + for (FlowRecord record : records) { |
| 184 | + IFlowOperator pushOperator = record.getCurrentOperator(); |
| 185 | + |
| 186 | + EventPusher.push(new FlowApprovalEvent(FlowApprovalEvent.STATE_CIRCULATE, |
| 187 | + record, |
| 188 | + pushOperator, |
| 189 | + flowWork, |
| 190 | + snapshot.toBindData()), |
| 191 | + true); |
| 192 | + } |
| 193 | + |
| 194 | + this.skipCirculate(); |
| 195 | + |
| 196 | + records = this.createNextRecord(); |
| 197 | + } |
| 198 | + return records; |
| 199 | + } |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + private List<FlowRecord> createNextRecord(){ |
172 | 204 | FlowSession flowSession = new FlowSession(flowWork, |
173 | 205 | nextNode, |
174 | 206 | createOperator, |
|
0 commit comments