Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin

This commit is contained in:
tiger_zhou 2022-10-27 14:42:58 +08:00
commit 987dbbe43c
2 changed files with 33 additions and 27 deletions

View File

@ -368,17 +368,16 @@ public class Training2Service {
return;
}
// 获取步骤中未完成的操作
Operation2 operation2 = step.getCurrentRunOperation();
Operation2.SimOperation2 operation2 = step.getCurrentRunSimOperation();
if (operation2 == null) {
return;
}
if (operation2 instanceof Operation2.SimOperation2) {
Operation2.SimOperation2 simOperation2 = (Operation2.SimOperation2) operation2;
// 为会话操作
if (CONVERSATION_LIST.contains(simOperation2.getOperationType().name()) && CONVERSATION_LIST.contains(event.getOperate())) {
checkSimOperationConversation(simOperation2, simulation, step);
} else if (simOperation2.getOperationType().name().equals(event.getOperate())
&& compareParams(event.getParams(), simOperation2.getParams())) {
if (CONVERSATION_LIST.contains(operation2.getOperationType().name())
&& CONVERSATION_LIST.contains(event.getOperate())) {
checkSimOperationConversation(operation2, simulation, step);
} else if (operation2.getOperationType().name().equals(event.getOperate())
&& compareParams(event.getParams(), operation2.getParams())) {
operation2.doOperated(); // 标识已操作过
} else {
// 错误操作数增加
@ -391,12 +390,11 @@ public class Training2Service {
if (!CollectionUtils.isEmpty(training2.getIndexList())) {
training2.getIndexList().stream()
.filter(index -> !index.isContinuity() && !CollectionUtils.isEmpty(index.getOperationType())
&& index.getOperationType().contains(simOperation2.getOperationType())
&& index.getOperationType().contains(operation2.getOperationType())
&& training2.getIndexAlgorithmMap().containsKey(index.name())
)
.forEach(index -> training2.getIndexAlgorithmMap().get(index.name())
.calculation(simulation, simOperation2.getParams()));
}
.calculation(simulation, operation2.getParams()));
}
}
}

View File

@ -25,6 +25,8 @@ public class StepRule {
private List<OperationRule> operationRules;
private List<OperationRule.SimOperationRule> simOperationRules;
private ValuableRule.ExpressionVORule triggerRule;
private ValuableRule.ExpressionVORule completionRule;
@ -40,9 +42,15 @@ public class StepRule {
copyStep2.setDescription(description.generateContent(simulation, mapElement));
}
if (!CollectionUtils.isEmpty(operationRules)) { // 操作规则
List<Operation2VO> operationList = operationRules.stream().map(o -> o.convert2BO(simulation, mapElement)).collect(Collectors.toList());
List<Operation2VO> operationList = operationRules.stream().map(o -> o.convert2BO(simulation, mapElement))
.collect(Collectors.toList());
copyStep2.setOperations(operationList);
}
if (!CollectionUtils.isEmpty(simOperationRules)) { // 实训操作列表
List<Operation2VO.SimOperation2VO> simOperationList = simOperationRules.stream()
.map(o -> (Operation2VO.SimOperation2VO) o.convert2BO(simulation, mapElement)).collect(Collectors.toList());
copyStep2.setSimOperations(simOperationList);
}
if (triggerRule != null) { // 触发规则
copyStep2.setTriggerCondition((ExpressionVO) triggerRule.convert2BO(simulation, mapElement));
}