【用户无角色结束实训操作】
This commit is contained in:
parent
10f9ebc161
commit
1e94f3ae5a
@ -236,20 +236,25 @@ public class Training2Service {
|
||||
if (simulation == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
|
||||
}
|
||||
boolean participant = simulation.getSimulationMembers().stream().anyMatch(m -> user.getId().equals(m.getUserId()));
|
||||
Training2 training2 = simulation.getTraining2();
|
||||
Map<String, Float> scoreMap;
|
||||
Map<String, Float> scoreMap = new HashMap<>();
|
||||
if (training2 != null) {
|
||||
// 创建者退出,则清理实训
|
||||
if (simulation.getCreator().getId().equals(user.getId())) {
|
||||
training2.finish();
|
||||
removeTrainingJob(simulation);
|
||||
}
|
||||
scoreMap = training2.mark();
|
||||
} else {
|
||||
scoreMap = new HashMap<>();
|
||||
if (participant || simulation.getCreator().getId().equals(user.getId())) {
|
||||
scoreMap = training2.mark();
|
||||
}
|
||||
}
|
||||
if (participant) {
|
||||
SimulationMember member = simulation.getSimulationMemberByUserId(user.getId());
|
||||
return scoreMap.get(member.getId());
|
||||
} else {
|
||||
return 0f;
|
||||
}
|
||||
SimulationMember member = simulation.getSimulationMemberByUserId(user.getId());
|
||||
return scoreMap.get(member.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,6 @@ package club.joylink.rtss.simulation.cbtc.CI.data;
|
||||
import club.joylink.rtss.constants.DirectionLabelEnum;
|
||||
import club.joylink.rtss.entity.DraftMapStationDirection;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -22,7 +19,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
@ExpConditionMaterialSrcAnno(name = "StationDirection", deviceType = MapElement.DeviceType.STATION_DIRECTION)
|
||||
public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
||||
/**
|
||||
* 发辅助默认倒计时 25s
|
||||
@ -82,7 +78,6 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
||||
/**
|
||||
* 处于接、发状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "runStatus", type = ReceiveAndDeliverModel.class, desc = "接、发状态", category = ExpTypeCategory.ENUM)
|
||||
private ReceiveAndDeliverModel runStatus;
|
||||
|
||||
/**
|
||||
@ -121,7 +116,6 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
||||
/**
|
||||
* 改方按钮状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "changeDirectionStatus", type = boolean.class, desc = "改方状态")
|
||||
private boolean changeDirectionStatus;
|
||||
|
||||
/**
|
||||
@ -137,19 +131,16 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
||||
/**
|
||||
* 接辅助
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "receiveAssistStatus", type = boolean.class, desc = "接辅助状态")
|
||||
private boolean receiveAssistStatus;
|
||||
|
||||
/**
|
||||
* 发辅助
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "deliverAssistStatus", type = boolean.class, desc = "发辅助状态")
|
||||
private boolean deliverAssistStatus;
|
||||
|
||||
/**
|
||||
* 辅助准备完毕状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "assistReadyStatus", type = boolean.class, desc = "辅助办理完成")
|
||||
private boolean assistReadyStatus;
|
||||
|
||||
/**
|
||||
@ -162,7 +153,6 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
||||
/**
|
||||
* 闭塞
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "blockStatus", type = boolean.class, desc = "闭塞状态")
|
||||
private boolean blockStatus;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,47 @@
|
||||
package club.joylink.rtss.simulation.cbtc.CI.data;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 自动闭塞属性,前端需要状态
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@ExpConditionMaterialSrcAnno(name = "StationDirectionAuto", deviceType = MapElement.DeviceType.STATION_DIRECTION)
|
||||
public class StationDirectionAuto {
|
||||
|
||||
/**
|
||||
* 处于接、发状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "runStatus", type = StationDirection.ReceiveAndDeliverModel.class, desc = "接、发状态", category = ExpTypeCategory.ENUM)
|
||||
private StationDirection.ReceiveAndDeliverModel runStatus;
|
||||
|
||||
/**
|
||||
* 改方按钮状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "changeDirectionStatus", type = boolean.class, desc = "改方状态")
|
||||
private boolean changeDirectionStatus;
|
||||
|
||||
/**
|
||||
* 接辅助
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "receiveAssistStatus", type = boolean.class, desc = "接辅助状态")
|
||||
private boolean receiveAssistStatus;
|
||||
|
||||
/**
|
||||
* 发辅助
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "deliverAssistStatus", type = boolean.class, desc = "发辅助状态")
|
||||
private boolean deliverAssistStatus;
|
||||
|
||||
/**
|
||||
* 辅助准备完毕状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "assistReadyStatus", type = boolean.class, desc = "辅助办理完成")
|
||||
private boolean assistReadyStatus;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package club.joylink.rtss.simulation.cbtc.CI.data;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.vo.ExpTypeCategory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 由于前端需要区别,先分开处理
|
||||
* 半自动闭塞,前端需要状态
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@ExpConditionMaterialSrcAnno(name = "StationDirectionSemi", deviceType = MapElement.DeviceType.STATION_DIRECTION)
|
||||
public class StationDirectionSemi {
|
||||
/**
|
||||
* 处于接、发状态
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "runStatus", type = StationDirection.ReceiveAndDeliverModel.class, desc = "接、发状态", category = ExpTypeCategory.ENUM)
|
||||
private StationDirection.ReceiveAndDeliverModel runStatus;
|
||||
|
||||
/**
|
||||
* 闭塞
|
||||
*/
|
||||
@ExpConditionMaterialAnno(name = "blockStatus", type = boolean.class, desc = "闭塞状态")
|
||||
private boolean blockStatus;
|
||||
}
|
@ -15,7 +15,7 @@ public enum SwitchIndication {
|
||||
/**
|
||||
* 无(失表)
|
||||
*/
|
||||
NO("反位"),
|
||||
NO("失表"),
|
||||
/**
|
||||
* 挤叉
|
||||
*/
|
||||
|
@ -3,11 +3,13 @@ package club.joylink.rtss.simulation.cbtc.training2.ecm.vo;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@NoArgsConstructor
|
||||
public class ExpConditionMaterialVo {
|
||||
/**
|
||||
@ -67,7 +69,8 @@ public class ExpConditionMaterialVo {
|
||||
}
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
resultList = null;
|
||||
log.error(enumClass.getSimpleName() + "没有label描述字段");
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user