11package com .codingapi .springboot .flow .service .impl ;
22
3+ import com .codingapi .springboot .flow .bind .BindDataSnapshot ;
4+ import com .codingapi .springboot .flow .bind .IBindData ;
35import com .codingapi .springboot .flow .domain .FlowNode ;
6+ import com .codingapi .springboot .flow .domain .FlowWork ;
7+ import com .codingapi .springboot .flow .event .FlowApprovalEvent ;
48import com .codingapi .springboot .flow .record .FlowRecord ;
9+ import com .codingapi .springboot .flow .repository .FlowBindDataRepository ;
510import com .codingapi .springboot .flow .repository .FlowProcessRepository ;
611import com .codingapi .springboot .flow .repository .FlowRecordRepository ;
712import com .codingapi .springboot .flow .repository .FlowWorkRepository ;
813import com .codingapi .springboot .flow .service .FlowRecordVerifyService ;
914import com .codingapi .springboot .flow .user .IFlowOperator ;
15+ import com .codingapi .springboot .framework .event .EventPusher ;
1016import lombok .AllArgsConstructor ;
1117import org .springframework .transaction .annotation .Transactional ;
1218
@@ -17,6 +23,7 @@ public class FlowRemoveService {
1723 private final FlowWorkRepository flowWorkRepository ;
1824 private final FlowRecordRepository flowRecordRepository ;
1925 private final FlowProcessRepository flowProcessRepository ;
26+ private final FlowBindDataRepository flowBindDataRepository ;
2027
2128 /**
2229 * 删除流程
@@ -37,15 +44,19 @@ public void remove(long recordId, IFlowOperator currentOperator) {
3744 flowRecordVerifyService .loadFlowNode ();
3845 flowRecordVerifyService .verifyFlowRecordNotFinish ();
3946 flowRecordVerifyService .verifyFlowRecordIsTodo ();
47+ FlowWork flowWork = flowRecordVerifyService .getFlowWork ();
4048 FlowNode flowNode = flowRecordVerifyService .getFlowNode ();
4149 FlowRecord flowRecord = flowRecordVerifyService .getFlowRecord ();
4250
4351 if (!flowNode .isStartNode ()){
4452 throw new IllegalArgumentException ("flow record not remove" );
4553 }
54+ BindDataSnapshot bindDataSnapshot = flowBindDataRepository .getBindDataSnapshotById (flowRecord .getSnapshotId ());
55+ IBindData bindData = bindDataSnapshot .toBindData ();
4656
4757 flowProcessRepository .deleteByProcessId (flowRecord .getProcessId ());
48-
4958 flowRecordRepository .deleteByProcessId (flowRecord .getProcessId ());
59+
60+ EventPusher .push (new FlowApprovalEvent (FlowApprovalEvent .STATE_DELETE , flowRecord , currentOperator , flowWork , bindData ), true );
5061 }
5162}
0 commit comments