[ysch-flow] S2.2 结果/退回消息改走 bizUrl 优先策略(F8 缺口①)
notifyResult/notifyReturned 此前把 jumpPath 硬编码 /instance/{id}、jumpApp 硬编码 null,
消息归属因此落在流程中心,四类消息(待办/抄送/结果/退回)口径不一致。现与 task/cc
同策略并抽出 jumpPath/jumpApp 两个共用判定:bizUrl 非空→直达业务方详情页且归属申报
给 apply 调用方 applyAppCode;bizUrl 空(存量办件)→仍回落中心页且归属留空。
单测 8 例(新增 4 例:结果带/不带 bizUrl、退回、抄送)。
This commit is contained in:
@@ -151,4 +151,75 @@ class UserMsgNotifierBizUrlTest {
|
||||
assertEquals("/task/78", userMsg.lastJumpPath);
|
||||
assertNull(userMsg.lastJumpApp);
|
||||
}
|
||||
|
||||
/**
|
||||
* F8 缺口①:结果消息(completed/rejected/withdrawn)不再硬编码归流程中心,
|
||||
* 与待办/抄送同策略——bizUrl 优先 + jumpApp=applyAppCode。
|
||||
*/
|
||||
@Test
|
||||
void resultMessage_followsBizUrlStrategy() {
|
||||
FlwInstance instance = instance(11L, "/leave/detail?id=88", "notice");
|
||||
when(instanceRepository.findById(11L)).thenReturn(Optional.of(instance));
|
||||
|
||||
notifier.onFlowEvent(FlowEvent.of(FlowEvent.Type.COMPLETED, 11L, null,
|
||||
java.util.Collections.singletonMap("result", "通过")));
|
||||
|
||||
assertEquals("/leave/detail?id=88", userMsg.lastJumpPath);
|
||||
assertEquals("notice", userMsg.lastJumpApp);
|
||||
}
|
||||
|
||||
/** 存量兼容:老办件无 bizUrl 时结果消息仍回落中心办件详情、归属留空 */
|
||||
@Test
|
||||
void resultMessageWithoutBizUrl_fallsBackToCenterInstancePage() {
|
||||
FlwInstance instance = instance(12L, " ", "notice");
|
||||
when(instanceRepository.findById(12L)).thenReturn(Optional.of(instance));
|
||||
|
||||
notifier.onFlowEvent(FlowEvent.of(FlowEvent.Type.REJECTED, 12L));
|
||||
|
||||
assertEquals("/instance/12", userMsg.lastJumpPath);
|
||||
assertNull(userMsg.lastJumpApp);
|
||||
}
|
||||
|
||||
/** F8 缺口①:退回消息同策略(四类消息归属口径从此一致) */
|
||||
@Test
|
||||
void returnedMessage_followsBizUrlStrategy() {
|
||||
FlwInstance instance = instance(13L, "/hall/detail?id=9", "svc-hall");
|
||||
when(instanceRepository.findById(13L)).thenReturn(Optional.of(instance));
|
||||
java.util.Map<String, Object> data = new java.util.HashMap<>();
|
||||
data.put("targetUserIds", java.util.Arrays.asList(201, 202));
|
||||
data.put("fromNodeName", "科室初审");
|
||||
data.put("opinion", "请补材料");
|
||||
|
||||
notifier.onFlowEvent(FlowEvent.of(FlowEvent.Type.RETURNED, 13L, null, data));
|
||||
|
||||
assertEquals("/hall/detail?id=9", userMsg.lastJumpPath);
|
||||
assertEquals("svc-hall", userMsg.lastJumpApp);
|
||||
}
|
||||
|
||||
/** 抄送消息(原已同策略)纳入同一断言口径,防后续回归 */
|
||||
@Test
|
||||
void ccMessage_followsBizUrlStrategy() {
|
||||
FlwInstance instance = instance(14L, "/notice/detail?serid=3", "notice");
|
||||
when(instanceRepository.findById(14L)).thenReturn(Optional.of(instance));
|
||||
java.util.Map<String, Object> data = new java.util.HashMap<>();
|
||||
data.put("ccUserId", 301);
|
||||
data.put("ccId", 55);
|
||||
data.put("nodeName", "抄送分管领导");
|
||||
|
||||
notifier.onFlowEvent(FlowEvent.of(FlowEvent.Type.CC_SENT, 14L, null, data));
|
||||
|
||||
assertEquals("/notice/detail?serid=3", userMsg.lastJumpPath);
|
||||
assertEquals("notice", userMsg.lastJumpApp);
|
||||
}
|
||||
|
||||
private FlwInstance instance(long id, String bizUrl, String applyAppCode) {
|
||||
FlwInstance instance = new FlwInstance();
|
||||
instance.setId(id);
|
||||
instance.setSchId(1L);
|
||||
instance.setBizTitle("测试办件");
|
||||
instance.setSubmitterId(101);
|
||||
instance.setBizUrl(bizUrl);
|
||||
instance.setApplyAppCode(applyAppCode);
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user