Skip to content

Commit ef27002

Browse files
committed
update 2.9.25
1 parent 7d0b79e commit ef27002

File tree

15 files changed

+171
-8
lines changed

15 files changed

+171
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<groupId>com.codingapi.springboot</groupId>
1717
<artifactId>springboot-parent</artifactId>
18-
<version>2.9.24</version>
18+
<version>2.9.25</version>
1919

2020
<url>https://github.com/codingapi/springboot-framewrok</url>
2121
<name>springboot-parent</name>

springboot-starter-data-authorization/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.9.24</version>
9+
<version>2.9.25</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-data-authorization</artifactId>

springboot-starter-data-fast/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-parent</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>2.9.24</version>
8+
<version>2.9.25</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.9.24</version>
9+
<version>2.9.25</version>
1010
</parent>
1111

1212
<name>springboot-starter-flow</name>

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/em/FlowButtonType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ public enum FlowButtonType {
2626
CUSTOM,
2727
// 前端
2828
VIEW,
29+
// 删除
30+
REMOVE,
2931
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/repository/FlowProcessRepository.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ public interface FlowProcessRepository {
1313

1414
FlowWork getFlowWorkByProcessId(String processId);
1515

16+
17+
void deleteByProcessId(String processId);
18+
1619
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/repository/FlowRecordRepository.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ public interface FlowRecordRepository {
7171
*/
7272
void delete(List<FlowRecord> childrenRecords);
7373

74+
/**
75+
* 根据流程id删除流程记录
76+
* @param processId 流程id
77+
*/
78+
void deleteByProcessId(String processId);
79+
7480
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class FlowService {
2222
private final FlowDetailService flowDetailService;
2323
private final FlowCustomEventService flowCustomEventService;
2424
private final FlowRecallService flowRecallService;
25+
private final FlowRemoveService flowRemoveService;
2526
private final FlowSaveService flowSaveService;
2627
private final FlowTransferService flowTransferService;
2728
private final FlowPostponedService flowPostponedService;
@@ -40,6 +41,7 @@ public FlowService(FlowWorkRepository flowWorkRepository,
4041
this.flowDetailService = new FlowDetailService(flowWorkRepository, flowRecordRepository, flowBindDataRepository, flowOperatorRepository, flowProcessRepository);
4142
this.flowCustomEventService = new FlowCustomEventService(flowWorkRepository,flowRecordRepository, flowProcessRepository);
4243
this.flowRecallService = new FlowRecallService(flowWorkRepository,flowRecordRepository, flowProcessRepository);
44+
this.flowRemoveService = new FlowRemoveService(flowWorkRepository,flowRecordRepository, flowProcessRepository);
4345
this.flowSaveService = new FlowSaveService(flowWorkRepository,flowRecordRepository, flowBindDataRepository, flowProcessRepository);
4446
this.flowTransferService = new FlowTransferService(flowWorkRepository,flowRecordRepository, flowBindDataRepository, flowProcessRepository);
4547
this.flowPostponedService = new FlowPostponedService(flowWorkRepository,flowRecordRepository, flowProcessRepository);
@@ -239,4 +241,14 @@ public void recall(long recordId, IFlowOperator currentOperator) {
239241
}
240242

241243

244+
245+
/**
246+
* 删除流程
247+
*
248+
* @param recordId 流程记录id
249+
* @param currentOperator 当前操作者
250+
*/
251+
public void remove(long recordId, IFlowOperator currentOperator) {
252+
flowRemoveService.remove(recordId, currentOperator);
253+
}
242254
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.codingapi.springboot.flow.service.impl;
2+
3+
import com.codingapi.springboot.flow.domain.FlowNode;
4+
import com.codingapi.springboot.flow.domain.FlowWork;
5+
import com.codingapi.springboot.flow.event.FlowApprovalEvent;
6+
import com.codingapi.springboot.flow.record.FlowRecord;
7+
import com.codingapi.springboot.flow.repository.FlowProcessRepository;
8+
import com.codingapi.springboot.flow.repository.FlowRecordRepository;
9+
import com.codingapi.springboot.flow.repository.FlowWorkRepository;
10+
import com.codingapi.springboot.flow.service.FlowRecordVerifyService;
11+
import com.codingapi.springboot.flow.user.IFlowOperator;
12+
import com.codingapi.springboot.framework.event.EventPusher;
13+
import lombok.AllArgsConstructor;
14+
import org.springframework.transaction.annotation.Transactional;
15+
16+
import java.util.Collections;
17+
import java.util.List;
18+
19+
@Transactional
20+
@AllArgsConstructor
21+
public class FlowRemoveService {
22+
23+
private final FlowWorkRepository flowWorkRepository;
24+
private final FlowRecordRepository flowRecordRepository;
25+
private final FlowProcessRepository flowProcessRepository;
26+
27+
28+
/**
29+
* 删除流程
30+
*
31+
* @param recordId 流程记录id
32+
* @param currentOperator 当前操作者
33+
*/
34+
public void remove(long recordId, IFlowOperator currentOperator) {
35+
FlowRecordVerifyService flowRecordVerifyService = new FlowRecordVerifyService(
36+
flowWorkRepository,
37+
flowRecordRepository,
38+
flowProcessRepository,
39+
recordId, currentOperator);
40+
41+
42+
flowRecordVerifyService.verifyFlowRecordCurrentOperator();
43+
flowRecordVerifyService.loadFlowWork();
44+
flowRecordVerifyService.loadFlowNode();
45+
flowRecordVerifyService.verifyFlowRecordNotFinish();
46+
flowRecordVerifyService.verifyFlowRecordIsTodo();
47+
FlowNode flowNode = flowRecordVerifyService.getFlowNode();
48+
FlowRecord flowRecord = flowRecordVerifyService.getFlowRecord();
49+
50+
if(!flowNode.isStartNode()){
51+
throw new IllegalArgumentException("flow record not remove");
52+
}
53+
54+
flowProcessRepository.deleteByProcessId(flowRecord.getProcessId());
55+
56+
flowRecordRepository.deleteByProcessId(flowRecord.getProcessId());
57+
}
58+
}

springboot-starter-flow/src/test/java/com/codingapi/springboot/flow/repository/FlowProcessRepositoryImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@ public FlowWork getFlowWorkByProcessId(String processId) {
3535
return flowBackup.resume(userRepository);
3636
}
3737

38-
38+
@Override
39+
public void deleteByProcessId(String processId) {
40+
cache.removeIf(flowProcess -> flowProcess.getProcessId().equals(processId));
41+
}
3942
}

0 commit comments

Comments
 (0)