From cb66ac91c0b98980243bc8e0ab2b11600ce2372a Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 26 Oct 2022 16:06:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/training2/Training2Service.java | 50 +++++++++---------- .../rtss/vo/training2/rule/StepRule.java | 10 +++- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java index a73f9679c..69b9b27e7 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java @@ -368,35 +368,33 @@ 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())) { - operation2.doOperated(); // 标识已操作过 - } else { - // 错误操作数增加 - operation2.getCount().incrementAndGet(); - // 错误提示 - // 发送操作完成信息 - applicationContext.publishEvent(new SimulationOperationErrorEvent(this, simulation, operation2, step)); - } - // 检查是否要计算指标 - if (!CollectionUtils.isEmpty(training2.getIndexList())) { - training2.getIndexList().stream() - .filter(index -> !index.isContinuity() && !CollectionUtils.isEmpty(index.getOperationType()) - && index.getOperationType().contains(simOperation2.getOperationType()) - && training2.getIndexAlgorithmMap().containsKey(index.name()) - ) - .forEach(index -> training2.getIndexAlgorithmMap().get(index.name()) - .calculation(simulation, 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 { + // 错误操作数增加 + operation2.getCount().incrementAndGet(); + // 错误提示 + // 发送操作完成信息 + applicationContext.publishEvent(new SimulationOperationErrorEvent(this, simulation, operation2, step)); + } + // 检查是否要计算指标 + if (!CollectionUtils.isEmpty(training2.getIndexList())) { + training2.getIndexList().stream() + .filter(index -> !index.isContinuity() && !CollectionUtils.isEmpty(index.getOperationType()) + && index.getOperationType().contains(operation2.getOperationType()) + && training2.getIndexAlgorithmMap().containsKey(index.name()) + ) + .forEach(index -> training2.getIndexAlgorithmMap().get(index.name()) + .calculation(simulation, operation2.getParams())); } } } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/StepRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/StepRule.java index 04b56fd8f..46febd190 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/StepRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/StepRule.java @@ -25,6 +25,8 @@ public class StepRule { private List operationRules; + private List 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 operationList = operationRules.stream().map(o -> o.convert2BO(simulation, mapElement)).collect(Collectors.toList()); + List operationList = operationRules.stream().map(o -> o.convert2BO(simulation, mapElement)) + .collect(Collectors.toList()); copyStep2.setOperations(operationList); } + if (!CollectionUtils.isEmpty(simOperationRules)) { // 实训操作列表 + List 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)); }