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

This commit is contained in:
joylink_zhangsai 2020-12-10 15:39:01 +08:00
commit 1924deac9c
45 changed files with 7171 additions and 170 deletions

72
sql/20201204.sql Normal file
View File

@ -0,0 +1,72 @@
CREATE TABLE `run_plan_routing` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`map_id` BIGINT(20) NOT NULL COMMENT '地图ID',
`user_id` BIGINT(20) NOT NULL,
`name` VARCHAR(64) NOT NULL COMMENT '名称' COLLATE 'utf8_general_ci',
`code` VARCHAR(32) NOT NULL COMMENT '编号' COLLATE 'utf8_general_ci',
`type` VARCHAR(32) NOT NULL COMMENT '交路类型',
`start_station_code` VARCHAR(32) NOT NULL COMMENT '起始车站' COLLATE 'utf8_general_ci',
`start_section_code` VARCHAR(32) NOT NULL COMMENT '起始站台' COLLATE 'utf8_general_ci',
`end_station_code` VARCHAR(32) NOT NULL COMMENT '终点车站' COLLATE 'utf8_general_ci',
`end_section_code` VARCHAR(32) NOT NULL COMMENT '终点站台' COLLATE 'utf8_general_ci',
`right` TINYINT(1) NULL DEFAULT '0' COMMENT '左右行方向',
`destination_code` VARCHAR(45) NULL DEFAULT NULL COMMENT '目的地码' COLLATE 'utf8_general_ci',
`remarks` VARCHAR(512) NULL DEFAULT NULL COMMENT '描述' COLLATE 'utf8_general_ci',
`section_data` LONGTEXT NOT NULL COMMENT '区段数据' COLLATE 'utf8_general_ci',
PRIMARY KEY (`id`),
INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户交路'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_runlevel` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`map_id` BIGINT(20) NOT NULL COMMENT '地图id',
`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
`start_station_code` VARCHAR(32) NOT NULL COMMENT '起始车站' COLLATE 'utf8_general_ci',
`start_section_code` VARCHAR(32) NOT NULL COMMENT '起始站台' COLLATE 'utf8_general_ci',
`end_station_code` VARCHAR(32) NOT NULL COMMENT '终点车站' COLLATE 'utf8_general_ci',
`end_section_code` VARCHAR(32) NOT NULL COMMENT '终点站台' COLLATE 'utf8_general_ci',
`right` TINYINT(1) NOT NULL COMMENT '方向',
`distance` FLOAT NOT NULL COMMENT '距离(米)',
`level1` INT(11) NOT NULL COMMENT '等级一s',
`level2` INT(11) NOT NULL COMMENT '等级二s',
`level3` INT(11) NOT NULL COMMENT '等级三s',
`level4` INT(11) NOT NULL COMMENT '等级四s',
`level5` INT(11) NOT NULL COMMENT '等级五s',
PRIMARY KEY (`id`),
INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户站间运行等级'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_parktime` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`map_id` BIGINT(20) NOT NULL COMMENT '所属地图id',
`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
`station_code` VARCHAR(32) NOT NULL COMMENT '车站code' COLLATE 'utf8_general_ci',
`section_code` VARCHAR(32) NOT NULL COMMENT '区段code' COLLATE 'utf8_general_ci',
`parking_time` INT(11) NOT NULL DEFAULT '30' COMMENT '停站时间s',
PRIMARY KEY (`id`),
INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户车站停站时间'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_user_config` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`map_id` BIGINT(20) NOT NULL COMMENT '所属地图id',
`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
`config` LONGTEXT NOT NULL COMMENT '折返车站code' COLLATE 'utf8_general_ci',
PRIMARY KEY (`id`),
INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户配置数据'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;

View File

@ -239,31 +239,31 @@ public class DraftMapController {
/*!!!!!!!!!!!!!!!!!!!!!!! 新 自动信号 !!!!!!!!!!!!!!!!!!!!!!!!!!*/
@ApiOperation(value = "创建自动信号")
@ApiOperation(value = "创建自动信号")
@PostMapping(path = "/autoSignalNew")
public void createAutoSignal(@RequestBody @Validated MapAutoSignalNewVO autoSignalVO) {
iDraftMapService.createAutoSignal(autoSignalVO);
}
@ApiOperation(value = "分页获取自动信号")
@ApiOperation(value = "分页获取自动信号")
@GetMapping(path = "/{mapId}/autoSignalNew")
public PageVO<MapAutoSignalNewVO> queryPagedAutoSignalNew(@PathVariable Long mapId, MapAutoSignalQueryVO queryVO) {
return iDraftMapService.queryPagedAutoSignalNew(mapId, queryVO);
}
@ApiOperation(value = "获取自动信号")
@ApiOperation(value = "获取自动信号")
@GetMapping(path = "/autoSignalNew/{autoSignalId}")
public MapAutoSignalNewVO getAutoSignalNew(@PathVariable Long autoSignalId) {
return iDraftMapService.getAutoSignalNew(autoSignalId);
}
@ApiOperation(value = "更新自动信号")
@ApiOperation(value = "更新自动信号")
@PutMapping(path = "/autoSignalNew/{autoSignalId}")
public void updateAutoSignal(@PathVariable Long autoSignalId, @RequestBody @Validated MapAutoSignalNewVO autoSignalVO) {
iDraftMapService.updateAutoSignal(autoSignalId, autoSignalVO);
}
@ApiOperation(value = "删除自动信号")
@ApiOperation(value = "删除自动信号")
@DeleteMapping(path = "/autoSignalNew/{autoSignalId}")
public void deleteAutoSignalNew(@PathVariable Long autoSignalId) {
iDraftMapService.deleteAutoSignal(autoSignalId);
@ -303,31 +303,31 @@ public class DraftMapController {
/*-------------- 新 进路 ------------------*/
@ApiOperation(value = "创建进路")
@ApiOperation(value = "创建进路")
@PostMapping(path = "/routeNew")
public void createRoute(@RequestBody @Validated MapRouteNewVO routeVO) {
iDraftMapService.createRoute(routeVO);
}
@ApiOperation(value = "查询进路列表")
@ApiOperation(value = "查询进路列表")
@GetMapping(path = "/{mapId}/routeNew")
public PageVO<MapRouteNewVO> queryPagedRouteNew(@PathVariable Long mapId, MapRouteQueryVO queryVO) {
return iDraftMapService.queryPagedRouteNew(mapId, queryVO);
}
@ApiOperation(value = "查询进路数据明细")
@ApiOperation(value = "查询进路数据明细")
@GetMapping(path = "/routeNew/{routeId}")
public MapRouteNewVO getRouteDetailNew(@PathVariable Long routeId) {
return iDraftMapService.getRouteDetailNew(routeId);
}
@ApiOperation(value = "更新进路数据")
@ApiOperation(value = "更新进路数据")
@PutMapping(path = "/routeNew/{routeId}")
public void updateRoute(@PathVariable Long routeId, @RequestBody @Validated MapRouteNewVO routeVO) {
iDraftMapService.updateRoute(routeId, routeVO);
}
@ApiOperation(value = "删除进路")
@ApiOperation(value = "删除进路")
@DeleteMapping(path = "/routeNew/{routeId}")
public void deleteRouteNew(@PathVariable Long routeId) {
iDraftMapService.deleteRoute(routeId);
@ -474,37 +474,37 @@ public class DraftMapController {
/*-------------- 新 交路 ------------------*/
@ApiOperation(value = "创建交路,可同时创建回路")
@ApiOperation(value = "创建交路,可同时创建回路")
@PostMapping(path = "/routingData")
public void createRoutingData(@RequestBody @Validated MapRoutingDataVO routingVO) {
iDraftMapService.createRoutingData(routingVO);
}
@ApiOperation(value = "生成交路区段数据")
@ApiOperation(value = "生成交路区段数据")
@PutMapping(path = "/routingData/generate")
public MapRoutingDataVO generateRoutingData(@RequestBody @Validated MapRoutingDataVO routingVO) {
return iDraftMapService.generateRoutingData(routingVO);
}
@ApiOperation(value = "分页获取交路")
@ApiOperation(value = "分页获取交路")
@GetMapping(path = "/{mapId}/routingData")
public PageVO<MapRoutingDataVO> queryPagedRoutingData(@PathVariable Long mapId, MapRoutingDataQueryVO queryVO) {
return iDraftMapService.queryPagedRoutingData(mapId, queryVO);
}
@ApiOperation(value = "获取交路详情")
@ApiOperation(value = "获取交路详情")
@GetMapping(path = "/routingData/{routingId}")
public MapRoutingDataVO getRoutingData(@PathVariable Long routingId) {
return iDraftMapService.getRoutingData(routingId);
}
@ApiOperation(value = "更新交路")
@ApiOperation(value = "更新交路")
@PutMapping(path = "/routingData/{routingId}")
public void updateRoutingData(@PathVariable Long routingId, @RequestBody @Validated MapRoutingDataVO routingVO) {
iDraftMapService.updateRoutingData(routingId, routingVO);
}
@ApiOperation(value = "删除交路")
@ApiOperation(value = "删除交路")
@DeleteMapping(path = "/routingData/{routingId}")
public void deleteRoutingData(@PathVariable Long routingId) {
iDraftMapService.deleteRouting(routingId);
@ -512,31 +512,31 @@ public class DraftMapController {
/*-------------- 新 车站区段停站时间 ------------------*/
@ApiOperation(value = "创建车站区段停站时间")
@ApiOperation(value = "创建车站区段停站时间")
@PostMapping(path = "/stationParkTime")
public void createStationParkTime(@RequestBody @Validated MapStationParkingTimeVO parkingTimeVO) {
iDraftMapService.createStationParkTime(parkingTimeVO);
}
@ApiOperation(value = "分页车站区段停站时间")
@ApiOperation(value = "分页车站区段停站时间")
@GetMapping(path = "/{mapId}/stationParkTime")
public PageVO<MapStationParkingTimeVO> queryPagedStationParkTime(@PathVariable Long mapId, MapParkTimeQueryVO queryVO) {
return iDraftMapService.queryPagedStationParkTime(mapId, queryVO);
}
@ApiOperation(value = "获取车站区段停站时间")
@ApiOperation(value = "获取车站区段停站时间")
@GetMapping(path = "/stationParkTime/{id}")
public MapStationParkingTimeVO getStationParkTime(@PathVariable Long id) {
return iDraftMapService.getStationParkTime(id);
}
@ApiOperation(value = "更新车站区段停站时间")
@ApiOperation(value = "更新车站区段停站时间")
@PutMapping(path = "/stationParkTime/{id}")
public void updateStationParkTime(@PathVariable Long id, @RequestBody @Validated MapStationParkingTimeVO parkingTimeVO) {
iDraftMapService.updateStationParkTime(id, parkingTimeVO);
}
@ApiOperation(value = "删除车站区段停站时间")
@ApiOperation(value = "删除车站区段停站时间")
@DeleteMapping(path = "/stationParkTime/{id}")
public void deleteStationParkTime(@PathVariable Long id) {
iDraftMapService.deleteStationParkTime(id);

View File

@ -47,7 +47,7 @@ public class LessonController {
return this.iLessonService.getLessonDetail(id, user);
}
@ApiOperation(value = "获取课程列表")
@ApiOperation(value = "根据条件获取课程列表")
@GetMapping(path = "")
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
return this.iLessonService.queryLessons(lessonQueryVO);

View File

@ -1,18 +1,22 @@
package club.joylink.rtss.controller;
package club.joylink.rtss.controller.runplan;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.IRunPlanDraftService;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.validGroup.RunPlanCreateCheck;
import club.joylink.rtss.vo.client.validGroup.RunPlanNameCheck;
import club.joylink.rtss.vo.client.validGroup.ValidList;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,6 +35,9 @@ public class RunPlanDraftController {
@Autowired
private IRunPlanDraftService iRunPlanDraftService;
@Autowired
private IRunPlanRoutingService iRunPlanRoutingService;
@ApiOperation(value = "创建运行图草稿")
@PostMapping(path = "")
public String create(@RequestBody @Validated(value = RunPlanCreateCheck.class) RunPlanVO runPlanVO,
@ -40,6 +47,7 @@ public class RunPlanDraftController {
@ApiOperation(value = "自动生成运行图车次数据")
@PostMapping(path = "/{id}")
@Deprecated
public RunPlanEChartsDataVO create(@RequestBody @Validated RunPlanInput runPlanInput, @PathVariable Long id) {
return iRunPlanDraftService.createCommon(id,runPlanInput);
}
@ -144,12 +152,24 @@ public class RunPlanDraftController {
return this.iRunPlanDraftService.queryRoutingBySDTNumber(planId, SDTNumber);
}
@ApiOperation(value = "根据车次号查询用户交路")
@GetMapping(path = "/{planId}/userRouting")
public RunPlanRoutingVO queryRoutingBySDTNumber(@PathVariable Long planId, String SDTNumber, @ApiIgnore @RequestAttribute UserVO user) {
return this.iRunPlanRoutingService.queryUserRoutingBySDTNumber(user.getId(), planId, SDTNumber);
}
@ApiOperation(value = "根据交路查询交路区段列表")
@GetMapping(path = "/{planId}/{routingCode}/routingSectionList")
public List getRoutingSectionList(@PathVariable Long planId, @PathVariable String routingCode) {
return this.iRunPlanDraftService.getRoutingSectionList(planId, routingCode);
}
@ApiOperation(value = "根据用户交路查询交路区段列表")
@GetMapping(path = "/{planId}/{routingCode}/userRoutingSectionList")
public List<RunPlanRoutingSection> getRoutingSectionList(@PathVariable Long planId, @PathVariable String routingCode, @ApiIgnore @RequestAttribute UserVO user) {
return this.iRunPlanRoutingService.getRoutingSectionDataBy(user.getId() , planId, routingCode);
}
@ApiOperation(value = "增加计划")
@PostMapping(path = "/{planId}/service")
public void addRunPlanService(@PathVariable Long planId,
@ -158,6 +178,12 @@ public class RunPlanDraftController {
this.iRunPlanDraftService.addRunPlanService(planId, serviceConfig, user);
}
@ApiOperation(value = "生成计划")
@PostMapping(path = "/{planId}/service/generate")
public void generateRunPlanService(@RequestBody @Validated RunPlanInputData inputData, @PathVariable Long planId,@ApiIgnore @RequestAttribute UserVO user) {
iRunPlanDraftService.generateRunPlanService(user.getId(),planId,inputData);
}
@ApiOperation(value = "修改计划")
@PutMapping(path = "/{planId}/service/{serviceNumber}")
public void updateRunPlanService(@PathVariable Long planId,

View File

@ -0,0 +1,107 @@
package club.joylink.rtss.controller.runplan;
import club.joylink.rtss.services.runplan.IRunPlanParktimeService;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.services.runplan.IRunPlanRunlevelService;
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = {"运行计划用户数据接口"})
@RestController
@RequestMapping("/api/runPlan/userData")
public class RunPlanUserDataController {
@Autowired
private IRunPlanRoutingService iRunPlanRoutingService;
@Autowired
private IRunPlanRunlevelService iRunPlanRunlevelService;
@Autowired
private IRunPlanParktimeService iRunPlanParktimeService;
@Autowired
private IRunPlanUserConfigService iRunPlanUserConfigService;
@ApiOperation(value = "用户创建交路")
@PostMapping(path = "/routing")
public void createUserRouting(@RequestBody @Validated RunPlanRoutingVO routingVO, @RequestAttribute UserVO user) {
routingVO.setUserId(user.getId());
iRunPlanRoutingService.createUserRouting(routingVO);
}
@ApiOperation(value = "分页获取用户交路")
@GetMapping(path = "/{mapId}/routing/page")
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(@PathVariable Long mapId, RunPlanRoutingQueryVO queryVO, @RequestAttribute UserVO user) {
return iRunPlanRoutingService.queryPagedUserRouting(user.getId(), mapId, queryVO);
}
@ApiOperation(value = "获取用户交路数据")
@GetMapping(path = "/{mapId}/routing")
public List<RunPlanRoutingVO> queryUserRoutings(@PathVariable Long mapId, @RequestAttribute UserVO user) {
return iRunPlanRoutingService.getUserRoutingBy(user.getId(), mapId);
}
@ApiOperation(value = "获取用户交路详情")
@GetMapping(path = "/routing/{routingId}")
public RunPlanRoutingVO getUserRouting(@PathVariable Long routingId) {
return iRunPlanRoutingService.getUserRouting(routingId);
}
@ApiOperation(value = "更新用户交路")
@PutMapping(path = "/routing/{routingId}")
public void updateUserRouting(@PathVariable Long routingId, @RequestBody @Validated RunPlanRoutingVO routingVO) {
iRunPlanRoutingService.updateUserRouting(routingId, routingVO);
}
@ApiOperation(value = "删除用户交路")
@DeleteMapping(path = "/routing/{routingId}")
public void deleteUserRouting(@PathVariable Long routingId) {
iRunPlanRoutingService.deleteUserRouting(routingId);
}
@ApiOperation(value = "分页获取用户站间运行等级")
@GetMapping(path = "/{mapId}/runlevel/page")
public PageVO<RunPlanRunlevelVO> queryPagedUserRunlevel(@PathVariable Long mapId, RunPlanRunLevelQueryVO queryVO, @RequestAttribute UserVO user) {
return iRunPlanRunlevelService.queryUserRunLevels(user.getId(), mapId, queryVO);
}
@ApiOperation(value = "更新用户站间运行等级")
@PutMapping(path = "/{mapId}/runlevel")
public void updateUserRunlevel(@PathVariable Long mapId, @RequestBody @Validated List<RunPlanRunlevelVO> list, @RequestAttribute UserVO user) {
iRunPlanRunlevelService.updateRefLevels(user.getId(), mapId, list);
}
@ApiOperation(value = "分页获取用户轨道停车时间")
@GetMapping(path = "/{mapId}/parktime/page")
public PageVO<RunPlanParkingTimeVO> queryPagedUserParktime(@PathVariable Long mapId, RunPlanParktimeQueryVO queryVO, @RequestAttribute UserVO user) {
return iRunPlanParktimeService.queryUserParktimes(user.getId(), mapId, queryVO);
}
@ApiOperation(value = "更新用户轨道停车时间")
@PutMapping(path = "/{mapId}/parktime")
public void updateUserParktime(@PathVariable Long mapId, @RequestBody @Validated List<RunPlanParkingTimeVO> list, @RequestAttribute UserVO user) {
iRunPlanParktimeService.updateRefUserParktime(user.getId(), mapId, list);
}
@ApiOperation(value = "保存用户配置")
@PostMapping(path = "/{mapId}/config")
public void createUserConfig(@PathVariable Long mapId, @RequestBody @Validated RunPlanUserConfigVO.Config config, @RequestAttribute UserVO user) {
iRunPlanUserConfigService.saveConfig(user.getId(), mapId, config);
}
@ApiOperation(value = "获取用户配置")
@GetMapping(path = "/{mapId}/config")
public RunPlanUserConfigVO getUserConfig(@PathVariable Long mapId, @RequestAttribute UserVO user) {
return iRunPlanUserConfigService.getConfig(user.getId(), mapId);
}
}

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.RunPlanParktime;
import club.joylink.rtss.entity.RunPlanParktimeExample;
import org.springframework.stereotype.Repository;
/**
* RunPlanParktimeDAO继承基类
*/
@Repository
public interface RunPlanParktimeDAO extends MyBatisBaseDao<RunPlanParktime, Long, RunPlanParktimeExample> {
}

View File

@ -0,0 +1,48 @@
package club.joylink.rtss.dao;
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.Select;
import org.springframework.stereotype.Repository;
@Repository
public interface RunPlanRoutingDAO {
long countByExample(RunPlanRoutingExample example);
int deleteByExample(RunPlanRoutingExample example);
int deleteByPrimaryKey(Long id);
int insert(RunPlanRouting record);
int insertSelective(RunPlanRouting record);
List<RunPlanRouting> selectByExampleWithBLOBs(RunPlanRoutingExample example);
List<RunPlanRouting> selectByExample(RunPlanRoutingExample example);
RunPlanRouting selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") RunPlanRouting record, @Param("example") RunPlanRoutingExample example);
int updateByExampleWithBLOBs(@Param("record") RunPlanRouting record, @Param("example") RunPlanRoutingExample example);
int updateByExample(@Param("record") RunPlanRouting record, @Param("example") RunPlanRoutingExample example);
int updateByPrimaryKeySelective(RunPlanRouting record);
int updateByPrimaryKeyWithBLOBs(RunPlanRouting record);
int updateByPrimaryKey(RunPlanRouting record);
@Select("<script>" +
"SELECT COUNT(*) " +
"FROM run_plan_routing " +
"WHERE map_id = #{mapId} " +
"AND user_id = #{userId} " +
"AND section_data = #{sectionData} " +
"</script>")
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
}

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.entity.RunPlanRunlevelExample;
import org.springframework.stereotype.Repository;
/**
* RunPlanRunlevelDAO继承基类
*/
@Repository
public interface RunPlanRunlevelDAO extends MyBatisBaseDao<RunPlanRunlevel, Long, RunPlanRunlevelExample> {
}

View File

@ -0,0 +1,38 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.RunPlanUserConfig;
import club.joylink.rtss.entity.RunPlanUserConfigExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface RunPlanUserConfigDAO {
long countByExample(RunPlanUserConfigExample example);
int deleteByExample(RunPlanUserConfigExample example);
int deleteByPrimaryKey(Long id);
int insert(RunPlanUserConfig record);
int insertSelective(RunPlanUserConfig record);
List<RunPlanUserConfig> selectByExampleWithBLOBs(RunPlanUserConfigExample example);
List<RunPlanUserConfig> selectByExample(RunPlanUserConfigExample example);
RunPlanUserConfig selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") RunPlanUserConfig record, @Param("example") RunPlanUserConfigExample example);
int updateByExampleWithBLOBs(@Param("record") RunPlanUserConfig record, @Param("example") RunPlanUserConfigExample example);
int updateByExample(@Param("record") RunPlanUserConfig record, @Param("example") RunPlanUserConfigExample example);
int updateByPrimaryKeySelective(RunPlanUserConfig record);
int updateByPrimaryKeyWithBLOBs(RunPlanUserConfig record);
int updateByPrimaryKey(RunPlanUserConfig record);
}

View File

@ -0,0 +1,136 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* run_plan_parktime
* @author
*/
public class RunPlanParktime implements Serializable {
private Long id;
/**
* 所属地图id
*/
private Long mapId;
/**
* 用户id
*/
private Long userId;
/**
* 车站code
*/
private String stationCode;
/**
* 区段code
*/
private String sectionCode;
/**
* 停站时间
*/
private Integer parkingTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getStationCode() {
return stationCode;
}
public void setStationCode(String stationCode) {
this.stationCode = stationCode;
}
public String getSectionCode() {
return sectionCode;
}
public void setSectionCode(String sectionCode) {
this.sectionCode = sectionCode;
}
public Integer getParkingTime() {
return parkingTime;
}
public void setParkingTime(Integer parkingTime) {
this.parkingTime = parkingTime;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
RunPlanParktime other = (RunPlanParktime) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getStationCode() == null ? other.getStationCode() == null : this.getStationCode().equals(other.getStationCode()))
&& (this.getSectionCode() == null ? other.getSectionCode() == null : this.getSectionCode().equals(other.getSectionCode()))
&& (this.getParkingTime() == null ? other.getParkingTime() == null : this.getParkingTime().equals(other.getParkingTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getStationCode() == null) ? 0 : getStationCode().hashCode());
result = prime * result + ((getSectionCode() == null) ? 0 : getSectionCode().hashCode());
result = prime * result + ((getParkingTime() == null) ? 0 : getParkingTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", userId=").append(userId);
sb.append(", stationCode=").append(stationCode);
sb.append(", sectionCode=").append(sectionCode);
sb.append(", parkingTime=").append(parkingTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,602 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class RunPlanParktimeExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RunPlanParktimeExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andStationCodeIsNull() {
addCriterion("station_code is null");
return (Criteria) this;
}
public Criteria andStationCodeIsNotNull() {
addCriterion("station_code is not null");
return (Criteria) this;
}
public Criteria andStationCodeEqualTo(String value) {
addCriterion("station_code =", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeNotEqualTo(String value) {
addCriterion("station_code <>", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeGreaterThan(String value) {
addCriterion("station_code >", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeGreaterThanOrEqualTo(String value) {
addCriterion("station_code >=", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeLessThan(String value) {
addCriterion("station_code <", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeLessThanOrEqualTo(String value) {
addCriterion("station_code <=", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeLike(String value) {
addCriterion("station_code like", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeNotLike(String value) {
addCriterion("station_code not like", value, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeIn(List<String> values) {
addCriterion("station_code in", values, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeNotIn(List<String> values) {
addCriterion("station_code not in", values, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeBetween(String value1, String value2) {
addCriterion("station_code between", value1, value2, "stationCode");
return (Criteria) this;
}
public Criteria andStationCodeNotBetween(String value1, String value2) {
addCriterion("station_code not between", value1, value2, "stationCode");
return (Criteria) this;
}
public Criteria andSectionCodeIsNull() {
addCriterion("section_code is null");
return (Criteria) this;
}
public Criteria andSectionCodeIsNotNull() {
addCriterion("section_code is not null");
return (Criteria) this;
}
public Criteria andSectionCodeEqualTo(String value) {
addCriterion("section_code =", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotEqualTo(String value) {
addCriterion("section_code <>", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThan(String value) {
addCriterion("section_code >", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThanOrEqualTo(String value) {
addCriterion("section_code >=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThan(String value) {
addCriterion("section_code <", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThanOrEqualTo(String value) {
addCriterion("section_code <=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLike(String value) {
addCriterion("section_code like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotLike(String value) {
addCriterion("section_code not like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeIn(List<String> values) {
addCriterion("section_code in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotIn(List<String> values) {
addCriterion("section_code not in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeBetween(String value1, String value2) {
addCriterion("section_code between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotBetween(String value1, String value2) {
addCriterion("section_code not between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andParkingTimeIsNull() {
addCriterion("parking_time is null");
return (Criteria) this;
}
public Criteria andParkingTimeIsNotNull() {
addCriterion("parking_time is not null");
return (Criteria) this;
}
public Criteria andParkingTimeEqualTo(Integer value) {
addCriterion("parking_time =", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotEqualTo(Integer value) {
addCriterion("parking_time <>", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeGreaterThan(Integer value) {
addCriterion("parking_time >", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeGreaterThanOrEqualTo(Integer value) {
addCriterion("parking_time >=", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeLessThan(Integer value) {
addCriterion("parking_time <", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeLessThanOrEqualTo(Integer value) {
addCriterion("parking_time <=", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeIn(List<Integer> values) {
addCriterion("parking_time in", values, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotIn(List<Integer> values) {
addCriterion("parking_time not in", values, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeBetween(Integer value1, Integer value2) {
addCriterion("parking_time between", value1, value2, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotBetween(Integer value1, Integer value2) {
addCriterion("parking_time not between", value1, value2, "parkingTime");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,261 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* run_plan_routing
* @author
*/
public class RunPlanRouting implements Serializable {
private Long id;
/**
* 地图ID
*/
private Long mapId;
private Long userId;
/**
* 名称
*/
private String name;
/**
* 编号
*/
private String code;
/**
* 交路类型
*/
private String type;
/**
* 起始车站
*/
private String startStationCode;
/**
* 起始站台
*/
private String startSectionCode;
/**
* 终点车站
*/
private String endStationCode;
/**
* 终点站台
*/
private String endSectionCode;
/**
* 左右行方向
*/
private Boolean right;
/**
* 目的地码
*/
private String destinationCode;
/**
* 描述
*/
private String remarks;
/**
* 区段数据
*/
private String sectionData;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStartStationCode() {
return startStationCode;
}
public void setStartStationCode(String startStationCode) {
this.startStationCode = startStationCode;
}
public String getStartSectionCode() {
return startSectionCode;
}
public void setStartSectionCode(String startSectionCode) {
this.startSectionCode = startSectionCode;
}
public String getEndStationCode() {
return endStationCode;
}
public void setEndStationCode(String endStationCode) {
this.endStationCode = endStationCode;
}
public String getEndSectionCode() {
return endSectionCode;
}
public void setEndSectionCode(String endSectionCode) {
this.endSectionCode = endSectionCode;
}
public Boolean getRight() {
return right;
}
public void setRight(Boolean right) {
this.right = right;
}
public String getDestinationCode() {
return destinationCode;
}
public void setDestinationCode(String destinationCode) {
this.destinationCode = destinationCode;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getSectionData() {
return sectionData;
}
public void setSectionData(String sectionData) {
this.sectionData = sectionData;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
RunPlanRouting other = (RunPlanRouting) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getStartStationCode() == null ? other.getStartStationCode() == null : this.getStartStationCode().equals(other.getStartStationCode()))
&& (this.getStartSectionCode() == null ? other.getStartSectionCode() == null : this.getStartSectionCode().equals(other.getStartSectionCode()))
&& (this.getEndStationCode() == null ? other.getEndStationCode() == null : this.getEndStationCode().equals(other.getEndStationCode()))
&& (this.getEndSectionCode() == null ? other.getEndSectionCode() == null : this.getEndSectionCode().equals(other.getEndSectionCode()))
&& (this.getRight() == null ? other.getRight() == null : this.getRight().equals(other.getRight()))
&& (this.getDestinationCode() == null ? other.getDestinationCode() == null : this.getDestinationCode().equals(other.getDestinationCode()))
&& (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()))
&& (this.getSectionData() == null ? other.getSectionData() == null : this.getSectionData().equals(other.getSectionData()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getStartStationCode() == null) ? 0 : getStartStationCode().hashCode());
result = prime * result + ((getStartSectionCode() == null) ? 0 : getStartSectionCode().hashCode());
result = prime * result + ((getEndStationCode() == null) ? 0 : getEndStationCode().hashCode());
result = prime * result + ((getEndSectionCode() == null) ? 0 : getEndSectionCode().hashCode());
result = prime * result + ((getRight() == null) ? 0 : getRight().hashCode());
result = prime * result + ((getDestinationCode() == null) ? 0 : getDestinationCode().hashCode());
result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
result = prime * result + ((getSectionData() == null) ? 0 : getSectionData().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", userId=").append(userId);
sb.append(", name=").append(name);
sb.append(", code=").append(code);
sb.append(", type=").append(type);
sb.append(", startStationCode=").append(startStationCode);
sb.append(", startSectionCode=").append(startSectionCode);
sb.append(", endStationCode=").append(endStationCode);
sb.append(", endSectionCode=").append(endSectionCode);
sb.append(", right=").append(right);
sb.append(", destinationCode=").append(destinationCode);
sb.append(", remarks=").append(remarks);
sb.append(", sectionData=").append(sectionData);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,264 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* run_plan_runlevel
* @author
*/
public class RunPlanRunlevel implements Serializable {
private Long id;
/**
* 地图id
*/
private Long mapId;
/**
* 用户id
*/
private Long userId;
/**
* 起始车站
*/
private String startStationCode;
/**
* 起始站台
*/
private String startSectionCode;
/**
* 终点车站
*/
private String endStationCode;
/**
* 终点站台
*/
private String endSectionCode;
/**
* 方向
*/
private Boolean right;
/**
* 距离厘米
*/
private Float distance;
/**
* 等级一
*/
private Integer level1;
/**
* 等级二
*/
private Integer level2;
/**
* 等级三
*/
private Integer level3;
/**
* 等级四
*/
private Integer level4;
/**
* 等级五
*/
private Integer level5;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getStartStationCode() {
return startStationCode;
}
public void setStartStationCode(String startStationCode) {
this.startStationCode = startStationCode;
}
public String getStartSectionCode() {
return startSectionCode;
}
public void setStartSectionCode(String startSectionCode) {
this.startSectionCode = startSectionCode;
}
public String getEndStationCode() {
return endStationCode;
}
public void setEndStationCode(String endStationCode) {
this.endStationCode = endStationCode;
}
public String getEndSectionCode() {
return endSectionCode;
}
public void setEndSectionCode(String endSectionCode) {
this.endSectionCode = endSectionCode;
}
public Boolean getRight() {
return right;
}
public void setRight(Boolean right) {
this.right = right;
}
public Float getDistance() {
return distance;
}
public void setDistance(Float distance) {
this.distance = distance;
}
public Integer getLevel1() {
return level1;
}
public void setLevel1(Integer level1) {
this.level1 = level1;
}
public Integer getLevel2() {
return level2;
}
public void setLevel2(Integer level2) {
this.level2 = level2;
}
public Integer getLevel3() {
return level3;
}
public void setLevel3(Integer level3) {
this.level3 = level3;
}
public Integer getLevel4() {
return level4;
}
public void setLevel4(Integer level4) {
this.level4 = level4;
}
public Integer getLevel5() {
return level5;
}
public void setLevel5(Integer level5) {
this.level5 = level5;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
RunPlanRunlevel other = (RunPlanRunlevel) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getStartStationCode() == null ? other.getStartStationCode() == null : this.getStartStationCode().equals(other.getStartStationCode()))
&& (this.getStartSectionCode() == null ? other.getStartSectionCode() == null : this.getStartSectionCode().equals(other.getStartSectionCode()))
&& (this.getEndStationCode() == null ? other.getEndStationCode() == null : this.getEndStationCode().equals(other.getEndStationCode()))
&& (this.getEndSectionCode() == null ? other.getEndSectionCode() == null : this.getEndSectionCode().equals(other.getEndSectionCode()))
&& (this.getRight() == null ? other.getRight() == null : this.getRight().equals(other.getRight()))
&& (this.getDistance() == null ? other.getDistance() == null : this.getDistance().equals(other.getDistance()))
&& (this.getLevel1() == null ? other.getLevel1() == null : this.getLevel1().equals(other.getLevel1()))
&& (this.getLevel2() == null ? other.getLevel2() == null : this.getLevel2().equals(other.getLevel2()))
&& (this.getLevel3() == null ? other.getLevel3() == null : this.getLevel3().equals(other.getLevel3()))
&& (this.getLevel4() == null ? other.getLevel4() == null : this.getLevel4().equals(other.getLevel4()))
&& (this.getLevel5() == null ? other.getLevel5() == null : this.getLevel5().equals(other.getLevel5()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getStartStationCode() == null) ? 0 : getStartStationCode().hashCode());
result = prime * result + ((getStartSectionCode() == null) ? 0 : getStartSectionCode().hashCode());
result = prime * result + ((getEndStationCode() == null) ? 0 : getEndStationCode().hashCode());
result = prime * result + ((getEndSectionCode() == null) ? 0 : getEndSectionCode().hashCode());
result = prime * result + ((getRight() == null) ? 0 : getRight().hashCode());
result = prime * result + ((getDistance() == null) ? 0 : getDistance().hashCode());
result = prime * result + ((getLevel1() == null) ? 0 : getLevel1().hashCode());
result = prime * result + ((getLevel2() == null) ? 0 : getLevel2().hashCode());
result = prime * result + ((getLevel3() == null) ? 0 : getLevel3().hashCode());
result = prime * result + ((getLevel4() == null) ? 0 : getLevel4().hashCode());
result = prime * result + ((getLevel5() == null) ? 0 : getLevel5().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", userId=").append(userId);
sb.append(", startStationCode=").append(startStationCode);
sb.append(", startSectionCode=").append(startSectionCode);
sb.append(", endStationCode=").append(endStationCode);
sb.append(", endSectionCode=").append(endSectionCode);
sb.append(", right=").append(right);
sb.append(", distance=").append(distance);
sb.append(", level1=").append(level1);
sb.append(", level2=").append(level2);
sb.append(", level3=").append(level3);
sb.append(", level4=").append(level4);
sb.append(", level5=").append(level5);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* run_plan_user_config
* @author
*/
public class RunPlanUserConfig implements Serializable {
private Long id;
/**
* 所属地图id
*/
private Long mapId;
/**
* 用户id
*/
private Long userId;
/**
* 折返车站code
*/
private String config;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getConfig() {
return config;
}
public void setConfig(String config) {
this.config = config;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
RunPlanUserConfig other = (RunPlanUserConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getConfig() == null ? other.getConfig() == null : this.getConfig().equals(other.getConfig()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getConfig() == null) ? 0 : getConfig().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", userId=").append(userId);
sb.append(", config=").append(config);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,402 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class RunPlanUserConfigExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RunPlanUserConfigExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -8,6 +8,7 @@ import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -149,6 +150,8 @@ public interface IRunPlanDraftService {
*/
void addRunPlanService(Long planId, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
void generateRunPlanService(Long userId, Long planId, RunPlanInputData inputData);
/**
* 修改计划
* @param planId

View File

@ -6,17 +6,25 @@ import club.joylink.rtss.dao.RealLineDAO;
import club.joylink.rtss.dao.RunPlanDraftDAO;
import club.joylink.rtss.dao.RunPlanLevelDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.*;
import club.joylink.rtss.vo.client.map.MapRoutingVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.RealLineConfigVO;
import club.joylink.rtss.vo.client.map.newmap.*;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanGenerator;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
import club.joylink.rtss.vo.runplan.newrunplan.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -62,6 +70,14 @@ public class RunPlanDraftService implements IRunPlanDraftService {
@Autowired
private RealLineDAO realLineDAO;
@Autowired
private IRunPlanRoutingService runPlanRoutingService;
@Autowired
private IRunPlanUserConfigService runPlanUserConfigService;
@Autowired
private RunPlanGenerator runPlanGenerator;
@Override
@Transactional
public String create(RunPlanVO runPlanVO, UserVO userVO) {
@ -79,7 +95,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput) {
RunPlanDraft draftPlan = runPlanDraftDAO.selectByPrimaryKey(id);
MapVO mapVO = this.iMapService.getMapDetail(draftPlan.getMapId());
List<RunPlanTripVO> runPlanTrips = RunPlanGenerator.generatorTrips(runPlanInput, mapVO);
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(runPlanInput, mapVO);
draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
@ -410,65 +426,65 @@ public class RunPlanDraftService implements IRunPlanDraftService {
@Transactional
public void addRunPlanService(Long planId, RunPlanServiceConfigVO serviceConfig, UserVO userVO) {
RunPlanVO planVO = getRunPlanById(planId);
// 判断服务号是否已存在
// if (this.ifServerExists(planVO, serviceConfig.getServiceNumber())) {
// // TODO 若存在删除 合并后期处理
// this.deleteRunPlanService(planId, serviceConfig.getServiceNumber(), userVO);
planVO.getTripList().removeAll(planVO.getTripList().stream().filter(tripVO -> tripVO.getServiceNumber().equals(serviceConfig.getServiceNumber())).collect(Collectors.toList()));
// }
// 查询上/下行最大车次号
int maxUpTripNumber = 0; //新地图右行后续再修改变量
int maxDownTripNumber = 0; //新地图左行后续再修改变量
planVO.getTripList().removeAll(planVO.getTripList().stream().filter(tripVO -> tripVO.getServiceNumber().equals(serviceConfig.getServiceNumber())).collect(Collectors.toList()));
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
// String tripNumber = "";
List<RunPlanTripVO> newTripList = new ArrayList<>();
if(mapVO.isDrawWay()){
if (mapVO.isDrawWay()) {
RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userVO.getId(), mapVO.getId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "运行图-用户缺少配置或没有配置车站折返数据");
Map<String, String> userReentryData = config.getConfig().getRunPlanUserReentryData();
List<RunPlanRoutingVO> userRoutings = runPlanRoutingService.getUserRoutingBy(userVO.getId(), mapVO.getId());
Map<String, RunPlanRoutingVO> userRoutingMap = userRoutings.stream().collect(Collectors.toMap(RunPlanRoutingVO::getCode, Function.identity()));
for (RunPlanTripConfigVO tripConfigVO : serviceConfig.getTripConfigList()) {
// 查询交路
MapRoutingDataVO routingData = mapVO.findRoutingDataByCode(tripConfigVO.getRoutingCode());
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData);
if(mapVO.getConfigVO().getUpRight()){
if(routingData.getRight()){
// tripNumber = String.format("%03d", ++maxUpTripNumber);
tripVO.setDirectionCode(DirectionType.Type02);
}else{
// tripNumber = String.format("%03d", ++maxDownTripNumber);
tripVO.setDirectionCode(DirectionType.Type01);
}
}else{
if(routingData.getRight()){
// tripNumber = String.format("%03d", ++maxDownTripNumber);
tripVO.setDirectionCode(DirectionType.Type01);
}else{
// tripNumber = String.format("%03d", ++maxUpTripNumber);
tripVO.setDirectionCode(DirectionType.Type02);
}
// MapRoutingDataVO routingData = mapVO.findRoutingDataByCode(tripConfigVO.getRoutingCode());
RunPlanRoutingVO routingData = userRoutingMap.get(tripConfigVO.getRoutingCode());
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
MapSectionNewVO endReentrySection = null;
if (Objects.nonNull(endReentrySectionCode)) {
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
}
MapSectionNewVO startReentrySection = null;
if (Objects.nonNull(startReentrySectionCode)) {
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
}
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData, startReentrySection, endReentrySection);
if (mapVO.getConfigVO().getUpRight()) {
if (routingData.getRight()) {
tripVO.setDirectionCode(DirectionType.Type02);
} else {
tripVO.setDirectionCode(DirectionType.Type01);
}
// 构建类车到站数据
// tripVO.setTripNumber(tripVO.getDirectionCode() + tripNumber);
tripVO.setServiceNumber(serviceConfig.getServiceNumber());
//增加方向码
} else {
if (routingData.getRight()) {
tripVO.setDirectionCode(DirectionType.Type01);
} else {
tripVO.setDirectionCode(DirectionType.Type02);
}
}
// 构建类车到站数据
tripVO.setServiceNumber(serviceConfig.getServiceNumber());
//增加方向码
List<RunPlanArriveConfigVO> arriveConfigList = tripConfigVO.getArriveConfigList();
arriveConfigList.stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
newTripList.add(tripVO);
List<RunPlanArriveConfigVO> arriveConfigList = tripConfigVO.getArriveConfigList();
arriveConfigList.stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
newTripList.add(tripVO);
}
}else{
} else {
for (RunPlanTripConfigVO tripConfigVO : serviceConfig.getTripConfigList()) {
// 查询交路
MapRoutingVO routing = mapVO.findRoutingByCode(tripConfigVO.getRoutingCode());
// if (DirectionType.Type02.equals(routing.getDirectionCode())) {
// tripNumber = DirectionType.Type02 + String.format("%03d", ++maxUpTripNumber);
// } else if (DirectionType.Type01.equals(routing.getDirectionCode())) {
// tripNumber = DirectionType.Type01 + String.format("%03d", ++maxDownTripNumber);
// }
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routing);
// 构建类车到站数据
// tripVO.setTripNumber(tripNumber);
tripVO.setServiceNumber(serviceConfig.getServiceNumber());
List<RunPlanArriveConfigVO> arriveConfigList = tripConfigVO.getArriveConfigList();
arriveConfigList.stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
newTripList.add(tripVO);
MapRoutingVO routing = mapVO.findRoutingByCode(tripConfigVO.getRoutingCode());
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routing);
// 构建类车到站数据
tripVO.setServiceNumber(serviceConfig.getServiceNumber());
List<RunPlanArriveConfigVO> arriveConfigList = tripConfigVO.getArriveConfigList();
arriveConfigList.stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
newTripList.add(tripVO);
}
}
@ -481,6 +497,23 @@ public class RunPlanDraftService implements IRunPlanDraftService {
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
}
@Override
@Transactional
public void generateRunPlanService(Long userId,Long planId, RunPlanInputData inputData) {
RunPlanVO planVO = getRunPlanById(planId);
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
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()));
planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
// draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
// draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
// runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
}
@Override
@Transactional
public void updateRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO) {
@ -593,7 +626,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
public void addRunPlanTrip(Long planId, String serviceNumber, RunPlanTripConfigVO tripConfig, UserVO userVO) {
RunPlanVO planVO = getRunPlanById(planId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(this.ifServerExists(planVO, serviceNumber));
this.addTrip(planVO, serviceNumber, tripConfig);
this.addTrip(planVO, serviceNumber, tripConfig, userVO);
}
@Override
@ -615,7 +648,7 @@ 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);
this.addTrip(runPlanVO, del.getServiceNumber(), tripConfig,userVO);
}
/**修改车次号*/
@ -635,15 +668,36 @@ public class RunPlanDraftService implements IRunPlanDraftService {
}
/** 添加车次号(不校验服务号)*/
private void addTrip(RunPlanVO runPlanVO, String serviceNumber, RunPlanTripConfigVO tripConfig) {
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(), "运行图-用户缺少配置或没有配置车站折返数据");
Map<String, String> userReentryData = config.getConfig().getRunPlanUserReentryData();
List<RunPlanRoutingVO> userRoutings = runPlanRoutingService.getUserRoutingBy(userVO.getId(), mapVO.getId());
Map<String, RunPlanRoutingVO> userRoutingMap = userRoutings.stream().collect(Collectors.toMap(RunPlanRoutingVO::getCode, Function.identity()));
String tripNumber = "000";
RunPlanTripVO tripVO;
if (mapVO.isDrawWay()) {
// 查询交路
MapRoutingDataVO routing = mapVO.findRoutingDataByCode(tripConfig.getRoutingCode());
// MapRoutingDataVO routing = mapVO.findRoutingDataByCode(tripConfig.getRoutingCode());
RunPlanRoutingVO routingData = userRoutingMap.get(tripConfig.getRoutingCode());
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
MapSectionNewVO endReentrySection = null;
if (Objects.nonNull(endReentrySectionCode)) {
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
}
MapSectionNewVO startReentrySection = null;
if (Objects.nonNull(startReentrySectionCode)) {
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
}
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
// 构建类车到站数据
tripVO = new RunPlanTripVO(tripConfig, routing);
// tripVO = new RunPlanTripVO(tripConfig, routing);
setDirectionCode(mapVO.getConfigVO().getUpRight(), tripVO);
} else {
// 查询交路
@ -669,49 +723,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
}
/*** 修改车次号(不校验服务号)*/
private void updateTrip(RunPlanVO runPlanVO, RunPlanTripVO tripVO0, RunPlanTripConfigVO tripConfig) {
MapVO mapVO = this.iMapService.getMapDetail(runPlanVO.getMapId());
if(mapVO.isDrawWay()){
// 查询交路
MapRoutingDataVO routing = mapVO.findRoutingDataByCode(tripConfig.getRoutingCode());
String tripNumber = "000";
// 构建类车到站数据
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfig, routing);
tripVO.setServiceNumber(tripVO0.getServiceNumber());
setDirectionCode(mapVO.getConfigVO().getUpRight(),tripVO);
tripVO.setTripNumber(tripVO0.getTripNumber());
tripVO.setIsReentry(tripVO0.getIsReentry());
tripVO.setIsOutbound(tripVO0.getIsOutbound());
tripVO.setIsInbound(tripVO0.getIsInbound());
tripVO.setIsBackUp(tripVO0.getIsBackUp());
tripConfig.getArriveConfigList().stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
if (CollectionUtils.isEmpty(runPlanVO.getTripList())) {
runPlanVO.setTripList(new ArrayList<>());
}
runPlanVO.getTripList().add(tripVO);
}else{
// 查询交路
MapRoutingVO routing = mapVO.findRoutingByCode(tripConfig.getRoutingCode());
String tripNumber = "000";
// 构建类车到站数据
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfig, routing);
tripVO.setServiceNumber(tripVO0.getServiceNumber());
tripVO.setTripNumber(tripVO0.getTripNumber());
tripVO.setIsReentry(tripVO0.getIsReentry());
tripVO.setIsOutbound(tripVO0.getIsOutbound());
tripVO.setIsInbound(tripVO0.getIsInbound());
tripVO.setIsBackUp(tripVO0.getIsBackUp());
tripConfig.getArriveConfigList().stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
if (CollectionUtils.isEmpty(runPlanVO.getTripList())) {
runPlanVO.setTripList(new ArrayList<>());
}
runPlanVO.getTripList().add(tripVO);
}
}
private void setDirectionCode(Boolean upRight, RunPlanTripVO runPlanTripVO) {
if (runPlanTripVO.getRight()) {
@ -1020,31 +1031,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
return runPlanVO;
}
private List<MapStationVO> prepareStationData(MapVO mapVO) {
// 获取站台轨
List<MapSectionVO> standTrackList = mapVO.findStandTrackList();
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(standTrackList);
// 获取车站
List<MapStationVO> stationList = mapVO.findSortedAllStationList();
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(stationList);
// 获取站台
List<MapStationStandVO> standList = mapVO.findAllStandList();
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(standList);
Map<String, MapStationStandVO> standVOMap = standList.stream().collect(
Collectors.toMap(MapStationStandVO::getCode, Function.identity()));
// 处理车站站台轨数据
standTrackList.forEach(sectionVO -> standVOMap.get(sectionVO.getRelStandCode()).setStandTrack(sectionVO));
// 处理车站站台数据
for (MapStationVO station : stationList) {
for (MapStationStandVO stand : standList) {
if (station.getCode().equals(stand.getStationCode())) {
station.addStand(stand);
}
}
}
return stationList;
}
private List<MapStationNewVO> prepareStationDataNew(MapVO mapVO) {
// // 获取站台轨
// List<MapSectionNewVO> standTrackList = mapVO.findStandTrackListNew();

View File

@ -0,0 +1,22 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParktimeQueryVO;
import java.util.List;
public interface IRunPlanParktimeService {
void createUserParktime(RunPlanParkingTimeVO parkingTimeVO);
void updateUserParktime(Long id, RunPlanParkingTimeVO parkingTimeVO);
void updateRefUserParktime(Long userId, Long mapId, List<RunPlanParkingTimeVO> list);
PageVO<RunPlanParkingTimeVO> queryUserParktimes(Long userId, Long mapId, RunPlanParktimeQueryVO queryVO);
List<RunPlanParkingTimeVO> queryUserParktimes(Long userId, Long mapId);
boolean isExisted(RunPlanParkingTimeVO parkingTimeVO);
}

View File

@ -0,0 +1,32 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
public interface IRunPlanRoutingService {
@Transactional
void createUserRouting(RunPlanRoutingVO routingVO);
RunPlanRoutingVO getUserRouting(Long routingId);
void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO);
void deleteUserRouting(Long routingId);
PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO);
List<RunPlanRoutingVO> getUserRoutingBy(Long userId, Long mapId);
RunPlanRoutingVO queryUserRoutingBySDTNumber(Long userId, Long planId, String SDTNumber);
RunPlanRoutingVO queryUserRoutingByCode(Long userId, Long mapId, String routingCode);
List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long planId, String routingCode);
}

View File

@ -0,0 +1,21 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunLevelQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import java.util.List;
public interface IRunPlanRunlevelService {
void createUserRunlevel(RunPlanRunlevelVO runLevelVO);
void update(Long id, RunPlanRunlevelVO runLevelVO);
void updateRefLevels(Long userId, Long mapId, List<RunPlanRunlevelVO> list);
PageVO<RunPlanRunlevelVO> queryUserRunLevels(Long userId, Long mapId, RunPlanRunLevelQueryVO queryVO);
List<RunPlanRunlevelVO> queryUserRunLevels(Long userId, Long mapId);
boolean isExisted(RunPlanRunlevelVO runLevelVO);
}

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
public interface IRunPlanUserConfigService {
RunPlanUserConfigVO getConfig(Long userId, Long mapId);
void saveConfig(Long userId, Long mapId, RunPlanUserConfigVO.Config config);
}

View File

@ -0,0 +1,103 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.dao.RunPlanParktimeDAO;
import club.joylink.rtss.dao.RunPlanRunlevelDAO;
import club.joylink.rtss.entity.RunPlanParktime;
import club.joylink.rtss.entity.RunPlanParktimeExample;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.entity.RunPlanRunlevelExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParktimeQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunLevelQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
@Slf4j
public class RunPlanParktimeService implements IRunPlanParktimeService {
@Autowired
private RunPlanParktimeDAO parktimeDAO;
@Override
public void createUserParktime(RunPlanParkingTimeVO parkingTimeVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isExisted(parkingTimeVO));
RunPlanParktime parktime = parkingTimeVO.convert2Entity();
this.parktimeDAO.insert(parktime);
}
@Override
public void updateUserParktime(Long id, RunPlanParkingTimeVO parkingTimeVO) {
RunPlanParktime parktime = this.getEntityById(id);
parktime.setParkingTime(parkingTimeVO.getParkingTime());
this.parktimeDAO.updateByPrimaryKey(parktime);
}
@Override
public void updateRefUserParktime(Long userId, Long mapId, List<RunPlanParkingTimeVO> list) {
list.forEach(parkingTimeVO -> {
RunPlanParktime parktime = this.getEntityById(parkingTimeVO.getId());
if (parktime.getMapId().equals(mapId) && parktime.getUserId().equals(userId)) {
parktime.setParkingTime(parkingTimeVO.getParkingTime());
this.parktimeDAO.updateByPrimaryKeySelective(parktime);
}
});
}
@Override
public PageVO<RunPlanParkingTimeVO> queryUserParktimes(Long userId, Long mapId, RunPlanParktimeQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
RunPlanParktimeExample example = new RunPlanParktimeExample();
RunPlanParktimeExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
if (StringUtils.hasText(queryVO.getStationCode())) {
criteria.andStationCodeEqualTo(queryVO.getStationCode());
}
if (StringUtils.hasText(queryVO.getSectionCode())) {
criteria.andSectionCodeEqualTo(queryVO.getSectionCode());
}
Page<RunPlanParktime> page = (Page<RunPlanParktime>) this.parktimeDAO.selectByExample(example);
List<RunPlanParkingTimeVO> timeVOS = RunPlanParkingTimeVO.convert2VOList(page.getResult());
return PageVO.convert(page, timeVOS);
}
@Override
public List<RunPlanParkingTimeVO> queryUserParktimes(Long userId, Long mapId) {
RunPlanParktimeExample example = new RunPlanParktimeExample();
RunPlanParktimeExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
List<RunPlanParktime> list = this.parktimeDAO.selectByExample(example);
List<RunPlanParkingTimeVO> timeVOS = RunPlanParkingTimeVO.convert2VOList(list);
return timeVOS;
}
@Override
public boolean isExisted(RunPlanParkingTimeVO parkingTimeVO) {
RunPlanParktimeExample example = new RunPlanParktimeExample();
example.createCriteria()
.andMapIdEqualTo(parkingTimeVO.getMapId())
.andUserIdEqualTo(parkingTimeVO.getUserId())
.andStationCodeEqualTo(parkingTimeVO.getStationCode())
.andSectionCodeEqualTo(parkingTimeVO.getSectionCode());
if (this.parktimeDAO.countByExample(example) > 0) {
return true;
}
return false;
}
private RunPlanParktime getEntityById(Long id) {
RunPlanParktime parktime = this.parktimeDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(parktime,
String.format("id为[%s]的用户定义运行等级数据不存在", id));
return parktime;
}
}

View File

@ -0,0 +1,229 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.dao.RunPlanDraftDAO;
import club.joylink.rtss.dao.RunPlanRoutingDAO;
import club.joylink.rtss.entity.RunPlanDraft;
import club.joylink.rtss.entity.RunPlanRouting;
import club.joylink.rtss.entity.RunPlanRoutingExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.runplan.user.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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.stream.Collectors;
@Service
@Slf4j
public class RunPlanRoutingService implements IRunPlanRoutingService {
@Autowired
private RunPlanRoutingDAO runPlanRoutingDAO;
@Autowired
private RunPlanDraftDAO runPlanDraftDAO;
@Autowired
private IRunPlanRunlevelService planRunlevelService;
@Autowired
private IRunPlanParktimeService planParktimeService;
@Autowired
private IMapService iMapService;
@Transactional
@Override
public void createUserRouting(RunPlanRoutingVO 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(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
if (startSection.isTransferTrack() && endSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OTHER);
} else if (startSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OUTBOUND);
} else if (endSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.INBOUND);
} else {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.LOOP);
}
RunPlanRouting routing = routingVO.convert2Entity();
runPlanRoutingDAO.insert(routing);
generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap);
}
@Override
public RunPlanRoutingVO getUserRouting(Long routingId) {
RunPlanRouting routing = getRunPlanRoutingData(routingId);
return RunPlanRoutingVO.convert2VO(routing);
}
@Transactional
@Override
public void updateUserRouting(Long routingId, RunPlanRoutingVO 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(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
if (startSection.isTransferTrack() && endSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OTHER);
} else if (startSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OUTBOUND);
} else if (endSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.INBOUND);
} else {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.LOOP);
}
RunPlanRouting newRouting = routingVO.convert2Entity();
newRouting.setId(routingId);
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap);
}
private void generateUserParktimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO);
parkingTimeVOS.forEach(p -> {
if (!((Section) deviceMap.get(p.getSectionCode())).isTransferTrack() && !planParktimeService.isExisted(p)) {
planParktimeService.createUserParktime(p);
}
});
}
private void generateUserRunlevels(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
levels.forEach(l -> {
if (!planRunlevelService.isExisted(l)) {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
l.setDistance(distance);
l.generateDefaultRunLevel();
planRunlevelService.createUserRunlevel(l);
}
});
}
@Override
public void deleteUserRouting(Long routingId) {
runPlanRoutingDAO.deleteByPrimaryKey(routingId);
}
@Override
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.setOrderByClause("id");
RunPlanRoutingExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
if (StringUtils.hasText(queryVO.getStartStationCode())) {
criteria.andStartStationCodeEqualTo(queryVO.getStartStationCode());
}
if (StringUtils.hasText(queryVO.getEndStationCode())) {
criteria.andEndStationCodeEqualTo(queryVO.getEndStationCode());
}
if (StringUtils.hasText(queryVO.getStartSectionCode())) {
criteria.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
}
if (StringUtils.hasText(queryVO.getEndSectionCode())) {
criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
}
Page<RunPlanRouting> page = (Page<RunPlanRouting>) runPlanRoutingDAO.selectByExampleWithBLOBs(example);
List<RunPlanRoutingVO> routingVOList = page.getResult().stream().map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(page, routingVOList);
}
@Override
public List<RunPlanRoutingVO> getUserRoutingBy(Long userId, Long mapId) {
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
return RunPlanRoutingVO.convert2VOList(runPlanRoutings);
}
@Override
public RunPlanRoutingVO queryUserRoutingBySDTNumber(Long userId, Long planId, String SDTNumber) {
RunPlanVO planVO = this.getRunPlanById(planId);
RunPlanTripVO trip = planVO.getTripList().stream()
.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));
}
@Override
public RunPlanRoutingVO queryUserRoutingByCode(Long userId, Long mapId, String routingCode) {
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId).andCodeEqualTo(routingCode);
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0));
}
@Override
public List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long planId, String routingCode) {
RunPlanDraft runPlanDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(runPlanDraft.getMapId()).andUserIdEqualTo(userId).andCodeEqualTo(routingCode);
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(runPlanRoutings)) return Collections.emptyList();
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0)).getParkSectionCodeList();
}
private boolean ifRoutingDataExist(RunPlanRoutingVO routingVO) {
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
}
private RunPlanRouting getRunPlanRoutingData(Long routingId) {
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing);
return routing;
}
private RunPlanVO getRunPlanById(Long planId) {
RunPlanDraft runPlanDraft = this.runPlanDraftDAO.selectByPrimaryKey(planId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanDraft);
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
if (StringUtils.hasText(runPlanDraft.getTrips())) {
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
} else {
runPlanVO.setTripList(new ArrayList<>());
}
return runPlanVO;
}
}

View File

@ -0,0 +1,102 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.dao.RunPlanRunlevelDAO;
import club.joylink.rtss.entity.DraftMapRunLevel;
import club.joylink.rtss.entity.DraftMapRunLevelExample;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.entity.RunPlanRunlevelExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapRunLevelQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunLevelQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
@Slf4j
public class RunPlanRunlevelService implements IRunPlanRunlevelService {
@Autowired
private RunPlanRunlevelDAO runPlanRunlevelDAO;
@Override
public void createUserRunlevel(RunPlanRunlevelVO runLevelVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isExisted(runLevelVO));
RunPlanRunlevel runLevel = runLevelVO.convert2Entity();
this.runPlanRunlevelDAO.insert(runLevel);
}
@Override
public void update(Long id, RunPlanRunlevelVO runLevelVO) {
RunPlanRunlevel runLevel = this.getEntityById(id);
runLevelVO.updateLevel(runLevel);
this.runPlanRunlevelDAO.updateByPrimaryKey(runLevel);
}
@Override
public void updateRefLevels(Long userId, Long mapId, List<RunPlanRunlevelVO> list) {
list.forEach(runLevelVO -> {
RunPlanRunlevel runLevel = this.getEntityById(runLevelVO.getId());
if (runLevel.getMapId().equals(mapId) && runLevel.getUserId().equals(userId)) {
runLevelVO.updateLevel(runLevel);
this.runPlanRunlevelDAO.updateByPrimaryKeySelective(runLevel);
}
});
}
@Override
public PageVO<RunPlanRunlevelVO> queryUserRunLevels(Long userId, Long mapId, RunPlanRunLevelQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
RunPlanRunlevelExample example = new RunPlanRunlevelExample();
RunPlanRunlevelExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
if (StringUtils.hasText(queryVO.getStartSectionCode())) {
criteria.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
}
if (StringUtils.hasText(queryVO.getEndSectionCode())) {
criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
}
Page<RunPlanRunlevel> page = (Page<RunPlanRunlevel>) this.runPlanRunlevelDAO.selectByExample(example);
List<RunPlanRunlevelVO> runLevels = RunPlanRunlevelVO.convert2VOList(page.getResult());
return PageVO.convert(page, runLevels);
}
@Override
public List<RunPlanRunlevelVO> queryUserRunLevels(Long userId, Long mapId) {
RunPlanRunlevelExample example = new RunPlanRunlevelExample();
RunPlanRunlevelExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
List<RunPlanRunlevel> list = this.runPlanRunlevelDAO.selectByExample(example);
List<RunPlanRunlevelVO> runLevels = RunPlanRunlevelVO.convert2VOList(list);
return runLevels;
}
@Override
public boolean isExisted(RunPlanRunlevelVO runLevelVO) {
RunPlanRunlevelExample example = new RunPlanRunlevelExample();
example.createCriteria()
.andMapIdEqualTo(runLevelVO.getMapId())
.andUserIdEqualTo(runLevelVO.getUserId())
.andStartSectionCodeEqualTo(runLevelVO.getStartSectionCode())
.andEndSectionCodeEqualTo(runLevelVO.getEndSectionCode());
if (this.runPlanRunlevelDAO.countByExample(example) > 0) {
return true;
}
return false;
}
private RunPlanRunlevel getEntityById(Long id) {
RunPlanRunlevel runLevel = this.runPlanRunlevelDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runLevel,
String.format("id为[%s]的用户定义运行等级数据不存在", id));
return runLevel;
}
}

View File

@ -0,0 +1,51 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.dao.RunPlanUserConfigDAO;
import club.joylink.rtss.entity.RunPlanUserConfig;
import club.joylink.rtss.entity.RunPlanUserConfigExample;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Service
@Slf4j
public class RunPlanUserConfigService implements IRunPlanUserConfigService {
@Autowired
private RunPlanUserConfigDAO runPlanUserConfigDAO;
@Override
public RunPlanUserConfigVO getConfig(Long userId, Long mapId) {
RunPlanUserConfigExample example = new RunPlanUserConfigExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
List<RunPlanUserConfig> runPlanUserConfigs = runPlanUserConfigDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(runPlanUserConfigs)) return null;
return RunPlanUserConfigVO.convert2VO(runPlanUserConfigs.get(0));
}
@Override
public void saveConfig(Long userId, Long mapId, RunPlanUserConfigVO.Config config) {
RunPlanUserConfigExample example = new RunPlanUserConfigExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
List<RunPlanUserConfig> runPlanUserConfigs = runPlanUserConfigDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(runPlanUserConfigs)) {
RunPlanUserConfigVO configVO = new RunPlanUserConfigVO();
configVO.setUserId(userId);
configVO.setMapId(mapId);
configVO.setConfig(config);
RunPlanUserConfig userConfig = configVO.convert2Entity();
runPlanUserConfigDAO.insert(userConfig);
return;
}
RunPlanUserConfig userConfig = runPlanUserConfigs.get(0);
userConfig.setConfig(JsonUtils.writeValueAsString(config));
runPlanUserConfigDAO.updateByPrimaryKeyWithBLOBs(userConfig);
}
}

View File

@ -827,21 +827,14 @@ public class RouteService {
return;
}
List<Section> sectionList = route.getSectionList();
for (Section section : sectionList) {
if (section.isLockedOn(right)) {
if (section.isSwitchTrack()) {
SwitchElement element = route.getRouteSwitchElement(section.getRelSwitch());
if (!section.getRelSwitch().isOnPosition(element.isNormal())) {
overlapRelock = false;
}
}
}
}
for (int i = 0; i < sectionList.size(); i++) {
Section section = sectionList.get(i);
if (!Objects.equals(route.getUnlockedSection(), section)) {
continue;
}
if (route.isLastRouteSection(section)) {
overlapRelock = false;
}
Switch relSwitch = section.getRelSwitch();
if (section.isOccupied()) {
// 区段逻辑占用且有逻辑区段
@ -874,7 +867,7 @@ public class RouteService {
if (!section.isRouteLock() && (i + 1) < sectionList.size()) {
// 区段已经解锁更新解锁区段
route.updateUnlockedSection(sectionList.get(i+1));
} else if (section.isRouteLock() && i + 1 >= sectionList.size()) {
} else if (section.isRouteLock() && (i + 1) >= sectionList.size()) {
allUnlock = true;
}
}
@ -882,7 +875,8 @@ public class RouteService {
route.normalUnlockOver();
simulation.getRepository().removeSettingRoute(route);
log.debug(String.format("进路[%s(%s)-%s]解锁完毕,移除",route.getName(), route.getCode(), route.isTurnBack()?"Z":"B"));
} else {
}
if (overlapRelock) {
// 延续保护重新锁闭
this.checkAndSetLockedRouteOverlap(simulation, route);
}

View File

@ -199,11 +199,11 @@ public class Route extends MapNamedElement {
}
}
}
if (Objects.nonNull(this.overlap)) {
if (this.overlap.containRpSwitch()) { // 延续保护存在反位道岔
return false;
}
}
// if (Objects.nonNull(this.overlap)) {
// if (this.overlap.containRpSwitch()) { // 延续保护存在反位道岔
// return false;
// }
// }
return true;
}

View File

@ -186,6 +186,19 @@ public class MapVO {
return null;
}
@JsonIgnore
public MapSectionNewVO findSectionNew(String code) {
MapGraphDataNewVO graphData = this.getGraphDataNew();
if (Objects.nonNull(graphData)) {
List<MapSectionNewVO> sectionList = graphData.getSectionList();
if (!CollectionUtils.isEmpty(sectionList)) {
MapSectionNewVO section = sectionList.stream().filter(mapSectionNewVO -> mapSectionNewVO.getCode().equals(code)).findFirst().orElse(null);
return section;
}
}
return null;
}
@JsonIgnore
public List<MapStationVO> findSortedAllStationList() {
MapGraphDataVO graphData = this.getGraphData();

View File

@ -1,6 +1,8 @@
package club.joylink.rtss.vo.client.runplan;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
@ -13,6 +15,8 @@ import lombok.Setter;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -136,6 +140,24 @@ public class RunPlanTripVO {
this.timeList = new ArrayList<>();
}
public RunPlanTripVO(RunPlanTripConfigVO tripConfigVO, RunPlanRoutingVO routingVO , MapSectionNewVO startReentrySection, MapSectionNewVO endReentrySection) {
this.right = routingVO.getRight();
this.destinationCode = Objects.nonNull(endReentrySection) ? endReentrySection.getDestinationCode() : routingVO.getDestinationCode();
this.startSectionCode = Objects.nonNull(startReentrySection) ? startReentrySection.getCode() : routingVO.getStartSectionCode();
this.endSectionCode = Objects.nonNull(endReentrySection) ? endReentrySection.getCode() : routingVO.getEndSectionCode();
this.startTime = tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME).minusSeconds(40);
this.endTime = tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME).plusSeconds(40);
this.timeList = new ArrayList<>();
}
public RunPlanTripVO(RunPlanRoutingVO routingVO , MapSectionNewVO startReentrySection, MapSectionNewVO endReentrySection) {
this.right = routingVO.getRight();
this.destinationCode = Objects.nonNull(endReentrySection) ? endReentrySection.getDestinationCode() : routingVO.getDestinationCode();
this.startSectionCode = Objects.nonNull(startReentrySection) ? startReentrySection.getCode() : routingVO.getStartSectionCode();
this.endSectionCode = Objects.nonNull(endReentrySection) ? endReentrySection.getCode() : routingVO.getEndSectionCode();
this.timeList = new ArrayList<>();
}
public RunPlanTripVO(TripPlan plan) {
this.serviceNumber = plan.getServiceNumber();
this.tripNumber = plan.getTripNumber();

View File

@ -0,0 +1,87 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanParktime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value = "用户车站区段停站时间")
@Getter
@Setter
@NoArgsConstructor
public class RunPlanParkingTimeVO {
public final static Integer PARKING_TIME = 30;//s
private Long id;
private Long mapId;
private Long userId;
@ApiModelProperty(value = "车站code")
@NotBlank(message = "车站code不能为空")
private String stationCode;
@ApiModelProperty(value = "站台轨/折返轨/转换轨区段code")
@NotBlank(message = "区段code不能为空")
private String sectionCode;
@ApiModelProperty(value = "停站时间,单位秒(s)")
@NotNull(message = "停站时间不能为空")
private Integer parkingTime;
public RunPlanParktime convert2Entity() {
RunPlanParktime runPlanParktime = new RunPlanParktime();
runPlanParktime.setId(this.id);
runPlanParktime.setMapId(this.mapId);
runPlanParktime.setUserId(this.userId);
runPlanParktime.setStationCode(this.stationCode);
runPlanParktime.setSectionCode(this.sectionCode);
runPlanParktime.setParkingTime(this.parkingTime);
return runPlanParktime;
}
public static RunPlanParkingTimeVO convert2VO(RunPlanParktime runPlanParktime) {
RunPlanParkingTimeVO vo = new RunPlanParkingTimeVO();
vo.setId(runPlanParktime.getId());
vo.setMapId(runPlanParktime.getMapId());
vo.setUserId(runPlanParktime.getUserId());
vo.setStationCode(runPlanParktime.getStationCode());
vo.setSectionCode(runPlanParktime.getSectionCode());
vo.setParkingTime(runPlanParktime.getParkingTime());
return vo;
}
public static List<RunPlanParkingTimeVO> convert2VOList(List<RunPlanParktime> list) {
List<RunPlanParkingTimeVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(p -> voList.add(convert2VO(p)));
}
return voList;
}
public static List<RunPlanParkingTimeVO> parkingTimeFromRouting(RunPlanRoutingVO routingVO) {
List<RunPlanRoutingSection> parkSectionList = routingVO.getParkSectionCodeList();
List<RunPlanParkingTimeVO> list = new ArrayList<>();
for (int i = 0; i < parkSectionList.size(); i++) {
RunPlanParkingTimeVO timeVO = new RunPlanParkingTimeVO();
timeVO.setMapId(routingVO.getMapId());
timeVO.setUserId(routingVO.getUserId());
timeVO.setStationCode(parkSectionList.get(i).getStationCode());
timeVO.setSectionCode(parkSectionList.get(i).getSectionCode());
timeVO.setParkingTime(PARKING_TIME);
list.add(timeVO);
}
return list;
}
}

View File

@ -0,0 +1,20 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@ApiModel(value = "停站时间查询vo")
public class RunPlanParktimeQueryVO extends PageQueryVO {
@ApiModelProperty(value = "车站code")
private String stationCode;
@ApiModelProperty(value = "停站区段code")
private String sectionCode;
}

View File

@ -0,0 +1,25 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ApiModel
@Getter
@Setter
public class RunPlanRoutingQueryVO extends PageQueryVO {
@ApiModelProperty(value = "起始车站code")
private String startStationCode;
@ApiModelProperty(value = "起始站台区段code")
private String startSectionCode;
@ApiModelProperty(value = "终到车站code")
private String endStationCode;
@ApiModelProperty(value = "终到站台区段code")
private String endSectionCode;
}

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value="交路经停区段草稿")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class RunPlanRoutingSection {
@ApiModelProperty(value = "车站编号")
@NotBlank(message = "车站编号不能为空")
private String stationCode;
@ApiModelProperty(value = "区段编号")
@NotBlank(message = "区段编号不能为空")
private String sectionCode;
public static List<RunPlanRoutingSection> from(List<Section> viaSectionList) {
List<RunPlanRoutingSection> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(viaSectionList)) {
for (Section section : viaSectionList) {
voList.add(new RunPlanRoutingSection(section.getStation().getCode(), section.getCode()));
}
}
return voList;
}
}

View File

@ -0,0 +1,137 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanRouting;
import club.joylink.rtss.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ApiModel(value = "运行图用户交路对象")
@Getter
@Setter
public class RunPlanRoutingVO {
@ApiModelProperty(hidden = true)
private Long id;
@ApiModelProperty(value = "地图ID")
@NotNull(message = "地图ID不能为空")
private Long mapId;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "交路名称")
private String name;
@ApiModelProperty(value = "交路编号")
@NotBlank(message = "交路编号不能为空")
private String code;
@ApiModelProperty(value = "交路类型",hidden = true)
private UserRoutingType routingType;
@ApiModelProperty(value = "起始车站code")
private String startStationCode;
@ApiModelProperty(value = "起始站台区段code")
private String startSectionCode;
@ApiModelProperty(value = "终到车站code")
private String endStationCode;
@ApiModelProperty(value = "终到站台区段code")
private String endSectionCode;
@ApiModelProperty(value = "目的地码")
private String destinationCode;
@ApiModelProperty(value = "方向(左向/右向)")
@NotNull(message = "方向不能为空")
private Boolean right;
@ApiModelProperty(value = "经停车站区段编号列表")
@NotEmpty
@Valid
private List<RunPlanRoutingSection> parkSectionCodeList;
@ApiModelProperty(value = "描述")
private String remarks;
public RunPlanRoutingVO() {
this.parkSectionCodeList = new ArrayList<>();
}
public static RunPlanRoutingVO convert2VO(RunPlanRouting runPlanRouting) {
RunPlanRoutingVO routingVO = new RunPlanRoutingVO();
routingVO.setId(runPlanRouting.getId());
routingVO.setMapId(runPlanRouting.getMapId());
routingVO.setUserId(runPlanRouting.getUserId());
routingVO.setName(runPlanRouting.getName());
routingVO.setCode(runPlanRouting.getCode());
routingVO.setRoutingType(UserRoutingType.valueOf(runPlanRouting.getType()));
routingVO.setStartStationCode(runPlanRouting.getStartStationCode());
routingVO.setStartSectionCode(runPlanRouting.getStartSectionCode());
routingVO.setEndStationCode(runPlanRouting.getEndStationCode());
routingVO.setEndSectionCode(runPlanRouting.getEndSectionCode());
routingVO.setRight(runPlanRouting.getRight());
routingVO.setDestinationCode(runPlanRouting.getDestinationCode());
routingVO.setRemarks(runPlanRouting.getRemarks());
routingVO.setParkSectionCodeList(JsonUtils.readCollection(runPlanRouting.getSectionData(), List.class, RunPlanRoutingSection.class));
return routingVO;
}
public RunPlanRouting convert2Entity() {
RunPlanRouting routing = new RunPlanRouting();
routing.setId(id);
routing.setMapId(mapId);
routing.setUserId(userId);
routing.setName(name);
routing.setCode(code);
routing.setType(routingType.name());
routing.setStartStationCode(startStationCode);
routing.setStartSectionCode(startSectionCode);
routing.setEndStationCode(endStationCode);
routing.setEndSectionCode(endSectionCode);
routing.setRight(right);
routing.setDestinationCode(destinationCode);
routing.setRemarks(remarks);
routing.setSectionData(JsonUtils.writeValueAsString(parkSectionCodeList));
return routing;
}
// public RunPlanRoutingVO generateLoopRoutingBasicData(){
// RunPlanRoutingVO routing = new RunPlanRoutingVO();
// routing.setMapId(mapId);
// routing.setName(name+LOOP_MARK);
// routing.setCode(code+LOOP_MARK);
// routing.setStartStationCode(endStationCode);
// routing.setStartSectionCode(endSectionCode);
// routing.setEndStationCode(startStationCode);
// routing.setEndSectionCode(startSectionCode);
// routing.setRight(!right);
// routing.setDescription(description+LOOP_MARK);
// return routing;
// }
public static List<RunPlanRoutingVO> convert2VOList(List<RunPlanRouting> runPlanRoutings){
return runPlanRoutings.stream().map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList());
}
public enum UserRoutingType{
OUTBOUND,
INBOUND,
LOOP,
OTHER
}
}

View File

@ -0,0 +1,20 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@ApiModel(value = "运行等级查询")
public class RunPlanRunLevelQueryVO extends PageQueryVO {
@ApiModelProperty(value = "起始区段code")
private String startSectionCode;
@ApiModelProperty(value = "终点区段code")
private String endSectionCode;
}

View File

@ -0,0 +1,185 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingSectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelCreateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelGenerateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelUpdateCheck;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ApiModel(value = "运行计划站间运行等级")
@Getter
@Setter
@NoArgsConstructor
public class RunPlanRunlevelVO {
public static final float L1_SPEED = 12f; //m/s
public static final float L2_SPEED = 10.5f;
public static final float L3_SPEED = 9f;
public static final float L4_SPEED = 7.5f;
public static final float L5_SPEED = 6f;
private Long id;
@NotNull(message = "地图id不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class})
private Long mapId;
private Long userId;
@ApiModelProperty(value = "起始车站code")
@NotBlank(message = "起始车站code不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class, RunLevelUpdateCheck.class})
private String startStationCode;
@ApiModelProperty(value = "起始区段code")
@NotBlank(message = "起始区段code不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class, RunLevelUpdateCheck.class})
private String startSectionCode;
@ApiModelProperty(value = "终点车站code")
@NotBlank(message = "终点车站code不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class, RunLevelUpdateCheck.class})
private String endStationCode;
@ApiModelProperty(value = "终点区段code")
@NotBlank(message = "终点区段code不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class, RunLevelUpdateCheck.class})
private String endSectionCode;
@ApiModelProperty(value = "方向(左向/右向)")
@NotNull(message = "方向不能为空", groups = {RunLevelGenerateCheck.class, RunLevelCreateCheck.class, RunLevelUpdateCheck.class})
private Boolean right;
@ApiModelProperty(value = "距离/m")
@NotNull(message = "距离不能为空")
@PositiveOrZero
private Float distance;
@ApiModelProperty(value = "等级一时间,单位秒(s)")
@NotNull(message = "等级一时间不能为空")
private Integer l1;
@ApiModelProperty(value = "等级二时间,单位秒(s)")
@NotNull(message = "等级二时间不能为空")
@PositiveOrZero
private Integer l2;
@ApiModelProperty(value = "等级三时间,单位秒(s)")
@NotNull(message = "等级三时间不能为空")
@PositiveOrZero
private Integer l3;
@ApiModelProperty(value = "等级四时间,单位秒(s)")
@NotNull(message = "等级四时间不能为空")
@PositiveOrZero
private Integer l4;
@ApiModelProperty(value = "等级五时间,单位秒(s)")
@NotNull(message = "等级五时间不能为空")
@PositiveOrZero
private Integer l5;
public static List<RunPlanRunlevelVO> convert2VOList(List<RunPlanRunlevel> list) {
List<RunPlanRunlevelVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(runLevel -> voList.add(RunPlanRunlevelVO.convert2VO(runLevel)));
}
return voList;
}
public static RunPlanRunlevelVO convert2VO(RunPlanRunlevel runLevel) {
RunPlanRunlevelVO runLevelVO = new RunPlanRunlevelVO();
runLevelVO.setId(runLevel.getId());
runLevelVO.setMapId(runLevel.getMapId());
runLevelVO.setUserId(runLevel.getUserId());
runLevelVO.setStartStationCode(runLevel.getStartStationCode());
runLevelVO.setStartSectionCode(runLevel.getStartSectionCode());
runLevelVO.setEndStationCode(runLevel.getEndStationCode());
runLevelVO.setEndSectionCode(runLevel.getEndSectionCode());
runLevelVO.setRight(runLevel.getRight());
runLevelVO.setDistance(runLevel.getDistance());
runLevelVO.setL1(runLevel.getLevel1());
runLevelVO.setL2(runLevel.getLevel2());
runLevelVO.setL3(runLevel.getLevel3());
runLevelVO.setL4(runLevel.getLevel4());
runLevelVO.setL5(runLevel.getLevel5());
return runLevelVO;
}
public RunPlanRunlevel convert2Entity() {
RunPlanRunlevel runLevel = new RunPlanRunlevel();
runLevel.setId(id);
runLevel.setMapId(mapId);
runLevel.setUserId(userId);
runLevel.setStartStationCode(startStationCode);
runLevel.setStartSectionCode(startSectionCode);
runLevel.setEndStationCode(endStationCode);
runLevel.setEndSectionCode(endSectionCode);
runLevel.setRight(right);
runLevel.setDistance(distance);
runLevel.setLevel1(l1);
runLevel.setLevel2(l2);
runLevel.setLevel3(l3);
runLevel.setLevel4(l4);
runLevel.setLevel5(l5);
return runLevel;
}
public void updateLevel(RunPlanRunlevel runLevel) {
runLevel.setLevel1(l1);
runLevel.setLevel2(l2);
runLevel.setLevel3(l3);
runLevel.setLevel4(l4);
runLevel.setLevel5(l5);
}
public static List<RunPlanRunlevelVO> runLevelsFromRouting(RunPlanRoutingVO routingVO) {
List<RunPlanRoutingSection> parkSectionList = routingVO.getParkSectionCodeList();
List<RunPlanRunlevelVO> list = new ArrayList<>();
for (int i = 0; i < parkSectionList.size()-1; i++) {
RunPlanRunlevelVO runlevelVO = new RunPlanRunlevelVO();
runlevelVO.setMapId(routingVO.getMapId());
runlevelVO.setUserId(routingVO.getUserId());
runlevelVO.setRight(routingVO.getRight());
runlevelVO.setStartStationCode(parkSectionList.get(i).getStationCode());
runlevelVO.setEndStationCode(parkSectionList.get(i+1).getStationCode());
runlevelVO.setStartSectionCode(parkSectionList.get(i).getSectionCode());
runlevelVO.setEndSectionCode(parkSectionList.get(i+1).getSectionCode());
list.add(runlevelVO);
}
return list;
}
public void generateDefaultRunLevel() {
Objects.requireNonNull(this.distance, "站间距离不能为空");
this.l1 = Math.round(this.distance / L1_SPEED);
this.l2 = Math.round(this.distance / L2_SPEED);
this.l3 = Math.round(this.distance / L3_SPEED);
this.l4 = Math.round(this.distance / L4_SPEED);
this.l5 = Math.round(this.distance / L5_SPEED);
}
@JsonIgnore
public int getLevelTime(int level){
switch (level){
case 1:return l1;
case 2:return l2;
case 4:return l4;
case 5:return l5;
default:return l3;
}
}
}

View File

@ -0,0 +1,73 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanUserConfig;
import club.joylink.rtss.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@ApiModel(value = "运行图用户基础配置对象")
@Getter
@Setter
public class RunPlanUserConfigVO {
@ApiModelProperty(hidden = true)
private Long id;
@ApiModelProperty(value = "地图ID")
@NotNull(message = "地图ID不能为空")
private Long mapId;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "交路编号")
@NotNull(message = "交路编号不能为空")
private Config config;
public static RunPlanUserConfigVO convert2VO(RunPlanUserConfig runPlanUserConfig) {
RunPlanUserConfigVO routingVO = new RunPlanUserConfigVO();
// routingVO.setId(runPlanUserConfig.getId());
routingVO.setMapId(runPlanUserConfig.getMapId());
// routingVO.setUserId(runPlanUserConfig.getUserId());
routingVO.setConfig(JsonUtils.read(runPlanUserConfig.getConfig(), Config.class));
return routingVO;
}
public RunPlanUserConfig convert2Entity() {
RunPlanUserConfig userConfig = new RunPlanUserConfig();
userConfig.setId(id);
userConfig.setMapId(mapId);
userConfig.setUserId(userId);
userConfig.setConfig(JsonUtils.writeValueAsString(config));
return userConfig;
}
public static List<RunPlanUserConfigVO> convert2VOList(List<RunPlanUserConfig> userConfigs) {
return userConfigs.stream().map(RunPlanUserConfigVO::convert2VO).collect(Collectors.toList());
}
public boolean hasReentryData(){
return Objects.nonNull(config) && !CollectionUtils.isEmpty(config.getRunPlanUserReentryData());
}
@Getter
@Setter
public static class Config{
/**运行车站折返配置数据:车站code->折返轨code*/
@ApiModelProperty(value = "运行车站折返配置数据")
@NonNull
private Map<String,String> runPlanUserReentryData;
}
}

View File

@ -1,22 +1,53 @@
package club.joylink.rtss.vo.runplan.newdraw;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.runplan.IRunPlanParktimeService;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.services.runplan.IRunPlanRunlevelService;
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.vo.client.runplan.user.*;
import club.joylink.rtss.vo.runplan.newdraw.mainstack.DrawFuzhouRunPlan;
import club.joylink.rtss.vo.runplan.newdraw.mainstack.DrawHarbinRunPlan;
import club.joylink.rtss.vo.runplan.newdraw.mainstack.DrawRunPlan;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalTime;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 通用运行图生成
*/
@Component
public class RunPlanGenerator {
private static final int OFFSET_TIME_HOURS = 2; //时间偏移早两小时
public static List<RunPlanTripVO> generatorTrips(RunPlanInput runPlanInput, MapVO mapVO) {
@Autowired
private IRunPlanRoutingService runPlanRoutingService;
@Autowired
private IRunPlanRunlevelService runPlanRunlevelService;
@Autowired
private IRunPlanParktimeService runPlanParktimeService;
@Autowired
private IRunPlanUserConfigService runPlanUserConfigService;
public List<RunPlanTripVO> generatorTrips(RunPlanInput runPlanInput, MapVO mapVO) {
//校验发车停运时间
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getOverTime().isAfter(runPlanInput.getBeginTime()));
@ -24,16 +55,211 @@ public class RunPlanGenerator {
LocalTime beginTimeOffset = runPlanInput.getBeginTime().minusHours(OFFSET_TIME_HOURS);
//向前推两小时如果到前一天则时间不合理
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getBeginTime().isAfter(beginTimeOffset),
"发车时间过早,建议晚于上午两点");
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getBeginTime().isAfter(beginTimeOffset), "发车时间过早,建议晚于上午两点");
runPlanInput.setBeginTime(beginTimeOffset);
runPlanInput.setOverTime(runPlanInput.getOverTime().minusHours(OFFSET_TIME_HOURS));
return drawRunPlanOf(runPlanInput.getRunLevel(),mapVO).generatorTrips(runPlanInput, mapVO);
return drawRunPlanOf(runPlanInput.getRunLevel(), mapVO).generatorTrips(runPlanInput, mapVO);
}
private static DrawRunPlan drawRunPlanOf(int runLevel, MapVO mapVO) {
public List<RunPlanTripVO> generatorTrips(Long userId, RunPlanInputData inputData, MapVO mapVO) {
//校验时间
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getOverTime().isAfter(inputData.getBeginTime()));
LocalTime beginTimeOffset = inputData.getBeginTime().minusHours(OFFSET_TIME_HOURS);
//向前推两小时如果到前一天则时间不合理
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getBeginTime().isAfter(beginTimeOffset),
"发车时间过早,建议晚于上午两点");
inputData.setBeginTime(beginTimeOffset);
inputData.setOverTime(inputData.getOverTime().minusHours(OFFSET_TIME_HOURS));
//查交路
RunPlanRoutingVO outboundRouting = null;
if (inputData.hasOutbound()) {
outboundRouting = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getOutboundRouting());
}
RunPlanRoutingVO inboundRouting = null;
if (inputData.hasInbound()) {
inboundRouting = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getInboundRouting());
}
RunPlanRoutingVO running1Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getRunningRouting1());
RunPlanRoutingVO running2Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getRunningRouting2());
//构建环路 出入库关系
//出库关联某环路
RunPlanRoutingVO outboundRefRunningRouting = null;
//回库关联某环路
RunPlanRoutingVO inboundRefRunningRouting = null;
//验证 出库和入库 一端折返轨 一段转换轨验证环路 两端折返轨 环路是否闭环 或出入库跟环路是否衔接
boolean isLoop = running1Routing.getParkSectionCodeList().get(0).getStationCode().equals(running2Routing.getParkSectionCodeList().get(running2Routing.getParkSectionCodeList().size() - 1).getStationCode())
&& running2Routing.getParkSectionCodeList().get(0).getStationCode().equals(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isLoop, "运行两交路无法构成环路数据");
boolean outToRun1 = outboundRouting.getParkSectionCodeList().get(outboundRouting.getParkSectionCodeList().size() - 1).getStationCode().equals(running1Routing.getParkSectionCodeList().get(0).getStationCode());
boolean outToRun2 = outboundRouting.getParkSectionCodeList().get(outboundRouting.getParkSectionCodeList().size() - 1).getStationCode().equals(running2Routing.getParkSectionCodeList().get(0).getStationCode());
if (outToRun1) {
outboundRefRunningRouting = running1Routing;
} else if (outToRun2) {
outboundRefRunningRouting = running2Routing;
} else {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("出库交路 无法与环路交路相接");
}
boolean inToRun1 = inboundRouting.getParkSectionCodeList().get(0).getStationCode().equals(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode());
boolean inToRun2 = inboundRouting.getParkSectionCodeList().get(0).getStationCode().equals(running2Routing.getParkSectionCodeList().get(running2Routing.getParkSectionCodeList().size() - 1).getStationCode());
if (inToRun1) {
inboundRefRunningRouting = running1Routing;
} else if (inToRun2) {
inboundRefRunningRouting = running2Routing;
} else {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("出库交路 无法与环路交路相接");
}
//查站间运行等级
List<RunPlanRunlevelVO> levels = runPlanRunlevelService.queryUserRunLevels(userId, mapVO.getId());
Map<String, Integer> runLevelMap = levels.stream().collect(Collectors.toMap(runLevelVO -> String.format("%s-%s", runLevelVO.getStartSectionCode(), runLevelVO.getEndSectionCode()), runLevelVO -> runLevelVO.getLevelTime(inputData.getRunLevel())));
//查停站时间
List<RunPlanParkingTimeVO> parktimes = runPlanParktimeService.queryUserParktimes(userId, mapVO.getId());
Map<String, Integer> parkTimeMap = parktimes.stream().collect(Collectors.toMap(RunPlanParkingTimeVO::getSectionCode, RunPlanParkingTimeVO::getParkingTime));
//查折返
RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userId, mapVO.getId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "运行图-用户缺少配置或没有配置车站折返数据");
Map<String, String> userReentryData = config.getConfig().getRunPlanUserReentryData();
// 检测折返轨配置
if (Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(0).getStationCode()))
|| Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode()))) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("折返轨未设置");
}
LinkedList<RunPlanTripVO> tripList = new LinkedList<>();
int initTripNumber = 1;
TempResult temp = new TempResult(initTripNumber, inputData.getBeginTime());
//构建出库车次
buildServiceTrips(inputData.getServiceNumber(), mapVO, outboundRouting, true, runLevelMap, parkTimeMap, userReentryData, tripList, temp);
//计算出库车次运行所需时间
int size = inboundRouting.getParkSectionCodeList().size();
int inboundTripRunTime = 40;
for (int i = 0; i < size - 1; i++) {
RunPlanRoutingSection routingSection = inboundRouting.getParkSectionCodeList().get(i);
RunPlanRoutingSection nextRoutingSection = inboundRouting.getParkSectionCodeList().get(i + 1);
Integer parkTime = parkTimeMap.getOrDefault(routingSection, 0);
Integer runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
inboundTripRunTime = inboundTripRunTime + parkTime + runTime;
}
//构建环路车次
boolean loop = false;
while (temp.getLastStationDepartTime().plusSeconds(80 + inboundTripRunTime).isBefore(inputData.getOverTime())) {
buildServiceTrips(inputData.getServiceNumber(), mapVO, outboundRefRunningRouting, null, runLevelMap, parkTimeMap, userReentryData, tripList, temp);
if (!loop && outboundRefRunningRouting == inboundRefRunningRouting) {
loop = true;
continue;
} else {
buildServiceTrips(inputData.getServiceNumber(), mapVO, inboundRefRunningRouting, null, runLevelMap, parkTimeMap, userReentryData, tripList, temp);
loop = false;
}
}
//构建回库计划
buildServiceTrips(inputData.getServiceNumber(), mapVO, inboundRouting, false, runLevelMap, parkTimeMap, userReentryData, tripList, temp);
return tripList;
}
private void buildServiceTrips(String serviceNumber, MapVO mapVO, RunPlanRoutingVO routing, Boolean outbound,
Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, String> userReentryData,
LinkedList<RunPlanTripVO> tripList, TempResult tempResult) {
String startReentrySectionCode = userReentryData.get(routing.getStartStationCode());
String endReentrySectionCode = userReentryData.get(routing.getEndStationCode());
MapSectionNewVO endReentrySection = null;
if (Objects.nonNull(endReentrySectionCode)) {
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
}
MapSectionNewVO startReentrySection = null;
if (Objects.nonNull(startReentrySectionCode)) {
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
}
RunPlanTripVO tripVO = new RunPlanTripVO(routing, startReentrySection, endReentrySection);
setDirectionCode(mapVO, tripVO);
tripVO.setServiceNumber(serviceNumber);
tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", tempResult.getTripNumber()));
tripVO.setIsReentry(true);
if (Objects.nonNull(outbound)) {
if (outbound) {
tripVO.setIsOutbound(true);
} else {
tripVO.setIsInbound(true);
tripVO.setIsReentry(false);
}
}
LinkedList<RunPlanTripTimeVO> tripTimeList = new LinkedList<>();
routing.getParkSectionCodeList().forEach(runPlanRoutingSection -> {
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
runPlanTripTimeVO.setStationCode(runPlanRoutingSection.getStationCode());
runPlanTripTimeVO.setSectionCode(runPlanRoutingSection.getSectionCode());
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripList) && CollectionUtils.isEmpty(tripTimeList) ?
tempResult.getLastStationDepartTime() :
(CollectionUtils.isEmpty(tripTimeList) ?
(Objects.equals(tripList.getLast().getEndSectionCode(), runPlanTripTimeVO.getSectionCode()) ?
tripList.getLast().getStartTime() : tempResult.getLastStationDepartTime().plusSeconds(80)) : tempResult.getLastStationDepartTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode()))));
runPlanTripTimeVO.setDepartureTime(CollectionUtils.isEmpty(tripList) && CollectionUtils.isEmpty(tripTimeList) ? tempResult.getLastStationDepartTime() : runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.getOrDefault(runPlanTripTimeVO.getSectionCode(), 0)));
tempResult.setLastStationDepartTime(runPlanTripTimeVO.getDepartureTime());
tripTimeList.add(runPlanTripTimeVO);
});
tripVO.setTimeList(tripTimeList);
setTripRunTime(tripVO, tripTimeList);
tripList.add(tripVO);
tempResult.incrementTripNumber();
}
private void setDirectionCode(MapVO mapVO, RunPlanTripVO tripVO) {
if (mapVO.getConfigVO().getUpRight()) {
if (tripVO.getRight()) {
tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
} else {
tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
}
} else {
if (tripVO.getRight()) {
tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
} else {
tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
}
}
}
private void setTripRunTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList) {
setTripStartTime(runPlanTripVO, tripTimeList);
setTripEndTime(runPlanTripVO, tripTimeList);
}
private void setTripEndTime(RunPlanTripVO lastRunPlanTrip, LinkedList<RunPlanTripTimeVO> tripTimeList) {
if (Objects.equals(lastRunPlanTrip.getEndSectionCode(), tripTimeList.getLast().getSectionCode())) {
lastRunPlanTrip.setEndTime(tripTimeList.getLast().getDepartureTime());
} else {
lastRunPlanTrip.setEndTime(tripTimeList.getLast().getDepartureTime().plusSeconds(40));
}
}
private void setTripStartTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList) {
if (Objects.equals(runPlanTripVO.getStartSectionCode(), tripTimeList.getFirst().getSectionCode())) {
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime());
} else {
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime().minusSeconds(40));
}
}
@Getter
@Setter
@AllArgsConstructor
private class TempResult {
private int tripNumber;
private LocalTime lastStationDepartTime;
public void incrementTripNumber() {
tripNumber++;
}
}
private DrawRunPlan drawRunPlanOf(int runLevel, MapVO mapVO) {
DrawRunPlan drawRunPlan;
switch (mapVO.getLineCode()) {
case "07":

View File

@ -0,0 +1,74 @@
package club.joylink.rtss.vo.runplan.newdraw;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.time.LocalTime;
@ApiModel(value = "运行图生成输入参数")
@Getter
@Setter
public class RunPlanInputData {
@ApiModelProperty(value = "表号")
@NotBlank
private String serviceNumber;
/**出库交路code*/
@ApiModelProperty(value = "出库交路code")
@NotBlank(message= "出库交路不能为空")
private String outboundRouting;
/**回库交路code*/
@ApiModelProperty(value = "入库交路code")
@NotBlank(message= "入库交路不能为空")
private String inboundRouting;
/**运行环路*/
/**环路1-运行交路code*/
@ApiModelProperty(value = "运行交路code")
@NotBlank(message= "环路不能为空")
private String runningRouting1;
/**环路2-运行交路code*/
@ApiModelProperty(value = "运行交路code")
@NotBlank(message= "环路不能为空")
private String runningRouting2;
/**运营开始时间*/
@ApiModelProperty(value = "开始时间")
@NotNull(message = "开始时间不能为空")
private LocalTime beginTime;
/**运营结束时间*/
@ApiModelProperty(value = "结束时间")
@NotNull(message = "结束时间不能为空")
private LocalTime overTime;
// /**折返时间*/
// @ApiModelProperty(value = "折返时间")
// private int reentryTime = 150;
// /**发车间隔,s*/
// @ApiModelProperty(value = "发车间隔,s")
// @Positive
// private int departureInterval = 180 ;
/**运行等级默认-站间运行时间*/
private int runLevel = 3;
public boolean hasOutbound(){
return StringUtils.hasText(outboundRouting);
}
public boolean hasInbound(){
return StringUtils.hasText(inboundRouting);
}
}

View File

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RunPlanParktimeDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.RunPlanParktime">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="station_code" jdbcType="VARCHAR" property="stationCode" />
<result column="section_code" jdbcType="VARCHAR" property="sectionCode" />
<result column="parking_time" jdbcType="INTEGER" property="parkingTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, user_id, station_code, section_code, parking_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.RunPlanParktimeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from run_plan_parktime
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_plan_parktime
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from run_plan_parktime
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.RunPlanParktimeExample">
delete from run_plan_parktime
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanParktime" useGeneratedKeys="true">
insert into run_plan_parktime (map_id, user_id, station_code,
section_code, parking_time)
values (#{mapId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{stationCode,jdbcType=VARCHAR},
#{sectionCode,jdbcType=VARCHAR}, #{parkingTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanParktime" useGeneratedKeys="true">
insert into run_plan_parktime
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="stationCode != null">
station_code,
</if>
<if test="sectionCode != null">
section_code,
</if>
<if test="parkingTime != null">
parking_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="stationCode != null">
#{stationCode,jdbcType=VARCHAR},
</if>
<if test="sectionCode != null">
#{sectionCode,jdbcType=VARCHAR},
</if>
<if test="parkingTime != null">
#{parkingTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.RunPlanParktimeExample" resultType="java.lang.Long">
select count(*) from run_plan_parktime
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update run_plan_parktime
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.stationCode != null">
station_code = #{record.stationCode,jdbcType=VARCHAR},
</if>
<if test="record.sectionCode != null">
section_code = #{record.sectionCode,jdbcType=VARCHAR},
</if>
<if test="record.parkingTime != null">
parking_time = #{record.parkingTime,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update run_plan_parktime
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
station_code = #{record.stationCode,jdbcType=VARCHAR},
section_code = #{record.sectionCode,jdbcType=VARCHAR},
parking_time = #{record.parkingTime,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.RunPlanParktime">
update run_plan_parktime
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="stationCode != null">
station_code = #{stationCode,jdbcType=VARCHAR},
</if>
<if test="sectionCode != null">
section_code = #{sectionCode,jdbcType=VARCHAR},
</if>
<if test="parkingTime != null">
parking_time = #{parkingTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.RunPlanParktime">
update run_plan_parktime
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
station_code = #{stationCode,jdbcType=VARCHAR},
section_code = #{sectionCode,jdbcType=VARCHAR},
parking_time = #{parkingTime,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,421 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RunPlanRoutingDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.RunPlanRouting">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="start_station_code" jdbcType="VARCHAR" property="startStationCode" />
<result column="start_section_code" jdbcType="VARCHAR" property="startSectionCode" />
<result column="end_station_code" jdbcType="VARCHAR" property="endStationCode" />
<result column="end_section_code" jdbcType="VARCHAR" property="endSectionCode" />
<result column="right" jdbcType="BIT" property="right" />
<result column="destination_code" jdbcType="VARCHAR" property="destinationCode" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.RunPlanRouting">
<result column="section_data" jdbcType="LONGVARCHAR" property="sectionData" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, user_id, `name`, code, `type`, start_station_code, start_section_code,
end_station_code, end_section_code, `right`, destination_code, remarks
</sql>
<sql id="Blob_Column_List">
section_data
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.RunPlanRoutingExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from run_plan_routing
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.RunPlanRoutingExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from run_plan_routing
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from run_plan_routing
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from run_plan_routing
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.RunPlanRoutingExample">
delete from run_plan_routing
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanRouting" useGeneratedKeys="true">
insert into run_plan_routing (map_id, user_id, `name`,
code, `type`, start_station_code,
start_section_code, end_station_code, end_section_code,
`right`, destination_code, remarks,
section_data)
values (#{mapId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{startStationCode,jdbcType=VARCHAR},
#{startSectionCode,jdbcType=VARCHAR}, #{endStationCode,jdbcType=VARCHAR}, #{endSectionCode,jdbcType=VARCHAR},
#{right,jdbcType=BIT}, #{destinationCode,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
#{sectionData,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanRouting" useGeneratedKeys="true">
insert into run_plan_routing
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="code != null">
code,
</if>
<if test="type != null">
`type`,
</if>
<if test="startStationCode != null">
start_station_code,
</if>
<if test="startSectionCode != null">
start_section_code,
</if>
<if test="endStationCode != null">
end_station_code,
</if>
<if test="endSectionCode != null">
end_section_code,
</if>
<if test="right != null">
`right`,
</if>
<if test="destinationCode != null">
destination_code,
</if>
<if test="remarks != null">
remarks,
</if>
<if test="sectionData != null">
section_data,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="startStationCode != null">
#{startStationCode,jdbcType=VARCHAR},
</if>
<if test="startSectionCode != null">
#{startSectionCode,jdbcType=VARCHAR},
</if>
<if test="endStationCode != null">
#{endStationCode,jdbcType=VARCHAR},
</if>
<if test="endSectionCode != null">
#{endSectionCode,jdbcType=VARCHAR},
</if>
<if test="right != null">
#{right,jdbcType=BIT},
</if>
<if test="destinationCode != null">
#{destinationCode,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
#{remarks,jdbcType=VARCHAR},
</if>
<if test="sectionData != null">
#{sectionData,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.RunPlanRoutingExample" resultType="java.lang.Long">
select count(*) from run_plan_routing
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update run_plan_routing
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.startStationCode != null">
start_station_code = #{record.startStationCode,jdbcType=VARCHAR},
</if>
<if test="record.startSectionCode != null">
start_section_code = #{record.startSectionCode,jdbcType=VARCHAR},
</if>
<if test="record.endStationCode != null">
end_station_code = #{record.endStationCode,jdbcType=VARCHAR},
</if>
<if test="record.endSectionCode != null">
end_section_code = #{record.endSectionCode,jdbcType=VARCHAR},
</if>
<if test="record.right != null">
`right` = #{record.right,jdbcType=BIT},
</if>
<if test="record.destinationCode != null">
destination_code = #{record.destinationCode,jdbcType=VARCHAR},
</if>
<if test="record.remarks != null">
remarks = #{record.remarks,jdbcType=VARCHAR},
</if>
<if test="record.sectionData != null">
section_data = #{record.sectionData,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update run_plan_routing
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
code = #{record.code,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
start_station_code = #{record.startStationCode,jdbcType=VARCHAR},
start_section_code = #{record.startSectionCode,jdbcType=VARCHAR},
end_station_code = #{record.endStationCode,jdbcType=VARCHAR},
end_section_code = #{record.endSectionCode,jdbcType=VARCHAR},
`right` = #{record.right,jdbcType=BIT},
destination_code = #{record.destinationCode,jdbcType=VARCHAR},
remarks = #{record.remarks,jdbcType=VARCHAR},
section_data = #{record.sectionData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update run_plan_routing
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
code = #{record.code,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
start_station_code = #{record.startStationCode,jdbcType=VARCHAR},
start_section_code = #{record.startSectionCode,jdbcType=VARCHAR},
end_station_code = #{record.endStationCode,jdbcType=VARCHAR},
end_section_code = #{record.endSectionCode,jdbcType=VARCHAR},
`right` = #{record.right,jdbcType=BIT},
destination_code = #{record.destinationCode,jdbcType=VARCHAR},
remarks = #{record.remarks,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.RunPlanRouting">
update run_plan_routing
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="startStationCode != null">
start_station_code = #{startStationCode,jdbcType=VARCHAR},
</if>
<if test="startSectionCode != null">
start_section_code = #{startSectionCode,jdbcType=VARCHAR},
</if>
<if test="endStationCode != null">
end_station_code = #{endStationCode,jdbcType=VARCHAR},
</if>
<if test="endSectionCode != null">
end_section_code = #{endSectionCode,jdbcType=VARCHAR},
</if>
<if test="right != null">
`right` = #{right,jdbcType=BIT},
</if>
<if test="destinationCode != null">
destination_code = #{destinationCode,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=VARCHAR},
</if>
<if test="sectionData != null">
section_data = #{sectionData,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.RunPlanRouting">
update run_plan_routing
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
start_station_code = #{startStationCode,jdbcType=VARCHAR},
start_section_code = #{startSectionCode,jdbcType=VARCHAR},
end_station_code = #{endStationCode,jdbcType=VARCHAR},
end_section_code = #{endSectionCode,jdbcType=VARCHAR},
`right` = #{right,jdbcType=BIT},
destination_code = #{destinationCode,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR},
section_data = #{sectionData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.RunPlanRouting">
update run_plan_routing
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
start_station_code = #{startStationCode,jdbcType=VARCHAR},
start_section_code = #{startSectionCode,jdbcType=VARCHAR},
end_station_code = #{endStationCode,jdbcType=VARCHAR},
end_section_code = #{endSectionCode,jdbcType=VARCHAR},
`right` = #{right,jdbcType=BIT},
destination_code = #{destinationCode,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,355 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RunPlanRunlevelDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.RunPlanRunlevel">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="start_station_code" jdbcType="VARCHAR" property="startStationCode" />
<result column="start_section_code" jdbcType="VARCHAR" property="startSectionCode" />
<result column="end_station_code" jdbcType="VARCHAR" property="endStationCode" />
<result column="end_section_code" jdbcType="VARCHAR" property="endSectionCode" />
<result column="right" jdbcType="BIT" property="right" />
<result column="distance" jdbcType="REAL" property="distance" />
<result column="level1" jdbcType="INTEGER" property="level1" />
<result column="level2" jdbcType="INTEGER" property="level2" />
<result column="level3" jdbcType="INTEGER" property="level3" />
<result column="level4" jdbcType="INTEGER" property="level4" />
<result column="level5" jdbcType="INTEGER" property="level5" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, user_id, start_station_code, start_section_code, end_station_code, end_section_code,
`right`, distance, level1, level2, level3, level4, level5
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.RunPlanRunlevelExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from run_plan_runlevel
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_plan_runlevel
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from run_plan_runlevel
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.RunPlanRunlevelExample">
delete from run_plan_runlevel
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanRunlevel" useGeneratedKeys="true">
insert into run_plan_runlevel (map_id, user_id, start_station_code,
start_section_code, end_station_code, end_section_code,
`right`, distance, level1, level2,
level3, level4, level5
)
values (#{mapId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{startStationCode,jdbcType=VARCHAR},
#{startSectionCode,jdbcType=VARCHAR}, #{endStationCode,jdbcType=VARCHAR}, #{endSectionCode,jdbcType=VARCHAR},
#{right,jdbcType=BIT}, #{distance,jdbcType=REAL}, #{level1,jdbcType=INTEGER}, #{level2,jdbcType=INTEGER},
#{level3,jdbcType=INTEGER}, #{level4,jdbcType=INTEGER}, #{level5,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanRunlevel" useGeneratedKeys="true">
insert into run_plan_runlevel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="startStationCode != null">
start_station_code,
</if>
<if test="startSectionCode != null">
start_section_code,
</if>
<if test="endStationCode != null">
end_station_code,
</if>
<if test="endSectionCode != null">
end_section_code,
</if>
<if test="right != null">
`right`,
</if>
<if test="distance != null">
distance,
</if>
<if test="level1 != null">
level1,
</if>
<if test="level2 != null">
level2,
</if>
<if test="level3 != null">
level3,
</if>
<if test="level4 != null">
level4,
</if>
<if test="level5 != null">
level5,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="startStationCode != null">
#{startStationCode,jdbcType=VARCHAR},
</if>
<if test="startSectionCode != null">
#{startSectionCode,jdbcType=VARCHAR},
</if>
<if test="endStationCode != null">
#{endStationCode,jdbcType=VARCHAR},
</if>
<if test="endSectionCode != null">
#{endSectionCode,jdbcType=VARCHAR},
</if>
<if test="right != null">
#{right,jdbcType=BIT},
</if>
<if test="distance != null">
#{distance,jdbcType=REAL},
</if>
<if test="level1 != null">
#{level1,jdbcType=INTEGER},
</if>
<if test="level2 != null">
#{level2,jdbcType=INTEGER},
</if>
<if test="level3 != null">
#{level3,jdbcType=INTEGER},
</if>
<if test="level4 != null">
#{level4,jdbcType=INTEGER},
</if>
<if test="level5 != null">
#{level5,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.RunPlanRunlevelExample" resultType="java.lang.Long">
select count(*) from run_plan_runlevel
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update run_plan_runlevel
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.startStationCode != null">
start_station_code = #{record.startStationCode,jdbcType=VARCHAR},
</if>
<if test="record.startSectionCode != null">
start_section_code = #{record.startSectionCode,jdbcType=VARCHAR},
</if>
<if test="record.endStationCode != null">
end_station_code = #{record.endStationCode,jdbcType=VARCHAR},
</if>
<if test="record.endSectionCode != null">
end_section_code = #{record.endSectionCode,jdbcType=VARCHAR},
</if>
<if test="record.right != null">
`right` = #{record.right,jdbcType=BIT},
</if>
<if test="record.distance != null">
distance = #{record.distance,jdbcType=REAL},
</if>
<if test="record.level1 != null">
level1 = #{record.level1,jdbcType=INTEGER},
</if>
<if test="record.level2 != null">
level2 = #{record.level2,jdbcType=INTEGER},
</if>
<if test="record.level3 != null">
level3 = #{record.level3,jdbcType=INTEGER},
</if>
<if test="record.level4 != null">
level4 = #{record.level4,jdbcType=INTEGER},
</if>
<if test="record.level5 != null">
level5 = #{record.level5,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update run_plan_runlevel
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
start_station_code = #{record.startStationCode,jdbcType=VARCHAR},
start_section_code = #{record.startSectionCode,jdbcType=VARCHAR},
end_station_code = #{record.endStationCode,jdbcType=VARCHAR},
end_section_code = #{record.endSectionCode,jdbcType=VARCHAR},
`right` = #{record.right,jdbcType=BIT},
distance = #{record.distance,jdbcType=REAL},
level1 = #{record.level1,jdbcType=INTEGER},
level2 = #{record.level2,jdbcType=INTEGER},
level3 = #{record.level3,jdbcType=INTEGER},
level4 = #{record.level4,jdbcType=INTEGER},
level5 = #{record.level5,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.RunPlanRunlevel">
update run_plan_runlevel
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="startStationCode != null">
start_station_code = #{startStationCode,jdbcType=VARCHAR},
</if>
<if test="startSectionCode != null">
start_section_code = #{startSectionCode,jdbcType=VARCHAR},
</if>
<if test="endStationCode != null">
end_station_code = #{endStationCode,jdbcType=VARCHAR},
</if>
<if test="endSectionCode != null">
end_section_code = #{endSectionCode,jdbcType=VARCHAR},
</if>
<if test="right != null">
`right` = #{right,jdbcType=BIT},
</if>
<if test="distance != null">
distance = #{distance,jdbcType=REAL},
</if>
<if test="level1 != null">
level1 = #{level1,jdbcType=INTEGER},
</if>
<if test="level2 != null">
level2 = #{level2,jdbcType=INTEGER},
</if>
<if test="level3 != null">
level3 = #{level3,jdbcType=INTEGER},
</if>
<if test="level4 != null">
level4 = #{level4,jdbcType=INTEGER},
</if>
<if test="level5 != null">
level5 = #{level5,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.RunPlanRunlevel">
update run_plan_runlevel
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
start_station_code = #{startStationCode,jdbcType=VARCHAR},
start_section_code = #{startSectionCode,jdbcType=VARCHAR},
end_station_code = #{endStationCode,jdbcType=VARCHAR},
end_section_code = #{endSectionCode,jdbcType=VARCHAR},
`right` = #{right,jdbcType=BIT},
distance = #{distance,jdbcType=REAL},
level1 = #{level1,jdbcType=INTEGER},
level2 = #{level2,jdbcType=INTEGER},
level3 = #{level3,jdbcType=INTEGER},
level4 = #{level4,jdbcType=INTEGER},
level5 = #{level5,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RunPlanUserConfigDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.RunPlanUserConfig">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.RunPlanUserConfig">
<result column="config" jdbcType="LONGVARCHAR" property="config" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, user_id
</sql>
<sql id="Blob_Column_List">
config
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.RunPlanUserConfigExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from run_plan_user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.RunPlanUserConfigExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from run_plan_user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from run_plan_user_config
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from run_plan_user_config
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.RunPlanUserConfigExample">
delete from run_plan_user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanUserConfig" useGeneratedKeys="true">
insert into run_plan_user_config (map_id, user_id, config
)
values (#{mapId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{config,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RunPlanUserConfig" useGeneratedKeys="true">
insert into run_plan_user_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="config != null">
config,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="config != null">
#{config,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.RunPlanUserConfigExample" resultType="java.lang.Long">
select count(*) from run_plan_user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update run_plan_user_config
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.config != null">
config = #{record.config,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update run_plan_user_config
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
config = #{record.config,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update run_plan_user_config
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.RunPlanUserConfig">
update run_plan_user_config
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="config != null">
config = #{config,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.RunPlanUserConfig">
update run_plan_user_config
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
config = #{config,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.RunPlanUserConfig">
update run_plan_user_config
set map_id = #{mapId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>