Compare commits
2 Commits
7192c2aaa6
...
0b8a9c4ce4
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b8a9c4ce4 | |||
| a019af8e3a |
@@ -10,8 +10,8 @@
|
||||
|---|---:|---|
|
||||
| framework 定制视图总数 | 46 | README 总览口径;backlog 表格当前可解析出 45 行,需后续校正缺的 1 行。 |
|
||||
| 已逐功能验收 / 可算 Done | 约 8 | 用户管理、功能模板下载、实体分类-枚举组、已办任务、消息查看/已读、短消息、查看审批、我的发起任务。功能模板下载/已办/消息查看各覆盖 2 个 templateId,但按 engineclass 各计 1 组。 |
|
||||
| 代码已提交但待最终副作用验收 | 约 4 | 待办任务:列表、查看详细、处理抽屉已验;未点同意/拒绝。用户选择框全家已切标准 amis picker,并已覆盖单选查询、单选表单、多选弹窗层级与多选展示烟测;流程选择框已接线/页面烟测;审批表单删除已补查看/删除端点和按钮注入。上述项未覆盖所有真实业务保存、权限差异或页面副作用验收。 |
|
||||
| 仍需修或逐功能验收 | 约 39 | 含上面的 4 个待验组;大多是通用页已产出,但 engineclass Java delta 未迁移。 |
|
||||
| 代码已提交但待最终副作用验收 | 约 5 | 待办任务:列表、查看详细、处理抽屉已验;未点同意/拒绝。用户选择框全家已切标准 amis picker,并已覆盖单选查询、单选表单、多选弹窗层级与多选展示烟测;流程选择框已接线/页面烟测;审批表单删除已补查看/删除端点和按钮注入;流程监控已补处理明细查看和结束流程。上述项未覆盖所有真实业务保存、权限差异或页面副作用验收。 |
|
||||
| 仍需修或逐功能验收 | 约 39 | 含上面的 5 个待验组;大多是通用页已产出,但 engineclass Java delta 未迁移。 |
|
||||
| 剩余工程单元 | 约 28+ | 多视图可复用同一套组件/端点,如脚本编辑器、消息详情、工作流按钮。 |
|
||||
|
||||
## Done(已完成 / 已验收)
|
||||
@@ -41,6 +41,7 @@
|
||||
| 用户选择框全家 | Implemented / Needs business verification | 最新口径:用户单选 `SelectDialog`、多选 `MultiSelectDialog` 均使用标准 amis `picker`(单选不加 `multiple`;多选 `multiple:true` + `overflowConfig.maxTagCount=1`;数据源 `/api/picker/<dialogid>/list`),`eip4-web` 兼容过滤器继续把存量 `user-transfer-picker` 归一成标准 picker。本轮补丁补齐运行时默认值契约:转换器给编辑/查看弹窗 load 服务追加 `?__egtpl=<editFormViewPageId>`,`FlowController` 按该编辑表单 XML 将 load 返回的 `SelectDialog/MultiSelectDialog` 裸 id 解析为 `{_id,_label}`(多选为对象数组),避免默认值显示 UUID 或撑开布局。部署:`BatchConvertCli` 全量重转 2757 项(view_page 编辑表单 1241 个产物),`SchemaImportCli` 扫描 2727 个产物、入库/更新 1054 个,8093 已重启。自动化:`mvn -q -pl platform-converter -Dtest=TemplateToAmisConverterTest#read按钮接load服务_dialog用api加载本体数据,TemplateToAmisConverterTest#crud_用户单选框受控转标准Picker,TemplateToAmisConverterTest#crud_用户选择框组织与考勤模式接线,TemplateToAmisConverterTest#crud_multiSelectDialog转picker多选弹窗 test`、`mvn -q -pl platform-metadata -Dtest=FlowControllerTest#postLoadWithEditTemplateResolvesPickerDefaults test`、`npm test -- --run src/amis/registerUserTransferPicker.test.ts`。浏览器烟测:`5078945c`「用户组-分配用户」为标准多选 picker,默认值显示 `施继栋002[222222]`、无裸 UUID、控件 32px、二级弹窗含搜索/分页/checkbox;`919477da`「流程代理授权」代理人为标准单选 picker,控件与 label 对齐且二级弹窗实际 input 类型为 radio;短消息 `ae79a47b` 已覆盖多选 picker 选人并保存。 | 继续在设置定时任务、岗位设置等真实引用页验保存值、ALL 互斥、受控/全部权限差异和考勤排除挂靠 |
|
||||
| 流程选择框 | Implemented / Needs business verification | `ProcessSelectController` 已提供 `/api/process-select/options|search`;转换器已把 `b3070157` 接到 amis `transfer-picker`;`919477da` 流程代理授权已重转重导并从 PARTIAL 转 SUCCESS;浏览器 smoke 可打开弹窗,显示「流程名称/已选流程」和流程名 | 继续验流程代理授权保存闭环:代理类型=指定流程时必填、保存后 `wf_agent_process` 写入/读取一致 |
|
||||
| 审批表单删除 `91ccbba3` | Implemented / Needs page verification | `eip4-platform 1d8a4fe` 已补 `flowable-service` 历史流程删除端点 `/api/flow/process/{processInstanceId}/delete-history`(运行中流程 409)、网关 AMIS 端点 `/api/workflow/process/{processInstanceId}/delete-history`、`ProcessFormRemoveComponent` 查看/删除按钮注入与 CRUD reload 锚点。自动化已过:`FlowControllerTest`、`TodoControllerAmisTest,FlowableClientTest`、`TemplateToAmisConverterTest#engineclass_ProcessFormRemoveComponent_注入查看和删除历史流程按钮`;打包已过:`mvn -q -pl flowable-service package -DskipTests`、`mvn -q -pl platform-app -am package -DskipTests`。 | 重转/导入 `91ccbba3` 后浏览器验收:列表选中已结束流程 → 查看打开只读 ApprovalDrawer;删除成功后列表刷新;运行中流程删除返回 409 且不误删 |
|
||||
| 流程监控 `9f3b5a8b` | Partial / Needs page verification | `eip4-platform a019af8` 已补 `flowable-service` 运行中流程结束端点 `/api/flow/process/{processInstanceId}/terminate`(已结束流程 409)、网关 AMIS 端点 `/api/workflow/process/{processInstanceId}/terminate` 并回写 `SYS_DATASTATUS=6(作废)`、`ProcessMonitorComponentNew` 注入「处理」和「结束流程」按钮与 CRUD reload 锚点。「处理」当前复用只读 ApprovalDrawer 承载流程监控明细查看;未注入「高级处理」假入口。自动化已过:`FlowControllerTest`、`TodoControllerAmisTest,FlowableClientTest`、`TemplateToAmisConverterTest#engineclass_ProcessMonitorComponentNew_注入处理和结束流程按钮`;打包已过:`mvn -q -pl flowable-service package -DskipTests`、`mvn -q -pl platform-app -am package -DskipTests`。 | 重转/导入 `9f3b5a8b` 后浏览器验收:选中运行中流程 → 处理打开审批详情;结束流程成功后列表刷新且状态回写作废;已结束流程返回 409。剩余「高级处理」走通用 code-editor + Groovy 权限/审计端点 |
|
||||
| 菜单真入口 | Needs verification | 前端已去硬编码假入口;需确认所有需要的真菜单在 `sys_menu` 中可达 | 用 `/api/menu` 和页面侧栏核对 |
|
||||
| 功能模板下载门控 | Pending | backlog 写了 `VIEW_TEMPLATEID` 非空才显示附件编辑;当前只做了去按钮/改标题 | 决定是否补门控,若补则在 `EngineclassDelta` mutator 中按行/上下文控制 |
|
||||
|
||||
@@ -48,7 +49,7 @@
|
||||
|
||||
| 优先级 | 范围 | 视图 / engineclass | 要补什么 | 复用机制 |
|
||||
|---|---|---|---|---|
|
||||
| P1 | 流程监控 | `9f3b5a8b` | 处理、高级处理、结束流程;高级处理涉及 Groovy 权限/审计 | 机制① + 流程端点,需权限守卫 |
|
||||
| P1 | 流程监控(剩余) | `9f3b5a8b` | 高级处理 Groovy 编辑/执行;处理明细查看和结束流程已接线待页面验收 | 通用 code-editor + Groovy 权限/审计端点 |
|
||||
|
||||
## P2(中等 delta,可批量复用)
|
||||
|
||||
|
||||
@@ -382,6 +382,50 @@ public class FlowController {
|
||||
return ResponseEntity.ok(resp);
|
||||
}
|
||||
|
||||
@PostMapping("/process/{processInstanceId}/terminate")
|
||||
@Operation(summary = "结束运行中流程实例",
|
||||
description = "对齐老 ProcessMonitorComponentNew:流程监控页按实例结束活动流程。仅运行中且有活动任务的流程可结束;"
|
||||
+ "操作会记录流程评论、设置 approveResult=invalid,并 deleteProcessInstance。")
|
||||
public ResponseEntity<Map<String, Object>> terminateProcessInstance(@PathVariable String processInstanceId,
|
||||
@RequestBody(required = false) Requests.ActionRequest req) {
|
||||
String pid = trimToNull(processInstanceId);
|
||||
if (pid == null) {
|
||||
return ResponseEntity.badRequest().body(errorBody("processInstanceId 不能为空"));
|
||||
}
|
||||
ProcessInstance pi = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(pid).singleResult();
|
||||
if (pi == null) {
|
||||
return ResponseEntity.status(org.springframework.http.HttpStatus.CONFLICT)
|
||||
.body(errorBody("该流程已结束"));
|
||||
}
|
||||
List<org.flowable.task.api.Task> activeTasks = taskService.createTaskQuery()
|
||||
.processInstanceId(pid).active().list();
|
||||
if (activeTasks == null || activeTasks.isEmpty()) {
|
||||
return ResponseEntity.status(org.springframework.http.HttpStatus.CONFLICT)
|
||||
.body(errorBody("该流程已结束"));
|
||||
}
|
||||
String comment = firstNonBlank(req == null ? null : req.comment, "流程有误作废处理");
|
||||
for (org.flowable.task.api.Task task : activeTasks) {
|
||||
if (task.getId() != null) {
|
||||
taskService.addComment(task.getId(), pid, comment);
|
||||
}
|
||||
}
|
||||
try {
|
||||
runtimeService.setVariable(pid, "approveResult", "invalid");
|
||||
} catch (RuntimeException ignore) {
|
||||
/* 变量写入失败不阻断终止 */
|
||||
}
|
||||
String businessKey = pi.getBusinessKey();
|
||||
runtimeService.deleteProcessInstance(pid, comment);
|
||||
Map<String, Object> resp = new java.util.LinkedHashMap<>();
|
||||
resp.put("terminated", true);
|
||||
resp.put("processEnded", true);
|
||||
resp.put("processInstanceId", pid);
|
||||
resp.put("businessKey", businessKey);
|
||||
resp.put("activeTaskCount", activeTasks.size());
|
||||
return ResponseEntity.ok(resp);
|
||||
}
|
||||
|
||||
@PostMapping("/tasks/{taskId}/delegate")
|
||||
@Operation(summary = "委托任务", description = "委托给指定用户:assignee 变为受托人,owner 记原办理人")
|
||||
public ResponseEntity<TaskDto> delegate(@PathVariable String taskId, @RequestBody Requests.DelegateRequest req) {
|
||||
|
||||
@@ -156,6 +156,49 @@ class FlowControllerTest {
|
||||
verify(historyService, never()).deleteHistoricProcessInstance(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void 结束运行中流程实例_记录评论并删除实例() throws Exception {
|
||||
ProcessInstance pi = org.mockito.Mockito.mock(ProcessInstance.class);
|
||||
when(pi.getBusinessKey()).thenReturn("BK-END");
|
||||
when(runtimeService.createProcessInstanceQuery()).thenReturn(processInstanceQuery);
|
||||
when(processInstanceQuery.processInstanceId("PI-END")).thenReturn(processInstanceQuery);
|
||||
when(processInstanceQuery.singleResult()).thenReturn(pi);
|
||||
|
||||
Task task = org.mockito.Mockito.mock(Task.class);
|
||||
when(task.getId()).thenReturn("T-END");
|
||||
when(taskService.createTaskQuery()).thenReturn(taskQuery);
|
||||
when(taskQuery.processInstanceId("PI-END")).thenReturn(taskQuery);
|
||||
when(taskQuery.active()).thenReturn(taskQuery);
|
||||
when(taskQuery.list()).thenReturn(java.util.List.of(task));
|
||||
|
||||
mvc.perform(post("/api/flow/process/PI-END/terminate")
|
||||
.contentType("application/json")
|
||||
.content("{}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.terminated").value(true))
|
||||
.andExpect(jsonPath("$.businessKey").value("BK-END"))
|
||||
.andExpect(jsonPath("$.activeTaskCount").value(1));
|
||||
|
||||
verify(taskService).addComment("T-END", "PI-END", "流程有误作废处理");
|
||||
verify(runtimeService).setVariable("PI-END", "approveResult", "invalid");
|
||||
verify(runtimeService).deleteProcessInstance("PI-END", "流程有误作废处理");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 结束已结束流程实例_返回409且不删除() throws Exception {
|
||||
when(runtimeService.createProcessInstanceQuery()).thenReturn(processInstanceQuery);
|
||||
when(processInstanceQuery.processInstanceId("PI-DONE")).thenReturn(processInstanceQuery);
|
||||
when(processInstanceQuery.singleResult()).thenReturn(null);
|
||||
|
||||
mvc.perform(post("/api/flow/process/PI-DONE/terminate")
|
||||
.contentType("application/json")
|
||||
.content("{}"))
|
||||
.andExpect(status().isConflict())
|
||||
.andExpect(jsonPath("$.msg").value("该流程已结束"));
|
||||
|
||||
verify(runtimeService, never()).deleteProcessInstance(anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void 撤回流程_移动回起始节点并挂起实例() throws Exception {
|
||||
Task task = org.mockito.Mockito.mock(Task.class);
|
||||
|
||||
@@ -94,6 +94,14 @@ public final class EngineclassDelta {
|
||||
registerMutator("com.dsasp.client.wf.ui.process.monitor.ProcessFormRemoveComponent",
|
||||
EngineclassDelta::processFormRemoveCrudAnchor);
|
||||
|
||||
// 流程监控:ProcessMonitorComponentNew 原有「处理 / 高级处理 / 结束流程」。
|
||||
// EIP4 当前只注入真实可用的「处理」明细查看与「结束流程」;高级处理(Groovy)需权限/审计另案。
|
||||
register("com.dsasp.client.wf.ui.process.monitor.ProcessMonitorComponentNew",
|
||||
EngineclassDelta::processMonitorDetailButton,
|
||||
EngineclassDelta::processMonitorTerminateButton);
|
||||
registerMutator("com.dsasp.client.wf.ui.process.monitor.ProcessMonitorComponentNew",
|
||||
EngineclassDelta::processMonitorCrudAnchor);
|
||||
|
||||
// 消息查看:MessageReceiveView/MessageSendView 在默认 GridTemplateComponent 之上加「查看」按钮。
|
||||
// 收到消息按 SYS_MESSAGEUSER_ID 打开并置已读;已发送消息按 SYS_MESSAGE_ID 打开只读详情。
|
||||
register("com.dsasp.client.tools.message.MessageReceiveView",
|
||||
@@ -415,6 +423,63 @@ public final class EngineclassDelta {
|
||||
}
|
||||
}
|
||||
|
||||
/** 流程监控「处理」:当前 EIP4 复用只读审批详情,承载流程监控明细查看。 */
|
||||
private static Map<String, Object> processMonitorDetailButton(String pkField) {
|
||||
Map<String, Object> args = mapOf(
|
||||
"taskName", "${selectedItems[0].TITLE || '流程监控明细'}",
|
||||
"processInstanceId", selectedSingleFieldExpr(pkField),
|
||||
"businessKey", "${selectedItems[0].businessKey || selectedItems[0].BUSINESSKEY || ''}",
|
||||
"businessTable", "${selectedItems[0].businessTable || selectedItems[0].BUSINESSTABLE || ''}",
|
||||
"businessSummary", "${selectedItems[0].businessSummary || {}}",
|
||||
"readOnly", true,
|
||||
"mode", "read");
|
||||
Map<String, Object> action = mapOf(
|
||||
"actionType", "openApprovalDrawer",
|
||||
"args", args);
|
||||
Map<String, Object> btn = new LinkedHashMap<>();
|
||||
btn.put("type", "button");
|
||||
btn.put("id", "处理");
|
||||
btn.put("label", "处理");
|
||||
btn.put("icon", "fa fa-edit");
|
||||
btn.put("disabledOn", "${!selectedItems || selectedItems.length !== 1}");
|
||||
btn.put("onEvent", mapOf("click", mapOf("actions", List.of(action))));
|
||||
return btn;
|
||||
}
|
||||
|
||||
/** 流程监控「结束流程」:按流程实例作废活动流程。 */
|
||||
private static Map<String, Object> processMonitorTerminateButton(String pkField) {
|
||||
Map<String, Object> btn = new LinkedHashMap<>();
|
||||
btn.put("type", "button");
|
||||
btn.put("id", "结束流程");
|
||||
btn.put("label", "结束流程");
|
||||
btn.put("icon", "fa fa-ban");
|
||||
btn.put("level", "danger");
|
||||
btn.put("actionType", "ajax");
|
||||
btn.put("disabledOn", "${!selectedItems || selectedItems.length !== 1}");
|
||||
btn.put("confirmText", "确认结束选中的流程?");
|
||||
btn.put("api", mapOf(
|
||||
"method", "post",
|
||||
"url", "/api/workflow/process/" + selectedSingleFieldExpr(pkField) + "/terminate",
|
||||
"data", mapOf(
|
||||
"comment", "流程有误作废处理",
|
||||
"businessKey", "${selectedItems[0].businessKey || selectedItems[0].BUSINESSKEY || ''}",
|
||||
"tableName", "${selectedItems[0].businessTable || selectedItems[0].BUSINESSTABLE || ''}")));
|
||||
btn.put("reload", "process-monitor-crud");
|
||||
return btn;
|
||||
}
|
||||
|
||||
/** 流程监控 CRUD 刷新锚点,供结束流程后精准 reload。 */
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void processMonitorCrudAnchor(Map<String, Object> schema, ConversionResult result) {
|
||||
Object bodyObj = schema.get("body");
|
||||
if (bodyObj instanceof Map<?, ?> body && "crud".equals(body.get("type"))) {
|
||||
((Map<String, Object>) bodyObj).putIfAbsent("id", "process-monitor-crud");
|
||||
if (result != null) {
|
||||
result.note("engineclass[ProcessMonitorComponentNew] 设置流程监控 CRUD 刷新锚点");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, Object> approvalDrawerButton(String label, String icon, String pkField,
|
||||
boolean readOnly) {
|
||||
Map<String, Object> args = mapOf(
|
||||
|
||||
@@ -1112,6 +1112,47 @@ class TemplateToAmisConverterTest {
|
||||
assertEquals("主动召回", data.get("comment"));
|
||||
}
|
||||
|
||||
/** engineclass=ProcessMonitorComponentNew → 流程监控注入处理明细和结束流程按钮,不注入高级处理假入口。 */
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void engineclass_ProcessMonitorComponentNew_注入处理和结束流程按钮() {
|
||||
String xml = "<crud entityid='e1'><display/></crud>";
|
||||
ConversionResult r = converter.convertGraded(xml, null,
|
||||
"com.dsasp.client.wf.ui.process.monitor.ProcessMonitorComponentNew",
|
||||
"流程监控", new ArrayList<>(), noPage);
|
||||
Map<String, Object> crud = body(r.getSchema());
|
||||
List<Object> toolbar = (List<Object>) crud.get("headerToolbar");
|
||||
Map<String, Object> handle = toolbar.stream()
|
||||
.filter(o -> o instanceof Map && "处理".equals(((Map<String, Object>) o).get("label")))
|
||||
.map(o -> (Map<String, Object>) o).findFirst().orElse(null);
|
||||
Map<String, Object> terminate = toolbar.stream()
|
||||
.filter(o -> o instanceof Map && "结束流程".equals(((Map<String, Object>) o).get("label")))
|
||||
.map(o -> (Map<String, Object>) o).findFirst().orElse(null);
|
||||
boolean hasAdvanced = toolbar.stream()
|
||||
.anyMatch(o -> o instanceof Map && "高级处理".equals(((Map<String, Object>) o).get("label")));
|
||||
|
||||
assertEquals("process-monitor-crud", crud.get("id"));
|
||||
assertNotNull(handle, "流程监控应注入「处理」");
|
||||
assertNotNull(terminate, "流程监控应注入「结束流程」");
|
||||
assertFalse(hasAdvanced, "高级处理需要权限/审计端点,不能生成假入口");
|
||||
|
||||
Map<String, Object> action = (Map<String, Object>) ((List<Object>) ((Map<String, Object>)
|
||||
((Map<String, Object>) handle.get("onEvent")).get("click")).get("actions")).get(0);
|
||||
Map<String, Object> args = (Map<String, Object>) action.get("args");
|
||||
assertEquals("openApprovalDrawer", action.get("actionType"));
|
||||
assertEquals("${selectedItems[0].PM_DEMO_ID}", args.get("processInstanceId"));
|
||||
assertEquals(true, args.get("readOnly"));
|
||||
|
||||
assertEquals("ajax", terminate.get("actionType"));
|
||||
assertEquals("danger", terminate.get("level"));
|
||||
assertEquals("process-monitor-crud", terminate.get("reload"));
|
||||
Map<String, Object> api = (Map<String, Object>) terminate.get("api");
|
||||
assertEquals("post", api.get("method"));
|
||||
assertEquals("/api/workflow/process/${selectedItems[0].PM_DEMO_ID}/terminate", api.get("url"));
|
||||
Map<String, Object> data = (Map<String, Object>) api.get("data");
|
||||
assertEquals("流程有误作废处理", data.get("comment"));
|
||||
}
|
||||
|
||||
/** engineclass=ProcessFormRemoveComponent → 审批表单删除注入查看和历史删除按钮。 */
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -181,4 +181,22 @@ class FlowableClientTest {
|
||||
assertThat(result).containsEntry("businessKey", "BK-1");
|
||||
server.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
void 结束流程_POST实例terminate端点并传评论() {
|
||||
FlowGatewayProperties p = props();
|
||||
RestClient.Builder builder = RestClient.builder().baseUrl(p.getBaseUrl());
|
||||
MockRestServiceServer server = MockRestServiceServer.bindTo(builder).build();
|
||||
server.expect(requestTo("http://localhost:8089/api/flow/process/P1/terminate"))
|
||||
.andExpect(method(HttpMethod.POST))
|
||||
.andExpect(jsonPath("$.comment").value("流程有误作废处理"))
|
||||
.andRespond(withSuccess("{\"terminated\":true,\"businessKey\":\"BK-1\"}", MediaType.APPLICATION_JSON));
|
||||
FlowableClient client = new FlowableClient(builder.build(), p);
|
||||
|
||||
Map<String, Object> result = client.terminateProcessInstance("P1", "流程有误作废处理");
|
||||
|
||||
assertThat(result).containsEntry("terminated", true);
|
||||
assertThat(result).containsEntry("businessKey", "BK-1");
|
||||
server.verify();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import com.dsasp.server.common.workflow.service.ProcessCoreService;
|
||||
import com.eip4.platform.auth.security.AuthPrincipal;
|
||||
import com.eip4.platform.flowgateway.aggregate.BusinessSummaryService;
|
||||
import com.eip4.platform.flowgateway.aggregate.TodoAggregator;
|
||||
@@ -207,6 +208,24 @@ class TodoControllerAmisTest {
|
||||
verify(flowableClient).deleteHistoricProcessInstance("PI-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void terminateProcess_透传结束流程并回写作废状态() {
|
||||
when(flowableClient.terminateProcessInstance("PI-1", "流程有误作废处理"))
|
||||
.thenReturn(Map.of("terminated", true, "businessKey", "BK-1"));
|
||||
GatewayRequests.ApprovalActionRequest req = new GatewayRequests.ApprovalActionRequest();
|
||||
req.tableName = "OA_NOTICE";
|
||||
|
||||
Map<String, Object> resp = controller.terminateProcess("PI-1", req).getBody();
|
||||
|
||||
assertThat(resp).containsEntry("status", 0);
|
||||
assertThat(resp).containsEntry("msg", "已结束该流程");
|
||||
assertThat(resp).containsEntry("terminated", true);
|
||||
assertThat(resp).containsEntry("statusWritten", true);
|
||||
assertThat(resp).containsEntry("businessKey", "BK-1");
|
||||
verify(flowableClient).terminateProcessInstance("PI-1", "流程有误作废处理");
|
||||
verify(statusWriteback).updateStatus("BK-1", "OA_NOTICE", ProcessCoreService.STATUS_INVALID);
|
||||
}
|
||||
|
||||
private static ProcessInstanceDto process(String id, String businessKey, boolean ended, long startMillis) {
|
||||
ProcessInstanceDto dto = new ProcessInstanceDto();
|
||||
dto.id = id;
|
||||
|
||||
Reference in New Issue
Block a user