feat: wire process form removal actions
This commit is contained in:
@@ -349,6 +349,39 @@ public class FlowController {
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@PostMapping("/process/{processInstanceId}/delete-history")
|
||||
@Operation(summary = "删除已结束历史流程实例",
|
||||
description = "对齐老 ProcessCoreService.dleteCompleteProcessInstance:仅允许删除已结束的历史流程实例;"
|
||||
+ "运行中实例返回 409,避免审批表单删除页误删活动流程。")
|
||||
public ResponseEntity<Map<String, Object>> deleteHistoricProcessInstance(@PathVariable String processInstanceId) {
|
||||
String pid = trimToNull(processInstanceId);
|
||||
if (pid == null) {
|
||||
return ResponseEntity.badRequest().body(errorBody("processInstanceId 不能为空"));
|
||||
}
|
||||
ProcessInstance runtime = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(pid).singleResult();
|
||||
if (runtime != null) {
|
||||
return ResponseEntity.status(org.springframework.http.HttpStatus.CONFLICT)
|
||||
.body(errorBody("流程未结束,不能删除审批表单"));
|
||||
}
|
||||
var hpi = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(pid).singleResult();
|
||||
if (hpi == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
if (hpi.getEndTime() == null) {
|
||||
return ResponseEntity.status(org.springframework.http.HttpStatus.CONFLICT)
|
||||
.body(errorBody("流程未结束,不能删除审批表单"));
|
||||
}
|
||||
String businessKey = hpi.getBusinessKey();
|
||||
historyService.deleteHistoricProcessInstance(pid);
|
||||
Map<String, Object> resp = new java.util.LinkedHashMap<>();
|
||||
resp.put("deleted", true);
|
||||
resp.put("processInstanceId", pid);
|
||||
resp.put("businessKey", businessKey);
|
||||
return ResponseEntity.ok(resp);
|
||||
}
|
||||
|
||||
@PostMapping("/tasks/{taskId}/delegate")
|
||||
@Operation(summary = "委托任务", description = "委托给指定用户:assignee 变为受托人,owner 记原办理人")
|
||||
public ResponseEntity<TaskDto> delegate(@PathVariable String taskId, @RequestBody Requests.DelegateRequest req) {
|
||||
|
||||
Reference in New Issue
Block a user