Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-01-26 14:32:29 +08:00
commit 4322ed671e
3 changed files with 6 additions and 7 deletions

View File

@ -144,9 +144,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
if (!planRunlevelService.isExisted(l)) {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
SectionPosition startPosition = new SectionPosition(startSection,startSection.getStopPointByDirection(l.getRight()));
SectionPosition endPosition = new SectionPosition(endSection,endSection.getStopPointByDirection(l.getRight()));
Float distance = CalculateService.calculateDistance(startPosition, endPosition, l.getRight());
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
l.setDistance(distance);
l.generateDefaultRunLevel();
planRunlevelService.createUserRunlevel(l);

View File

@ -82,11 +82,10 @@ public class RunPlanRunlevelService implements IRunPlanRunlevelService {
list.forEach(l -> {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
SectionPosition startPosition = new SectionPosition(startSection,startSection.getStopPointByDirection(l.getRight()));
SectionPosition endPosition = new SectionPosition(endSection,endSection.getStopPointByDirection(l.getRight()));
Float distance = CalculateService.calculateDistance(startPosition, endPosition, l.getRight());
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
RunPlanRunlevel entity = new RunPlanRunlevel();
entity.setId(l.getId());
entity.setMapId(l.getMapId());
entity.setDistance(distance);
this.runPlanRunlevelDAO.updateByPrimaryKeySelective(entity);
r.put(l.getId(),distance);

View File

@ -303,7 +303,9 @@ public class CalculateService {
if (Objects.isNull(distance)) {
throw new SimulationException(SimulationExceptionType.System_Fault, String.format("根据起始区段[%s(%s)]找不到对应方向(%s)的目标区段[%s(%s)]", startSection.getName(), startSection.getCode(), isRight ? "右向" : "左向", endSection.getName(), endSection.getCode()));
}
distance = distance - startSection.getLen() + endSection.getLen();
distance = isRight ?
distance - startSection.getStopPointByDirection(isRight) + endSection.getStopPointByDirection(isRight) :
distance - startSection.getLen() + startSection.getStopPointByDirection(isRight) + endSection.getLen()-endSection.getStopPointByDirection(isRight);
return distance;
}