diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/flow/FlowInputCoercer.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/flow/FlowInputCoercer.java
new file mode 100644
index 0000000..bde9f32
--- /dev/null
+++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/flow/FlowInputCoercer.java
@@ -0,0 +1,279 @@
+package com.eip4.platform.metadata.flow;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Component;
+
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+
+/**
+ * 写流入参类型强制器(写路径走服务流安全前置之类型兼容修复)。
+ *
+ *
问题根因:{@code POST /api/flow/{servicename}} body 来自 amis JSON,
+ * 所有值都是 {@code String}。引擎 {@code pojoCRUDService.save(map, tableName, ctx)}
+ * 调用 {@code new GeneralPO(tableName, map, ctx)} 构造器,内部按 {@code POJOInfo.getColumnClass(i)}
+ * 直接 {@code (Integer) map.get(columnName)} cast,遇到 {@code String "1"} → {@code ClassCastException}。
+ *
+ *
解法(元数据驱动,按 SYS_ENTITYATTRIBUTE.referenceid 判目标类型):
+ *
+ * - 从流的 {@code contentxml} 用正则抽取 {@code } 得实体表名。
+ * - 按表名查 {@code SYS_ENTITYATTRIBUTE},得列名 → referenceid(即 DisplayType 字符串)映射。
+ * - 遍历入参 map,对值为 {@code String} 的键,若目标类型是 {@code INTEGER/ENUMERATE/STATUS → Integer}、
+ * {@code BOOLEAN → Boolean}、{@code DECIMAL/MONEY → BigDecimal},就地 parse;其余(NVARCHAR/CHAR/TIME/DATE/LIST/BLOB)不动。
+ *
+ *
+ * fail-safe(不阻断写路径):表名提取失败、元数据查不到、parse 失败 → 原值保留,
+ * 交由引擎校验如实报错;不会因 coerce 本身抛 RuntimeException 阻断写。
+ *
+ *
幂等:值若已经是正确类型(前端传了 Integer)则不重复转换。
+ *
+ *
缓存:表名 → 列类型 map,Caffeine maxSize 2000,与 {@code /api/meta/evict} 对齐。
+ *
+ *
纪律:零改 {@code com.dsasp};只读 SYS_ENTITYATTRIBUTE 元数据,不写业务表。
+ */
+@Component
+public class FlowInputCoercer {
+
+ private static final Logger log = LoggerFactory.getLogger(FlowInputCoercer.class);
+
+ /**
+ * 从 contentxml 抽取 tableName initValue:
+ * {@code } 或自闭合 {@code .../>}。
+ */
+ private static final Pattern TABLE_NAME_PATTERN = Pattern.compile(
+ "]*\\bname\\s*=\\s*\"tableName\"[^>]*\\binitValue\\s*=\\s*\"([^\"]+)\"",
+ Pattern.CASE_INSENSITIVE);
+
+ /** 表名(大写)→ {列名(大写)→ referenceid(DisplayType 字符串)} 映射。 */
+ private final Cache> columnTypeCache = Caffeine.newBuilder()
+ .maximumSize(2_000)
+ .build();
+
+ /**
+ * flowId → tableName(大写)映射缓存。
+ * 避免 {@link #coerceByFlowId} 每次重查 contentxml 文本。
+ * 空字符串 {@code ""} 表示该流无固定 tableName(动态多表流),同样缓存避免重查。
+ */
+ private final Cache flowTableCache = Caffeine.newBuilder()
+ .maximumSize(5_000)
+ .build();
+
+ private final JdbcTemplate jdbcTemplate;
+
+ public FlowInputCoercer(JdbcTemplate jdbcTemplate) {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ /**
+ * 按 flowId 就地 coerce 写流入参 map:自动查 contentxml 提取表名,再按元数据类型强制转换。
+ *
+ * 这是 {@link #coerce(String, Map)} 的便捷入口,供 {@code FlowController} 写流路径调用。
+ * flowId→tableName 和 tableName→columnTypes 均有 Caffeine 缓存,热路径 0 DB 往返。
+ *
+ * @param flowId sys_serviceflow 主键(即服务流名)
+ * @param map 写流入参 map,就地修改
+ */
+ public void coerceByFlowId(String flowId, Map map) {
+ if (flowId == null || flowId.isBlank() || map == null || map.isEmpty()) {
+ return;
+ }
+ // 先从缓存取 tableName;缓存未命中则查 contentxml
+ String tableName = flowTableCache.get(flowId, this::resolveTableNameByFlowId);
+ if (tableName.isEmpty()) {
+ return; // 无固定 tableName,跳过
+ }
+ Map colTypes = columnTypeCache.get(tableName, this::queryColumnTypes);
+ if (colTypes.isEmpty()) {
+ return;
+ }
+ applyCoerce(map, colTypes);
+ }
+
+ /**
+ * 就地 coerce 写流入参 map:按流 contentxml 里的 tableName 查元数据,把 String 值
+ * 强制转成引擎期望的 Java 类型(Integer/Boolean/BigDecimal),其余类型不动。
+ *
+ * fail-safe:任何步骤失败(无 tableName / DB 异常 / parse 失败)→ 原值保留,不抛异常。
+ *
+ * @param contentXml 流的 contentxml(调用方已按 PK 查好);null/空 → 跳过
+ * @param map 写流入参 map,就地修改;null → 跳过
+ */
+ public void coerce(String contentXml, Map map) {
+ if (contentXml == null || contentXml.isBlank() || map == null || map.isEmpty()) {
+ return;
+ }
+ String tableName = extractTableName(contentXml);
+ if (tableName == null) {
+ return; // 无固定 tableName(如跨表流),不做 coerce
+ }
+ Map colTypes = columnTypeCache.get(tableName, this::queryColumnTypes);
+ if (colTypes.isEmpty()) {
+ return;
+ }
+ applyCoerce(map, colTypes);
+ }
+
+ /** 遍历 map,按 colTypes 就地强制转换 String 值为目标 Java 类型。 */
+ private void applyCoerce(Map map, Map colTypes) {
+ for (Map.Entry entry : map.entrySet()) {
+ Object val = entry.getValue();
+ if (!(val instanceof String)) {
+ continue; // 已是正确类型,幂等跳过
+ }
+ String colUpper = entry.getKey().toUpperCase();
+ String refId = colTypes.get(colUpper);
+ if (refId == null) {
+ continue; // 元数据无此列,不动
+ }
+ Object coerced = coerceValue((String) val, refId, colUpper);
+ if (coerced != val) { // 引用变了才更新
+ entry.setValue(coerced);
+ }
+ }
+ }
+
+ /**
+ * 按 flowId 从 sys_serviceflow 查 contentxml,提取 tableName。
+ * 找不到 → 返回 {@code ""}(空字符串,会被缓存以避免重查)。
+ */
+ private String resolveTableNameByFlowId(String flowId) {
+ try {
+ String xml = jdbcTemplate.queryForObject(
+ "SELECT contentxml::text FROM eip3.sys_serviceflow WHERE sys_serviceflow_id = ?",
+ String.class, flowId);
+ if (xml == null) {
+ return "";
+ }
+ String tableName = extractTableName(xml);
+ return tableName != null ? tableName : "";
+ } catch (org.springframework.dao.EmptyResultDataAccessException e) {
+ return ""; // 流不存在
+ } catch (RuntimeException e) {
+ log.warn("[FLOW-COERCE] 查 contentxml 失败 flowId={}: {}", sanitize(flowId), e.getMessage());
+ return "";
+ }
+ }
+
+ /**
+ * 从 contentxml 抽取固定实体表名({@code })。
+ *
+ * @return 大写表名,或 null(无 tableName initValue 的流,如动态多表流)
+ */
+ String extractTableName(String contentXml) {
+ if (contentXml == null || contentXml.isBlank()) {
+ return null; // 流不存在/无 contentxml → 无固定表名
+ }
+ Matcher m = TABLE_NAME_PATTERN.matcher(contentXml);
+ if (m.find()) {
+ return m.group(1).trim().toUpperCase();
+ }
+ return null;
+ }
+
+ /**
+ * 按 tableName 查 SYS_ENTITYATTRIBUTE,返回 {列名大写 → referenceid} 映射。
+ * 结果由 Caffeine 缓存;DB 异常 → 返回空 map(fail-safe)。
+ */
+ private Map queryColumnTypes(String upperTable) {
+ try {
+ List