Skip to content

Commit a5ac8b3

Browse files
committed
fix #121
1 parent 35d2efc commit a5ac8b3

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/event/FlowApprovalEvent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public class FlowApprovalEvent implements ISyncEvent {
3636
public static final int STATE_CIRCULATE = 9;
3737
// 保存
3838
public static final int STATE_SAVE = 10;
39-
39+
// 删除
40+
public static final int STATE_DELETE = 11;
4041

4142
private final int state;
4243
private final IFlowOperator operator;

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/FlowService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public FlowService(FlowWorkRepository flowWorkRepository,
4141
this.flowServiceRepositoryHolder = new FlowServiceRepositoryHolder(flowWorkRepository, flowRecordRepository, flowBindDataRepository, flowOperatorRepository, flowProcessRepository, flowBackupRepository);
4242
this.flowDetailService = new FlowDetailService(flowWorkRepository, flowRecordRepository, flowBindDataRepository, flowOperatorRepository, flowProcessRepository);
4343
this.flowCustomEventService = new FlowCustomEventService(flowWorkRepository, flowRecordRepository, flowProcessRepository);
44-
this.flowRecallService = new FlowRecallService(flowWorkRepository, flowRecordRepository, flowProcessRepository);
45-
this.flowRemoveService = new FlowRemoveService(flowWorkRepository, flowRecordRepository, flowProcessRepository);
44+
this.flowRecallService = new FlowRecallService(flowWorkRepository, flowRecordRepository, flowProcessRepository,flowBindDataRepository);
45+
this.flowRemoveService = new FlowRemoveService(flowWorkRepository, flowRecordRepository, flowProcessRepository,flowBindDataRepository);
4646
this.flowSaveService = new FlowSaveService(flowWorkRepository, flowRecordRepository, flowBindDataRepository, flowProcessRepository);
4747
this.flowTransferService = new FlowTransferService(flowWorkRepository, flowRecordRepository, flowBindDataRepository, flowProcessRepository);
4848
this.flowPostponedService = new FlowPostponedService(flowWorkRepository, flowRecordRepository, flowProcessRepository);

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowRecallService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.codingapi.springboot.flow.service.impl;
22

3+
import com.codingapi.springboot.flow.bind.BindDataSnapshot;
4+
import com.codingapi.springboot.flow.bind.IBindData;
35
import com.codingapi.springboot.flow.domain.FlowWork;
46
import com.codingapi.springboot.flow.event.FlowApprovalEvent;
57
import com.codingapi.springboot.flow.record.FlowRecord;
@@ -19,6 +21,7 @@ public class FlowRecallService {
1921
private final FlowWorkRepository flowWorkRepository;
2022
private final FlowRecordRepository flowRecordRepository;
2123
private final FlowProcessRepository flowProcessRepository;
24+
private final FlowBindDataRepository flowBindDataRepository;
2225

2326
/**
2427
* 撤回流程
@@ -44,6 +47,9 @@ public void recall(long recordId, IFlowOperator currentOperator) {
4447

4548
// 下一流程的流程记录
4649
List<FlowRecord> childrenRecords = flowRecordRepository.findFlowRecordByPreId(recordId);
50+
51+
BindDataSnapshot bindDataSnapshot = flowBindDataRepository.getBindDataSnapshotById(flowRecord.getSnapshotId());
52+
4753
// 下一流程均为办理且未读
4854

4955
// 如果是在开始节点撤销,则直接删除
@@ -67,7 +73,8 @@ public void recall(long recordId, IFlowOperator currentOperator) {
6773

6874
flowRecordRepository.delete(childrenRecords);
6975
}
76+
IBindData bindData = bindDataSnapshot.toBindData();
7077

71-
EventPusher.push(new FlowApprovalEvent(FlowApprovalEvent.STATE_RECALL, flowRecord, currentOperator, flowWork, null), true);
78+
EventPusher.push(new FlowApprovalEvent(FlowApprovalEvent.STATE_RECALL, flowRecord, currentOperator, flowWork, bindData), true);
7279
}
7380
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowRemoveService.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
package com.codingapi.springboot.flow.service.impl;
22

3+
import com.codingapi.springboot.flow.bind.BindDataSnapshot;
4+
import com.codingapi.springboot.flow.bind.IBindData;
35
import com.codingapi.springboot.flow.domain.FlowNode;
6+
import com.codingapi.springboot.flow.domain.FlowWork;
7+
import com.codingapi.springboot.flow.event.FlowApprovalEvent;
48
import com.codingapi.springboot.flow.record.FlowRecord;
9+
import com.codingapi.springboot.flow.repository.FlowBindDataRepository;
510
import com.codingapi.springboot.flow.repository.FlowProcessRepository;
611
import com.codingapi.springboot.flow.repository.FlowRecordRepository;
712
import com.codingapi.springboot.flow.repository.FlowWorkRepository;
813
import com.codingapi.springboot.flow.service.FlowRecordVerifyService;
914
import com.codingapi.springboot.flow.user.IFlowOperator;
15+
import com.codingapi.springboot.framework.event.EventPusher;
1016
import lombok.AllArgsConstructor;
1117
import 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

Comments
 (0)