查询用户交路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 java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -45,4 +46,14 @@ public interface RunPlanRoutingDAO {
|
||||
"AND section_data = #{sectionData} " +
|
||||
"</script>")
|
||||
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.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@ -54,7 +53,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
@ -86,7 +85,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
@ -178,11 +177,15 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0));
|
||||
List<RunPlanRoutingSection> routingSections = trip.getTimeList().stream().map(rt -> {
|
||||
RunPlanRoutingSection routingSection = new RunPlanRoutingSection();
|
||||
routingSection.setStationCode(rt.getStationCode());
|
||||
routingSection.setSectionCode(rt.getSectionCode());
|
||||
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
|
||||
|
@ -7,10 +7,8 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@ApiModel(value = "运行图生成输入参数")
|
||||
|
Loading…
Reference in New Issue
Block a user