【行车日志删除标识操作】

【行车计划同一车次限制】
This commit is contained in:
weizhihong 2022-07-18 14:21:30 +08:00
parent febb565223
commit c794758d09
5 changed files with 31 additions and 29 deletions

View File

@ -108,7 +108,7 @@ public class CtcStationRunPlanOperateHandler {
*/
@OperateHandlerMapping(type = Operation.Type.CTC_REMOVE_RUN_PLAN)
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode);
}
/**
@ -273,7 +273,7 @@ public class CtcStationRunPlanOperateHandler {
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_DELETE_LABEL)
public void setDelete(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode);
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode, status);
}
/**

View File

@ -231,11 +231,14 @@ public class CtcStationRunPlanLogService {
* @param stationCode 车站信息
* @param runPlanCode 运行编码
*/
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) {
ctcStationRunPlanLog.setDelete(Boolean.TRUE);
// ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
if (status == 1 && ctcStationRunPlanLog.getStatus() != -1) {
ctcStationRunPlanLog.setStatus(-1);
ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
} else {
ctcStationRunPlanLog.setStatus(0);
ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE);
}
}
@ -438,12 +441,11 @@ public class CtcStationRunPlanLogService {
// 确定车次信息
String tripNumber = runPlanParam.generateTripNumber();
// 确定车次班次
if (StringUtils.isEmpty(runPlanParam.getGroupNumber())) {
long time = simulation.getCtcRepository().getAllRunPlanList().stream()
.filter(r -> tripNumber.equals(r.getTripNumber()) && stationCode.equals(r.getStation().getCode()))
.count();
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(time > 0, "本站存在相同车次运行记录");
runPlanParam.generateGroupNumber(time + 1);
}
runPlanParam.generateRunPlanCode();
// 设置默认的实际时间
runPlanParam.setDefaultActual();
@ -598,8 +600,8 @@ public class CtcStationRunPlanLogService {
*/
private boolean modifyRunPlanInfo(Simulation simulation, CtcStationRunPlanLog runPlanLog, CtcRunPlanParam planParam) {
boolean change;
if (planParam.getStatus() == -1) {
runPlanLog.setDelete(Boolean.TRUE);
if (planParam.getStatus() == -1) { // 删除状态
runPlanLog.setStatus(planParam.getStatus());
}
// 到达
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true, false);

View File

@ -43,11 +43,11 @@ public class CtcZoneService {
if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息
// 确定车次信息
String tripNumber = planParam.generateTripNumber();
// 确定车次班次
if (StringUtils.isEmpty(planParam.getGroupNumber())) {
// 目前先限制添加车次
long time = railwayRepository.getTripNumberNum(planParam.getStationCode(), tripNumber);
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(time > 1, "本站存在相同车次运行记录");
// 确定车次班次
planParam.generateGroupNumber(time);
}
planParam.generateRunPlanCode();
// 设置默认的实际时间
planParam.setDefaultActual();

View File

@ -88,11 +88,6 @@ public class CtcStationRunPlanLog {
*/
private boolean origin;
/**
* 是否删除
*/
private Boolean delete;
/**
* 客运车
*/
@ -154,6 +149,11 @@ public class CtcStationRunPlanLog {
*/
private CtcRunPlanParam.RunType runType;
/**
* 状态
*/
private int status;
public CtcStationRunPlanLog(CtcRunPlanParam paramInfo) {
this.planParam = paramInfo;
this.code = paramInfo.getRunPlanCode();
@ -195,7 +195,7 @@ public class CtcStationRunPlanLog {
}
});
// 删除状态
this.delete = paramInfo.getStatus() == -1;
this.status = paramInfo.getStatus();
this.startRunPlan = paramInfo.getStartRunPlan() != null && paramInfo.getStartRunPlan();
this.endRunPlan = paramInfo.getEndRunPlan() != null && paramInfo.getEndRunPlan();
this.trainType = paramInfo.getTrainType();

View File

@ -67,7 +67,7 @@ public class CtcStationRunPlanLogVO {
/**
* 删除标识
*/
private Boolean delete;
private Integer status;
/**
* 重点列车
@ -153,7 +153,7 @@ public class CtcStationRunPlanLogVO {
this.tripNumber = ctcStationRunPlanLog.getTripNumber();
this.remark = ctcStationRunPlanLog.getRemark();
this.lateReason = ctcStationRunPlanLog.getLateReason();
this.delete = ctcStationRunPlanLog.getDelete(); // 删除
this.status = ctcStationRunPlanLog.getStatus(); // 删除
this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车
this.military = ctcStationRunPlanLog.getMilitary(); // 军用
this.transfinite = ctcStationRunPlanLog.getTransfinite(); // 超限等级
@ -193,9 +193,9 @@ public class CtcStationRunPlanLogVO {
public CtcStationRunPlanLogVO compareAndChange(CtcStationRunPlanLog runPlanLog) {
CtcStationRunPlanLogVO changeCtcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlanLog.getStation().getCode(), runPlanLog.getCode());
boolean change = false;
if (!Objects.equals(this.delete, runPlanLog.getDelete())) {
this.delete = runPlanLog.getDelete();
changeCtcStationRunPlanLogVO.setDelete(runPlanLog.getDelete());
if (!Objects.equals(this.status, runPlanLog.getStatus())) {
this.status = runPlanLog.getStatus();
changeCtcStationRunPlanLogVO.setStatus(runPlanLog.getStatus());
change = true;
}
// 存在不一样的选项