查询用户交路bug
This commit is contained in:
parent
806d6c6e67
commit
24ece695d2
@ -4,6 +4,7 @@ import club.joylink.rtss.entity.RunPlanRouting;
|
|||||||
import club.joylink.rtss.entity.RunPlanRoutingExample;
|
import club.joylink.rtss.entity.RunPlanRoutingExample;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.ResultMap;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -45,4 +46,14 @@ public interface RunPlanRoutingDAO {
|
|||||||
"AND section_data = #{sectionData} " +
|
"AND section_data = #{sectionData} " +
|
||||||
"</script>")
|
"</script>")
|
||||||
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
||||||
|
|
||||||
|
@ResultMap("ResultMapWithBLOBs")
|
||||||
|
@Select("<script>" +
|
||||||
|
"SELECT * " +
|
||||||
|
"FROM run_plan_routing " +
|
||||||
|
"WHERE map_id = #{mapId} " +
|
||||||
|
"AND user_id = #{userId} " +
|
||||||
|
"AND section_data = #{sectionData} " +
|
||||||
|
"</script>")
|
||||||
|
RunPlanRouting getUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
import java.util.stream.Collector;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -54,7 +53,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
||||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO));
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO),"存在相同经停轨道的交路");
|
||||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
@ -86,7 +85,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
||||||
// BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO));
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO),"存在相同经停轨道的交路");
|
||||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
@ -178,11 +177,15 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
List<RunPlanRoutingSection> routingSections = trip.getTimeList().stream().map(rt -> {
|
||||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
RunPlanRoutingSection routingSection = new RunPlanRoutingSection();
|
||||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
routingSection.setStationCode(rt.getStationCode());
|
||||||
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
|
routingSection.setSectionCode(rt.getSectionCode());
|
||||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0));
|
return routingSection;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
RunPlanRouting runPlanRouting = runPlanRoutingDAO.getUserRoutingBySectionData(userId,planVO.getMapId(),JsonUtils.writeValueAsString(routingSections));
|
||||||
|
if (Objects.isNull(runPlanRouting)) return null;
|
||||||
|
return RunPlanRoutingVO.convert2VO(runPlanRouting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,10 +7,8 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Positive;
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@ApiModel(value = "运行图生成输入参数")
|
@ApiModel(value = "运行图生成输入参数")
|
||||||
|
Loading…
Reference in New Issue
Block a user