Commit b80e0bc9023c8e33eaeb40e520f3e925fcef74e6
1 parent
a97c9c6f
feat(tax-central): 新增文档字段类型OTHER并优化JSON解析
- 在DocumentFieldType枚举中新增OTHER类型,值为3,描述为"其他"- 优化handleAdopt方法中的JSON反序列化实现,增强代码可读性- 保持原有业务逻辑不变,确保与其他字段类型的兼容性
Showing
1 changed file
with
7 additions
and
1 deletions
tax-central/src/main/java/com/diligrp/tax/central/type/DocumentFieldType.java
| ... | ... | @@ -18,7 +18,8 @@ public enum DocumentFieldType { |
| 18 | 18 | @Override |
| 19 | 19 | public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { |
| 20 | 20 | List<Map<String, Object>> list = new ArrayList<>(); |
| 21 | - Map<String, Object> data = JsonUtils.fromJsonString(json, new TypeReference<HashMap<String, Object>>() {}); | |
| 21 | + Map<String, Object> data = JsonUtils.fromJsonString(json, new TypeReference<HashMap<String, Object>>() { | |
| 22 | + }); | |
| 22 | 23 | data.forEach((k, v) -> { |
| 23 | 24 | if (v instanceof Object[] os) { |
| 24 | 25 | Arrays.stream(os).forEach(o -> list.add(JsonPathUtils.parseToMap(o, keyword.getDocumentValueContent()))); |
| ... | ... | @@ -27,6 +28,11 @@ public enum DocumentFieldType { |
| 27 | 28 | res.put(keyword.getDocumentField(), list); |
| 28 | 29 | } |
| 29 | 30 | }, |
| 31 | + OTHER(3, "其他") { | |
| 32 | + @Override | |
| 33 | + public void handleAdopt(Map<String, Object> res, PipelineBusinessKeyword keyword, String json) { | |
| 34 | + } | |
| 35 | + }, | |
| 30 | 36 | ; |
| 31 | 37 | public final int value; |
| 32 | 38 | public final String desc; | ... | ... |