refactor(flow): 目录键归一 flowcenter→flow-center(D1)——出站枚举 FLOW_CENTER 跟随、本地 yh.open.services 键与注释同步;yml 另一 hunk(Phase 2 front.base-url 删除)为在途 WIP 未随本笔提交
build / build-push (push) Successful in 1m36s

This commit is contained in:
chenxing
2026-09-28 17:35:33 +08:00
parent b08d076f0b
commit 4bbcd22d25
3 changed files with 10 additions and 10 deletions
@@ -23,7 +23,7 @@ import java.util.Map;
* /oapi/flow/**(flow-center 的 RequireAppSignFilter 验本应用 appKey)。flow-center 未部署时
* enabled=false,方法全部抛"流程中心未接入"。
*
* <p>主路径走 SDK 类型化门面 {@code YschFlowOpenApi}(服务目录 key=flowcenter:
* <p>主路径走 SDK 类型化门面 {@code YschFlowOpenApi}(服务目录 key=flow-center:
* yh.call.targets &gt; yh.open.services &gt; 枚举 base-host 兜底,《子应用配置优化方案》§4.2
* 零专属地址配置);目录未显式配置时回落 legacy 键 {@code svchall.flow.base-url}(ad-hoc
* TargetSpec,可配带/不带 context-path 两种形态,构造时拆成 host+basePath,迁移期兼容)。
@@ -37,7 +37,7 @@ public class FlowCenterClient implements FlowClient {
private final ObjectMapper objectMapper;
private final boolean enabled;
private final TargetSpec flowSpec;
/** 服务目录显式配置了 flowcenter(targets/services)则主路径走门面命名目标 */
/** 服务目录显式配置了 flow-center(targets/services)则主路径走门面命名目标 */
private final boolean directoryResolved;
public FlowCenterClient(YschOpenCall openCall, ObjectMapper objectMapper,
@@ -48,7 +48,7 @@ public class FlowCenterClient implements FlowClient {
this.enabled = enabled;
String base = trimTrailing(baseUrl == null ? "" : baseUrl.trim());
this.directoryResolved = openCall != null && openCall.hasTarget(
com.yunhai.platform.openapi.core.PlatformService.FLOWCENTER.key());
com.yunhai.platform.openapi.core.PlatformService.FLOW_CENTER.key());
if (directoryResolved) {
com.yunhai.platform.openapi.flow.YschFlowOpenApi.setCall(openCall);
}
@@ -56,7 +56,7 @@ public class FlowCenterClient implements FlowClient {
// 目录未配且 legacy 键也空:构造期 fail-fast——别把"地址没配"伪装成"流程中心不可达"。
// enabled=false(显式未接入)时不校验——地址本就不需要。
throw new IllegalStateException("流程中心调用地址未配置:请配置服务目录 yh.open.services."
+ com.yunhai.platform.openapi.core.PlatformService.FLOWCENTER.key()
+ com.yunhai.platform.openapi.core.PlatformService.FLOW_CENTER.key()
+ "(推荐,容器直连完整 URL)或回落键 svchall.flow.base-url");
}
URI uri = URI.create(base);
@@ -146,7 +146,7 @@ public class FlowCenterClient implements FlowClient {
query.put("bizId", bizId);
if (directoryResolved) {
// 门面 instance(...) 只反序列化 FlowInstance 的字段子集;本方法契约是 Map 全字段透传
// (对账/查看守卫要 status/version/assigneeIds/nodeSummary…),故走预绑 flowcenter 的
// (对账/查看守卫要 status/version/assigneeIds/nodeSummary…),故走预绑 flow-center 的
// 泛化视图 raw()——目标名由门面承载,不再回落应用专属地址。
return com.yunhai.platform.openapi.flow.YschFlowOpenApi.raw()
.get("/oapi/flow/instance", query, Map.class);
@@ -226,7 +226,7 @@ public class FlowCenterClient implements FlowClient {
* 流程示意图字节:先换免签 token(/oapi/flow/diagram/url,走应用签名),再取图
* (/open/flow/diagram/img,免签只认 token)。两步都在本方法内,token 不出后端。
* <p>
* 取图走 {@code raw()}(预绑 flowcenter 的泛化视图)/ ad-hoc spec 的 download:目标基址解析
* 取图走 {@code raw()}(预绑 flow-center 的泛化视图)/ ad-hoc spec 的 download:目标基址解析
* 与签名由 SDK 统一承载,本类不拼 flow-center 地址——Caddy 没有 flow-center 的通用路由
* (Projman 只生成 {ctx}/api/* 与前端静态段),故浏览器侧不可达,必须由后端中转运图。
*/
+3 -3
View File
@@ -63,12 +63,12 @@ yh:
base-host: http://base.yunhaixingtong.com
base-path: /userbase
# 服务目录(子应用配置优化方案 §4.2):跨服务出站唯一地址来源,命名目标走 SDK 门面 /
# YschOpenCall。cms 未晋升 PlatformService 枚举(按名直调);flowcenter 已入枚举,此处
# YschOpenCall。cms 未晋升 PlatformService 枚举(按名直调);flow-center 已入枚举,此处
# 显式覆盖为本地端口。完整 URL 拆 host+ctx,per-target base-path 与提供方 context-path
# 对齐 → 签名天然一致。生产改容器直连:flowcenter=http://flow-center-service:10008/flow-center、
# 对齐 → 签名天然一致。生产改容器直连:flow-center=http://flow-center-service:10008/flow-center、
# cms=http://yschcms-service:10005/yschcms。
services:
flowcenter: http://localhost:8085
flow-center: http://localhost:8085
cms: http://base.yunhaixingtong.com:10005/yschcms
# 流程中心回调接收端 starter(2026-09-20 迁移,X-Flw 验签式):端点保持既有 /callback/flow,
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.when;
@DisplayName("svc-hall FlowCenterClient - 服务目录命名目标(全端点)")
class FlowCenterClientFacadeTest {
private static final String TARGET = "flowcenter";
private static final String TARGET = "flow-center";
private static final String LEGACY_BASE = "http://flow-center-service:10008/flow-center";
private final ObjectMapper objectMapper = new ObjectMapper();