Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin
This commit is contained in:
commit
600f4ebe04
@ -114,13 +114,22 @@ public class VoiceParseServiceImpl implements VoiceParseService {
|
|||||||
List<ParamExtractRule> paramsRules = result.getRule().getParamsRules();
|
List<ParamExtractRule> paramsRules = result.getRule().getParamsRules();
|
||||||
List<ParamExtractResult> paramExtractResults = new ArrayList<>(paramsRules.size());
|
List<ParamExtractResult> paramExtractResults = new ArrayList<>(paramsRules.size());
|
||||||
ParamExtractResult extractResult = null;
|
ParamExtractResult extractResult = null;
|
||||||
|
String[] groupStrArr = null;
|
||||||
|
int groupSize = groupList.size();
|
||||||
for (ParamExtractRule rule : paramsRules) {
|
for (ParamExtractRule rule : paramsRules) {
|
||||||
if (groupList.size() < rule.getIndex()) {
|
if (rule.getIndexArr() != null) { // 如果定位信息不为空
|
||||||
result.setSuccess(false);
|
groupStrArr = new String[rule.getIndexArr().length];
|
||||||
result.setMsg("提取参数出错");
|
for (int index = 0, len = groupStrArr.length; index < len; index ++) {
|
||||||
return;
|
if (groupSize < rule.getIndexArr()[index]) {
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMsg("提取参数出错");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
groupStrArr[index] = groupList.get(rule.getIndexArr()[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extractResult = rule.getParseRule().matchParam(simulation, groupList.get(rule.getIndex()));
|
extractResult = new ParamExtractResult();
|
||||||
|
extractResult.setValue(rule.getParseRule().matchParam(simulation, groupStrArr));
|
||||||
paramExtractResults.add(extractResult);
|
paramExtractResults.add(extractResult);
|
||||||
}
|
}
|
||||||
result.setParamExtractResultList(paramExtractResults);
|
result.setParamExtractResultList(paramExtractResults);
|
||||||
|
@ -9,17 +9,17 @@ import lombok.Data;
|
|||||||
public class CommandParamRule {
|
public class CommandParamRule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 方法参数对应的参数名:优先使用
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结果类型
|
* 方法参数所在位置:通过反射获取
|
||||||
*/
|
*/
|
||||||
private String type;
|
private Integer paramIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对应解析参数位置
|
* 对应解析参数位置:VoiceDiscriminateResult.paramExtractResultList的位置
|
||||||
*/
|
*/
|
||||||
private Integer index;
|
private Integer index;
|
||||||
|
|
||||||
|
@ -11,11 +11,12 @@ public enum ExtractRule {
|
|||||||
|
|
||||||
STATION_NAME {
|
STATION_NAME {
|
||||||
@Override
|
@Override
|
||||||
public ParamExtractResult matchParam(Simulation simulation, String sourceStr) {
|
public Object matchParam(Simulation simulation, String... sourceStr) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract ParamExtractResult matchParam(Simulation simulation, String sourceStr);
|
|
||||||
|
public abstract Object matchParam(Simulation simulation, String... sourceStr);
|
||||||
}
|
}
|
@ -7,13 +7,10 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ParamExtractResult {
|
public class ParamExtractResult {
|
||||||
/**
|
|
||||||
* 设置名
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据
|
* 参数解析出的相关数据
|
||||||
*/
|
*/
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
}
|
}
|
@ -7,23 +7,13 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ParamExtractRule {
|
public class ParamExtractRule {
|
||||||
/**
|
|
||||||
* 参数名
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否是设备
|
|
||||||
*/
|
|
||||||
private boolean isDevice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析规则
|
* 解析规则
|
||||||
*/
|
*/
|
||||||
private ExtractRule parseRule;
|
private ExtractRule parseRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* group位置索引
|
* group位置索引,有时需要多个参数信息定位具体值,始终信号机定位进路
|
||||||
*/
|
*/
|
||||||
private Integer index;
|
private Integer[] indexArr;
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc.discriminate;
|
|||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user