调度命令-调度台调度

This commit is contained in:
xzb 2022-09-15 17:40:28 +08:00
parent 07a476bcfe
commit 1e9d953c3b
7 changed files with 17 additions and 28 deletions

View File

@ -18,10 +18,6 @@ public class DisCmd {
* 调度命令号(不一定唯一)
*/
private String cmdCode;
/**
* 调度命令的创建平台识别号
*/
private String cpId;
/**
* 标题
*/

View File

@ -121,7 +121,7 @@ public class DisCmdApiController {
*/
public static class ClearCacheReqVo{
/**
* 调度命令的创建平台识别号
* 调度命令的创建平台(调度台或车站code)识别号
*/
private String cpId;
}
@ -131,7 +131,7 @@ public class DisCmdApiController {
@Data
public static class DeleteFromCacheReqVo{
/**
* 调度命令的创建平台识别号
* 调度命令的创建平台(调度台或车站code)识别号
*/
private String cpId;
/**

View File

@ -9,16 +9,16 @@ import java.time.LocalDateTime;
*/
@Data
public class DisCmdSendCompany {
/**
* 发令单位类型
*/
private Type type = Type.Undefined;
/**
* 发令单位名称
*/
private String name;
/**
* 发令单位code
* 发令平台类型
*/
private Type type = Type.Undefined;
/**
* 发令平台code
*/
private String code;
/**

View File

@ -104,8 +104,6 @@ public class DisCmdConvertor {
return to;
}
public static DisCmd convert(DisCmdSrcVo from,DisCmd to){
//
to.setCpId(from.getCpId());
to.setAuthState(from.getAuthState());
to.setCmdId(from.getCmdId());
to.setCmdCode(from.getCmdCode());

View File

@ -49,27 +49,27 @@ public class DisCmdService {
}
/**
* 删除缓存箱中的某条调度命令
* @param cpId 调度命令的创建平台识别号
* @param cpId 调度命令的创建平台调度台或车站的code识别号
* @param cmdId
*/
public void deleteFromCache(Simulation simulation,String cpId,String cmdId){
CtcRepository ctcRepository = simulation.getCtcRepository();
DisCmd cmd = this.findDisCmd(simulation,cmdId);
if(null != cmd){
final boolean can = cpId.equals(cmd.getCpId())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState());
final boolean can = cpId.equals(cmd.getSendCompany().getCode())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(can, String.format("仿真(%s),调度命令id(%s)的删除校验失败", simulation.getId(),cmdId));
ctcRepository.getDisCmdMap().remove(cmdId);
}
}
/**
* 清空缓存箱中的所有调度命令
* @param cpId 调度命令的创建平台识别号
* @param cpId 调度命令的创建平台调度台或车站的code识别号
*/
public void clearCache(Simulation simulation,String cpId){
CtcRepository ctcRepository = simulation.getCtcRepository();
List<String> clearList = new ArrayList<>();
ctcRepository.getDisCmdMap().values().forEach(cmd->{
if(cpId.equals(cmd.getCpId())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState())){
if(cpId.equals(cmd.getSendCompany().getCode())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState())){
clearList.add(cmd.getCmdId());
}
});

View File

@ -11,18 +11,17 @@ import java.time.LocalDateTime;
*/
@Data
public class DisCmdSendCompanyVo {
/**
* 发令单位类型[Dispatcher(调度台) Station(车站)]
* @see DisCmdSendCompany.Type
*/
private String type = "Undefined";
/**
* 发令单位名称
*/
private String name;
/**
* 发令单位code
* 发令平台类型[Dispatcher(调度台) Station(车站)]
* @see DisCmdSendCompany.Type
*/
private String type = "Undefined";
/**
* 发令平台code
*/
private String code;
/**

View File

@ -10,10 +10,6 @@ import java.util.List;
*/
@Data
public class DisCmdSrcVo {
/**
* 调度命令的创建平台识别号
*/
private String cpId;
/**
* 标题
*/