|
|
@@ -112,6 +112,32 @@ public class CompatibleUtils {
|
|
|
FIELD_DESCRIPTION_MAP.put("auditPerson", "审核人");
|
|
|
}
|
|
|
|
|
|
+ /** PO 状态字段码值映射(用于操作轨迹 compareResultList 中文展示) */
|
|
|
+ private static final Map<String, String> APPROVED_MAP = new HashMap<>();
|
|
|
+ static {
|
|
|
+ APPROVED_MAP.put("0", "申请审核");
|
|
|
+ APPROVED_MAP.put("1", "审核通过");
|
|
|
+ APPROVED_MAP.put("2", "审核未通过");
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final Map<String, String> AUDIT_METHOD_MAP = new HashMap<>();
|
|
|
+ static {
|
|
|
+ AUDIT_METHOD_MAP.put("0", "自动审核");
|
|
|
+ AUDIT_METHOD_MAP.put("1", "手动审核");
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final Map<String, String> IS_VALID_MAP = new HashMap<>();
|
|
|
+ static {
|
|
|
+ IS_VALID_MAP.put("0", "生效中");
|
|
|
+ IS_VALID_MAP.put("1", "已失效");
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final Map<String, String> IS_ENABLED_MAP = new HashMap<>();
|
|
|
+ static {
|
|
|
+ IS_ENABLED_MAP.put("0", "启用");
|
|
|
+ IS_ENABLED_MAP.put("1", "停用");
|
|
|
+ }
|
|
|
+
|
|
|
// ============ 字典解析器(由外部注入) ============
|
|
|
private static DictLabelResolver dictLabelResolver;
|
|
|
|
|
|
@@ -418,8 +444,12 @@ public class CompatibleUtils {
|
|
|
results.add(buildCompareResult(entityName, key, displayOld, displayNew));
|
|
|
}
|
|
|
} else {
|
|
|
- String newValue = getValue(newData);
|
|
|
- String oldValue = getValue(oldData);
|
|
|
+ // 先 getValue 做类型归一化(时间戳、LocalDateTime、BigDecimal...)
|
|
|
+ String rawNew = getValue(newData);
|
|
|
+ String rawOld = getValue(oldData);
|
|
|
+ // 再字典转换(PO 状态 int → 中文描述)
|
|
|
+ String newValue = convertDictValue(key, rawNew != null ? rawNew : newData, attrNameMap, dictLabelMap);
|
|
|
+ String oldValue = convertDictValue(key, rawOld != null ? rawOld : oldData, attrNameMap, dictLabelMap);
|
|
|
if (StringUtils.isNotEmpty(newValue) && !Objects.equals(oldValue, newValue)) {
|
|
|
String displayOld = (oldValue == null) ? "(空)" : oldValue;
|
|
|
results.add(buildCompareResult(entityName, key, displayOld, newValue));
|
|
|
@@ -742,6 +772,18 @@ public class CompatibleUtils {
|
|
|
value = new java.math.BigDecimal(value).stripTrailingZeros().toPlainString();
|
|
|
} catch (NumberFormatException ignored) { }
|
|
|
}
|
|
|
+ // ★ 时间戳字符串转日期(13位毫秒时间戳,落在合理日期范围)
|
|
|
+ if (value.matches("^\\d{13}$")) {
|
|
|
+ try {
|
|
|
+ long ts = Long.parseLong(value);
|
|
|
+ if (ts >= 946684800000L && ts <= 4102444800000L) {
|
|
|
+ return LocalDateTime.ofInstant(
|
|
|
+ java.time.Instant.ofEpochMilli(ts),
|
|
|
+ java.time.ZoneId.systemDefault()
|
|
|
+ ).format(DATE_TIME_FORMATTER);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException ignored) { }
|
|
|
+ }
|
|
|
|
|
|
// 1) 操作符
|
|
|
if ("operator".equals(fieldKey)) {
|
|
|
@@ -786,8 +828,25 @@ public class CompatibleUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 6) 非字典字段直接返回原始值,不做通用字典匹配
|
|
|
- // 避免数值字段(如 inlet=2)被其他字典的 code 错误匹配
|
|
|
+ // 6) approved → 审核状态
|
|
|
+ if ("approved".equals(fieldKey)) {
|
|
|
+ return APPROVED_MAP.getOrDefault(value, value);
|
|
|
+ }
|
|
|
+ // 7) auditMethod → 审核方式
|
|
|
+ if ("auditMethod".equals(fieldKey)) {
|
|
|
+ return AUDIT_METHOD_MAP.getOrDefault(value, value);
|
|
|
+ }
|
|
|
+ // 8) isValid → 是否有效
|
|
|
+ if ("isValid".equals(fieldKey)) {
|
|
|
+ return IS_VALID_MAP.getOrDefault(value, value);
|
|
|
+ }
|
|
|
+ // 9) isEnabled → 是否启用
|
|
|
+ if ("isEnabled".equals(fieldKey)) {
|
|
|
+ return IS_ENABLED_MAP.getOrDefault(value, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 10) 非字典字段直接返回原始值,不做通用字典匹配
|
|
|
+ // 避免数值字段(如 inlet=2)被其他字典的 code 错误匹配
|
|
|
return value;
|
|
|
}
|
|
|
|