diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MemberRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MemberRule.java index 678a3af8d..ef6996a6e 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MemberRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MemberRule.java @@ -4,6 +4,10 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.springframework.util.CollectionUtils; import java.util.List; @@ -12,6 +16,10 @@ import java.util.stream.Collectors; /** * 筛选人员规则 */ +@Setter +@Getter +@NoArgsConstructor +@AllArgsConstructor public class MemberRule { /** diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/OperationRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/OperationRule.java index 0b6e77e97..32b8e766d 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/OperationRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/OperationRule.java @@ -2,7 +2,6 @@ package club.joylink.rtss.vo.training2.rule; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.Simulation; -import club.joylink.rtss.vo.client.training2.ExpressionVO; import club.joylink.rtss.vo.client.training2.Operation2VO; import lombok.Getter; import lombok.NoArgsConstructor; @@ -27,13 +26,13 @@ public abstract class OperationRule { protected void convertExpressionRule(Operation2VO operation2, Simulation simulation, Object mapElement) { if (triggerRule != null) { - operation2.setTriggerCondition((ExpressionVO) triggerRule.convert2BO(simulation, mapElement)); + operation2.setTriggerCondition(triggerRule.convert2BO(simulation, mapElement)); } if (completionRule != null) { - operation2.setCompletionCondition((ExpressionVO) completionRule.convert2BO(simulation, mapElement)); + operation2.setCompletionCondition(completionRule.convert2BO(simulation, mapElement)); } if (failureRule != null) { - operation2.setFailureCondition((ExpressionVO) failureRule.convert2BO(simulation, mapElement)); + operation2.setFailureCondition(failureRule.convert2BO(simulation, mapElement)); } } 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 6dbeac1ef..6d295c9f2 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 @@ -4,7 +4,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; -import club.joylink.rtss.vo.client.training2.ExpressionVO; import club.joylink.rtss.vo.client.training2.Operation2VO; import club.joylink.rtss.vo.client.training2.Step2VO; import lombok.Getter; @@ -59,13 +58,13 @@ public class StepRule { copyStep2.setSimCommands(simCommandList); } if (triggerRule != null) { // 触发规则 - copyStep2.setTriggerCondition((ExpressionVO) triggerRule.convert2BO(simulation, mapElement)); + copyStep2.setTriggerCondition(triggerRule.convert2BO(simulation, mapElement)); } if (completionRule != null) { // 完成规则 - copyStep2.setCompletionCondition((ExpressionVO) completionRule.convert2BO(simulation, mapElement)); + copyStep2.setCompletionCondition(completionRule.convert2BO(simulation, mapElement)); } if (failureRule != null) { // 失败规则 - copyStep2.setFailureCondition((ExpressionVO) failureRule.convert2BO(simulation, mapElement)); + copyStep2.setFailureCondition(failureRule.convert2BO(simulation, mapElement)); } if (!CollectionUtils.isEmpty(tipPositionRule)) { // 定位信息 tipPositionRule.forEach((k, v) -> { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java index 80634a3ef..d49a9321f 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java @@ -80,16 +80,6 @@ public class Training2Rule { */ private Long creatorId; - /** - * 创建时间 - */ - private LocalDateTime createTime; - - /** - * 更新时间 - */ - private LocalDateTime updateTime; - public DraftTraining2WithBLOBs convert2BO(Simulation simulation, MapNamedElement mapElement) { DraftTraining2WithBLOBs copyTraining2 = new DraftTraining2WithBLOBs(); // 地图ID @@ -117,8 +107,8 @@ public class Training2Rule { List step2VOList = steps.stream().map(s -> s.convert2BO(simulation, mapElement)).collect(Collectors.toList()); copyTraining2.setStepJson(JsonUtils.writeValueAsString(step2VOList)); // 扮演者集合 - List playerList = step2VOList.stream().filter(s -> !StringUtils.isEmpty(s.getMemberId())).map(s -> s.getMemberId()) - .distinct().collect(Collectors.toList()); + List playerList = step2VOList.stream().filter(s -> !StringUtils.isEmpty(s.getMemberId())) + .map(Step2VO::getMemberId).distinct().collect(Collectors.toList()); if (CollectionUtils.isEmpty(playerList)) { throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据:无扮演者"); } @@ -132,8 +122,8 @@ public class Training2Rule { List simulationMemberPOList = SimulationMemberPO.convertFromBOList(simulation.getSimulationMembers()); copyTraining2.setMemberJson(JsonUtils.writeValueAsString(simulationMemberPOList)); copyTraining2.setCreatorId(creatorId); - copyTraining2.setCreateTime(createTime); - copyTraining2.setUpdateTime(updateTime); + copyTraining2.setCreateTime(LocalDateTime.now()); + copyTraining2.setUpdateTime(LocalDateTime.now()); return copyTraining2; } } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/ValuableRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/ValuableRule.java index 653cd1aeb..fb2c17d4f 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/ValuableRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/ValuableRule.java @@ -32,7 +32,7 @@ public abstract class ValuableRule { private PropertyValueRule elementCodeRule; @Override - public ValuableVO convert2BO(Simulation simulation, Object mapElement) { + public StatusValueVO convert2BO(Simulation simulation, Object mapElement) { StatusValueVO valuable = JsonUtils.read(JsonUtils.writeValueAsString(this.getValuableVO()), StatusValueVO.class); if (elementCodeRule != null) { valuable.setElementCode(elementCodeRule.resolve(simulation, mapElement)); @@ -48,7 +48,7 @@ public abstract class ValuableRule { private ValuableRule[] valueRules; @Override - public ValuableVO convert2BO(Simulation simulation, Object mapElement) { + public ExpressionVO convert2BO(Simulation simulation, Object mapElement) { ExpressionVO valuable = JsonUtils.read(JsonUtils.writeValueAsString(this.getValuableVO()), ExpressionVO.class); if (valueRules != null) { ValuableVO[] valuables = valuable.getValuables(); @@ -67,7 +67,7 @@ public abstract class ValuableRule { @NoArgsConstructor public static class ValueVORule extends ValuableRule { @Override - public ValuableVO convert2BO(Simulation simulation, Object mapElement) { + public ValueVO convert2BO(Simulation simulation, Object mapElement) { return JsonUtils.read(JsonUtils.writeValueAsString(this.getValuableVO()), ValueVO.class); } }