Skip to content

Commit 8717601

Browse files
committed
update 3.5.58
1 parent 0864cc5 commit 8717601

File tree

30 files changed

+169
-16
lines changed

30 files changed

+169
-16
lines changed

admin-ui/src/api/flow.ts

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export async function startFlow(body:any) {
4242
return post('/api/cmd/flowRecord/startFlow', body);
4343
}
4444

45+
export async function removeFlow(body:any) {
46+
return post('/api/cmd/flowRecord/remove', body);
47+
}
48+
49+
4550
export async function detail(id?:any,workCode?:any) {
4651
return get('/api/query/flowRecord/detail', {id,workCode});
4752
}

admin-ui/src/components/Flow/flow/events.tsx

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import {useEffect} from "react";
22
import {FormInstance} from "antd/es/form/hooks/useForm";
33
import {FlowData, FlowSubmitResultBuilder, FlowTrySubmitResultBuilder} from "@/components/Flow/flow/data";
4-
import {custom, postponed, recall, saveFlow, startFlow, submitFlow, transfer, trySubmitFlow, urge} from "@/api/flow";
4+
import {
5+
custom,
6+
postponed,
7+
recall,
8+
removeFlow,
9+
saveFlow,
10+
startFlow,
11+
submitFlow,
12+
transfer,
13+
trySubmitFlow,
14+
urge
15+
} from "@/api/flow";
516
import {message} from "antd";
617
import {useDispatch, useSelector} from "react-redux";
718
import {
@@ -231,6 +242,24 @@ export const registerEvents = (id: string,
231242
})
232243
}
233244

245+
246+
// 删除流程
247+
const handleRemoveFlow = () => {
248+
const body = {
249+
recordId,
250+
}
251+
setRequestLoading(true);
252+
removeFlow(body).then(res => {
253+
if (res.success) {
254+
message.success('流程已删除').then();
255+
closeFlow();
256+
}
257+
}).finally(() => {
258+
setRequestLoading(false)
259+
})
260+
}
261+
262+
234263
// 延期流程
235264
const handlePostponedFlow = () => {
236265
const body = {
@@ -418,6 +447,10 @@ export const registerEvents = (id: string,
418447
handleRecallFlow();
419448
break;
420449
}
450+
case 'REMOVE': {
451+
handleRemoveFlow();
452+
break;
453+
}
421454
case 'URGE': {
422455
handlerUrgeFlow();
423456
break;

admin-ui/src/components/Flow/flow/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export type CustomButtonType =
1616
| 'POSTPONED'
1717
| 'URGE'
1818
| 'CUSTOM'
19-
| 'VIEW';
19+
| 'VIEW'
20+
| 'REMOVE';
2021

2122
// 流程图中线的类型
2223
export type EdgeType = 'line' | 'polyline' | 'bezier';

admin-ui/src/components/Flow/panel/ButtonPanel.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ const buttonEventOptions = [
6969
label: "自定义事件",
7070
value: "VIEW"
7171
},
72+
{
73+
label: "删除",
74+
value: "REMOVE"
75+
},
7276
] as {
7377
label: string;
7478
value: CustomButtonType;

example/example-application/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-application/src/main/java/com/codingapi/example/command/FlowRecordCmdController.java

+7
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,11 @@ public Response urge(@RequestBody FlowCmd.UrgeFlow request) {
100100
}
101101

102102

103+
@PostMapping("/remove")
104+
public Response remove(@RequestBody FlowCmd.RemoveFlow request) {
105+
User current = userRepository.getUserByUsername(request.getUserName());
106+
flowService.remove(request.getRecordId(), current);
107+
return Response.buildSuccess();
108+
}
109+
103110
}

example/example-application/src/main/java/com/codingapi/example/pojo/cmd/FlowCmd.java

+11
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@ public String getUserName() {
180180
}
181181
}
182182

183+
@Setter
184+
@Getter
185+
public static class RemoveFlow {
186+
187+
private long recordId;
188+
189+
public String getUserName() {
190+
return TokenContext.current().getUsername();
191+
}
192+
}
193+
183194

184195
@Setter
185196
@Getter

example/example-domain/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-flow/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-flow/src/main/java/com/codingapi/example/jpa/FlowProcessEntityRepository.java

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ public interface FlowProcessEntityRepository extends FastRepository<FlowProcessE
77

88
FlowProcessEntity getFlowProcessEntityByProcessId(String processId);
99

10+
11+
void deleteByProcessId(String processId);
12+
1013
}

example/example-infra-flow/src/main/java/com/codingapi/example/jpa/FlowRecordEntityRepository.java

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public interface FlowRecordEntityRepository extends FastRepository<FlowRecordEnt
1313

1414
FlowRecordEntity getFlowRecordEntityById(long id);
1515

16+
void deleteByProcessId(String processId);
17+
1618

1719
List<FlowRecordEntity> findFlowRecordEntityByPreId(long preId);
1820

example/example-infra-flow/src/main/java/com/codingapi/example/repository/FlowProcessRepositoryImpl.java

+6
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ public FlowWork getFlowWorkByProcessId(String processId) {
4040
}
4141
return null;
4242
}
43+
44+
45+
@Override
46+
public void deleteByProcessId(String processId) {
47+
flowProcessEntityRepository.deleteByProcessId(processId);
48+
}
4349
}

example/example-infra-flow/src/main/java/com/codingapi/example/repository/FlowRecordRepositoryImpl.java

+5
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,9 @@ public void finishFlowRecordByProcessId(String processId) {
6868
public void delete(List<FlowRecord> childrenRecords) {
6969
flowRecordEntityRepository.deleteAll(childrenRecords.stream().map(FlowRecordConvertor::convert).toList());
7070
}
71+
72+
@Override
73+
public void deleteByProcessId(String processId) {
74+
flowRecordEntityRepository.deleteByProcessId(processId);
75+
}
7176
}

example/example-infra-jpa/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-server/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</parent>
1818

1919
<artifactId>springboot-example</artifactId>
20-
<version>3.3.57</version>
20+
<version>3.3.58</version>
2121

2222
<name>springboot-example</name>
2323
<description>springboot-example project for Spring Boot</description>

pom.xml

+1-1
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>3.3.57</version>
18+
<version>3.3.58</version>
1919

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

springboot-starter-data-authorization/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>springboot-parent</artifactId>
9-
<version>3.3.57</version>
9+
<version>3.3.58</version>
1010
</parent>
1111

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

springboot-starter-data-fast/pom.xml

+1-1
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>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-flow/pom.xml

+1-1
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>3.3.57</version>
9+
<version>3.3.58</version>
1010
</parent>
1111

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

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

+2
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

+2
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ public interface FlowProcessRepository {
1313

1414
FlowWork getFlowWorkByProcessId(String processId);
1515

16+
void deleteByProcessId(String processId);
17+
1618
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ public interface FlowRecordRepository {
7171
*/
7272
void delete(List<FlowRecord> childrenRecords);
7373

74+
void deleteByProcessId(String processId);
75+
7476
}

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

+11
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);
@@ -238,5 +240,14 @@ public void recall(long recordId, IFlowOperator currentOperator) {
238240
flowRecallService.recall(recordId, currentOperator);
239241
}
240242

243+
/**
244+
* 删除流程
245+
*
246+
* @param recordId 流程记录id
247+
* @param currentOperator 当前操作者
248+
*/
249+
public void remove(long recordId, IFlowOperator currentOperator) {
250+
flowRemoveService.remove(recordId, currentOperator);
251+
}
241252

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

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@ public FlowWork getFlowWorkByProcessId(String processId) {
3434
return flowBackup.resume(userRepository);
3535
}
3636

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

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

+5
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,9 @@ public void finishFlowRecordByProcessId(String processId) {
160160
public void delete(List<FlowRecord> childrenRecords) {
161161
cache.removeAll(childrenRecords);
162162
}
163+
164+
@Override
165+
public void deleteByProcessId(String processId) {
166+
cache.removeIf(record -> record.getProcessId().equals(processId));
167+
}
163168
}

springboot-starter-security/pom.xml

+1-1
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>3.3.57</version>
9+
<version>3.3.58</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-security</artifactId>

springboot-starter/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.codingapi.springboot</groupId>
77
<artifactId>springboot-parent</artifactId>
8-
<version>3.3.57</version>
8+
<version>3.3.58</version>
99
</parent>
1010
<artifactId>springboot-starter</artifactId>
1111

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
------------------------------------------------------
2-
CodingApi SpringBoot-Starter 3.3.57
2+
CodingApi SpringBoot-Starter 3.3.58
33
springboot version (${spring-boot.version})
44
------------------------------------------------------

0 commit comments

Comments
 (0)