|
|
|
|
@@ -7,21 +7,27 @@ import com.solution.rule.domain.config.RuleConfig;
|
|
|
|
|
import com.solution.rule.domain.config.RuleConfigParam;
|
|
|
|
|
import com.solution.rule.domain.config.RuleConfigQuery;
|
|
|
|
|
import com.solution.rule.domain.config.RuleDictItem;
|
|
|
|
|
import com.solution.rule.domain.config.RuleParamMeta;
|
|
|
|
|
import com.solution.rule.mapper.RuleConfigMapper;
|
|
|
|
|
import com.solution.rule.service.IRuleConfigService;
|
|
|
|
|
import com.solution.rule.service.RuleDrlSyncService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
|
|
|
|
|
private static final Pattern RULE_SLOT_KEYS = Pattern.compile("^(blueRuleKeywords|redRuleKeywords|ruleScore)_\\d+$");
|
|
|
|
|
private static final boolean ALLOW_UNKNOWN_PARAM_KEY = false;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RuleConfigMapper ruleConfigMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RuleDrlSyncService ruleDrlSyncService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<RuleConfig> selectRuleConfigList(RuleConfigQuery query) {
|
|
|
|
|
@@ -48,6 +54,8 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
}
|
|
|
|
|
int rows = ruleConfigMapper.insertRuleConfig(fillDefault(ruleConfig));
|
|
|
|
|
saveChildren(ruleConfig);
|
|
|
|
|
// return rows;
|
|
|
|
|
syncDrlAfterCrud();
|
|
|
|
|
return rows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -63,6 +71,8 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
ruleConfigMapper.deleteParamsByRuleCodes(ruleCodes);
|
|
|
|
|
ruleConfigMapper.deleteTaskTypesByRuleCodes(ruleCodes);
|
|
|
|
|
saveChildren(ruleConfig);
|
|
|
|
|
// return rows;
|
|
|
|
|
syncDrlAfterCrud();
|
|
|
|
|
return rows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -74,7 +84,10 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
}
|
|
|
|
|
ruleConfigMapper.deleteParamsByRuleCodes(ruleCodes);
|
|
|
|
|
ruleConfigMapper.deleteTaskTypesByRuleCodes(ruleCodes);
|
|
|
|
|
return ruleConfigMapper.deleteRuleConfigByCodes(ruleCodes);
|
|
|
|
|
// return ruleConfigMapper.deleteRuleConfigByCodes(ruleCodes);
|
|
|
|
|
int rows = ruleConfigMapper.deleteRuleConfigByCodes(ruleCodes);
|
|
|
|
|
syncDrlAfterCrud();
|
|
|
|
|
return rows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -85,6 +98,27 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
return ruleConfigMapper.selectDictByType(dictType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> loadEnabledGlobalParams() {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
List<RuleConfigParam> params = ruleConfigMapper.selectEnabledParamsForGlobal();
|
|
|
|
|
if (CollUtil.isEmpty(params)) {
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
for (RuleConfigParam param : params) {
|
|
|
|
|
if (param == null || ObjectUtil.isEmpty(param.getParamKey())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
map.put(param.getParamKey(), parseValue(param.getParamVal(), param.getValType()));
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<RuleParamMeta> selectParamMetaList() {
|
|
|
|
|
return new ArrayList<>(metaMap().values());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveChildren(RuleConfig ruleConfig) {
|
|
|
|
|
if (CollUtil.isNotEmpty(ruleConfig.getParams())) {
|
|
|
|
|
Set<String> keys = new HashSet<>();
|
|
|
|
|
@@ -95,6 +129,7 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
if (!keys.add(param.getParamKey())) {
|
|
|
|
|
throw new RuntimeException("参数键重复: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
validateParam(param);
|
|
|
|
|
param.setRuleCode(ruleConfig.getRuleCode());
|
|
|
|
|
if (param.getSortNo() == null) {
|
|
|
|
|
param.setSortNo(0);
|
|
|
|
|
@@ -136,4 +171,200 @@ public class RuleConfigServiceImpl implements IRuleConfigService {
|
|
|
|
|
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void syncDrlAfterCrud() {
|
|
|
|
|
ruleDrlSyncService.syncGlobalParamsToDrl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object parseValue(String val, String valType) {
|
|
|
|
|
if ("bool".equalsIgnoreCase(valType) || "boolean".equalsIgnoreCase(valType)) {
|
|
|
|
|
return Boolean.parseBoolean(val);
|
|
|
|
|
}
|
|
|
|
|
if ("number".equalsIgnoreCase(valType)) {
|
|
|
|
|
if (val == null || val.trim().isEmpty()) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
String t = val.trim();
|
|
|
|
|
if (t.contains(".")) {
|
|
|
|
|
try {
|
|
|
|
|
return Double.parseDouble(t);
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
return Integer.parseInt(t);
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 多值按英文逗号分隔时保持字符串原样,不做拆分
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void validateParam(RuleConfigParam param) {
|
|
|
|
|
RuleParamMeta meta = resolveMeta(param.getParamKey());
|
|
|
|
|
if (meta == null) {
|
|
|
|
|
if (ALLOW_UNKNOWN_PARAM_KEY) {
|
|
|
|
|
param.setValType("string");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
throw new RuntimeException("不支持的参数键: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
String val = param.getParamVal();
|
|
|
|
|
if (Boolean.TRUE.equals(meta.getRequired()) && ObjectUtil.isEmpty(val)) {
|
|
|
|
|
throw new RuntimeException("参数值不能为空: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
if ("bool".equalsIgnoreCase(meta.getValueType())) {
|
|
|
|
|
if (!"true".equalsIgnoreCase(String.valueOf(val)) && !"false".equalsIgnoreCase(String.valueOf(val))) {
|
|
|
|
|
throw new RuntimeException("布尔参数仅支持 true/false: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
param.setValType("bool");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ("enum".equalsIgnoreCase(meta.getValueType())) {
|
|
|
|
|
if (CollUtil.isEmpty(meta.getEnumOptions()) || !meta.getEnumOptions().contains(val)) {
|
|
|
|
|
throw new RuntimeException("参数值不在可选范围内: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
param.setValType("string");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ("number".equalsIgnoreCase(meta.getValueType())) {
|
|
|
|
|
try {
|
|
|
|
|
double d = Double.parseDouble(String.valueOf(val));
|
|
|
|
|
if (meta.getMin() != null && d < meta.getMin()) {
|
|
|
|
|
throw new RuntimeException("参数值小于最小值: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
if (meta.getMax() != null && d > meta.getMax()) {
|
|
|
|
|
throw new RuntimeException("参数值大于最大值: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
throw new RuntimeException("数值参数格式错误: " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
param.setValType("number");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ("csv".equalsIgnoreCase(meta.getValueType())) {
|
|
|
|
|
if (meta.getPattern() != null && !Pattern.matches(meta.getPattern(), String.valueOf(val))) {
|
|
|
|
|
throw new RuntimeException("CSV 参数格式错误(英文逗号分隔): " + param.getParamKey());
|
|
|
|
|
}
|
|
|
|
|
param.setValType("string");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
param.setValType("string");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private RuleParamMeta resolveMeta(String key) {
|
|
|
|
|
RuleParamMeta direct = metaMap().get(key);
|
|
|
|
|
if (direct != null) {
|
|
|
|
|
return direct;
|
|
|
|
|
}
|
|
|
|
|
if (RULE_SLOT_KEYS.matcher(key).matches()) {
|
|
|
|
|
RuleParamMeta slotMeta = new RuleParamMeta();
|
|
|
|
|
slotMeta.setParamKey(key);
|
|
|
|
|
slotMeta.setLabel("规则槽动态参数");
|
|
|
|
|
slotMeta.setValueType(key.startsWith("ruleScore_") ? "number" : "csv");
|
|
|
|
|
slotMeta.setRequired(Boolean.TRUE);
|
|
|
|
|
slotMeta.setPattern("^[^,]+(?:,[^,]+)*$");
|
|
|
|
|
slotMeta.setDescription("支持 blueRuleKeywords_i/redRuleKeywords_i/ruleScore_i");
|
|
|
|
|
if (key.startsWith("ruleScore_")) {
|
|
|
|
|
slotMeta.setMin(0d);
|
|
|
|
|
}
|
|
|
|
|
return slotMeta;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, RuleParamMeta> metaMap() {
|
|
|
|
|
Map<String, RuleParamMeta> map = new LinkedHashMap<>();
|
|
|
|
|
map.put("executeTypeDefault", meta("executeTypeDefault", "执行类型", "enum", true, Arrays.asList("assault", "strike_test", "my_test_type"), null, null, null, "assault", "execute[0].type"));
|
|
|
|
|
map.put("positionRuleEnabled", meta("positionRuleEnabled", "阵位规则开关", "bool", true, null, null, null, null, "true", "是否执行阵位生成"));
|
|
|
|
|
map.put("trackRuleEnabled", meta("trackRuleEnabled", "航迹规则开关", "bool", true, null, null, null, null, "true", "是否执行航迹生成"));
|
|
|
|
|
map.put("groupRuleEnabled", meta("groupRuleEnabled", "编组规则开关", "bool", true, null, null, null, null, "true", "是否执行编组生成"));
|
|
|
|
|
map.put("enableTrackWarZoneClamp", meta("enableTrackWarZoneClamp", "航迹作战区约束开关", "bool", true, null, null, null, null, "true", "是否对航迹点进行作战区约束"));
|
|
|
|
|
map.put("enableWarZoneClamp", meta("enableWarZoneClamp", "阵位作战区约束开关", "bool", true, null, null, null, null, "true", "是否对阵位点进行作战区约束"));
|
|
|
|
|
map.put("targetPickMode", meta("targetPickMode", "目标分配模式", "enum", true, Arrays.asList("roundRobin", "random"), null, null, null, "roundRobin", "目标挑选方式"));
|
|
|
|
|
map.put("formationType", meta("formationType", "编队样式", "enum", true, Arrays.asList("line", "wedge", "circle"), null, null, null, "line", "平台编队样式"));
|
|
|
|
|
map.put("trackRouteAlgorithm", meta("trackRouteAlgorithm", "航迹算法", "enum", true, Arrays.asList("followBlue", "shortestPath", "flank", "jam"), null, null, null, "followBlue", "航迹变形算法"));
|
|
|
|
|
map.put("trackFlankSideMode", meta("trackFlankSideMode", "flank侧向模式", "enum", true, Arrays.asList("alternate", "left", "right"), null, null, null, "alternate", "侧向策略"));
|
|
|
|
|
map.put("groupFormationMode", meta("groupFormationMode", "编组模式", "enum", true, Arrays.asList("onePerRed", "clusterByCount", "singleGroup"), null, null, null, "onePerRed", "编组策略"));
|
|
|
|
|
map.put("groupLeaderPickMode", meta("groupLeaderPickMode", "领队选择模式", "enum", true, Arrays.asList("byHitRateThenId", "byId"), null, null, null, "byHitRateThenId", "领队策略"));
|
|
|
|
|
|
|
|
|
|
map.put("weight", meta("weight", "全局权重", "number", true, null, 0d, 100d, null, "1", "评分乘数"));
|
|
|
|
|
map.put("minSelectedScore", meta("minSelectedScore", "最小选中分", "number", true, null, 0d, 100000d, null, "1", "低于该分不选中"));
|
|
|
|
|
map.put("minTargetsPerRed", meta("minTargetsPerRed", "每红装最少目标数", "number", true, null, 1d, 20d, null, "1", "目标分配下限"));
|
|
|
|
|
map.put("maxTargetsPerRedCap", meta("maxTargetsPerRedCap", "每红装最多目标数", "number", true, null, 1d, 50d, null, "3", "目标分配上限"));
|
|
|
|
|
map.put("redHitRateThreshold", meta("redHitRateThreshold", "命中率阈值", "number", true, null, 0d, 1d, null, "0.6", "低于阈值触发补拿"));
|
|
|
|
|
map.put("maxExtraWeaponsPerTask", meta("maxExtraWeaponsPerTask", "补拿装备上限", "number", true, null, 0d, 20d, null, "2", "每任务补拿数量"));
|
|
|
|
|
map.put("maxSupplementRounds", meta("maxSupplementRounds", "补拿轮次上限", "number", true, null, 0d, 20d, null, "2", "补拿循环轮次"));
|
|
|
|
|
map.put("extraPickMinScore", meta("extraPickMinScore", "补拿最低分", "number", true, null, 0d, 100000d, null, "1", "补拿分数门槛"));
|
|
|
|
|
map.put("deployDistanceKmMin", meta("deployDistanceKmMin", "部署距离最小值(km)", "number", true, null, 0d, 1000d, null, "8", "部署距离下限"));
|
|
|
|
|
map.put("deployDistanceKmMax", meta("deployDistanceKmMax", "部署距离最大值(km)", "number", true, null, 0d, 1000d, null, "30", "部署距离上限"));
|
|
|
|
|
map.put("deployDistanceKmDefault", meta("deployDistanceKmDefault", "默认部署距离(km)", "number", true, null, 0d, 1000d, null, "15", "默认部署距离"));
|
|
|
|
|
map.put("formationSpacingMeters", meta("formationSpacingMeters", "编队间距(米)", "number", true, null, 1d, 100000d, null, "300", "编队间距"));
|
|
|
|
|
map.put("formationHeadingOffsetDeg", meta("formationHeadingOffsetDeg", "编队偏转角(度)", "number", true, null, 0d, 360d, null, "15", "编队航向偏移"));
|
|
|
|
|
map.put("defaultDeployHeight", meta("defaultDeployHeight", "默认部署高度(米)", "number", true, null, -10000d, 100000d, null, "30", "默认部署高度"));
|
|
|
|
|
map.put("heightFollowBlueRatio", meta("heightFollowBlueRatio", "高度跟随比例", "number", true, null, 0d, 100d, null, "0.0", "高度跟随系数"));
|
|
|
|
|
map.put("minInterPlatformDistanceMeters", meta("minInterPlatformDistanceMeters", "最小平台间距(米)", "number", true, null, 0d, 100000d, null, "80", "平台最小间距"));
|
|
|
|
|
map.put("trackFallbackBearingDeg", meta("trackFallbackBearingDeg", "航迹默认回退方位角", "number", true, null, 0d, 360d, null, "0", "航迹回退方位"));
|
|
|
|
|
map.put("fallbackBearingDeg", meta("fallbackBearingDeg", "默认回退方位角", "number", true, null, 0d, 360d, null, "0", "阵位回退方位"));
|
|
|
|
|
map.put("trackExtraNodesMax", meta("trackExtraNodesMax", "航迹额外插点数", "number", true, null, 0d, 1000d, null, "0", "额外插值节点"));
|
|
|
|
|
map.put("trackShortPathSegments", meta("trackShortPathSegments", "短路径分段数", "number", true, null, 1d, 1000d, null, "3", "最短路径分段"));
|
|
|
|
|
map.put("trackFlankOffsetMeters", meta("trackFlankOffsetMeters", "flank偏移(米)", "number", true, null, 0d, 100000d, null, "800", "侧向偏移"));
|
|
|
|
|
map.put("trackJamWobbleMeters", meta("trackJamWobbleMeters", "jam摆动振幅(米)", "number", true, null, 0d, 100000d, null, "400", "正弦扰动振幅"));
|
|
|
|
|
map.put("trackJamSegments", meta("trackJamSegments", "jam周期数", "number", true, null, 1d, 1000d, null, "4", "正弦周期"));
|
|
|
|
|
map.put("groupClusterSize", meta("groupClusterSize", "编组人数上限", "number", true, null, 1d, 1000d, null, "3", "固定人数编组上限"));
|
|
|
|
|
map.put("groupMinMembersForWingman", meta("groupMinMembersForWingman", "生成僚机最小人数", "number", true, null, 1d, 1000d, null, "2", "僚机人数阈值"));
|
|
|
|
|
map.put("wingmanDistanceBaseMeters", meta("wingmanDistanceBaseMeters", "僚机基础距离(米)", "number", true, null, 0d, 100000d, null, "100", "僚机基础距离"));
|
|
|
|
|
map.put("wingmanDistanceStepMeters", meta("wingmanDistanceStepMeters", "僚机距离步长(米)", "number", true, null, 0d, 100000d, null, "50", "僚机距离步长"));
|
|
|
|
|
map.put("wingmanAngleBaseDeg", meta("wingmanAngleBaseDeg", "僚机基础角度(度)", "number", true, null, 0d, 360d, null, "50", "僚机基础角度"));
|
|
|
|
|
map.put("wingmanAngleStepDeg", meta("wingmanAngleStepDeg", "僚机角度步长(度)", "number", true, null, 0d, 360d, null, "15", "僚机角度步长"));
|
|
|
|
|
map.put("wingmanAltBaseMeters", meta("wingmanAltBaseMeters", "僚机基础高度(米)", "number", true, null, -10000d, 100000d, null, "40", "僚机基础高度"));
|
|
|
|
|
map.put("wingmanAltScale", meta("wingmanAltScale", "僚机高度缩放", "number", true, null, 0d, 100d, null, "1.0", "僚机高度系数"));
|
|
|
|
|
map.put("minRangeToAllowAssignKm", meta("minRangeToAllowAssignKm", "允许分配最小射程(km)", "number", true, null, 0d, 100000d, null, "0", "射程过滤阈值"));
|
|
|
|
|
|
|
|
|
|
map.put("tieBreak", meta("tieBreak", "并列决策方式", "enum", true, Arrays.asList("equipmentId"), null, null, null, "equipmentId", "并列评分决策"));
|
|
|
|
|
map.put("positionAnchorMode", meta("positionAnchorMode", "阵位锚点模式", "enum", true, Arrays.asList("hybrid"), null, null, null, "hybrid", "当前仅支持hybrid"));
|
|
|
|
|
map.put("trackPointDirectionMode", meta("trackPointDirectionMode", "航向计算模式", "enum", true, Arrays.asList("head2next", "tail2prev"), null, null, null, "head2next", "航向计算方式"));
|
|
|
|
|
map.put("warZoneClampMode", meta("warZoneClampMode", "作战区约束模式", "enum", true, Arrays.asList("nearestInside"), null, null, null, "nearestInside", "当前仅支持nearestInside"));
|
|
|
|
|
map.put("trackRouteNameSuffix", meta("trackRouteNameSuffix", "航迹名称后缀", "string", true, null, null, null, null, "航迹", "航迹名称后缀"));
|
|
|
|
|
map.put("groupDrawNameSuffix", meta("groupDrawNameSuffix", "编组名称后缀", "string", true, null, null, null, null, "编组", "编组名称后缀"));
|
|
|
|
|
map.put("groupDrawNameWithIndex", meta("groupDrawNameWithIndex", "编组名称带序号", "bool", true, null, null, null, null, "false", "是否追加序号"));
|
|
|
|
|
map.put("outputDrawNameSuffix", meta("outputDrawNameSuffix", "任务名称后缀", "string", true, null, null, null, null, "打击任务", "装备匹配后的名称后缀"));
|
|
|
|
|
map.put("trackGroundTrackType", meta("trackGroundTrackType", "地面航迹类型", "string", true, null, null, null, null, "routeLineGround", "非飞行航迹类型"));
|
|
|
|
|
map.put("rangeUnit", meta("rangeUnit", "射程单位", "enum", true, Arrays.asList("km", "m"), null, null, null, "km", "射程单位"));
|
|
|
|
|
|
|
|
|
|
map.put("bluePlatformKeywords_air", meta("bluePlatformKeywords_air", "蓝方空中平台关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "F-16,J-10,F-35", "英文逗号分隔"));
|
|
|
|
|
map.put("redPreferredWhenBlueAir", meta("redPreferredWhenBlueAir", "红方空中偏好关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "防空,导弹,无人机", "英文逗号分隔"));
|
|
|
|
|
map.put("airTaskKeywords", meta("airTaskKeywords", "空中任务关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "空中,制空,拦截,空战", "英文逗号分隔"));
|
|
|
|
|
map.put("groundTaskKeywords", meta("groundTaskKeywords", "地面任务关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "地面,突击,登陆", "英文逗号分隔"));
|
|
|
|
|
map.put("redPreferredWhenGround", meta("redPreferredWhenGround", "红方地面偏好关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "远火,榴弹,炮,火箭", "英文逗号分隔"));
|
|
|
|
|
map.put("tankKeywords", meta("tankKeywords", "坦克关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "坦克,装甲", "英文逗号分隔"));
|
|
|
|
|
map.put("redMatchKeywords_tank", meta("redMatchKeywords_tank", "红方反坦克关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "反坦克", "英文逗号分隔"));
|
|
|
|
|
map.put("missileKeywords", meta("missileKeywords", "导弹关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "导弹,火箭弹,巡航", "英文逗号分隔"));
|
|
|
|
|
map.put("redMatchKeywords_missile", meta("redMatchKeywords_missile", "红方导弹匹配关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "防空,导弹,导弹发射", "英文逗号分隔"));
|
|
|
|
|
map.put("radToTargetsCsv", meta("radToTargetsCsv", "命中率映射", "string", true, null, null, null, "^\\d+(?:\\.\\d+)?:\\d+(?:,\\d+(?:\\.\\d+)?:\\d+)*$", "0.8:1,0.5:2,0.2:3", "阈值:目标数,英文逗号分隔"));
|
|
|
|
|
map.put("distanceByPlatformCsv", meta("distanceByPlatformCsv", "按平台部署距离映射", "string", false, null, null, null, "^(|[^,:]+:\\d+(?:\\.\\d+)?(?:,[^,:]+:\\d+(?:\\.\\d+)?)*?)$", "防空:18,反坦克:10", "关键词:距离,英文逗号分隔"));
|
|
|
|
|
map.put("trackAirDataTypeCsv", meta("trackAirDataTypeCsv", "空中dataType关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "taskPlane,air,plane,flight", "英文逗号分隔"));
|
|
|
|
|
map.put("trackAirKeywordsCsv", meta("trackAirKeywordsCsv", "空中关键词", "csv", true, null, null, null, "^[^,]+(?:,[^,]+)*$", "机,飞,空,J-,F-", "英文逗号分隔"));
|
|
|
|
|
map.put("rangeParseRegex", meta("rangeParseRegex", "射程提取正则", "string", true, null, null, null, null, "(\\\\d+(?:\\\\.\\\\d+)?)", "Java正则表达式"));
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private RuleParamMeta meta(String key, String label, String valueType, boolean required, List<String> enumOptions,
|
|
|
|
|
Double min, Double max, String pattern, String example, String description) {
|
|
|
|
|
RuleParamMeta m = new RuleParamMeta();
|
|
|
|
|
m.setParamKey(key);
|
|
|
|
|
m.setLabel(label);
|
|
|
|
|
m.setValueType(valueType);
|
|
|
|
|
m.setRequired(required);
|
|
|
|
|
m.setEnumOptions(enumOptions);
|
|
|
|
|
m.setMin(min);
|
|
|
|
|
m.setMax(max);
|
|
|
|
|
m.setPattern(pattern);
|
|
|
|
|
m.setExample(example);
|
|
|
|
|
m.setDescription(description);
|
|
|
|
|
return m;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|