refactor(common-json): 优化 JSON 增强处理链路

- 抽取 JSON 字符串校验的重复解析逻辑
  - 为 JsonFieldProcessor 增加 supports 判断,减少无关字段处理
  - 优化 JsonValueEnhancer,未命中增强字段时直接返回原对象
  - 拆分响应增强渲染逻辑,提升代码可读性
  - 增强上下文属性管理能力
  - 优化翻译、脱敏处理器的字段匹配逻辑
  - 修正 Date 反序列化空字符串处理
  - 支持 LocalDateTime 秒级、毫秒级及负时间戳反序列化
This commit is contained in:
疯狂的狮子Li
2026-05-16 14:08:52 +08:00
parent 7b66f0de26
commit 2af4b2c7a3
8 changed files with 180 additions and 68 deletions
@@ -20,6 +20,11 @@ public class SensitiveJsonFieldProcessor implements JsonFieldProcessor {
@Autowired(required = false)
private SensitiveService sensitiveService;
@Override
public boolean supports(JsonFieldContext fieldContext) {
return fieldContext.getAnnotation(Sensitive.class) != null;
}
@Override
public Object process(JsonFieldContext fieldContext, Object value, JsonEnhancementContext context) {
Sensitive sensitive = fieldContext.getAnnotation(Sensitive.class);