调度命令

This commit is contained in:
xzb 2022-09-14 14:32:16 +08:00
parent 8abff77bad
commit d1e9c258f0
10 changed files with 146 additions and 2 deletions

View File

@ -1292,6 +1292,14 @@ public class Operation {
* 保存调度命令
*/
CTC_SAVE_DIS_COMMAND(new Label[]{Label.OTHER}),
/**
* 删除缓存箱某条调度命令
*/
CTC_DELETE_DIS_COMMAND(new Label[]{Label.OTHER}),
/**
* 清空缓存箱调度命令
*/
CTC_CLEAR_DIS_COMMAND(new Label[]{Label.OTHER}),
//---------------------------- 行车簿册 -------------------------
/**
* 填写行车簿册

View File

@ -11,7 +11,6 @@ import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.*;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
@ -108,4 +107,21 @@ public class RailCtcDisCmdOperateHandler {
public FindAllDisCmdForHolderRspVo findAllForHolder(Simulation simulation, String holderType, String holderCode, String trainNum) {
return disCmdFindService.findAllForHolder(simulation, DisCmdHolderEnum.valueOf(holderType), holderCode, trainNum);
}
/**
* 删除缓存箱中的某条调度命令
* @param cpId 调度命令的创建平台识别号
* @param disCmdCode
*/
@OperateHandlerMapping(type = Operation.Type.CTC_DELETE_DIS_COMMAND)
public void deleteFromCache(Simulation simulation,String cpId,String disCmdCode){
disCmdService.deleteFromCache(simulation,cpId,disCmdCode);
}
/**
* 清空缓存箱中的所有调度命令
* @param cpId 调度命令的创建平台识别号
*/
@OperateHandlerMapping(type = Operation.Type.CTC_CLEAR_DIS_COMMAND)
public void clearCache(Simulation simulation,String cpId){
disCmdService.clearCache(simulation,cpId);
}
}

View File

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

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.*;
import club.joylink.rtss.simulation.cbtc.Simulation;
import lombok.Data;
@ -100,9 +102,44 @@ public class DisCmdApiController {
public FindAllDisCmdForHolderRspVo findAllForHolder(@RequestBody FindReqVo param) {
return null;
}
/**
* 删除缓存箱中的某条调度命令
*/
@PostMapping("/1-5471-194-903/operate/CTC_DELETE_DIS_COMMAND")
public void deleteFromCache(@RequestBody DeleteFromCacheReqVo param){
}
/**
* 清空缓存箱中的所有调度命令
*/
@PostMapping("/1-5471-194-903/operate/CTC_CLEAR_DIS_COMMAND")
public void clearCache(@RequestBody ClearCacheReqVo param){
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 清空缓存箱中的所有调度命令
*/
public static class ClearCacheReqVo{
/**
* 调度命令的创建平台识别号
*/
private String cpId;
}
/**
* 删除缓存箱中的某条调度命令
*/
@Data
public static class DeleteFromCacheReqVo{
/**
* 调度命令的创建平台识别号
*/
private String cpId;
/**
* 要删除的调度命令号
*/
private String disCmdCode;
}
@Data
public static class FindReceiptsReqVo{

View File

@ -100,6 +100,7 @@ public class DisCmdConvertor {
}
public static DisCmd convert(DisCmdSrcVo from,DisCmd to){
//
to.setCpId(from.getCpId());
to.setAuthState(from.getAuthState());
to.setCode(from.getCode());
to.setContent(from.getContent());

View File

@ -65,6 +65,22 @@ public class DisCmdReceiptService {
}
rsp.add(rtv);
}
if(null!=rc.getTransReceiveTime()){
ReceiptVo rtv = new ReceiptVo();
rtv.setDisCmdCode(cmd.getCode());
rtv.setTime(rc.getTransReceiveTime());
rtv.setState(ReceiptVo.Status.TrainSrmReceived.name());
rtv.setSrmStation(rc.getTransStationCode());
rsp.add(rtv);
}
if(null!=rc.getTransSendTime()){
ReceiptVo rtv = new ReceiptVo();
rtv.setDisCmdCode(cmd.getCode());
rtv.setTime(rc.getTransSendTime());
rtv.setState(ReceiptVo.Status.TrainSrmSent.name());
rtv.setSrmStation(rc.getTransStationCode());
rsp.add(rtv);
}
if(null!=rc.getSignTime()){
ReceiptVo rtv = new ReceiptVo();
rtv.setDisCmdCode(cmd.getCode());

View File

@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@ -40,6 +41,36 @@ public class DisCmdService {
int id = ctcRepository.getDispatchCommandIdGenerator().getAndIncrement();
return String.valueOf(id);
}
/**
* 删除缓存箱中的某条调度命令
* @param cpId 调度命令的创建平台识别号
* @param disCmdCode
*/
public void deleteFromCache(Simulation simulation,String cpId,String disCmdCode){
CtcRepository ctcRepository = simulation.getCtcRepository();
DisCmd cmd = ctcRepository.getDisCmdMap().get(disCmdCode);
if(null != cmd){
final boolean can = cpId.equals(cmd.getCpId())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(can, String.format("仿真(%s),调度命令(%s)的删除校验失败", simulation.getId(),disCmdCode));
ctcRepository.getDisCmdMap().remove(disCmdCode);
}
}
/**
* 清空缓存箱中的所有调度命令
* @param cpId 调度命令的创建平台识别号
*/
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())){
clearList.add(cmd.getCode());
}
});
clearList.forEach(cmdId->{
ctcRepository.getDisCmdMap().remove(cmdId);
});
}
/**
* 保存调度命令,保存到发送方缓存箱(保存到仓库)
*/

View File

@ -0,0 +1,23 @@
package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo;
import lombok.Data;
/**
* 新建调度命令请求
*/
@Data
public class DisCmdNewReqVo {
/**
* 是否启用根据调度命令类型独立滚号模式
* <p>
* 默认值 - false <br>
* 当按类型独立滚号启用时每个类型一个号段这样调度命令号仍然唯一
*/
private Boolean enableByType = false;
/**
* 调度命令类型
* <p>
* 当enableByType=true时有效
*/
private String cmdType;
}

View File

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

View File

@ -14,7 +14,7 @@ public class ReceiptVo {
*/
private String disCmdCode;
/**
* 回执状态[Sent(已发送) AllSigned(已全部签收) Received(已接收) Signed(已签收) ProxySigned(已代签) Read(已阅读) Rejected(已拒签)]
* 回执状态[Sent(已发送) AllSigned(已全部签收) Received(已接收) Signed(已签收) ProxySigned(已代签) Read(已阅读) Rejected(已拒签) TrainSrmReceived(车站自律机中转接收无线调令) TrainSrmSent(车站自律机中转发送无线调令)]
* @see ReceiptVo.Status
*/
private String state;
@ -75,6 +75,10 @@ public class ReceiptVo {
AllSigned,
//已接收
Received,
//无线调令车站自律机接收
TrainSrmReceived,
//无线调令车站自律机发送
TrainSrmSent,
//已签收
Signed,
//已代签