1
1
package com .codingapi .springboot .flow .service .impl ;
2
2
3
+ import com .codingapi .springboot .flow .bind .BindDataSnapshot ;
4
+ import com .codingapi .springboot .flow .bind .IBindData ;
3
5
import com .codingapi .springboot .flow .domain .FlowNode ;
6
+ import com .codingapi .springboot .flow .domain .FlowWork ;
7
+ import com .codingapi .springboot .flow .event .FlowApprovalEvent ;
4
8
import com .codingapi .springboot .flow .record .FlowRecord ;
9
+ import com .codingapi .springboot .flow .repository .FlowBindDataRepository ;
5
10
import com .codingapi .springboot .flow .repository .FlowProcessRepository ;
6
11
import com .codingapi .springboot .flow .repository .FlowRecordRepository ;
7
12
import com .codingapi .springboot .flow .repository .FlowWorkRepository ;
8
13
import com .codingapi .springboot .flow .service .FlowRecordVerifyService ;
9
14
import com .codingapi .springboot .flow .user .IFlowOperator ;
15
+ import com .codingapi .springboot .framework .event .EventPusher ;
10
16
import lombok .AllArgsConstructor ;
11
17
import org .springframework .transaction .annotation .Transactional ;
12
18
@@ -17,6 +23,7 @@ public class FlowRemoveService {
17
23
private final FlowWorkRepository flowWorkRepository ;
18
24
private final FlowRecordRepository flowRecordRepository ;
19
25
private final FlowProcessRepository flowProcessRepository ;
26
+ private final FlowBindDataRepository flowBindDataRepository ;
20
27
21
28
/**
22
29
* 删除流程
@@ -37,15 +44,19 @@ public void remove(long recordId, IFlowOperator currentOperator) {
37
44
flowRecordVerifyService .loadFlowNode ();
38
45
flowRecordVerifyService .verifyFlowRecordNotFinish ();
39
46
flowRecordVerifyService .verifyFlowRecordIsTodo ();
47
+ FlowWork flowWork = flowRecordVerifyService .getFlowWork ();
40
48
FlowNode flowNode = flowRecordVerifyService .getFlowNode ();
41
49
FlowRecord flowRecord = flowRecordVerifyService .getFlowRecord ();
42
50
43
51
if (!flowNode .isStartNode ()){
44
52
throw new IllegalArgumentException ("flow record not remove" );
45
53
}
54
+ BindDataSnapshot bindDataSnapshot = flowBindDataRepository .getBindDataSnapshotById (flowRecord .getSnapshotId ());
55
+ IBindData bindData = bindDataSnapshot .toBindData ();
46
56
47
57
flowProcessRepository .deleteByProcessId (flowRecord .getProcessId ());
48
-
49
58
flowRecordRepository .deleteByProcessId (flowRecord .getProcessId ());
59
+
60
+ EventPusher .push (new FlowApprovalEvent (FlowApprovalEvent .STATE_DELETE , flowRecord , currentOperator , flowWork , bindData ), true );
50
61
}
51
62
}
0 commit comments