准备修复枚举
This commit is contained in:
parent
6b1947d7ee
commit
7a5627add7
@ -57,7 +57,8 @@ public class ApplicationTest__03 {
|
|||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
for(Object obj: list) {
|
for(Object obj: list) {
|
||||||
Map<String, String> map = JSON.parseObject(JSON.toJSONString(obj), Map.class);
|
Map<String, String> map = JSON.parseObject(JSON.toJSONString(obj), Map.class);
|
||||||
result = FormatUtil.stealBeamsAndReplacePillars(result, map);
|
// result = FormatUtil.stealBeamsAndReplacePillars(result, map);
|
||||||
|
result = FormatUtil.stealBeamsAndReplacePillars(result, map, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step.3
|
// Step.3
|
||||||
|
@ -8,4 +8,7 @@ package com.example.demo.parser.process.constant;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
public final class ParserProcessConstant {
|
public final class ParserProcessConstant {
|
||||||
|
|
||||||
|
public static final String LOG_GROUP_LINE = String.format(" %s> %s <%s", "=".repeat(20), "%s","=".repeat(20));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,13 @@ package com.example.demo.parser.process.core;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.example.demo.parser.process.constant.ParserProcessConstant;
|
||||||
import com.example.demo.parser.process.domain.ConfigValue;
|
import com.example.demo.parser.process.domain.ConfigValue;
|
||||||
import com.example.demo.parser.process.domain.LevelConfig;
|
import com.example.demo.parser.process.domain.LevelConfig;
|
||||||
import com.example.demo.parser.process.domain.ValueConfig;
|
import com.example.demo.parser.process.domain.ValueConfig;
|
||||||
import com.example.demo.draft.demo043.util.FormatUtil;
|
import com.example.demo.draft.demo043.util.FormatUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -27,6 +30,7 @@ import java.util.regex.Pattern;
|
|||||||
* @author 岳佳君 (2025年09月27日 19:54:24)
|
* @author 岳佳君 (2025年09月27日 19:54:24)
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class EnhancedConfigProcessor {
|
public class EnhancedConfigProcessor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -222,6 +226,9 @@ public class EnhancedConfigProcessor {
|
|||||||
|
|
||||||
// 1. 应用正则表达式
|
// 1. 应用正则表达式
|
||||||
if (configValue.getRegexPattern() != null && configValue.getRegexReplacement() != null) {
|
if (configValue.getRegexPattern() != null && configValue.getRegexReplacement() != null) {
|
||||||
|
log.info("{}", String.format(ParserProcessConstant.LOG_GROUP_LINE, "应用正则表达式"));
|
||||||
|
log.info("RegexPattern = {}", configValue.getRegexPattern());
|
||||||
|
log.info("RegexReplacement = {}", configValue.getRegexReplacement());
|
||||||
try {
|
try {
|
||||||
Pattern pattern = Pattern.compile(configValue.getRegexPattern());
|
Pattern pattern = Pattern.compile(configValue.getRegexPattern());
|
||||||
Matcher matcher = pattern.matcher(strValue);
|
Matcher matcher = pattern.matcher(strValue);
|
||||||
@ -233,11 +240,15 @@ public class EnhancedConfigProcessor {
|
|||||||
|
|
||||||
// 2. 应用枚举映射
|
// 2. 应用枚举映射
|
||||||
if (configValue.getEnumMapping() != null && configValue.getEnumMapping().containsKey(strValue)) {
|
if (configValue.getEnumMapping() != null && configValue.getEnumMapping().containsKey(strValue)) {
|
||||||
|
log.info("{}", String.format(ParserProcessConstant.LOG_GROUP_LINE, "应用枚举映射"));
|
||||||
|
log.info("EnumMapping = {}", JSON.toJSONString(configValue.getEnumMapping()));
|
||||||
strValue = configValue.getEnumMapping().get(strValue);
|
strValue = configValue.getEnumMapping().get(strValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 应用工具函数
|
// 3. 应用工具函数
|
||||||
if (configValue.getUtilFunction() != null && !configValue.getUtilFunction().isEmpty()) {
|
if (configValue.getUtilFunction() != null && !configValue.getUtilFunction().isEmpty()) {
|
||||||
|
log.info("{}", String.format(ParserProcessConstant.LOG_GROUP_LINE, "应用工具函数"));
|
||||||
|
log.info("Function = {}", JSON.toJSONString(configValue.getUtilFunction()));
|
||||||
strValue = applyUtilFunction(strValue, configValue.getUtilFunction(), context, loopIndex);
|
strValue = applyUtilFunction(strValue, configValue.getUtilFunction(), context, loopIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
<速度>350</速度>
|
<速度>350</速度>
|
||||||
<高度>2500</高度>
|
<高度>2500</高度>
|
||||||
<高度属性>相对高度</高度属性>
|
<高度属性>相对高度</高度属性>
|
||||||
<升将率>0</升将率>
|
<升降率>0</升降率>
|
||||||
</任务航线>
|
</任务航线>
|
@ -11,5 +11,5 @@
|
|||||||
<速度>250 m/s</速度>
|
<速度>250 m/s</速度>
|
||||||
<高度>500</高度>
|
<高度>500</高度>
|
||||||
<高度属性>相对高度</高度属性>
|
<高度属性>相对高度</高度属性>
|
||||||
<升将率>-5</升将率>
|
<升降率>-5</升降率>
|
||||||
</任务航线>
|
</任务航线>
|
@ -11,5 +11,5 @@
|
|||||||
<速度>300</速度>
|
<速度>300</速度>
|
||||||
<高度>1000</高度>
|
<高度>1000</高度>
|
||||||
<高度属性>相对高度</高度属性>
|
<高度属性>相对高度</高度属性>
|
||||||
<升将率>5</升将率>
|
<升降率>5</升降率>
|
||||||
</任务航线>
|
</任务航线>
|
@ -11,5 +11,5 @@
|
|||||||
<速度>400</速度>
|
<速度>400</速度>
|
||||||
<高度>2000</高度>
|
<高度>2000</高度>
|
||||||
<高度属性>绝对高度</高度属性>
|
<高度属性>绝对高度</高度属性>
|
||||||
<升将率>-3</升将率>
|
<升降率>-3</升降率>
|
||||||
</任务航线>
|
</任务航线>
|
@ -50,7 +50,15 @@
|
|||||||
"combined": false,
|
"combined": false,
|
||||||
"value": "{{任务航线.航线点类型}}"
|
"value": "{{任务航线.航线点类型}}"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"enumMapping": {
|
||||||
|
"起飞点": "N1",
|
||||||
|
"航路点": "N2",
|
||||||
|
"降落点": "N3",
|
||||||
|
"拐弯点": "N4",
|
||||||
|
"爬坡点": "N5",
|
||||||
|
"返航点": "N6"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"comment": "准时到达时间",
|
"comment": "准时到达时间",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user