Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
c61ac54e2b
@ -84,6 +84,12 @@ public class RunPlanDraftController {
|
||||
iRunPlanDraftService.deleteDiagramDraftData(planId, user);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除运行图数据")
|
||||
@DeleteMapping(path = "/{planId}/data")
|
||||
public void deleteDraftData(@PathVariable Long planId, @RequestAttribute UserVO user) {
|
||||
iRunPlanDraftService.deleteDraftData(planId, user);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "运行图草稿发布")
|
||||
@PostMapping(path = "/{planId}/publish")
|
||||
public List<String> publish(@PathVariable Long planId, @RequestAttribute UserVO user) {
|
||||
@ -210,6 +216,15 @@ public class RunPlanDraftController {
|
||||
this.iRunPlanDraftService.copyRunPlanService(planId, serviceNumber, serviceConfig, user);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "平移计划")
|
||||
@PutMapping(path = "/{planId}/service/{serviceNumber}/move")
|
||||
public void moveRunPlanService(@PathVariable Long planId,
|
||||
@PathVariable String serviceNumber,
|
||||
@RequestBody RunPlanServiceConfigVO serviceConfig,
|
||||
@ApiIgnore @RequestAttribute UserVO user) {
|
||||
this.iRunPlanDraftService.moveRunPlanService(planId, serviceNumber, serviceConfig, user);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改计划号")
|
||||
@PutMapping(path = "/{planId}/service/{serviceNumber}/serviceNumber")
|
||||
public void updateRunPlanService(@PathVariable Long planId, @PathVariable String serviceNumber, String newServiceNumber) {
|
||||
|
@ -59,6 +59,8 @@ public interface IRunPlanDraftService {
|
||||
*/
|
||||
void deleteDiagramDraftData(Long planId, UserVO user);
|
||||
|
||||
void deleteDraftData(Long planId, UserVO userVO);
|
||||
|
||||
/**
|
||||
* 运行图草稿发布
|
||||
*/
|
||||
@ -178,6 +180,9 @@ public interface IRunPlanDraftService {
|
||||
*/
|
||||
void copyRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
|
||||
|
||||
@Transactional
|
||||
void moveRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
|
||||
|
||||
void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber);
|
||||
|
||||
/**
|
||||
|
@ -95,10 +95,10 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput,UserVO userVO) {
|
||||
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput, UserVO userVO) {
|
||||
RunPlanDraft draftPlan = runPlanDraftDAO.selectByPrimaryKey(id);
|
||||
MapVO mapVO = this.iMapService.getMapDetail(draftPlan.getMapId());
|
||||
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(userVO.getId(),runPlanInput, mapVO);
|
||||
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(userVO.getId(), runPlanInput, mapVO);
|
||||
draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
|
||||
draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
|
||||
@ -152,6 +152,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
runPlanDraftDAO.deleteByPrimaryKey(planId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDraftData(Long planId, UserVO userVO) {
|
||||
RunPlanDraft planDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(Objects.equals(planDraft.getCreatorId(), userVO.getId()));
|
||||
planDraft.setTrips(null);
|
||||
planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(planDraft);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void publish(Long planId, UserVO userVO) {
|
||||
@ -178,7 +187,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertHasText(runPlanDraft.getTrips(),
|
||||
"运行图车次数据为空,请检查!");
|
||||
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
|
||||
if(StringUtils.hasText(runPlanName)) runPlanVO.setName(runPlanName);
|
||||
if (StringUtils.hasText(runPlanName)) runPlanVO.setName(runPlanName);
|
||||
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
|
||||
iRunPlanTemplateService.draftPublish(runPlanVO, userVO);
|
||||
runPlanDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_03);
|
||||
@ -408,14 +417,14 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
public List getRoutingSectionList(Long planId, String routingCode) {
|
||||
RunPlanDraft runPlanDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||
MapVO mapVO = this.iMapService.getMapDetail(runPlanDraft.getMapId());
|
||||
if(mapVO.isDrawWay()){
|
||||
if (mapVO.isDrawWay()) {
|
||||
|
||||
MapRoutingDataVO routingVO = mapVO.findRoutingDataByCode(routingCode);
|
||||
if (Objects.nonNull(routingVO)) {
|
||||
return routingVO.getParkSectionCodeList();
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
MapRoutingVO routingVO = mapVO.findRoutingByCode(routingCode);
|
||||
if (Objects.nonNull(routingVO)) {
|
||||
return routingVO.getRoutingSectionList();
|
||||
@ -446,17 +455,17 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
String startSectionCode = routingData.getStartSectionCode();
|
||||
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
||||
MapSectionNewVO endReentrySection = null;
|
||||
if(endSection.isStandTrack()) {
|
||||
if (endSection.isStandTrack()) {
|
||||
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode,"车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode, "车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||
}
|
||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||
MapSectionNewVO startReentrySection = null;
|
||||
if(startSection.isStandTrack()) {
|
||||
if (startSection.isStandTrack()) {
|
||||
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode,"车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode, "车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||
}
|
||||
|
||||
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData, startReentrySection, endReentrySection);
|
||||
@ -509,15 +518,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
RunPlanVO planVO = getRunPlanById(planId);
|
||||
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
||||
if (Objects.nonNull(inputData.getDepartureInterval())) {
|
||||
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.naturalOrder()).orElse("0");
|
||||
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.naturalOrder()).orElse("0");
|
||||
// 当前已有最大服务号
|
||||
int maxServiceNumber = Integer.parseInt(max);
|
||||
inputData.setServiceNumber(String.format("%03d", ++maxServiceNumber));
|
||||
Integer departureInterval = inputData.getDepartureInterval() < 60 ? 180 : inputData.getDepartureInterval();
|
||||
inputData.setDepartureInterval(departureInterval);
|
||||
}
|
||||
List<RunPlanTripVO> newTripList = runPlanGenerator.generatorTrips(userId,inputData,mapVO);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(newTripList),String.format("生成服务号%s运行图数据失败",inputData.getServiceNumber()));
|
||||
List<RunPlanTripVO> newTripList = runPlanGenerator.generatorTrips(userId, inputData, mapVO);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(newTripList), String.format("生成服务号%s运行图数据失败", inputData.getServiceNumber()));
|
||||
planVO.getTripList().addAll(newTripList);
|
||||
RunPlanDraft planDraft = planVO.convert2Draft();
|
||||
planDraft.setTrips(JsonUtils.writeValueAsString(planVO.getTripList()));
|
||||
@ -587,9 +596,14 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
planTripVO.setRight(tripVO.getRight());
|
||||
planTripVO.setDestinationCode(tripVO.getDestinationCode());
|
||||
planTripVO.setStartSectionCode(tripVO.getStartSectionCode());
|
||||
planTripVO.setStartTime(tripVO.getStartTime().plusSeconds(seconds));
|
||||
planTripVO.setEndSectionCode(tripVO.getEndSectionCode());
|
||||
planTripVO.setEndTime(tripVO.getEndTime().plusSeconds(seconds));
|
||||
if (serviceConfig.isForward()) {
|
||||
planTripVO.setStartTime(tripVO.getStartTime().minusSeconds(seconds));
|
||||
planTripVO.setEndTime(tripVO.getEndTime().minusSeconds(seconds));
|
||||
} else {
|
||||
planTripVO.setStartTime(tripVO.getStartTime().plusSeconds(seconds));
|
||||
planTripVO.setEndTime(tripVO.getEndTime().plusSeconds(seconds));
|
||||
}
|
||||
planTripVO.setIsReentry(tripVO.getIsReentry());
|
||||
planTripVO.setIsOutbound(tripVO.getIsOutbound());
|
||||
planTripVO.setIsInbound(tripVO.getIsInbound());
|
||||
@ -620,7 +634,49 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||
}
|
||||
|
||||
/**修改服务号号*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void moveRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(serviceConfig.getIntervals() > 0, "服务计划平移时间需大于0s");
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(this.ifServerExists(planId, serviceNumber));
|
||||
RunPlanVO planVO = getRunPlanById(planId);
|
||||
int intervals = serviceConfig.getIntervals();
|
||||
boolean forward = serviceConfig.isForward();
|
||||
if (forward) {
|
||||
planVO.getTripList().stream()
|
||||
.filter(tripVO -> tripVO.getServiceNumber().equals(serviceNumber))
|
||||
.forEach(tr -> {
|
||||
tr.setStartTime(tr.getStartTime().minusSeconds(intervals));
|
||||
tr.setEndTime(tr.getEndTime().minusSeconds(intervals));
|
||||
for (RunPlanTripTimeVO timeVO : tr.getTimeList()) {
|
||||
timeVO.setArrivalTime(timeVO.getArrivalTime().minusSeconds(intervals));
|
||||
timeVO.setDepartureTime(timeVO.getDepartureTime().minusSeconds(intervals));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
planVO.getTripList().stream()
|
||||
.filter(tripVO -> tripVO.getServiceNumber().equals(serviceNumber))
|
||||
.forEach(tr -> {
|
||||
tr.setStartTime(tr.getStartTime().plusSeconds(intervals));
|
||||
tr.setEndTime(tr.getEndTime().plusSeconds(intervals));
|
||||
for (RunPlanTripTimeVO timeVO : tr.getTimeList()) {
|
||||
timeVO.setArrivalTime(timeVO.getArrivalTime().plusSeconds(intervals));
|
||||
timeVO.setDepartureTime(timeVO.getDepartureTime().plusSeconds(intervals));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RunPlanDraft planDraft = planVO.convert2Draft();
|
||||
planDraft.setTrips(JsonUtils.writeValueAsString(planVO.getTripList()));
|
||||
planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务号号
|
||||
*/
|
||||
@Override
|
||||
public void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber) {
|
||||
RunPlanVO runPlanVO = getRunPlanById(planId);
|
||||
@ -662,10 +718,12 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
// planDraft.setTrips(JsonUtils.writeValueAsString(runPlanVO.getTripList()));
|
||||
// planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
// runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||
this.addTrip(runPlanVO, del.getServiceNumber(), tripConfig,userVO);
|
||||
this.addTrip(runPlanVO, del.getServiceNumber(), tripConfig, userVO);
|
||||
}
|
||||
|
||||
/**修改车次号*/
|
||||
/**
|
||||
* 修改车次号
|
||||
*/
|
||||
@Override
|
||||
public void updateRunPlanTripNumber(Long planId, String SDTNumber, String tripNumber) {
|
||||
RunPlanVO runPlanVO = getRunPlanById(planId);
|
||||
@ -681,8 +739,10 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||
}
|
||||
|
||||
/** 添加车次号(不校验服务号)*/
|
||||
private void addTrip(RunPlanVO runPlanVO, String serviceNumber, RunPlanTripConfigVO tripConfig,UserVO userVO) {
|
||||
/**
|
||||
* 添加车次号(不校验服务号)
|
||||
*/
|
||||
private void addTrip(RunPlanVO runPlanVO, String serviceNumber, RunPlanTripConfigVO tripConfig, UserVO userVO) {
|
||||
MapVO mapVO = this.iMapService.getMapDetail(runPlanVO.getMapId());
|
||||
RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userVO.getId(), mapVO.getId());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "运行图-用户缺少配置或没有配置车站折返数据");
|
||||
@ -699,19 +759,19 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
String startSectionCode = routingData.getStartSectionCode();
|
||||
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
||||
MapSectionNewVO endReentrySection = null;
|
||||
if(endSection.isStandTrack()) {
|
||||
if (endSection.isStandTrack()) {
|
||||
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode,"车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode, "车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||
}
|
||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||
MapSectionNewVO startReentrySection = null;
|
||||
if(startSection.isStandTrack()) {
|
||||
if (startSection.isStandTrack()) {
|
||||
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode,"车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode, "车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||
}
|
||||
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
|
||||
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
|
||||
// 构建类车到站数据
|
||||
// tripVO = new RunPlanTripVO(tripConfig, routing);
|
||||
setDirectionCode(mapVO.getConfigVO().getUpRight(), tripVO);
|
||||
@ -757,6 +817,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteRunPlanTrip(Long planId, String SDTNumber, boolean deleteBefore, UserVO userVO) {
|
||||
@ -844,9 +905,9 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
for (int i = 0; i < tripList.size(); i++) {
|
||||
RunPlanTripVO tripVO = tripList.get(i);
|
||||
if (DirectionType.Type02.equals(tripVO.getDirectionCode())) {
|
||||
tripVO.setTripNumber(tripVO.getDirectionCode()+ String.format("%03d", ++upTripNumber));
|
||||
tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", ++upTripNumber));
|
||||
} else if (DirectionType.Type01.equals(tripVO.getDirectionCode())) {
|
||||
tripVO.setTripNumber(tripVO.getDirectionCode()+ String.format("%03d", ++downTripNumber));
|
||||
tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", ++downTripNumber));
|
||||
}
|
||||
if (i == 0) {
|
||||
tripVO.setIsOutbound(true);
|
||||
@ -906,17 +967,17 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
RunPlanVO planVO = getRunPlanById(planId);
|
||||
planVO.getTripList().forEach(tripVO -> {
|
||||
List<RunPlanTripTimeVO> timeList = tripVO.getTimeList();
|
||||
if(CollectionUtils.isEmpty(timeList) || timeList.size()<2){
|
||||
if (CollectionUtils.isEmpty(timeList) || timeList.size() < 2) {
|
||||
return;
|
||||
}
|
||||
RunPlanTripTimeVO first = timeList.get(0);
|
||||
RunPlanTripTimeVO second = timeList.get(1);
|
||||
RunPlanTripTimeVO second2Last = timeList.get(timeList.size()-2);
|
||||
RunPlanTripTimeVO last = timeList.get(timeList.size()-1);
|
||||
if(Objects.equals(first.getStationCode(),second.getStationCode())){
|
||||
RunPlanTripTimeVO second2Last = timeList.get(timeList.size() - 2);
|
||||
RunPlanTripTimeVO last = timeList.get(timeList.size() - 1);
|
||||
if (Objects.equals(first.getStationCode(), second.getStationCode())) {
|
||||
timeList.remove(first);
|
||||
}
|
||||
if(timeList.size()>2 && Objects.equals(second2Last.getStationCode(),last.getStationCode())){
|
||||
if (timeList.size() > 2 && Objects.equals(second2Last.getStationCode(), last.getStationCode())) {
|
||||
timeList.remove(last);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user