feat: wire process monitor actions
This commit is contained in:
@@ -216,6 +216,16 @@ public class FlowableClient {
|
||||
Map.of(), Map.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束运行中流程实例。对应 flowable-service
|
||||
* {@code POST /api/flow/process/{processInstanceId}/terminate}。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> terminateProcessInstance(String processInstanceId, String comment) {
|
||||
return post("结束流程", "/api/flow/process/" + processInstanceId + "/terminate",
|
||||
comment == null ? Map.of() : Map.of("comment", comment), Map.class);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 内部:重试 + 异常分类
|
||||
|
||||
private List<FlowTaskDto> get(String op, java.util.function.Function<UriBuilder, java.net.URI> uriFn) {
|
||||
|
||||
@@ -227,6 +227,33 @@ public class TodoController {
|
||||
return ResponseEntity.ok(resp);
|
||||
}
|
||||
|
||||
@Operation(summary = "流程监控结束流程",
|
||||
description = "流程监控页专用:按流程实例结束活动流程,并按老系统语义回写 SYS_DATASTATUS=6(作废)。")
|
||||
@PostMapping("/api/workflow/process/{processInstanceId}/terminate")
|
||||
public ResponseEntity<Map<String, Object>> terminateProcess(@PathVariable String processInstanceId,
|
||||
@RequestBody(required = false) GatewayRequests.ApprovalActionRequest req) {
|
||||
String comment = firstNonBlank(req == null ? null : req.comment, "流程有误作废处理");
|
||||
Map<String, Object> engine = flowableClient.terminateProcessInstance(processInstanceId, comment);
|
||||
String businessKey = req != null && notBlank(req.businessKey)
|
||||
? req.businessKey
|
||||
: rowString(engine, "businessKey", "BUSINESSKEY");
|
||||
String table = req == null ? null : req.tableName;
|
||||
boolean written = false;
|
||||
if (notBlank(businessKey)) {
|
||||
statusWriteback.updateStatus(businessKey, table, ProcessCoreService.STATUS_INVALID);
|
||||
written = true;
|
||||
}
|
||||
Map<String, Object> resp = new LinkedHashMap<>();
|
||||
resp.put("status", 0);
|
||||
resp.put("msg", "已结束该流程");
|
||||
resp.put("terminated", true);
|
||||
resp.put("processEnded", true);
|
||||
resp.put("processInstanceId", processInstanceId);
|
||||
resp.put("businessKey", businessKey);
|
||||
resp.put("statusWritten", written);
|
||||
return ResponseEntity.ok(resp);
|
||||
}
|
||||
|
||||
@Operation(summary = "流程轨迹", description = "返回流程实例的历史任务节点(含当前活动节点),按开始时间升序;包含办理人姓名/审批意见/办理结果")
|
||||
@GetMapping("/api/flow/process/{processInstanceId}/trace")
|
||||
public ResponseEntity<List<TraceNodeDto>> trace(@PathVariable String processInstanceId) {
|
||||
|
||||
Reference in New Issue
Block a user