Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
84fb648992
72
sql/20201204.sql
Normal file
72
sql/20201204.sql
Normal 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
|
||||
;
|
||||
|
||||
|
2
sql/20201208.sql
Normal file
2
sql/20201208.sql
Normal file
@ -0,0 +1,2 @@
|
||||
alter table user_simulation_stats modify role varchar(32) null comment '用户角色';
|
||||
|
@ -8,10 +8,16 @@ public enum Project {
|
||||
DEFAULT,
|
||||
/** 西铁院定制项目 */
|
||||
XTY,
|
||||
/** 南铁院定制项目 */
|
||||
/** 南铁院项目 */
|
||||
NTY,
|
||||
/** 西安地铁定制项目 */
|
||||
/** 南铁院云端定制项目 */
|
||||
NTYC,
|
||||
/** 南铁院本地定制项目 */
|
||||
NTYL,
|
||||
/** 西安地铁运营公司项目 */
|
||||
XADT,
|
||||
/** 苏州电子信息学院项目 */
|
||||
SDY,
|
||||
/** 贵州装备职业学院项目 */
|
||||
GZB,
|
||||
/** 哈尔滨项目 */
|
||||
|
@ -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);
|
||||
|
@ -106,6 +106,6 @@ public class GoodsController {
|
||||
@ApiOperation(value = "根据权限ids查询权限包商品")
|
||||
@GetMapping(path = "/permissionIds")
|
||||
public GoodsVO findGoodsByPermissionIds(Long[] ids) {
|
||||
return iGoodsService.findGoodsByPermissionIds(ids);
|
||||
return iGoodsService.findGoodsByRelPermissionIds(ids);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = {"每日运行计划接口"})
|
||||
@RestController
|
||||
@ -78,4 +79,9 @@ public class RunPlanDailyController {
|
||||
public RunPlanEChartsDataVO selectDiagramData(@PathVariable Long planId) {
|
||||
return this.iDailyRunPlanService.selectDiagramData(planId);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/{id}/copyToMaps")
|
||||
public void copyLoadPlanToMaps(@PathVariable Long id, @RequestBody List<Long> mapIds) {
|
||||
this.iLoadPlanService.copyToMaps(id, mapIds);
|
||||
}
|
||||
}
|
||||
|
@ -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,8 +47,9 @@ public class RunPlanDraftController {
|
||||
|
||||
@ApiOperation(value = "自动生成运行图车次数据")
|
||||
@PostMapping(path = "/{id}")
|
||||
public RunPlanEChartsDataVO create(@RequestBody @Validated RunPlanInput runPlanInput, @PathVariable Long id) {
|
||||
return iRunPlanDraftService.createCommon(id,runPlanInput);
|
||||
@Deprecated
|
||||
public RunPlanEChartsDataVO create(@RequestBody @Validated RunPlanInput runPlanInput, @PathVariable Long id,@ApiIgnore @RequestAttribute UserVO user) {
|
||||
return iRunPlanDraftService.createCommon(id,runPlanInput,user);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改运行图名称")
|
||||
@ -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,
|
@ -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);
|
||||
}
|
||||
}
|
@ -128,4 +128,10 @@ public class UserController {
|
||||
public List<StudentClassVO> getClasses(@PathVariable String projectCode){
|
||||
return this.iClassStudentUserService.getClassesByProjectCode(projectCode);
|
||||
}
|
||||
|
||||
@ApiOperation("查询销售人员")
|
||||
@GetMapping("/seller")
|
||||
public List<UserVO> querySellers(){
|
||||
return iSysUserService.querySellers();
|
||||
}
|
||||
}
|
||||
|
@ -76,4 +76,10 @@ public class UserPermissionController {
|
||||
return iUserPermissionService.queryPersonalUserPermission(user);
|
||||
}
|
||||
|
||||
@ApiOperation("根据地图一键领取权限")
|
||||
@PostMapping("/{mapId}/getPermissions")
|
||||
public void getPermissions4Map(@PathVariable Long mapId, Integer count ,@RequestAttribute @ApiIgnore UserVO user) {
|
||||
iUserPermissionService.getPermissions4Map(mapId, count, user);
|
||||
}
|
||||
|
||||
}
|
||||
|
12
src/main/java/club/joylink/rtss/dao/RunPlanParktimeDAO.java
Normal file
12
src/main/java/club/joylink/rtss/dao/RunPlanParktimeDAO.java
Normal 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> {
|
||||
}
|
48
src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java
Normal file
48
src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java
Normal 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);
|
||||
}
|
12
src/main/java/club/joylink/rtss/dao/RunPlanRunlevelDAO.java
Normal file
12
src/main/java/club/joylink/rtss/dao/RunPlanRunlevelDAO.java
Normal 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> {
|
||||
}
|
@ -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);
|
||||
}
|
136
src/main/java/club/joylink/rtss/entity/RunPlanParktime.java
Normal file
136
src/main/java/club/joylink/rtss/entity/RunPlanParktime.java
Normal 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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
261
src/main/java/club/joylink/rtss/entity/RunPlanRouting.java
Normal file
261
src/main/java/club/joylink/rtss/entity/RunPlanRouting.java
Normal 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();
|
||||
}
|
||||
}
|
1092
src/main/java/club/joylink/rtss/entity/RunPlanRoutingExample.java
Normal file
1092
src/main/java/club/joylink/rtss/entity/RunPlanRoutingExample.java
Normal file
File diff suppressed because it is too large
Load Diff
264
src/main/java/club/joylink/rtss/entity/RunPlanRunlevel.java
Normal file
264
src/main/java/club/joylink/rtss/entity/RunPlanRunlevel.java
Normal 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();
|
||||
}
|
||||
}
|
1102
src/main/java/club/joylink/rtss/entity/RunPlanRunlevelExample.java
Normal file
1102
src/main/java/club/joylink/rtss/entity/RunPlanRunlevelExample.java
Normal file
File diff suppressed because it is too large
Load Diff
104
src/main/java/club/joylink/rtss/entity/RunPlanUserConfig.java
Normal file
104
src/main/java/club/joylink/rtss/entity/RunPlanUserConfig.java
Normal 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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.SaleGoodsTypeEnum;
|
||||
import club.joylink.rtss.constants.StatusEnum;
|
||||
@ -13,6 +10,7 @@ import club.joylink.rtss.entity.Permission;
|
||||
import club.joylink.rtss.entity.PermissionExample;
|
||||
import club.joylink.rtss.entity.SaleGoods;
|
||||
import club.joylink.rtss.entity.SaleGoodsExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.GoodsTryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -22,14 +20,19 @@ import club.joylink.rtss.vo.client.goods.GoodsVO;
|
||||
import club.joylink.rtss.vo.client.permission.PermissionQueryVO;
|
||||
import club.joylink.rtss.vo.client.permission.PermissionSelectVO;
|
||||
import club.joylink.rtss.vo.client.permission.PermissionVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@ -151,7 +154,7 @@ public class GoodsService implements IGoodsService {
|
||||
* 如果有权限包但没有对应的商品,返回一个只有permissionId和permissionName的goodsVO
|
||||
*/
|
||||
@Override
|
||||
public GoodsVO findGoodsByPermissionIds(Long[] relPermissionIds) {
|
||||
public GoodsVO findGoodsByRelPermissionIds(Long[] relPermissionIds) {
|
||||
List<PermissionVO> voList = iPermissionService.findPermissionByRelPermissionIds(Arrays.asList(relPermissionIds));
|
||||
if (voList.isEmpty()) {
|
||||
return null;
|
||||
@ -238,6 +241,15 @@ public class GoodsService implements IGoodsService {
|
||||
return goods != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GoodsVO> getByPermissionIds(List<Long> permissionIds) {
|
||||
SaleGoodsExample example = new SaleGoodsExample();
|
||||
example.createCriteria().andPermissionIdIn(permissionIds);
|
||||
List<SaleGoods> saleGoods = saleGoodsDAO.selectByExample(example);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(saleGoods);
|
||||
return saleGoods.stream().map(GoodsVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public SaleGoods findEntity(Long id) {
|
||||
return saleGoodsDAO.selectByPrimaryKey(id);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public interface IGoodsService {
|
||||
/**
|
||||
* 通过关联权限ids查询权限包商品
|
||||
*/
|
||||
GoodsVO findGoodsByPermissionIds(Long[] relPermissionIds);
|
||||
GoodsVO findGoodsByRelPermissionIds(Long[] relPermissionIds);
|
||||
|
||||
PageVO<GoodsVO> queryPagedGoodsByPermission(PermissionQueryVO queryVO);
|
||||
|
||||
@ -65,4 +65,5 @@ public interface IGoodsService {
|
||||
|
||||
boolean isExist(Long goodsId);
|
||||
|
||||
List<GoodsVO> getByPermissionIds(List<Long> permissionIds);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import club.joylink.rtss.vo.client.runplan.RunPlanLoadQueryVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运行图加载计划服务
|
||||
@ -77,4 +78,11 @@ public interface ILoadPlanService {
|
||||
RunPlanLoadVO findCommonLoadPlanOfMap(Long mapId);
|
||||
|
||||
void deleteByTemplateId(Long templateId);
|
||||
|
||||
/**
|
||||
* 相同线路数据(不同皮肤)运行加载计划及运行图数据拷贝
|
||||
* @param id
|
||||
* @param mapIds
|
||||
*/
|
||||
void copyToMaps(Long id, List<Long> mapIds);
|
||||
}
|
||||
|
@ -54,4 +54,6 @@ public interface IPermissionService {
|
||||
* 根据mapId查询教学权限
|
||||
*/
|
||||
Permission findTeachPermissionEntity(Long mapId);
|
||||
|
||||
List<PermissionVO> getByMapId(Long mapId);
|
||||
}
|
||||
|
@ -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;
|
||||
@ -21,7 +22,7 @@ public interface IRunPlanDraftService {
|
||||
/**
|
||||
* 创建通用运行图车次数据
|
||||
*/
|
||||
RunPlanEChartsDataVO createCommon(Long runPlanId, RunPlanInput runPlanInput);
|
||||
RunPlanEChartsDataVO createCommon(Long runPlanId, RunPlanInput runPlanInput,UserVO userVO);
|
||||
|
||||
/**
|
||||
* 更新运行图名称
|
||||
@ -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
|
||||
|
@ -291,4 +291,9 @@ public interface ISysUserService {
|
||||
void ensureExist(Long id);
|
||||
|
||||
void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin);
|
||||
|
||||
/**
|
||||
* 查询所有的销售人员
|
||||
*/
|
||||
List<UserVO> querySellers();
|
||||
}
|
||||
|
@ -87,4 +87,12 @@ public interface IUserPermissionService {
|
||||
* 查询有效的用户教学权限
|
||||
*/
|
||||
List<UserPermission> findEntity(List<Long> userIds, Boolean valid);
|
||||
|
||||
/**
|
||||
* 给该用户领取该地图的权限
|
||||
* @param mapId
|
||||
* @param count
|
||||
* @param user
|
||||
*/
|
||||
void getPermissions4Map(Long mapId, Integer count, UserVO user);
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.dao.RunPlanLoadDAO;
|
||||
import club.joylink.rtss.dao.RunPlanTemplateDAO;
|
||||
import club.joylink.rtss.entity.RunPlanLoad;
|
||||
import club.joylink.rtss.entity.RunPlanLoadExample;
|
||||
import club.joylink.rtss.entity.RunPlanTemplate;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -25,6 +27,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class LoadPlanService implements ILoadPlanService {
|
||||
|
||||
@Autowired
|
||||
private RunPlanTemplateDAO runPlanTemplateDAO;
|
||||
|
||||
@Autowired
|
||||
private RunPlanLoadDAO runPlanLoadDAO;
|
||||
|
||||
@ -131,7 +136,7 @@ public class LoadPlanService implements ILoadPlanService {
|
||||
@Override
|
||||
public PageVO<RunPlanLoadVO> queryPagedLoadPlan(RunPlanLoadQueryVO queryVO) {
|
||||
RunPlanLoadExample runPlanLoadExample = new RunPlanLoadExample();
|
||||
runPlanLoadExample.setOrderByClause(" load_time DESC");
|
||||
runPlanLoadExample.setOrderByClause(" load_time DESC, id");
|
||||
RunPlanLoadExample.Criteria loadExampleCriteria = runPlanLoadExample.createCriteria();
|
||||
if (Objects.nonNull(queryVO.getUserId())) {
|
||||
loadExampleCriteria.andUserIdEqualTo(queryVO.getUserId());
|
||||
@ -140,6 +145,9 @@ public class LoadPlanService implements ILoadPlanService {
|
||||
}
|
||||
if (Objects.nonNull(queryVO.getMapId())) {
|
||||
loadExampleCriteria.andMapIdEqualTo(queryVO.getMapId());
|
||||
} else {
|
||||
List<Long> onlineMapIds = iMapService.queryOnlineMapInfos().stream().map(MapVO::getId).collect(Collectors.toList());
|
||||
loadExampleCriteria.andMapIdIn(onlineMapIds);
|
||||
}
|
||||
if(Objects.nonNull(queryVO.getTemplatePlanId())) {
|
||||
loadExampleCriteria.andTemplatePlanIdEqualTo(queryVO.getTemplatePlanId());
|
||||
@ -232,4 +240,34 @@ public class LoadPlanService implements ILoadPlanService {
|
||||
.andTemplatePlanIdEqualTo(templateId);
|
||||
this.runPlanLoadDAO.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void copyToMaps(Long id, List<Long> mapIds) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(mapIds);
|
||||
RunPlanLoad runPlanLoad = this.runPlanLoadDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanLoad);
|
||||
Long templatePlanId = runPlanLoad.getTemplatePlanId();
|
||||
RunPlanTemplate runPlanTemplate = this.runPlanTemplateDAO.selectByPrimaryKey(templatePlanId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanTemplate);
|
||||
for (Long mapId : mapIds) {
|
||||
if (Objects.equals(mapId, runPlanLoad.getMapId())) {
|
||||
continue;
|
||||
}
|
||||
RunPlanTemplate template = new RunPlanTemplate();
|
||||
template.setMapId(mapId);
|
||||
template.setName(runPlanTemplate.getName());
|
||||
template.setCreatorId(runPlanTemplate.getCreatorId());
|
||||
template.setCreateTime(runPlanTemplate.getCreateTime());
|
||||
template.setStatus(runPlanTemplate.getStatus());
|
||||
template.setTrips(runPlanTemplate.getTrips());
|
||||
this.runPlanTemplateDAO.insert(template);
|
||||
Long templateId = template.getId();
|
||||
RunPlanLoad loadPlan = new RunPlanLoad();
|
||||
loadPlan.setTemplatePlanId(templateId);
|
||||
loadPlan.setMapId(mapId);
|
||||
loadPlan.setCreatorId(runPlanLoad.getCreatorId());
|
||||
this.runPlanLoadDAO.insert(loadPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,6 +189,9 @@ public class MapService implements IMapService {
|
||||
if (StringUtils.hasText(queryVO.getCityCode())) {
|
||||
criteria.andCityCodeEqualTo(queryVO.getCityCode());
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getLineCode())) {
|
||||
criteria.andLineCodeEqualTo(queryVO.getLineCode());
|
||||
}
|
||||
Page<MapInfo> page = (Page<MapInfo>) mapInfoDAO.selectByExample(example);
|
||||
List<MapVO> mapVOS = MapVO.convert2VOList(page.getResult());
|
||||
return PageVO.convert(page, mapVOS);
|
||||
|
@ -459,7 +459,7 @@ public class PermissionService implements IPermissionService {
|
||||
example.createCriteria()
|
||||
.andRelPermissionsEqualTo(ids);
|
||||
List<Permission> permissionList = permissionDAO.selectByExample(example);
|
||||
List<PermissionVO> voList = permissionList.stream().map(permission -> new PermissionVO(permission)).collect(Collectors.toList());
|
||||
List<PermissionVO> voList = permissionList.stream().map(PermissionVO::new).collect(Collectors.toList());
|
||||
return voList;
|
||||
}
|
||||
|
||||
@ -468,8 +468,7 @@ public class PermissionService implements IPermissionService {
|
||||
PermissionExample example = new PermissionExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Permission> permissionList = permissionDAO.selectByExample(example);
|
||||
List<PermissionVO> voList = permissionList.stream().map(permission -> new PermissionVO(permission)).collect(Collectors.toList());
|
||||
return voList;
|
||||
return permissionList.stream().map(PermissionVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -535,6 +534,13 @@ public class PermissionService implements IPermissionService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PermissionVO> getByMapId(Long mapId) {
|
||||
List<PermissionVO> permissions = findByMapId(mapId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(permissions, String.format("地图[%s]下没有权限", mapId));
|
||||
return permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId获取该地图下的综合演练权限
|
||||
*/
|
||||
|
@ -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) {
|
||||
@ -76,10 +92,10 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput) {
|
||||
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput,UserVO userVO) {
|
||||
RunPlanDraft draftPlan = runPlanDraftDAO.selectByPrimaryKey(id);
|
||||
MapVO mapVO = this.iMapService.getMapDetail(draftPlan.getMapId());
|
||||
List<RunPlanTripVO> runPlanTrips = RunPlanGenerator.generatorTrips(runPlanInput, mapVO);
|
||||
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(userVO.getId(),runPlanInput, mapVO);
|
||||
draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
|
||||
draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
|
||||
@ -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,31 @@ 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());
|
||||
if (Objects.nonNull(inputData.getDepartureInterval())) {
|
||||
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.naturalOrder()).orElse("0");
|
||||
// 当前已有最大服务号
|
||||
int maxServiceNumber = Integer.parseInt(max);
|
||||
inputData.setServiceNumber(String.format("%03d", ++maxServiceNumber));
|
||||
Integer departureInterval = inputData.getDepartureInterval() < 60 ? 180 : inputData.getDepartureInterval();
|
||||
inputData.setDepartureInterval(departureInterval);
|
||||
}
|
||||
List<RunPlanTripVO> newTripList = runPlanGenerator.generatorTrips(userId,inputData,mapVO);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(newTripList),String.format("生成服务号%s运行图数据失败",inputData.getServiceNumber()));
|
||||
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 +634,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 +656,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 +676,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 +731,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 +1039,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();
|
||||
|
@ -742,6 +742,15 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserVO> querySellers() {
|
||||
SysUserExample example = new SysUserExample();
|
||||
example.setOrderByClause("id");
|
||||
example.createCriteria().andRolesLike(String.format("%%%s%%", BusinessConsts.ROLE_06));
|
||||
List<SysUser> users = sysUserDAO.selectByExample(example);
|
||||
return UserVO.convert2BaseInfoVO(users);
|
||||
}
|
||||
|
||||
private SysUser getEntity(Long id) {
|
||||
SysUser user = sysUserDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id));
|
||||
|
@ -1,9 +1,6 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.constants.PermissionTypeEnum;
|
||||
import club.joylink.rtss.constants.StatusEnum;
|
||||
import club.joylink.rtss.constants.UserPermissionStatusEnum;
|
||||
import club.joylink.rtss.constants.*;
|
||||
import club.joylink.rtss.dao.PermissionDAO;
|
||||
import club.joylink.rtss.dao.SysUserDAO;
|
||||
import club.joylink.rtss.dao.UserPermissionDAO;
|
||||
@ -13,7 +10,11 @@ import club.joylink.rtss.entity.UserPermission;
|
||||
import club.joylink.rtss.entity.UserPermissionExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.OrganizationVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.goods.GoodsVO;
|
||||
import club.joylink.rtss.vo.client.order.OrderCreateVO;
|
||||
import club.joylink.rtss.vo.client.order.OrderDetailCreateVO;
|
||||
import club.joylink.rtss.vo.client.permission.DistributeSelectVO;
|
||||
import club.joylink.rtss.vo.client.permission.PermissionQueryVO;
|
||||
import club.joylink.rtss.vo.client.permission.PermissionVO;
|
||||
@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -59,6 +61,9 @@ public class UserPermissionService implements IUserPermissionService {
|
||||
@Autowired
|
||||
private IOrderService iOrderService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService iOrganizationService;
|
||||
|
||||
@Override
|
||||
public PageVO<UserPermissionVO> queryPagedPermission(PermissionQueryVO queryVO) {
|
||||
List<Long> relDistributeIds = new ArrayList<>();
|
||||
@ -512,6 +517,33 @@ public class UserPermissionService implements IUserPermissionService {
|
||||
return userPermissionDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPermissions4Map(Long mapId, Integer count, UserVO user) {
|
||||
if (count == null || count == 0) {
|
||||
return;
|
||||
}
|
||||
List<OrganizationVO> organizations = iOrganizationService.queryOrganization();
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(organizations, "没有组织数据");
|
||||
|
||||
List<PermissionVO> permissions = iPermissionService.getByMapId(mapId);
|
||||
List<GoodsVO> goods = iGoodsService.getByPermissionIds(permissions.stream().map(PermissionVO::getId).collect(Collectors.toList()));
|
||||
List<OrderDetailCreateVO> orderDetails = goods.stream().map(goodsVO -> new OrderDetailCreateVO(goodsVO.getId(), count)).collect(Collectors.toList());
|
||||
|
||||
OrderCreateVO orderCreate = new OrderCreateVO();
|
||||
orderCreate.setOrganizationId(48L);
|
||||
orderCreate.setOrderType(SaleOrderTypeEnum.Internal_Distribution.getCode());
|
||||
orderCreate.setForever(true);
|
||||
orderCreate.setStartTime(LocalDateTime.now());
|
||||
orderCreate.setPayStatus(SaleOrderPayStatusEnum.No_Need.getCode());
|
||||
orderCreate.setDetailCreateVOList(orderDetails);
|
||||
//创建权限分发并领取权限
|
||||
String orderCode = iOrderService.createOrder(orderCreate, user);
|
||||
iPermissionDistributeService.distributeFromOrder(orderCode, user);
|
||||
DistributeVO distribute = iPermissionDistributeService.getByOrderCode(orderCode);
|
||||
Long distributeId = distribute.getId();
|
||||
iPermissionDistributeService.getUserPermission(distributeId, user);
|
||||
}
|
||||
|
||||
private List<UserPermissionVO> findByUserId(Long userId) {
|
||||
UserPermissionExample example = new UserPermissionExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId);
|
||||
|
@ -36,7 +36,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
String.format("地图基础数据有错误"));
|
||||
String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
|
||||
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
// 联锁关系数据生成
|
||||
@ -116,7 +116,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
List<MapStationRunLevelVO> stationRunLevelList;
|
||||
|
||||
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, List<AutoSignal> autoSignalList, List<Route> routeList,
|
||||
List<RouteOverlap> overlapList, List<Cycle> generateCycleList, List<MapRoutingDataVO> routingList,
|
||||
List<RouteOverlap> overlapList, List<Cycle> generateCycleList, /*List<MapRoutingDataVO> routingList,*/
|
||||
List<MapStationRunLevelVO> stationRunLevelList, List<DestinationCodeDefinition> destinationCodeDefinitionList) {
|
||||
this.errMsgList = errMsgList;
|
||||
this.approachList = approachList;
|
||||
@ -125,14 +125,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
this.overlapList = overlapList;
|
||||
this.cycleList = generateCycleList;
|
||||
this.destinationCodeDefinitionList = destinationCodeDefinitionList;
|
||||
this.routingList = routingList;
|
||||
// this.routingList = routingList;
|
||||
this.stationRunLevelList = stationRunLevelList;
|
||||
log.info(String.format("生成信号机接近区段数据[%s]条", approachList.size()));
|
||||
log.info(String.format("生成进路数据总计[%s]条", routeList.size()));
|
||||
log.info(String.format("生成延续保护数据[%s]条", overlapList.size()));
|
||||
log.info(String.format("生成自动信号数据[%s]条", autoSignalList.size()));
|
||||
log.info(String.format("生成自动折返数据[%s]条", generateCycleList.size()));
|
||||
log.info(String.format("生成交路数据[%s]条", routingList.size()));
|
||||
// log.info(String.format("生成交路数据[%s]条", routingList.size()));
|
||||
log.info(String.format("生成站间运行数据[%s]条", stationRunLevelList.size()));
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
resultVO.setOverlapCount(this.overlapList.size());
|
||||
resultVO.setCycleCount(this.cycleList.size());
|
||||
resultVO.setAutoSignalCount(this.autoSignalList.size());
|
||||
resultVO.setRoutingCount(this.routingList.size());
|
||||
// resultVO.setRoutingCount(this.routingList.size());
|
||||
resultVO.setStationRunlevelCount(this.stationRunLevelList.size());
|
||||
resultVO.setDestinationCodeDefinitionCount(this.destinationCodeDefinitionList.size());
|
||||
return resultVO;
|
||||
@ -249,8 +249,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
autoSignal.getSignal().setAutoSignal(autoSignal);
|
||||
}
|
||||
|
||||
// 生成交路数据
|
||||
List<MapRoutingDataVO> generateRoutingList = this.generateRoutings(deviceMap, generatedRouteList, autoSignalList, errorList);
|
||||
// // 生成交路数据
|
||||
// List<MapRoutingDataVO> generateRoutingList = this.generateRoutings(deviceMap, generatedRouteList, autoSignalList, errorList);
|
||||
|
||||
|
||||
// // 获取所有转换轨或者折返轨
|
||||
@ -323,7 +323,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
return new CiGenerateResult(errorList, approachList,
|
||||
autoSignalList, generatedRouteList, generatedOverlapList,
|
||||
generateCycleList, generateRoutingList, generatedStationRunLevelList, destinationCodeDefinitionList);
|
||||
generateCycleList, generatedStationRunLevelList, destinationCodeDefinitionList);
|
||||
}
|
||||
|
||||
private Collection<? extends Route> generateRouteLikeHa1(Signal signal, CodeGenerator routeCodeGenerator,
|
||||
@ -453,7 +453,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
clickEnd = this.queryNearlySignalOf(start, sectionPath);
|
||||
}
|
||||
// 构建进路
|
||||
if (config.isRouteApartByOverlap() && overlapList.size() > 1) {
|
||||
if (config.isRouteApartByOverlap() && overlapList != null && overlapList.size() > 1) {
|
||||
int index = 1;
|
||||
for (RouteOverlap routeOverlap : overlapList) {
|
||||
String code = routeCodeGenerator.next();
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.services.script;
|
||||
|
||||
import club.joylink.rtss.services.script.IScriptSimulationService;
|
||||
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.services.IScriptDraftService;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
|
||||
@ -22,9 +23,6 @@ import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.robot.RobotLogicLoop;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptActionBO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.services.IScriptDraftService;
|
||||
import club.joylink.rtss.services.script.IScriptService;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
@ -36,11 +34,11 @@ import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import club.joylink.rtss.websocket.StompMessageService;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -195,7 +193,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
|
||||
}
|
||||
// 构建一个仿真
|
||||
Simulation simulation = this.groupSimulationService.create(loginUserInfoVO, draftScript.getMapId(), null,
|
||||
Simulation.FunctionalType.SIMULATION);
|
||||
Simulation.FunctionalType.SCRIPT_PREVIEW);
|
||||
loadDraftScript(simulation, draftScriptId);
|
||||
return simulation.getGroup();
|
||||
}
|
||||
|
@ -16,12 +16,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class UserSimulationStatStatService implements IUserSimulationStatService {
|
||||
public class UserSimulationStatService implements IUserSimulationStatService {
|
||||
|
||||
@Autowired
|
||||
private UserSimulationStatsDAO userSimulationStatsDAO;
|
@ -54,7 +54,7 @@ public class ZCLogicLoop {
|
||||
} else if (RunLevel.CBTC.equals(defaultRunLevel)) {
|
||||
//更新ITC ma
|
||||
Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal();
|
||||
if (distance2NextSignal != null && distance2NextSignal <= 100) {
|
||||
if (distance2NextSignal != null && distance2NextSignal <= 5) {
|
||||
this.calculateMAOfITC(simulation, train, trainList);
|
||||
}
|
||||
//更新CBTC ma
|
||||
@ -105,6 +105,17 @@ public class ZCLogicLoop {
|
||||
this.groundAtpApiService.handleTrainStopMessage(simulation, trainStopMessage);
|
||||
}
|
||||
|
||||
private void calculateMaOfCtc(Simulation simulation, VirtualRealityTrain train,
|
||||
List<VirtualRealityTrain> trainList) {
|
||||
// 查找移动授权终端列表
|
||||
List<MovementAuthority.End> endList = this.findCtcMaEnd(simulation, train, trainList);
|
||||
}
|
||||
|
||||
private List<MovementAuthority.End> findCtcMaEnd(Simulation simulation, VirtualRealityTrain train,
|
||||
List<VirtualRealityTrain> trainList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void calculateMAOfCBTC(Simulation simulation, VirtualRealityTrain train,
|
||||
List<VirtualRealityTrain> trainList) {
|
||||
// 查找移动授权终端列表
|
||||
|
@ -275,8 +275,10 @@ public class AtsPlanService {
|
||||
//找不到计划,不处理
|
||||
return;
|
||||
}
|
||||
//有计划折返
|
||||
this.turnBackTrain(simulation, train, nextTripPlan);
|
||||
if (simulation.getSystemTime().toLocalTime().plusSeconds(60).isAfter(nextTripPlan.getStartTime())) {
|
||||
//有计划折返,且到发车时间
|
||||
this.turnBackTrain(simulation, train, nextTripPlan);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -621,23 +623,20 @@ public class AtsPlanService {
|
||||
// 更新追踪列车到站状态
|
||||
StationPlan stationPlan = tripPlan.queryStationPlanByStation(station);
|
||||
if (parkTime < 0) {
|
||||
|
||||
int planParkTime = stationPlan.getParkTime();
|
||||
parkTime = stationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
|
||||
if (this.checkIfFrontTurnBack(simulation, train, section, tripPlan, stationPlan)) {
|
||||
//是站台折返车
|
||||
//如果停车时间为0 ,则取后一个车次计划的首站发车时间
|
||||
TripPlan nextTripPlan = repository.queryServiceNextTripPlan(tripPlan.getServiceNumber(), tripPlan.getTripNumber());
|
||||
StationPlan nextFirstStationPlan = nextTripPlan.queryStationPlanByStation(station);
|
||||
planParkTime = nextFirstStationPlan.getLeaveTime().toSecondOfDay() - stationPlan.getArriveTime().toSecondOfDay();
|
||||
parkTime = nextFirstStationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
|
||||
}
|
||||
parkTime = planParkTime;
|
||||
}
|
||||
} else {
|
||||
if (parkTime < 0) {
|
||||
// 头码车和人工车默认给30s
|
||||
parkTime = 30;
|
||||
}
|
||||
}
|
||||
if (parkTime < 10) {
|
||||
// 头码车和人工车默认给25s
|
||||
parkTime = 25;
|
||||
}
|
||||
LocalTime leaveTime = systemTime.plusSeconds(parkTime);
|
||||
train.updateEstimatedLeaveInfo(section, leaveTime);
|
||||
this.atsStandService.updateStandParkTime(section, parkTime);
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -35,6 +36,14 @@ public class AtsRouteSettingService {
|
||||
//根据一定规则清除掉冲突进路
|
||||
this.filterConflictTrainRouteByPlanTime(simulation, waitSetList);
|
||||
|
||||
//如果进路区段有占用时不排列进路,筛选出没有区段占用的进路
|
||||
if (simulation.getRepository().getConfig().isDoNotSetRouteWhenSectionOccupied()) {
|
||||
waitSetList = waitSetList.stream().filter(trainRoute -> {
|
||||
Route route = trainRoute.getRoute();
|
||||
return route.getSectionList().stream().noneMatch(section -> section.isCtOccupied() || section.isNctOccupied());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 执行进路排列
|
||||
for (TrainRoute trainRoute : waitSetList) {
|
||||
Route route = trainRoute.getRoute();
|
||||
@ -88,6 +97,10 @@ public class AtsRouteSettingService {
|
||||
Signal neededSignal = signal;
|
||||
List<RoutePath> routePaths = new ArrayList<>();
|
||||
if (Objects.nonNull(destDefinition)) {
|
||||
// 如果已经到达目的地,返回
|
||||
if (Objects.equals(headSection, destDefinition.getSection())) {
|
||||
return null;
|
||||
}
|
||||
// 目的地定义存在,根据目的地定义查询路径,办理进路
|
||||
// 判断是否终点站折返办理
|
||||
if (train.isParking() && destDefinition.isLoop()) { // 列车停车,且目的地为环路运营
|
||||
@ -118,7 +131,7 @@ public class AtsRouteSettingService {
|
||||
Section eaStandSection = repository.getByCode(train.getEstimatedArriveStandTrack(), Section.class);
|
||||
List<RoutePath> paths = repository.queryRoutePathsByEnd(eaStandSection);
|
||||
for (RoutePath path : paths) {
|
||||
if (path.containsSection(headSection)) {
|
||||
if (path.containsSection(headSection) && path.isRight() == right) {
|
||||
routePaths.add(path);
|
||||
}
|
||||
}
|
||||
@ -222,10 +235,6 @@ public class AtsRouteSettingService {
|
||||
// 处理站前折返的进路排列
|
||||
routePaths = repository.queryRoutePaths(trainSection, nextSection);
|
||||
} else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack() || trainSection.isTransferTrack())) { // 折返轨停车
|
||||
if (tripPlan.getStartSection().isSamePhysical(trainSection.getCode()) &&
|
||||
!simulation.getSystemTime().toLocalTime().plusSeconds(60).isAfter(train.getPlanArriveTime())) {
|
||||
return null;
|
||||
}
|
||||
List<RoutePath> routePaths1 = repository.queryRoutePaths(trainSection, nextSection);
|
||||
if (!CollectionUtils.isEmpty(routePaths1)) {
|
||||
routePaths = routePaths1;
|
||||
@ -287,9 +296,7 @@ public class AtsRouteSettingService {
|
||||
if (route.isTurnBack() && firstChoiceRoutePath.getEnd().isNormalStandTrack()) {
|
||||
continue;
|
||||
}
|
||||
if (this.isAtsTrigger(simulation, train, route, false, trainList)) {
|
||||
triggerList.add(route);
|
||||
}
|
||||
triggerList.add(route);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(triggerList)) {
|
||||
@ -297,8 +304,17 @@ public class AtsRouteSettingService {
|
||||
} else if (triggerList.size() > 1) {
|
||||
if (this.hasSameEnd(triggerList)) {
|
||||
// 多延续保护进路,取延续保护是定位的那条
|
||||
// todo 暂时逻辑定为只触发定位保护进路,后需完善为根据接下来的运行目的选择延续保护
|
||||
for (Route route : triggerList) {
|
||||
if (this.isOverlapStraight(route)) {
|
||||
if (this.isAtsTrigger(simulation, train, route, false, trainList)) {
|
||||
return route;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Route route : triggerList) {
|
||||
if (this.isAtsTrigger(simulation, train, route, false, trainList)) {
|
||||
return route;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.service;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.TrainType;
|
||||
@ -23,10 +24,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ATS列车服务
|
||||
@ -178,11 +176,11 @@ public class AtsTrainService {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
|
||||
String.format("不存在追踪的列车[%s]", groupNumber));
|
||||
}
|
||||
if (supervisedTrain.isPlanTrain()) {
|
||||
if (!CollectionUtils.isEmpty(simulation.getRepository().getDestinationMap())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (supervisedTrain.isPlanTrain()) {
|
||||
// if (!CollectionUtils.isEmpty(simulation.getRepository().getDestinationMap())) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// Section targetSection = repository.querySectionByDestCode(destinationCode);
|
||||
// if (Objects.isNull(targetSection)) {
|
||||
// throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
|
||||
@ -196,17 +194,30 @@ public class AtsTrainService {
|
||||
*/
|
||||
private void setDestinationCode(Simulation simulation, String groupNumber, String serviceNumber, String tripNumber,
|
||||
String destinationCode, SimulationDataRepository repository, TrainInfo supervisedTrain) {
|
||||
Boolean right = supervisedTrain.getRight();
|
||||
Section headSection = repository.getByCode(supervisedTrain.getNotNullPhysicalSection(), Section.class);
|
||||
Map<String, DestinationCodeDefinition> destinationMap = repository.getDestinationMap();
|
||||
Section targetSection = repository.getByCode(supervisedTrain.getEstimatedArriveStandTrack(), Section.class);
|
||||
Station targetStation = targetSection.getStation();
|
||||
// Section targetSection = repository.getByCode(supervisedTrain.getEstimatedArriveStandTrack(), Section.class);
|
||||
// Station targetStation = targetSection.getStation();
|
||||
|
||||
if (!CollectionUtils.isEmpty(destinationMap)) { //有新版目的地码数据
|
||||
DestinationCodeDefinition destinationCodeDefinition = destinationMap.get(destinationCode);
|
||||
if (destinationCodeDefinition == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument, String.format("目的地码[%s]不存在", destinationCode));
|
||||
}
|
||||
Section destinationSection = destinationCodeDefinition.getSection();
|
||||
Section targetSection = null;
|
||||
Station targetStation = null;
|
||||
String estimatedArriveStandTrack = supervisedTrain.getEstimatedArriveStandTrack();
|
||||
if (estimatedArriveStandTrack != null) {
|
||||
targetSection = repository.getByCode(estimatedArriveStandTrack, Section.class);
|
||||
targetStation = targetSection.getStation();
|
||||
}
|
||||
boolean stop = supervisedTrain.isStop();
|
||||
switch (destinationCodeDefinition.getType()) {
|
||||
case NORMAL_OPERATION:
|
||||
case NORMAL_OPERATION: {
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(targetStation,
|
||||
String.format("列车[%s]目标区段为null", supervisedTrain.getGroupNumber()));
|
||||
Station leftStation = destinationCodeDefinition.getLeftStation();
|
||||
Station rightStation = destinationCodeDefinition.getRightStation();
|
||||
boolean beyondStationRage =
|
||||
@ -223,28 +234,78 @@ public class AtsTrainService {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LAST_OPERATION:
|
||||
case NON_OPERATION:
|
||||
case LAST_NON_OPERATION:
|
||||
Boolean trainRight = supervisedTrain.getRight();
|
||||
if (trainRight == null) {
|
||||
case LAST_NON_OPERATION: {
|
||||
if (right == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||
String.format("列车[%s]方向未知", groupNumber));
|
||||
}
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(targetSection,
|
||||
String.format("列车[%s]目标区段为null", supervisedTrain.getGroupNumber()));
|
||||
Boolean destinationRight = destinationCodeDefinition.getRight();
|
||||
if (!targetSection.isTurnBackTrack() || !supervisedTrain.isStop()) {
|
||||
if (!Objects.equals(trainRight, destinationRight)) {
|
||||
if (!targetSection.isTurnBackTrack() || !stop) {
|
||||
if (!Objects.equals(right, destinationRight)) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||
String.format("列车方向与目的地码[%s]的方向相反", destinationCode));
|
||||
}
|
||||
}
|
||||
Station station = destinationCodeDefinition.getSection().getStation();
|
||||
Station station = destinationSection.getStation();
|
||||
if ((destinationRight && targetStation.getSn() > station.getSn())
|
||||
|| (!destinationRight && targetStation.getSn() < station.getSn())) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||
String.format("列车目标轨道[%s]超出目的地码[%s]的范围", targetSection, destinationCode));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OTHER:
|
||||
Set<List<Section>> pathSet = CalculateService.querySectionPaths2Destination(headSection, destinationSection, right, stop);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionNotEmpty(pathSet,
|
||||
String.format("列车[%s]无法到达目的地码[%s]对应区段[%s]", groupNumber, destinationCode, destinationSection.getCode()));
|
||||
//从找到的路径中筛选出最短路径
|
||||
List<Section> path = null;
|
||||
if (pathSet.size() == 1) {
|
||||
path = pathSet.stream().findAny().get();
|
||||
} else if (pathSet.size() > 1) {
|
||||
Optional<List<Section>> pathOptional = pathSet.stream()
|
||||
.min(Comparator.comparingDouble(availablePath -> availablePath.stream().mapToDouble(Section::getLen).sum()));
|
||||
path = pathOptional.get();
|
||||
}
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(path,
|
||||
String.format("列车[%s]无法到达目的地码[%s]对应区段[%s]", groupNumber, destinationCode, destinationSection.getCode()));
|
||||
supervisedTrain.setHeadPath(path);
|
||||
//根据找到的路径更新目标区段---
|
||||
Section nextTarget = null;
|
||||
int index = path.indexOf(headSection);
|
||||
if (index == -1)
|
||||
break;
|
||||
for (int i = index; i < path.size(); i++) {
|
||||
Section section = path.get(i);
|
||||
if (section.isSpecialSection()
|
||||
&& supervisedTrain.isNotArriveAt(repository, new SectionPosition(section, section.getStopPointByDirection(right)))) {
|
||||
List<RoutePath> routePaths = repository.queryRoutePathsByEnd(section);
|
||||
if (routePaths.stream().anyMatch(rp -> rp.containsSection(headSection))) {
|
||||
nextTarget = section;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextTarget == null) {
|
||||
nextTarget = path.get(path.size() - 1);
|
||||
}
|
||||
if (nextTarget.getCode().equals(estimatedArriveStandTrack)) {
|
||||
break;
|
||||
}
|
||||
MapStationRunLevelVO runLevel = simulation.getBuildParams().getMap().getRunLevelByStartAndEndSection(estimatedArriveStandTrack, nextTarget.getCode());
|
||||
int runningTime = 0;
|
||||
if (runLevel != null) {
|
||||
runningTime = runLevel.getL3();
|
||||
}
|
||||
supervisedTrain.updateEstimatedArriveInfo(nextTarget, simulation.getSystemTime().plusSeconds(runningTime).toLocalTime());
|
||||
this.onboardAtpApiService.updateNextStation(simulation, supervisedTrain.getGroupNumber(),
|
||||
nextTarget.getStation().getCode(), nextTarget.getCode(), runningTime, true);
|
||||
break;
|
||||
default:
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, String.format("无法识别的目的地码类型[%s]", destinationCodeDefinition.getType()));
|
||||
}
|
||||
@ -312,11 +373,18 @@ public class AtsTrainService {
|
||||
Boolean trainRight = train.getRight();
|
||||
TrainType type = train.getType();
|
||||
String estimatedArriveStandTrack = train.getEstimatedArriveStandTrack();
|
||||
if (Objects.isNull(estimatedArriveStandTrack)) {
|
||||
return;
|
||||
Section targetSection = null;
|
||||
Station targetStation = null;
|
||||
if (estimatedArriveStandTrack != null) {
|
||||
targetSection = repository.getByCode(estimatedArriveStandTrack, Section.class);
|
||||
targetStation = targetSection.getStation();
|
||||
}
|
||||
Section targetSection = repository.getByCode(estimatedArriveStandTrack, Section.class);
|
||||
Station targetStation = targetSection.getStation();
|
||||
// String estimatedArriveStandTrack = train.getEstimatedArriveStandTrack();
|
||||
// if (Objects.isNull(estimatedArriveStandTrack)) {
|
||||
// return;
|
||||
// }
|
||||
// Section targetSection = repository.getByCode(estimatedArriveStandTrack, Section.class);
|
||||
// Station targetStation = targetSection.getStation();
|
||||
boolean stop = train.isStop();
|
||||
Section nextTarget = null;
|
||||
long runningTime = 0;
|
||||
@ -391,69 +459,6 @@ public class AtsTrainService {
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*case HEAD: {
|
||||
if (train.isParking() && !stop) {
|
||||
// 站台停站状态取消
|
||||
this.atsStandService.trainLeaveStand(headSection);
|
||||
// 更新列车实际离开信息
|
||||
train.updateLeaveInfo(headSection, systemTime);
|
||||
}
|
||||
//目的地码更新条件检查
|
||||
Map<String, DestinationCodeDefinition> destinationMap = repository.getDestinationMap();
|
||||
String destinationCode = train.getDestinationCode();
|
||||
if (!headTrainTargetUpdateConditionCheck(destinationMap, destinationCode, trainRight, stop, headSection, targetSection)) {
|
||||
return;
|
||||
}
|
||||
//根据目的地码类型更新目标区段
|
||||
DestinationCodeDefinition destinationCodeDefinition = destinationMap.get(destinationCode);
|
||||
switch (destinationCodeDefinition.getType()) {
|
||||
case NORMAL_OPERATION:
|
||||
if (destinationCodeDefinition.isBorder(targetStation)) {
|
||||
//--- 需要站后折返
|
||||
boolean normalStandTrack = targetSection.isNormalStandTrack();
|
||||
if (!normalStandTrack) {
|
||||
break;
|
||||
}
|
||||
boolean standOfTargetSectionIsRight = targetStation.isStandOfSectionRight(targetSection);
|
||||
Station station = destinationCodeDefinition.getStationOf(standOfTargetSectionIsRight);
|
||||
if (station.equals(targetStation)) {
|
||||
List<Section> parkSections = targetStation.getParkSectionListBy(!standOfTargetSectionIsRight);
|
||||
Optional<Section> normalSection = parkSections.stream().filter(Section::isNormalStandTrack).limit(1).findFirst();
|
||||
if (normalSection.isPresent())
|
||||
nextTarget = normalSection.get();
|
||||
train.startTurnBack(nextTarget);
|
||||
this.onboardAtpApiService.startTurnBack(simulation, train.getGroupNumber(),
|
||||
nextTarget.getCode());
|
||||
}
|
||||
} else if (相邻车站是边界车站) {
|
||||
if (需要站前折返) {
|
||||
|
||||
}
|
||||
} else {
|
||||
找相邻车站
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case LAST_OPERATION:
|
||||
case NON_OPERATION:
|
||||
case LAST_NON_OPERATION:
|
||||
if (已经抵达或越过运行路径最后一个区段) {
|
||||
if (有直达终点区段的进路路径) {
|
||||
|
||||
}
|
||||
} else {
|
||||
if (相邻车站有位于运行路径上的站台轨) {
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (目标区段还没找到 && 并且相邻车站有值) {
|
||||
|
||||
}
|
||||
}*/
|
||||
case HEAD: {
|
||||
if (train.isParking() && !stop) {
|
||||
// 站台停站状态取消
|
||||
@ -465,138 +470,163 @@ public class AtsTrainService {
|
||||
Map<String, DestinationCodeDefinition> destinationMap = repository.getDestinationMap();
|
||||
String destinationCode = train.getDestinationCode();
|
||||
if (!CollectionUtils.isEmpty(destinationMap)) { //有目的地码定义数据
|
||||
// if (!this.targetUpdateConditionCheckOfNewDestination(destinationMap, destinationCode, trainRight, stop, headSection, targetSection)) {
|
||||
// break;
|
||||
// }
|
||||
if (stop && (headSection.isTurnBackTrack() || headSection.isTransferTrack() || headSection.isStandTrack())) {
|
||||
DestinationCodeDefinition destinationCodeDefinition = destinationMap.get(destinationCode);
|
||||
if (destinationCodeDefinition == null) {
|
||||
log.warn("目的地码[{}]没有数据", destinationCode);
|
||||
if (!stop)
|
||||
break;
|
||||
if (trainRight == null)
|
||||
break;
|
||||
DestinationCodeDefinition destinationCodeDefinition = destinationMap.get(destinationCode);
|
||||
if (destinationCodeDefinition == null) {
|
||||
log.warn("目的地码[{}]没有数据", destinationCode);
|
||||
break;
|
||||
}
|
||||
if (Objects.equals(destinationCodeDefinition.getSection(), headSection))
|
||||
break;
|
||||
Section destinationSection = destinationCodeDefinition.getSection();
|
||||
Boolean destinationRight = destinationCodeDefinition.getRight();
|
||||
switch (destinationCodeDefinition.getType()) {
|
||||
case NORMAL_OPERATION: {
|
||||
if (Objects.isNull(estimatedArriveStandTrack)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Station leftStation = destinationCodeDefinition.getLeftStation();
|
||||
Station rightStation = destinationCodeDefinition.getRightStation();
|
||||
if (Math.min(leftStation.getSn(), rightStation.getSn()) > targetStation.getSn()
|
||||
|| targetStation.getSn() > Math.max(leftStation.getSn(), rightStation.getSn())) { //超出环路范围
|
||||
log.warn(String.format("仿真[%s]列车[%s]目标轨不在环路范围内", simulation.getGroup(), train.getGroupNumber()));
|
||||
break;
|
||||
}
|
||||
Station station = destinationCodeDefinition.getStationOf(trainRight);
|
||||
if (Objects.equals(station.getSn(), targetStation.getSn())) { //已经抵达同向边界车站
|
||||
if (targetSection.isNormalStandTrack()) { //如果是在站台轨,并开始折返
|
||||
List<Section> turnBackList = targetStation.getTurnBackList();
|
||||
if (!CollectionUtils.isEmpty(turnBackList)) {
|
||||
nextTarget = turnBackList.get(0);
|
||||
// 站后折返
|
||||
train.startTurnBack(nextTarget);
|
||||
// 开始折返
|
||||
this.onboardAtpApiService.startTurnBack(simulation, train.getGroupNumber(),
|
||||
nextTarget.getCode());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { //未抵达同向边界车站
|
||||
Station adjacentStation = repository.findAdjacentStation(targetStation, trainRight);
|
||||
Optional<Stand> first;
|
||||
if ((adjacentStation.equals(leftStation)
|
||||
|| adjacentStation.equals(rightStation))
|
||||
&& destinationCodeDefinition.isFrontTurnBack(adjacentStation)) { //相邻站是环路的边界车站且是站前折返
|
||||
first = adjacentStation.getStandOf(!trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
|
||||
} else {
|
||||
first = adjacentStation.getStandOf(trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
|
||||
}
|
||||
if (first.isPresent()) {
|
||||
nextTarget = first.get().getSection();
|
||||
} else {
|
||||
log.warn(String.format("地图[%s]车站[%s]所有站台都是小站台", mapId, adjacentStation.getCode()));
|
||||
}
|
||||
}
|
||||
if (targetSection.isTurnBackTrack()) { //如果是在折返轨,选择能到达的站台
|
||||
for (Stand stand : targetStation.getAllStandList()) {
|
||||
Section section = stand.getSection();
|
||||
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, section))) {
|
||||
nextTarget = section;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (Objects.equals(destinationCodeDefinition.getSection(), headSection)) {
|
||||
break;
|
||||
}
|
||||
if (!Objects.equals(targetSection, headSection)) {
|
||||
break;
|
||||
}
|
||||
//-------------------- 列车停在目标轨 --------------------
|
||||
if (trainRight == null) {
|
||||
break;
|
||||
}
|
||||
switch (destinationCodeDefinition.getType()) {
|
||||
case NORMAL_OPERATION:
|
||||
Station leftStation = destinationCodeDefinition.getLeftStation();
|
||||
Station rightStation = destinationCodeDefinition.getRightStation();
|
||||
if (Math.min(leftStation.getSn(), rightStation.getSn()) > targetStation.getSn()
|
||||
|| targetStation.getSn() > Math.max(leftStation.getSn(), rightStation.getSn())) { //超出环路范围
|
||||
log.warn(String.format("仿真[%s]列车[%s]目标轨不在环路范围内", simulation.getGroup(), train.getGroupNumber()));
|
||||
case LAST_OPERATION:
|
||||
case NON_OPERATION:
|
||||
case LAST_NON_OPERATION:
|
||||
if (Objects.isNull(estimatedArriveStandTrack)) {
|
||||
return;
|
||||
}
|
||||
if (!targetSection.isTurnBackTrack()) {
|
||||
if (!Objects.equals(trainRight, destinationRight)) {
|
||||
log.warn(String.format("仿真[%s]列车[%s]目标轨方向和目的地码方向不同", simulation.getGroup(), train.getGroupNumber()));
|
||||
break;
|
||||
}
|
||||
Station station = destinationCodeDefinition.getStationOf(trainRight);
|
||||
if (Objects.equals(station.getSn(), targetStation.getSn())) { //已经抵达同向边界车站
|
||||
if (targetSection.isNormalStandTrack()) { //如果是在站台轨,并开始折返
|
||||
List<Section> turnBackList = targetStation.getTurnBackList();
|
||||
if (!CollectionUtils.isEmpty(turnBackList)) {
|
||||
nextTarget = turnBackList.get(0);
|
||||
// 站后折返
|
||||
train.startTurnBack(nextTarget);
|
||||
// 开始折返
|
||||
this.onboardAtpApiService.startTurnBack(simulation, train.getGroupNumber(),
|
||||
nextTarget.getCode());
|
||||
//如果列车目标轨已经超出目的地码的对应区段
|
||||
if (trainRight) {
|
||||
if (targetStation.getSn() >= destinationSection.getStation().getSn()) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (targetStation.getSn() <= destinationSection.getStation().getSn()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------- 找下一目标轨 --------------------------
|
||||
Station adjacentStation = repository.findAdjacentStation(targetStation, destinationRight);
|
||||
Section lastRunPathSection = destinationCodeDefinition.getLastSectionFromRunPath();
|
||||
//---运行路径最后一个区段存在,且列车没有越过时:找相邻车站并注意路径---
|
||||
if (lastRunPathSection != null) {
|
||||
Station lastStationOnPath = lastRunPathSection.getStation();
|
||||
//如果列车目标车站没有到达/越过目的地码运行路径的最后一个车站
|
||||
if ((destinationRight && targetStation.getSn() < lastStationOnPath.getSn())
|
||||
|| (!destinationRight && targetStation.getSn() > lastStationOnPath.getSn())) {
|
||||
if (adjacentStation == null) {
|
||||
break;
|
||||
}
|
||||
for (Stand stand : adjacentStation.getAllStandList()) {
|
||||
if (destinationCodeDefinition.isOnThePath(stand.getSection())) {
|
||||
nextTarget = stand.getSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { //未抵达同向边界车站
|
||||
Station adjacentStation = repository.findAdjacentStation(targetStation, trainRight);
|
||||
Optional<Stand> first;
|
||||
if ((adjacentStation.equals(leftStation)
|
||||
|| adjacentStation.equals(rightStation))
|
||||
&& destinationCodeDefinition.isFrontTurnBack(adjacentStation)) { //相邻站是环路的边界车站且是站前折返
|
||||
first = adjacentStation.getStandOf(!trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
|
||||
} else {
|
||||
first = adjacentStation.getStandOf(trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
|
||||
}
|
||||
if (first.isPresent()) {
|
||||
nextTarget = first.get().getSection();
|
||||
} else {
|
||||
log.warn(String.format("地图[%s]车站[%s]所有站台都是小站台", mapId, adjacentStation.getCode()));
|
||||
}
|
||||
}
|
||||
if (targetSection.isTurnBackTrack()) { //如果是在折返轨,选择能到达的站台
|
||||
for (Stand stand : targetStation.getAllStandList()) {
|
||||
Section section = stand.getSection();
|
||||
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, section))) {
|
||||
}
|
||||
//尝试找到直达终点的路径
|
||||
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, destinationSection))) {
|
||||
nextTarget = destinationSection;
|
||||
break;
|
||||
}
|
||||
//找到相邻车站的同向站台轨
|
||||
for (Stand stand : adjacentStation.getStandOf(destinationRight)) {
|
||||
if (!stand.isSmall()) {
|
||||
nextTarget = stand.getSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OTHER:
|
||||
List<Section> path = train.getHeadPath();
|
||||
if (path != null) {
|
||||
int index = path.indexOf(headSection);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}
|
||||
for (int i = index; i < path.size(); i++) {
|
||||
Section section = path.get(i);
|
||||
if (section.isSpecialSection()
|
||||
&& train.isNotArriveAt(repository, new SectionPosition(section, section.getStopPointByDirection(trainRight)))) {
|
||||
List<RoutePath> routePaths = repository.queryRoutePathsByEnd(section);
|
||||
if (routePaths.stream().anyMatch(rp -> rp.containsSection(headSection))) {
|
||||
nextTarget = section;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LAST_OPERATION:
|
||||
case NON_OPERATION:
|
||||
case LAST_NON_OPERATION:
|
||||
Section destinationSection = destinationCodeDefinition.getSection();
|
||||
Boolean destinationRight = destinationCodeDefinition.getRight();
|
||||
if (!targetSection.isTurnBackTrack()) {
|
||||
if (!Objects.equals(trainRight, destinationRight)) {
|
||||
log.warn(String.format("仿真[%s]列车[%s]目标轨方向和目的地码方向不同", simulation.getGroup(), train.getGroupNumber()));
|
||||
break;
|
||||
}
|
||||
//如果列车目标轨已经超出目的地码的对应区段
|
||||
if (trainRight) {
|
||||
if (targetStation.getSn() >= destinationSection.getStation().getSn()) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (targetStation.getSn() <= destinationSection.getStation().getSn()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextTarget == null) {
|
||||
nextTarget = path.get(path.size() - 1);
|
||||
}
|
||||
//-------------------------- 找下一目标轨 --------------------------
|
||||
Station adjacentStation = repository.findAdjacentStation(targetStation, destinationRight);
|
||||
Section lastRunPathSection = destinationCodeDefinition.getLastSectionFromRunPath();
|
||||
//---运行路径最后一个区段存在,且列车没有越过时:找相邻车站并注意路径---
|
||||
if (lastRunPathSection != null) {
|
||||
Station lastStationOnPath = lastRunPathSection.getStation();
|
||||
//如果列车目标车站没有到达/越过目的地码运行路径的最后一个车站
|
||||
if ((destinationRight && targetStation.getSn() < lastStationOnPath.getSn())
|
||||
|| (!destinationRight && targetStation.getSn() > lastStationOnPath.getSn())) {
|
||||
if (adjacentStation == null) {
|
||||
break;
|
||||
}
|
||||
for (Stand stand : adjacentStation.getAllStandList()) {
|
||||
if (destinationCodeDefinition.isOnThePath(stand.getSection())) {
|
||||
nextTarget = stand.getSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//尝试找到直达终点的路径
|
||||
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, destinationSection))) {
|
||||
nextTarget = destinationSection;
|
||||
break;
|
||||
}
|
||||
//找到相邻车站的同向站台轨
|
||||
for (Stand stand : adjacentStation.getStandOf(destinationRight)) {
|
||||
if (!stand.isSmall()) {
|
||||
nextTarget = stand.getSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (nextTarget != null) {
|
||||
MapStationRunLevelVO runLevel = simulation.getBuildParams().getMap().getRunLevelByStartAndEndSection(targetSection.getCode(), nextTarget.getCode());
|
||||
if (runLevel != null) {
|
||||
runningTime = runLevel.getL3();
|
||||
}
|
||||
train.updateEstimatedArriveInfo(nextTarget, simulation.getSystemTime().plusSeconds(runningTime).toLocalTime());
|
||||
this.onboardAtpApiService.updateNextStation(simulation, train.getGroupNumber(),
|
||||
nextTarget.getStation().getCode(), nextTarget.getCode(), runningTime, true);
|
||||
break;
|
||||
}
|
||||
if (nextTarget != null) {
|
||||
if (nextTarget.getCode().equals(estimatedArriveStandTrack)) {
|
||||
return;
|
||||
}
|
||||
MapStationRunLevelVO runLevel = simulation.getBuildParams().getMap().getRunLevelByStartAndEndSection(estimatedArriveStandTrack, nextTarget.getCode());
|
||||
if (runLevel != null) {
|
||||
runningTime = runLevel.getL3();
|
||||
}
|
||||
train.updateEstimatedArriveInfo(nextTarget, simulation.getSystemTime().plusSeconds(runningTime).toLocalTime());
|
||||
this.onboardAtpApiService.updateNextStation(simulation, train.getGroupNumber(),
|
||||
nextTarget.getStation().getCode(), nextTarget.getCode(), runningTime, true);
|
||||
}
|
||||
} else { //没有目的地码定义数据
|
||||
Section prePassed = null;
|
||||
|
@ -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()) {
|
||||
// 区段逻辑占用,且有逻辑区段
|
||||
@ -853,7 +846,7 @@ public class RouteService {
|
||||
Collections.reverse(logicList);
|
||||
}
|
||||
for (Section logic : logicList) {
|
||||
if (!logic.isCtOccupied()) {
|
||||
if (!logic.isOccupied()) {
|
||||
logic.routeUnlocking(right);
|
||||
} else {
|
||||
break;
|
||||
@ -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);
|
||||
}
|
||||
@ -968,18 +962,18 @@ public class RouteService {
|
||||
}
|
||||
SectionPath sectionPath = overlap.selectPath();
|
||||
if (Objects.nonNull(sectionPath)) {
|
||||
boolean routeLock = true;
|
||||
for (Section section : sectionPath.getSectionList()) {
|
||||
if (!section.isRouteLock()) {
|
||||
routeLock = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (routeLock) { // 延续保护区段进路锁闭,立即解锁
|
||||
overlap.releaseImmediately();
|
||||
} else if (overlap.getSection().isRouteLock() &&
|
||||
|
||||
overlap.getSection().isOccupied()) { // 前方进路最后子进路占用,触发/解锁执行
|
||||
// boolean routeLock = true;
|
||||
// for (Section section : sectionPath.getSectionList()) {
|
||||
// if (!section.isRouteLock()) {
|
||||
// routeLock = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (routeLock) { // 延续保护区段进路锁闭,立即解锁
|
||||
// overlap.releaseImmediately();
|
||||
// } else
|
||||
if (overlap.getSection().isRouteLock() &&
|
||||
overlap.getSection().isOccupied()) { // 前方进路最后子进路占用,触发/解锁执行
|
||||
if (!overlap.isReleasing()) {
|
||||
log.debug(String.format("[%s]延续保护[%s],触发区段[%s(%s)]触发开始解锁",
|
||||
overlap.isRight() ? "右向" : "左向", overlap.getName(),
|
||||
@ -991,6 +985,17 @@ public class RouteService {
|
||||
} else if (!overlap.getSection().isRouteLock()) {
|
||||
// 最后子进路解锁,则延续保护解锁
|
||||
overlap.releaseImmediately();
|
||||
} else {
|
||||
boolean allUnlock = true;
|
||||
for (Section section : sectionPath.getSectionList()) {
|
||||
if (section.isOverlapLock()) {
|
||||
allUnlock = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allUnlock) {
|
||||
overlap.releaseImmediately();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc;
|
||||
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
|
||||
import club.joylink.rtss.simulation.cbtc.command.CommandInitiateVO;
|
||||
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
||||
@ -8,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||
@ -315,4 +315,9 @@ public interface GroupSimulationService {
|
||||
* @param userVO
|
||||
*/
|
||||
void alarmConfirm(String group, List<String> codes, UserVO userVO);
|
||||
|
||||
/**
|
||||
* 查询仿真
|
||||
*/
|
||||
Simulation findSimulationByGroup(String group);
|
||||
}
|
||||
|
@ -908,4 +908,9 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
.forEach(atsAlarm -> atsAlarm.confirm(userVO, simulation.getCorrectSystemTime()));
|
||||
this.applicationContext.publishEvent(new SimulationAlarmConfirmEvent(this, simulation, codes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Simulation findSimulationByGroup(String group) {
|
||||
return groupSimulationCache.findSimulationByGroup(group);
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,10 @@ public class Simulation {
|
||||
return Objects.equals(this.buildParams.getFunctionalType(), FunctionalType.SCRIPT_MAKING);
|
||||
}
|
||||
|
||||
public boolean isScriptPreviewSimulation() {
|
||||
return FunctionalType.SCRIPT_PREVIEW.equals(buildParams.getFunctionalType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该角色类型的所有成员
|
||||
*/
|
||||
@ -484,7 +488,11 @@ public class Simulation {
|
||||
/**
|
||||
* 剧本编制
|
||||
*/
|
||||
SCRIPT_MAKING;
|
||||
SCRIPT_MAKING,
|
||||
/**
|
||||
* 剧本预览
|
||||
*/
|
||||
SCRIPT_PREVIEW;
|
||||
|
||||
|
||||
}
|
||||
|
@ -412,6 +412,7 @@ public class SimulationMainThread {
|
||||
}
|
||||
case MESSAGE_3D: {
|
||||
this.joylink3DMessageService.collectAndSendTrainHmiDisplayMessage(simulation);
|
||||
this.joylink3DMessageService.tdtStatusCollectAndSend(simulation);
|
||||
break;
|
||||
}
|
||||
case TRAIN_POSITION_3D: {
|
||||
|
@ -414,8 +414,8 @@ public class InterlockBuilder2 {
|
||||
checkBetweenRouteSameDirectionSignal(elementMap, errMsgList);
|
||||
|
||||
// ------------交路start-------------
|
||||
List<Routing> routingList = checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList);
|
||||
mapDataBuildResult.setRoutingList(routingList);
|
||||
// List<Routing> routingList = checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList);
|
||||
// mapDataBuildResult.setRoutingList(routingList);
|
||||
// ------------交路end-------------
|
||||
|
||||
// ------------站间运行等级start-------------
|
||||
@ -424,31 +424,31 @@ public class InterlockBuilder2 {
|
||||
// ------------站间运行等级end-------------
|
||||
|
||||
// ------------目的地码start-------------
|
||||
// checkAndBuildDestinationCodeDefinition(elementMap, logicData.getDestinationCodeDefinitionList(), mapDataBuildResult.getDestinationMap(), errMsgList);
|
||||
checkAndBuildDestinationCodeDefinition(elementMap, logicData.getDestinationCodeDefinitionList(), mapDataBuildResult.getDestinationMap(), errMsgList);
|
||||
// ------------目的地码end-------------
|
||||
|
||||
// 交路的经过区段校验
|
||||
for (Routing routing : routingList) {
|
||||
List<Section> viaSectionList = routing.getViaSectionList();
|
||||
for (int i = 1; i < viaSectionList.size(); i++) {
|
||||
Section start = viaSectionList.get(i - 1);
|
||||
Section end = viaSectionList.get(i);
|
||||
boolean find = false;
|
||||
for (StationRunLevel stationRunLevel : stationRunLevelList) {
|
||||
if (Objects.equals(start, stationRunLevel.getStartSection()) &&
|
||||
Objects.equals(end, stationRunLevel.getEndSection())) {
|
||||
find = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
log.warn(String.format("交路[%s]中,从区段[%s(%s)]-区段[%s(%s)]的站间运行等级数据不存在",
|
||||
routing.getName(),
|
||||
start.getName(), start.getCode(),
|
||||
end.getName(), end.getCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 交路的经过区段校验
|
||||
// for (Routing routing : routingList) {
|
||||
// List<Section> viaSectionList = routing.getViaSectionList();
|
||||
// for (int i = 1; i < viaSectionList.size(); i++) {
|
||||
// Section start = viaSectionList.get(i - 1);
|
||||
// Section end = viaSectionList.get(i);
|
||||
// boolean find = false;
|
||||
// for (StationRunLevel stationRunLevel : stationRunLevelList) {
|
||||
// if (Objects.equals(start, stationRunLevel.getStartSection()) &&
|
||||
// Objects.equals(end, stationRunLevel.getEndSection())) {
|
||||
// find = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!find) {
|
||||
// log.warn(String.format("交路[%s]中,从区段[%s(%s)]-区段[%s(%s)]的站间运行等级数据不存在",
|
||||
// routing.getName(),
|
||||
// start.getName(), start.getCode(),
|
||||
// end.getName(), end.getCode()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 根据站间运行等级数据构建路径单元
|
||||
if (!errMsgList.isEmpty()) {
|
||||
|
@ -7,7 +7,9 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.*;
|
||||
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TdtStatusVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
@ -57,6 +59,29 @@ public class Joylink3DMessageService {
|
||||
}
|
||||
}
|
||||
|
||||
public void tdtStatusCollectAndSend(Simulation simulation) {
|
||||
List<TdtStatusVO> list = new ArrayList<>();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
if (!stand.isSmall()) {
|
||||
TdtStatusVO statusVO = repository.queryTdtStatus(stand.getCode());
|
||||
if (Objects.isNull(statusVO)) {
|
||||
statusVO = new TdtStatusVO(stand);
|
||||
repository.addTdtStatus(statusVO);
|
||||
list.add(statusVO);
|
||||
} else {
|
||||
if (statusVO.compareAndChange(stand)) {
|
||||
list.add(statusVO);
|
||||
}
|
||||
}
|
||||
TdtStatusVO tdtStatusVO = new TdtStatusVO(stand);
|
||||
list.add(tdtStatusVO);
|
||||
}
|
||||
}
|
||||
SocketMessageVO message = SocketMessageFactory.buildTrainIsAbout2ArriveMessage(simulation.getGroup(), list);
|
||||
this.stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建并发送列车状态信息
|
||||
*
|
||||
@ -305,4 +330,6 @@ public class Joylink3DMessageService {
|
||||
Set<String> users = simulation.getSimulationUserIds();
|
||||
this.collectAndSend3DInitDeviceList(simulation, users);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
@ -7,10 +8,12 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class CalculateService {
|
||||
@ -57,11 +60,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 根据开始位置、方向、距离计算到达的位置(不会超出正线轨道范围,不会冲过位置不合适道岔)
|
||||
*
|
||||
* @param startPosition
|
||||
* @param right
|
||||
* @param len
|
||||
* @return
|
||||
*/
|
||||
public static SectionPosition calculateNextPositionByStartAndLen(SectionPosition startPosition,
|
||||
boolean right, float len) {
|
||||
@ -75,11 +73,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 计算起点到终点的距离(双方向)(有正负)
|
||||
*
|
||||
* @param startPosition
|
||||
* @param endPosition
|
||||
* @param right 正方向是否是右
|
||||
* @return
|
||||
*/
|
||||
public static Float calculateDistanceDoubleDirection(SectionPosition startPosition, SectionPosition endPosition, boolean right) {
|
||||
Float distance = calculateDistance(startPosition, endPosition, right);
|
||||
@ -91,11 +84,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 计算从起点到终点距离(单方向)
|
||||
*
|
||||
* @param startPosition
|
||||
* @param endPosition
|
||||
* @param right
|
||||
* @return
|
||||
*/
|
||||
public static Float calculateDistance(SectionPosition startPosition, SectionPosition endPosition, boolean right) {
|
||||
// long start = System.currentTimeMillis();
|
||||
@ -241,12 +229,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 递归计算起始区段到目标区段之间的距离
|
||||
*
|
||||
* @param startSection 起始区段-站台轨/转换轨/折返轨
|
||||
* @param endSection 目标区段-站台轨/转换轨/折返轨
|
||||
* @param isRight 是否向右
|
||||
* @param frequency 递归频率1~51,不超过50次防止栈溢出,且不做过大站间数据设置,如果存在超大站间设置或有超过50个中间区段再修改此处
|
||||
* @return
|
||||
*/
|
||||
private static Float recursiveCalculate(Section startSection, Section endSection, boolean isRight, byte frequency) {
|
||||
if (startSection.equals(endSection)) {
|
||||
@ -312,8 +294,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 不包含起始区段的长度,未考虑出库或者折返、左右向停车点及列车长度
|
||||
*
|
||||
* @return if is null:目标方向上找不到对应的区段
|
||||
*/
|
||||
public static Float calculateDistance(Section startSection, Section endSection, boolean isRight) {
|
||||
byte frequency = 51;
|
||||
@ -518,11 +498,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 获取列车占用物理区段列表
|
||||
*
|
||||
* @param headPosition
|
||||
* @param tailPosition
|
||||
* @param right
|
||||
* @return
|
||||
*/
|
||||
public static List<Section> getTrainOccupySection(SectionPosition headPosition,
|
||||
SectionPosition tailPosition,
|
||||
@ -638,11 +613,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 区段front是否区段base前方区段
|
||||
*
|
||||
* @param base 基础区段
|
||||
* @param right 方向
|
||||
* @param front 前方区段
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTargetSectionOnDirectionExist(Section base, boolean right, Section front) {
|
||||
Objects.requireNonNull(base);
|
||||
@ -745,6 +715,129 @@ public class CalculateService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找从startSection到destination的途径区段路径
|
||||
*/
|
||||
public static Set<List<Section>> querySectionPaths2Destination(@NonNull Section startSection, @NonNull Section destination,
|
||||
@NonNull Boolean right, @NonNull boolean stop) {
|
||||
long start = System.currentTimeMillis();
|
||||
//从startSection开始寻找第一个同向信号机(如果是折返轨,两边的信号机都算),并记录途径区段
|
||||
List<Signal> signals = new ArrayList<>();
|
||||
List<Section> sections = new ArrayList<>(); //找到第一个同向信号机途径的区段
|
||||
Section section = startSection;
|
||||
//如果已经停在折返轨,如果有已经/正在办理的进路,只要有进路办理那边的信号机,否则两边都要
|
||||
if (startSection.isTurnBackTrack() && stop) { //如果停在折返轨
|
||||
sections.add(startSection);
|
||||
Signal signal1 = startSection.getSignalOf(right);
|
||||
Signal signal2 = startSection.getSignalOf(!right);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(signal1 != null || signal2 != null,
|
||||
String.format("折返轨[%s]两边都没有信号机", startSection.getCode()));
|
||||
if (signal1 == null || signal2 == null) { //如果有一边信号机没有
|
||||
signals.add(signal1 != null ? signal1 : signal2);
|
||||
} else {
|
||||
List<Route> routeList1 = signal1.getRouteList();
|
||||
List<Route> routeList2 = signal2.getRouteList();
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(routeList1) || !CollectionUtils.isEmpty(routeList2),
|
||||
String.format("信号机[%s][%s]都没有进路", signal1.getCode(), signal2.getCode()));
|
||||
if (CollectionUtils.isEmpty(routeList1) || CollectionUtils.isEmpty(routeList2)) { //如果有一边的信号机没有进路
|
||||
signals.add(!CollectionUtils.isEmpty(routeList1) ? signal1 : signal2);
|
||||
} else {
|
||||
boolean routes1HasSetting = routeList1.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
boolean routes2HasSetting = routeList2.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
if (routes1HasSetting || routes2HasSetting) { //如果有一边的信号机有进路排列
|
||||
signals.add(routes1HasSetting ? signal1 : signal2);
|
||||
} else { //如果两边信号机都没有进路排列
|
||||
signals.add(signal1);
|
||||
signals.add(signal2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
sections.add(section);
|
||||
if (section.equals(destination)) { //在找第一个同向信号机的过程中找到目标区段
|
||||
Set<List<Section>> pathSet = new HashSet<>();
|
||||
pathSet.add(sections);
|
||||
return pathSet;
|
||||
}
|
||||
Signal signal = section.getSignalOf(right);
|
||||
if (signal != null) {
|
||||
signals.add(signal);
|
||||
break;
|
||||
}
|
||||
section = section.getNextRunningSectionOf(right);
|
||||
if (section == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(signals)) {
|
||||
log.warn(String.format("从区段[%s]向[%s]找10个区段,没有找到同向信号机", startSection.getCode(), right ? "右" : "左"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//从同向信号机找进路,通过进路找目标区段,并且记录途径区段
|
||||
Set<List<Section>> pathSet = null;
|
||||
for (Signal signal : signals) {
|
||||
pathSet = findPath2DestinationAndRecordSections(destination, signal, sections, null);
|
||||
if (!CollectionUtils.isEmpty(pathSet))
|
||||
break;
|
||||
}
|
||||
System.out.println(String.format("路径查找用时:%s", System.currentTimeMillis() - start));
|
||||
return pathSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从signal找到destination的进路,并记录途径区段
|
||||
* (用来找到某目的地码的路径)
|
||||
* @param destination 目的地码对应的区段
|
||||
* @param followSettingRoute 是否要沿着已经/正在排列的进路找路径
|
||||
*/
|
||||
private static Set<List<Section>> findPath2DestinationAndRecordSections(@NonNull Section destination, @NonNull Signal signal,
|
||||
@NonNull List<Section> sections, Boolean followSettingRoute) {
|
||||
Set<List<Section>> pathSet = new HashSet<>();
|
||||
List<Route> routeList = signal.getRouteList();
|
||||
if (routeList == null) {
|
||||
return pathSet;
|
||||
}
|
||||
boolean signalRight = signal.isRight();
|
||||
if (followSettingRoute == null || followSettingRoute) {
|
||||
//如果信号机的进路中有已经锁闭或者正在排列的,从已经排列的进路找起
|
||||
List<Route> settingRoutes = routeList.stream().filter(route -> route.isLock() || route.isSetting()).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(settingRoutes)) {
|
||||
routeList = settingRoutes;
|
||||
followSettingRoute = true;
|
||||
} else {
|
||||
followSettingRoute = false;
|
||||
}
|
||||
}
|
||||
//通过进路,递归寻找路径
|
||||
for (Route route : routeList) {
|
||||
List<Section> newSections = new ArrayList<>(sections);
|
||||
boolean end = false; //当前路径是否结束
|
||||
for (Section section : route.getSectionList()) {
|
||||
if (!section.isTurnBackTrack() && !section.isTransferTrack()) { //非折返轨和转换轨
|
||||
List<Stand> standList = section.getStandList();
|
||||
if (!CollectionUtils.isEmpty(standList)) {
|
||||
if (standList.stream().allMatch(stand -> stand.isRight() != signalRight)) { //区段关联站台都和信号机方向不一致
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
newSections.add(section);
|
||||
if (section.equals(destination)) {
|
||||
pathSet.add(newSections);
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!end) {
|
||||
pathSet.addAll(findPath2DestinationAndRecordSections(destination, route.getDestination(), newSections, followSettingRoute));
|
||||
}
|
||||
}
|
||||
return pathSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算下一个停车点的位置
|
||||
*/
|
||||
@ -781,9 +874,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 追加长度的列车位置
|
||||
*
|
||||
* @param train
|
||||
* @param append 追加的长度
|
||||
*/
|
||||
public TrainPositionInfo(VirtualRealityTrain train, float append) {
|
||||
this.headPosition = train.getHeadPosition();
|
||||
@ -795,10 +885,6 @@ public class CalculateService {
|
||||
|
||||
/**
|
||||
* 两车碰撞检查
|
||||
*
|
||||
* @param train1
|
||||
* @param train2
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTrainPositionCollision(TrainPositionInfo train1, TrainPositionInfo train2) {
|
||||
// 计算车一占压的区段
|
||||
|
@ -9,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TdtStatusVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
@ -77,6 +78,13 @@ public class SimulationDataRepository {
|
||||
*/
|
||||
private Map<String, TrainHmiDisplay> trainHmiMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* TDT(train depart timer)状态数据
|
||||
* key-站台code
|
||||
* val-tdt状态对象
|
||||
*/
|
||||
private Map<String, TdtStatusVO> tdtStatusMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* ATS监控的列车信息map
|
||||
* key-车组号
|
||||
@ -643,6 +651,7 @@ public class SimulationDataRepository {
|
||||
// 清空设备状态
|
||||
this.deviceInfoMap.clear();
|
||||
this.trainHmiMap.clear();
|
||||
this.tdtStatusMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -904,6 +913,18 @@ public class SimulationDataRepository {
|
||||
this.trainHmiMap.remove(code);
|
||||
}
|
||||
|
||||
public TdtStatusVO queryTdtStatus(String code) {
|
||||
return this.tdtStatusMap.get(code);
|
||||
}
|
||||
|
||||
public void addTdtStatus(TdtStatusVO tdtStatusVO) {
|
||||
this.tdtStatusMap.put(tdtStatusVO.getStandCode(), tdtStatusVO);
|
||||
}
|
||||
|
||||
public void removeTdtStatus(String code) {
|
||||
this.tdtStatusMap.remove(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该车站某个方向的相邻车站
|
||||
*/
|
||||
|
@ -131,6 +131,11 @@ public class MapConfig {
|
||||
*/
|
||||
private float urmAtpSpeed;
|
||||
|
||||
/**
|
||||
* 当进路的区段占用时不排列进路
|
||||
*/
|
||||
private boolean doNotSetRouteWhenSectionOccupied;
|
||||
|
||||
private Set<SimulationMember.Type> needConfirmConnectMembers =
|
||||
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
|
||||
|
||||
@ -158,6 +163,7 @@ public class MapConfig {
|
||||
setParkingSM(configVO.getParkingSM());
|
||||
setRmAtpSpeed(configVO.getRmAtpSpeed() / 3.6f);
|
||||
setUrmAtpSpeed(configVO.getUrmAtpSpeed() / 3.6f);
|
||||
setDoNotSetRouteWhenSectionOccupied(configVO.isDoNotSetRouteWhenSectionOccupied());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
@ -370,10 +370,10 @@ public class Route extends MapNamedElement {
|
||||
* 排列失败
|
||||
*/
|
||||
public void settingFailed() {
|
||||
this.lock = false;
|
||||
if (Objects.equals(this.start.getLockedRoute(), this)) {
|
||||
this.start.setLockedRoute(null);
|
||||
}
|
||||
// this.lock = false;
|
||||
// if (Objects.equals(this.start.getLockedRoute(), this)) {
|
||||
// this.start.setLockedRoute(null);
|
||||
// }
|
||||
this.setting = false;
|
||||
if (Objects.nonNull(this.overlap)) {
|
||||
this.overlap.settingFailed();
|
||||
@ -447,8 +447,8 @@ public class Route extends MapNamedElement {
|
||||
Switch aSwitch = element.getASwitch();
|
||||
if (aSwitch.isFault() &&
|
||||
(Switch.SwitchFault.SPLIT.equals(aSwitch.getFault()) ||
|
||||
(element.isNormal() && Switch.SwitchFault.NORMAL_SPLIT.equals(aSwitch.getFault())) ||
|
||||
(!element.isNormal() && Switch.SwitchFault.REVERSE_SPLIT.equals(aSwitch.getFault())))) {
|
||||
(element.isNormal() && !aSwitch.isReversePosition() && Switch.SwitchFault.NORMAL_SPLIT.equals(aSwitch.getFault())) ||
|
||||
(!element.isNormal() && !aSwitch.isNormalPosition() && Switch.SwitchFault.REVERSE_SPLIT.equals(aSwitch.getFault())))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class RouteOverlap extends MapNamedElement {
|
||||
}
|
||||
|
||||
public void settingFailed() {
|
||||
this.lock = false;
|
||||
// this.lock = false;
|
||||
this.setting = false;
|
||||
this.settingStartTime = null;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ public class StorageSimulationDataRepository {
|
||||
//恢复ATS监控列车信息map
|
||||
if (Objects.nonNull(this.trainInfoList)) {
|
||||
for (StorageTrainInfo info : this.trainInfoList) {
|
||||
repository.addTrainInfo(new TrainInfo(info));
|
||||
repository.addTrainInfo(info.convert2SimulationObj(repository));
|
||||
}
|
||||
}
|
||||
// 使用中的列车恢复
|
||||
|
@ -3,12 +3,17 @@ package club.joylink.rtss.simulation.cbtc.data.storage.vo;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.TrainType;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -105,6 +110,9 @@ public class StorageTrainInfo {
|
||||
/**备用车*/
|
||||
private boolean backUp;
|
||||
|
||||
/** 头码车的路径 */
|
||||
private List<String> headPath;
|
||||
|
||||
public StorageTrainInfo(TrainInfo info) {
|
||||
this.code = info.getCode();
|
||||
this.groupNumber = info.getGroupNumber();
|
||||
@ -140,9 +148,12 @@ public class StorageTrainInfo {
|
||||
this.actualLeaveStandTrack = info.getActualLeaveStandTrack();
|
||||
this.actualLeaveTime = info.getActualLeaveTime();
|
||||
this.backUp = info.isBackUp();
|
||||
if (!CollectionUtils.isEmpty(info.getHeadPath())) {
|
||||
this.headPath = info.getHeadPath().stream().map(MapElement::getCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
public TrainInfo convert2SimulationObj() {
|
||||
return new TrainInfo(this);
|
||||
public TrainInfo convert2SimulationObj(SimulationDataRepository repository) {
|
||||
return new TrainInfo(this, repository);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TdtStatusVO {
|
||||
/**
|
||||
* 站台code
|
||||
*/
|
||||
private String standCode;
|
||||
/**
|
||||
* 是否扣车
|
||||
*/
|
||||
private boolean hold;
|
||||
/**
|
||||
* 是否跳停
|
||||
*/
|
||||
private boolean jump;
|
||||
/**
|
||||
* 倒计时剩余时间
|
||||
*/
|
||||
private int remain;
|
||||
/**
|
||||
* 是否有停靠列车
|
||||
*/
|
||||
private boolean parking;
|
||||
|
||||
public TdtStatusVO(Stand stand) {
|
||||
this.standCode = stand.getCode();
|
||||
boolean trainParking = stand.isTrainParking();
|
||||
this.parking = trainParking;
|
||||
if (trainParking) {
|
||||
this.remain = stand.getRemainTime() / 1000;
|
||||
}
|
||||
this.hold = stand.isHoldTrain();
|
||||
this.jump = stand.isJumpStop();
|
||||
}
|
||||
|
||||
public boolean compareAndChange(Stand stand) {
|
||||
boolean change = false;
|
||||
boolean trainParking = stand.isTrainParking();
|
||||
if (!Objects.equals(this.parking, trainParking)) {
|
||||
change = true;
|
||||
this.parking = trainParking;
|
||||
}
|
||||
int remainTime = stand.getRemainTime() / 1000;
|
||||
if (trainParking && !Objects.equals(this.remain, remainTime)) {
|
||||
change = true;
|
||||
this.remain = remainTime;
|
||||
}
|
||||
if (!Objects.equals(this.jump, stand.isJumpStop())) {
|
||||
change = true;
|
||||
this.jump = stand.isJumpStop();
|
||||
}
|
||||
if (!Objects.equals(this.hold, stand.isHoldTrain())) {
|
||||
change = true;
|
||||
this.hold = stand.isHoldTrain();
|
||||
}
|
||||
return change;
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
@ -10,11 +13,14 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ATS追踪的列车信息
|
||||
@ -136,6 +142,10 @@ public class TrainInfo extends MapElement {
|
||||
/**备用车*/
|
||||
private boolean backUp;
|
||||
|
||||
/** 头码车的区段路径 */
|
||||
@Setter
|
||||
private List<Section> headPath;
|
||||
|
||||
public TrainInfo(String groupNumber) {
|
||||
super(groupNumber, DeviceType.TRAIN);
|
||||
this.groupNumber = groupNumber;
|
||||
@ -157,7 +167,7 @@ public class TrainInfo extends MapElement {
|
||||
this.tripNumber = train.getTripNumber();
|
||||
}
|
||||
|
||||
public TrainInfo(StorageTrainInfo info) {
|
||||
public TrainInfo(StorageTrainInfo info, SimulationDataRepository repository) {
|
||||
this(info.getCode());
|
||||
this.type = info.getType();
|
||||
this.serviceNumber = info.getServiceNumber();
|
||||
@ -192,6 +202,9 @@ public class TrainInfo extends MapElement {
|
||||
this.actualLeaveStandTrack = info.getActualLeaveStandTrack();
|
||||
this.actualLeaveTime = info.getActualLeaveTime();
|
||||
this.backUp = info.isBackUp();
|
||||
if (!CollectionUtils.isEmpty(info.getHeadPath())) {
|
||||
this.headPath = info.getHeadPath().stream().map(code -> repository.getByCode(code, Section.class)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -388,4 +401,35 @@ public class TrainInfo extends MapElement {
|
||||
public String debugStr() {
|
||||
return String.format("%s", groupNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取physicalSection并确保它不是null
|
||||
*/
|
||||
public String getNotNullPhysicalSection(){
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(physicalSection, String.format("列车[%s]所在物理区段为空", groupNumber));
|
||||
return physicalSection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列车是否已经停在或超出目标位置(考虑误差)
|
||||
*/
|
||||
public boolean isNotArriveAt(SimulationDataRepository repository, SectionPosition targetPosition) {
|
||||
//判断是否超出目标位置
|
||||
if (physicalSection == null)
|
||||
return false;
|
||||
boolean right = this.right;
|
||||
boolean stop = isStop();
|
||||
Section headSection = repository.getByCode(physicalSection, Section.class);
|
||||
float offset = headSection.getLen() * offsetp;
|
||||
SectionPosition headPosition = new SectionPosition(headSection, offset);
|
||||
SectionPosition max = CalculateService.calculateNextPositionByStartAndLen(targetPosition,
|
||||
right, SimulationConstants.PARK_POINT_MAX_OFFSET);
|
||||
SectionPosition min = CalculateService.calculateNextPositionByStartAndLen(targetPosition,
|
||||
!right, SimulationConstants.PARK_POINT_MAX_OFFSET);
|
||||
if (stop) {
|
||||
return min.isAheadOf(headPosition, right);
|
||||
} else {
|
||||
return max.isAheadOf(headPosition, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package club.joylink.rtss.simulation.cbtc.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SimulationSubscribeEvent extends ApplicationEvent {
|
||||
private Long userId;
|
||||
|
||||
private String group;
|
||||
|
||||
public SimulationSubscribeEvent(Object source, Long userId, String group) {
|
||||
super(source);
|
||||
this.userId = userId;
|
||||
this.group = group;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package club.joylink.rtss.simulation.cbtc.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* 用户退订仿真的所有订阅路径
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SimulationUnsubscribeAllEvent extends ApplicationEvent {
|
||||
private Long userId;
|
||||
|
||||
private String group;
|
||||
|
||||
public SimulationUnsubscribeAllEvent(Object source, Long userId, String group) {
|
||||
super(source);
|
||||
this.userId = userId;
|
||||
this.group = group;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package club.joylink.rtss.simulation.cbtc.message;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationDestroyEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationSubscribeEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationUnsubscribeAllEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class UserSimulationStatsListen {
|
||||
|
||||
@Autowired
|
||||
private UserSimulationStatsManager userSimulationStatsManager;
|
||||
|
||||
@Async("nsExecutor")
|
||||
@EventListener
|
||||
public void subscribeSimulation(SimulationSubscribeEvent event) {
|
||||
userSimulationStatsManager.subscribeSimulation(event.getUserId(), event.getGroup());
|
||||
}
|
||||
|
||||
@Async("nsExecutor")
|
||||
@EventListener
|
||||
public void unsubscribeAll(SimulationUnsubscribeAllEvent event) {
|
||||
userSimulationStatsManager.unsubscribeAll(event.getUserId(), event.getGroup());
|
||||
}
|
||||
|
||||
@Async("nsExecutor")
|
||||
@EventListener
|
||||
public void simulationDestroy(SimulationDestroyEvent event) {
|
||||
userSimulationStatsManager.simulationDestroy(event.getSimulation());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package club.joylink.rtss.simulation.cbtc.message;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.user.IUserSimulationStatService;
|
||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
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.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 用户使用仿真情况记录
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserSimulationStatsManager {
|
||||
@Autowired
|
||||
private GroupSimulationService groupSimulationService;
|
||||
|
||||
@Autowired
|
||||
private IUserSimulationStatService iUserSimulationStatService;
|
||||
|
||||
/**
|
||||
* k - userId
|
||||
* v - 用户订阅的仿真的groups
|
||||
*/
|
||||
private final Map<Long, Set<SimulationUseInfo>> userAndUseInfosMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* k - group
|
||||
* v - 仿真使用记录
|
||||
*/
|
||||
private final Map<String, Set<SimulationUseInfo>> simulationAndUseInfosMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 仿真被订阅,记录仿真使用记录
|
||||
*/
|
||||
public void subscribeSimulation(Long userId, String group) {
|
||||
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
|
||||
if (simulation.isScriptMakingSimulation() || simulation.isScriptPreviewSimulation()) {
|
||||
return;
|
||||
}
|
||||
Set<SimulationUseInfo> useInfos = userAndUseInfosMap.computeIfAbsent(userId, k -> new HashSet<>());
|
||||
Optional<SimulationUseInfo> infoOptional = useInfos.stream().filter(info -> group.equals(info.getGroup())).limit(1).findFirst();
|
||||
if (infoOptional.isPresent()) { //如果记录已经存在
|
||||
SimulationUseInfo useInfo = infoOptional.get();
|
||||
useInfo.restart();
|
||||
} else { //如果记录不存在
|
||||
SimulationUseInfo newInfo = new SimulationUseInfo(group, userId);
|
||||
useInfos.add(newInfo);
|
||||
Set<SimulationUseInfo> groupKeyUseInfos = simulationAndUseInfosMap.computeIfAbsent(group, k -> new HashSet<>());
|
||||
groupKeyUseInfos.add(newInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户将仿真所有订阅退订,则仿真使用记录暂停
|
||||
*/
|
||||
public void unsubscribeAll(Long userId, String group) {
|
||||
Simulation simulation = groupSimulationService.findSimulationByGroup(group);
|
||||
if (simulation == null) {
|
||||
return;
|
||||
}
|
||||
if (simulation.isScriptMakingSimulation() || simulation.isScriptPreviewSimulation()) {
|
||||
return;
|
||||
}
|
||||
SimulationUseInfo useInfo = findUseInfo(userId, group);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(useInfo, String.format("仿真[%s]的使用未被记录", group));
|
||||
useInfo.pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 仿真销毁,持久化数据
|
||||
*/
|
||||
public void simulationDestroy(Simulation simulation) {
|
||||
if (simulation.isScriptMakingSimulation() || simulation.isScriptPreviewSimulation()) { //剧本编制和预览仿真不记录
|
||||
return;
|
||||
}
|
||||
|
||||
//暂停并从map中移除仿真使用记录
|
||||
String group = simulation.getGroup();
|
||||
Set<SimulationUseInfo> useInfos = simulationAndUseInfosMap.remove(group);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(useInfos, String.format("仿真[%s]的使用未被记录", group));
|
||||
useInfos.forEach(info -> {
|
||||
info.pause();
|
||||
Set<SimulationUseInfo> infos = userAndUseInfosMap.get(info.getUserId());
|
||||
infos.removeIf(i -> group.equals(i.getGroup()));
|
||||
});
|
||||
SimulationBuildParams buildParams = simulation.getBuildParams();
|
||||
useInfos.forEach(info -> {
|
||||
Long userId = info.getUserId();
|
||||
SimulationMember member = simulation.findMemberByUserId(userId);
|
||||
String memberType = member == null ? null : member.getType().name();
|
||||
String prdType = buildParams.getProdType() == null ? null : buildParams.getProdType().getCode();
|
||||
iUserSimulationStatService.addUserSimulationStats(userId, buildParams.getMap().getId(),
|
||||
prdType, info.getDuration(), memberType);
|
||||
});
|
||||
}
|
||||
|
||||
private SimulationUseInfo findUseInfo(Long userId, String group) {
|
||||
Set<SimulationUseInfo> infos = userAndUseInfosMap.get(userId);
|
||||
if (CollectionUtils.isEmpty(infos)) {
|
||||
return null;
|
||||
} else {
|
||||
Optional<SimulationUseInfo> optional = infos.stream().filter(info -> group.equals(info.getGroup())).limit(1).findFirst();
|
||||
return optional.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 仿真使用信息
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SimulationUseInfo {
|
||||
private String group;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private LocalDateTime startTime = LocalDateTime.now();
|
||||
|
||||
private int duration;
|
||||
|
||||
private boolean pause;
|
||||
|
||||
public SimulationUseInfo(String group, Long userId) {
|
||||
this.group = group;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停计时
|
||||
*/
|
||||
public void pause() {
|
||||
if (!pause) {
|
||||
duration = (int) (duration + Duration.between(startTime, LocalDateTime.now()).toSeconds());
|
||||
this.pause = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新开始计时
|
||||
*/
|
||||
public void restart() {
|
||||
if (pause) {
|
||||
startTime = LocalDateTime.now();
|
||||
pause = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.message.websocket;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.event.*;
|
||||
import club.joylink.rtss.websocket.WebsocketConfig;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@ -48,6 +49,7 @@ public class SimulationSubscribeManager {
|
||||
|
||||
/**
|
||||
* 发布仿真连接/断连事件
|
||||
*
|
||||
* @param user
|
||||
* @param subscribeTopic
|
||||
* @param destination
|
||||
@ -58,12 +60,18 @@ public class SimulationSubscribeManager {
|
||||
String destination, boolean sub) {
|
||||
if (sub) {
|
||||
log.info(String.format("用户[%s]订阅仿真[%s]", user.getName(), destination));
|
||||
this.applicationContext.publishEvent(new SimulationSubscribeEvent(this, user.getUser().getId(), subscribeTopic.getId(destination)));
|
||||
} else {
|
||||
log.info(String.format("用户[%s]取消订阅仿真[%s]", user.getName(), destination));
|
||||
//如果某个仿真的所有订阅都被取消
|
||||
SimulationUserSubscribeInfo simulationUserSubscribeInfo = userSubInfoMap.get(user.getName());
|
||||
if (simulationUserSubscribeInfo == null || simulationUserSubscribeInfo.isSubscribeInfoEmpty(destination)) {
|
||||
this.applicationContext.publishEvent(new SimulationUnsubscribeAllEvent(this, user.getUser().getId(), subscribeTopic.getId(destination)));
|
||||
}
|
||||
}
|
||||
switch (subscribeTopic) {
|
||||
case Main:
|
||||
case WeChatMini:{
|
||||
case WeChatMini: {
|
||||
if (sub) {
|
||||
this.applicationContext.publishEvent(new SimulationUserConnectEvent(user.getUser().getId(), subscribeTopic.getId(destination), this));
|
||||
} else {
|
||||
@ -71,7 +79,7 @@ public class SimulationSubscribeManager {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SandBox:{
|
||||
case SandBox: {
|
||||
if (sub) {
|
||||
this.applicationContext.publishEvent(new SandboxUserConnectEvent(user.getUser().getId(), subscribeTopic.getId(destination), this));
|
||||
} else {
|
||||
@ -79,7 +87,7 @@ public class SimulationSubscribeManager {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Drive:{
|
||||
case Drive: {
|
||||
if (sub) {
|
||||
this.applicationContext.publishEvent(new Drive3DUserConnectEvent(user.getUser().getId(), subscribeTopic.getId(destination), this));
|
||||
} else {
|
||||
@ -150,6 +158,7 @@ public class SimulationSubscribeManager {
|
||||
|
||||
/**
|
||||
* 断开连接,删除此连接的所有订阅,并查询此用户所有客户端都不再订阅的路径返回
|
||||
*
|
||||
* @param wsSessionId
|
||||
* @return 此用户所有客户端都没有订阅的路径
|
||||
*/
|
||||
@ -177,9 +186,24 @@ public class SimulationSubscribeManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSubscribeInfoEmpty(String destination) {
|
||||
if (sessionSubMap == null || sessionSubMap.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (Set<SubscribeInfo> infos : sessionSubMap.values()) {
|
||||
for (SubscribeInfo info : infos) {
|
||||
if (destination.equals(info.getDestination())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class SubscribeInfo {
|
||||
String wsSessionId;
|
||||
String subId;
|
||||
@Getter
|
||||
String destination;
|
||||
|
||||
public SubscribeInfo(String wsSessionId, String subId, String destination) {
|
||||
|
@ -189,6 +189,13 @@ public class ATPLogicLoop {
|
||||
|
||||
private void handleStandParkedTrain(Simulation simulation, VirtualRealityTrain train) {
|
||||
StandParkedTrainActivity activity = train.getStandParkedTrainActivity();
|
||||
int parkRemainTime = train.getParkRemainTime();
|
||||
if (parkRemainTime > 0) {
|
||||
parkRemainTime -= SimulationModule.ATP.getRateMs();
|
||||
train.setParkRemainTime(parkRemainTime);
|
||||
} else {
|
||||
train.setParkRemainTime(0);
|
||||
}
|
||||
switch (activity) {
|
||||
case PARK: // 停靠
|
||||
train.nextParkedTrainActivity();
|
||||
@ -204,11 +211,7 @@ public class ATPLogicLoop {
|
||||
}
|
||||
break;
|
||||
case BOARD: // 乘客乘降
|
||||
int parkRemainTime = train.getParkRemainTime();
|
||||
if (parkRemainTime >= 0) {
|
||||
parkRemainTime -= SimulationModule.ATP.getRateMs();
|
||||
train.setParkRemainTime(parkRemainTime);
|
||||
} else {
|
||||
if (parkRemainTime < 10000) { // 小于10秒,关门
|
||||
train.nextParkedTrainActivity();
|
||||
}
|
||||
break;
|
||||
|
@ -80,10 +80,10 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
train.park(parkTime);
|
||||
log.debug(String.format("列车[%s]停站时间[%s s]",
|
||||
train.getGroupNumber(), parkTime));
|
||||
if (parkTime > 0) {
|
||||
// 开屏蔽门
|
||||
this.ATOService.syncOpenDoor(simulation, train);
|
||||
}
|
||||
// if (parkTime > 0) {
|
||||
// // 开屏蔽门
|
||||
// this.ATOService.syncOpenDoor(simulation, train);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,7 +112,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
train.updateNextStationPlan(nextStation, targetSection, parking);
|
||||
this.checkAndChangeDirection(simulation, train, targetSection);
|
||||
//根据时间控制速度
|
||||
runningTime -= 10; //减去开关门和延迟启动耗费的时间
|
||||
// runningTime -= 10; //减去开关门和延迟启动耗费的时间
|
||||
Float atoMaxSpeed = CalculateService.calculateAtoSpeedMax4RunTime(train, runningTime);
|
||||
if (atoMaxSpeed != null) {
|
||||
train.setAtoSpeedMax(atoMaxSpeed);
|
||||
|
@ -24,4 +24,6 @@ public class MapQueryVO extends PageQueryVO {
|
||||
*/
|
||||
@NotBlank(message="所属城市不能为空", groups= {DraftMapCreateCheck.class})
|
||||
private String cityCode;
|
||||
|
||||
private String lineCode;
|
||||
}
|
||||
|
@ -141,6 +141,8 @@ public enum WebSocketMessageType {
|
||||
DeviceCtrl_3D,
|
||||
/** 列车即将进站消息 */
|
||||
BeAbout2Arrive_3D,
|
||||
/** 列车即将进站消息 */
|
||||
TDT_3D,
|
||||
/** 3D设备故障设置消息 */
|
||||
Device_Fault_Set_3D,
|
||||
/** 3D设备故障解决消息 */
|
||||
|
@ -6,10 +6,7 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationSocketMessageVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainIsAbout2ArriveVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.*;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
@ -139,6 +136,7 @@ public class SocketMessageFactory {
|
||||
}
|
||||
case Device_Load_Destroy_3D:
|
||||
case DeviceCtrl_3D:
|
||||
case TDT_3D:
|
||||
case BeAbout2Arrive_3D: {
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.TrainDrive3D, group));
|
||||
@ -320,6 +318,14 @@ public class SocketMessageFactory {
|
||||
return build(WebSocketMessageType.BeAbout2Arrive_3D, group, arriveVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建列车即将到站消息
|
||||
* @return
|
||||
*/
|
||||
public static SocketMessageVO<List<TdtStatusVO>> buildTrainIsAbout2ArriveMessage(String group, List<TdtStatusVO> list) {
|
||||
return build(WebSocketMessageType.TDT_3D, group, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建VR同步消息
|
||||
*/
|
||||
|
@ -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();
|
||||
|
@ -70,6 +70,11 @@ public class RealLineConfigVO {
|
||||
*/
|
||||
private boolean initSingleLockSwitch = false;
|
||||
|
||||
/**
|
||||
* 当进路的区段占用时不排列进路
|
||||
*/
|
||||
private boolean doNotSetRouteWhenSectionOccupied = false;
|
||||
|
||||
public static RealLineConfigVO parseJsonStr(String configData) {
|
||||
if (StringUtils.hasText(configData)) {
|
||||
return JsonUtils.read(configData, RealLineConfigVO.class);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,22 +1,47 @@
|
||||
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.runplan.newdraw.mainstack.DrawFuzhouRunPlan;
|
||||
import club.joylink.rtss.vo.runplan.newdraw.mainstack.DrawHarbinRunPlan;
|
||||
import club.joylink.rtss.vo.runplan.newdraw.mainstack.DrawRunPlan;
|
||||
import club.joylink.rtss.vo.client.runplan.user.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
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(Long userId, RunPlanInput runPlanInput, MapVO mapVO) {
|
||||
|
||||
//校验发车停运时间
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getOverTime().isAfter(runPlanInput.getBeginTime()));
|
||||
@ -24,28 +49,394 @@ 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);
|
||||
//检查环路
|
||||
RunPlanRoutingVO running1Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), runPlanInput.getRunningRouting1());
|
||||
RunPlanRoutingVO running2Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), runPlanInput.getRunningRouting2());
|
||||
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, "运行两交路无法构成环路数据");
|
||||
//查站间运行等级
|
||||
List<RunPlanRunlevelVO> levels = runPlanRunlevelService.queryUserRunLevels(userId, mapVO.getId());
|
||||
Map<String, Integer> runLevelTime = levels.stream().collect(Collectors.toMap(runLevelVO -> String.format("%s-%s", runLevelVO.getStartSectionCode(), runLevelVO.getEndSectionCode()), runLevelVO -> runLevelVO.getLevelTime(runPlanInput.getRunLevel())));
|
||||
//查停站时间
|
||||
List<RunPlanParkingTimeVO> parkTimes = runPlanParktimeService.queryUserParktimes(userId, mapVO.getId());
|
||||
Map<String, Integer> parkTime = 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<>();
|
||||
//是否同时相向发车
|
||||
boolean opposite = Objects.isNull(runPlanInput.getRight());
|
||||
if (opposite) {
|
||||
//相向发车
|
||||
int initialServiceNum = 1;
|
||||
/*分别先发一辆车,计算控制左右发车服务号*/
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
ServiceTempResult tempResultLeft = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultLeft, false, runLevelTime, parkTime, userReentryData);
|
||||
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
ServiceTempResult tempResultRight = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultRight, true, runLevelTime, parkTime, userReentryData);
|
||||
|
||||
LocalTime firstRoundTripTimeLeft = tempResultLeft.getFirstRoundTripTime();
|
||||
LocalTime firstRoundTripTimeRight = tempResultRight.getFirstRoundTripTime();
|
||||
tempResultRight.setFirstRoundTripTime(firstRoundTripTimeLeft);
|
||||
tempResultLeft.setFirstRoundTripTime(firstRoundTripTimeRight);
|
||||
//暂时先定义发完左行,再发右行..
|
||||
do {
|
||||
tempResultLeft.setPreServiceDepartTime(tempResultLeft.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultLeft, false, runLevelTime, parkTime, userReentryData);
|
||||
} while (tempResultLeft.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResultLeft.getFirstRoundTripTime()) <= 0);
|
||||
//发完左行,再发右行
|
||||
do {
|
||||
tempResultRight.setPreServiceDepartTime(tempResultRight.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultRight, true, runLevelTime, parkTime, userReentryData);
|
||||
} while (tempResultRight.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResultRight.getFirstRoundTripTime()) <= 0);
|
||||
|
||||
} else {
|
||||
//单向发车
|
||||
allServiceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, tripList, runLevelTime, parkTime, userReentryData);
|
||||
|
||||
}
|
||||
return tripList;
|
||||
|
||||
}
|
||||
|
||||
private static DrawRunPlan drawRunPlanOf(int runLevel, MapVO mapVO) {
|
||||
DrawRunPlan drawRunPlan;
|
||||
switch (mapVO.getLineCode()) {
|
||||
case "07":
|
||||
drawRunPlan = new DrawHarbinRunPlan(runLevel, mapVO);
|
||||
/**
|
||||
* 服务号发车
|
||||
*/
|
||||
private void serviceNumberDepart(MapVO mapVO, RunPlanInput runPlanInput, RunPlanRoutingVO running1Routing, RunPlanRoutingVO running2Routing, int initialServiceNum, LinkedList<RunPlanTripVO> tripList, ServiceTempResult tempResult, boolean isRight, Map<String, Integer> runLevelTime, Map<String, Integer> parkTime, Map<String, String> userReentryData) {
|
||||
String serviceNumber = String.format("%03d", initialServiceNum);
|
||||
//初始化车次号,右行偶数,左行奇数
|
||||
int initTripNumber = isRight ? 0 : 1;
|
||||
LocalTime lastTripEndTime = null;//一个车次终点时间
|
||||
LinkedList<RunPlanTripVO> tempTripList = new LinkedList<>();
|
||||
//根据运行时间判断结束末班车次
|
||||
do {
|
||||
RunPlanRoutingVO routing = Objects.equals(running1Routing.getRight(), isRight) ? running1Routing : running2Routing;
|
||||
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 runPlanTripVO = new RunPlanTripVO(routing, startReentrySection, endReentrySection);
|
||||
runPlanTripVO.setServiceNumber(serviceNumber);
|
||||
setDirectionCode(mapVO, runPlanTripVO);
|
||||
runPlanTripVO.setIsReentry(true);
|
||||
//车次号
|
||||
String tripNumber = String.format("%03d", initTripNumber++);
|
||||
runPlanTripVO.setTripNumber(runPlanTripVO.getDirectionCode() + tripNumber);
|
||||
//首班右行方向
|
||||
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(tempTripList) && CollectionUtils.isEmpty(tripTimeList) ?
|
||||
tempResult.getPreServiceDepartTime() :
|
||||
(CollectionUtils.isEmpty(tripTimeList) ?
|
||||
(Objects.equals(tempTripList.getLast().getEndSectionCode(), runPlanTripTimeVO.getSectionCode()) ?
|
||||
tempTripList.getLast().getEndTime() : ((LinkedList<RunPlanTripTimeVO>) tempTripList.getLast().getTimeList()).getLast().getDepartureTime().plusSeconds(runPlanInput.getReentryTime())) : tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelTime.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode()))));
|
||||
runPlanTripTimeVO.setDepartureTime(CollectionUtils.isEmpty(tempTripList) && CollectionUtils.isEmpty(tripTimeList) ? tempResult.getPreServiceDepartTime() : runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTime.getOrDefault(runPlanTripTimeVO.getSectionCode(), 0)));
|
||||
tripTimeList.add(runPlanTripTimeVO);
|
||||
});
|
||||
runPlanTripVO.setTimeList(tripTimeList);
|
||||
setTripTerminalTime(runPlanTripVO, tripTimeList, runPlanInput.getReentryTime());
|
||||
lastTripEndTime = runPlanTripVO.getEndTime();
|
||||
tempTripList.add(runPlanTripVO);
|
||||
if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
||||
|
||||
break;
|
||||
case "02":
|
||||
drawRunPlan = new DrawFuzhouRunPlan(runLevel, mapVO);
|
||||
break;
|
||||
default:
|
||||
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception();
|
||||
}
|
||||
isRight = !isRight;
|
||||
|
||||
} while (lastTripEndTime.isBefore(runPlanInput.getOverTime()));
|
||||
//设置服务号末班车次入库
|
||||
RunPlanTripVO lastrunPlanTrip = tempTripList.get(tempTripList.size() - 1);
|
||||
lastrunPlanTrip.setIsInbound(true);
|
||||
lastrunPlanTrip.setIsReentry(false);
|
||||
LinkedList<RunPlanTripTimeVO> tripTimeList = (LinkedList<RunPlanTripTimeVO>) lastrunPlanTrip.getTimeList();
|
||||
setTripEndTime(lastrunPlanTrip, tripTimeList, runPlanInput.getReentryTime());
|
||||
tripList.addAll(tempTripList);
|
||||
if (Objects.isNull(tempResult.getFirstRoundTripTime())) {
|
||||
tempResult.setFirstRoundTripTime(((RunPlanTripTimeVO) (((LinkedList) (tempTripList.get(0).getTimeList())).getLast())).getDepartureTime());
|
||||
}
|
||||
return drawRunPlan;
|
||||
tempResult.setPreServiceDepartTime(((RunPlanTripTimeVO) (((LinkedList) (tempTripList.get(0).getTimeList())).getFirst())).getArrivalTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 单向发车
|
||||
*/
|
||||
private void allServiceNumberDepart(MapVO mapVO, RunPlanInput runPlanInput, RunPlanRoutingVO running1Routing, RunPlanRoutingVO running2Routing, LinkedList<RunPlanTripVO> tripList, Map<String, Integer> runLevelTime, Map<String, Integer> parkTime, Map<String, String> userReentryData) {
|
||||
|
||||
|
||||
//设置初始服务号
|
||||
int initialServiceNum = 1;
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
ServiceTempResult tempResult = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
do {
|
||||
if (initialServiceNum != 1) {
|
||||
tempResult.setPreServiceDepartTime(tempResult.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
}
|
||||
serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResult, runPlanInput.getRight(), runLevelTime, parkTime, userReentryData);
|
||||
} while (tempResult.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResult.getFirstRoundTripTime()) <= 0);
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
//构建环路 和 出入库关系
|
||||
|
||||
//验证 出库和入库 一端折返轨 一段转换轨,验证环路 两端折返轨 ,环路是否闭环 或出入库跟环路是否衔接
|
||||
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());
|
||||
|
||||
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());
|
||||
|
||||
//出库关联环路某交楼
|
||||
RunPlanRoutingVO outRef = null;
|
||||
//环路其它交路
|
||||
RunPlanRoutingVO other = null;
|
||||
boolean same = false;
|
||||
if (outToRun1 && inToRun1) {
|
||||
same = true;
|
||||
outRef = running1Routing;
|
||||
other = running2Routing;
|
||||
} else if (outToRun2 && inToRun2) {
|
||||
same = true;
|
||||
outRef = running2Routing;
|
||||
other = running1Routing;
|
||||
} else if (outToRun1 && inToRun2) {
|
||||
outRef = running1Routing;
|
||||
other = running2Routing;
|
||||
} else if (outToRun2 && inToRun1) {
|
||||
outRef = running2Routing;
|
||||
other = running1Routing;
|
||||
} 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("折返轨未设置");
|
||||
}
|
||||
|
||||
List<RunPlanTripVO> tripList = new ArrayList<>(100);
|
||||
ServiceTempResult serviceResult = new ServiceTempResult();
|
||||
//单个服务号还是多个
|
||||
if (Objects.nonNull(inputData.getDepartureInterval())) {
|
||||
do {
|
||||
generateService(inputData, mapVO, outboundRouting, inboundRouting, outRef, same, other, runLevelMap, parkTimeMap, userReentryData, tripList, serviceResult);
|
||||
inputData.setServiceNumber(String.format("%03d", Integer.parseInt(inputData.getServiceNumber()) + 1));
|
||||
inputData.setBeginTime(inputData.getBeginTime().plusSeconds(inputData.getDepartureInterval()));
|
||||
} while (serviceResult.preServiceDepartTime.plusSeconds(inputData.getDepartureInterval()).compareTo(serviceResult.firstRoundTripTime) <= 0);
|
||||
|
||||
} else {
|
||||
generateService(inputData, mapVO, outboundRouting, inboundRouting, outRef, same, other, runLevelMap, parkTimeMap, userReentryData, tripList, serviceResult);
|
||||
}
|
||||
return tripList;
|
||||
}
|
||||
|
||||
private void generateService(RunPlanInputData inputData, MapVO mapVO, RunPlanRoutingVO outboundRouting, RunPlanRoutingVO inboundRouting, RunPlanRoutingVO outRef, final boolean same, RunPlanRoutingVO other, Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, String> userReentryData, List<RunPlanTripVO> tripList, ServiceTempResult serviceResult) {
|
||||
LinkedList<RunPlanTripVO> serviceTripList = new LinkedList<>();
|
||||
int initTripNumber = 1;
|
||||
TripTempResult temp = new TripTempResult(initTripNumber, inputData.getBeginTime());
|
||||
//构建出库车次
|
||||
buildServiceTrips(inputData, mapVO, outboundRouting, true, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
|
||||
//计算出库车次运行所需时间
|
||||
int size = inboundRouting.getParkSectionCodeList().size();
|
||||
int inboundTripRunTime = inputData.getReentryTime() / 2;
|
||||
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(inputData.getReentryTime() + inboundTripRunTime).isBefore(inputData.getOverTime())) {
|
||||
if (same) {
|
||||
if (!loop) {
|
||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
loop = true;
|
||||
} else {
|
||||
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
}
|
||||
} else {
|
||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
}
|
||||
}
|
||||
//构建回库计划
|
||||
buildServiceTrips(inputData, mapVO, inboundRouting, false, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||
|
||||
if (Objects.isNull(serviceResult.getFirstRoundTripTime())) {
|
||||
serviceResult.setFirstRoundTripTime(serviceTripList.get(1).getEndTime());
|
||||
}
|
||||
serviceResult.setPreServiceDepartTime(serviceTripList.getFirst().getStartTime());
|
||||
tripList.addAll(serviceTripList);
|
||||
}
|
||||
|
||||
private void buildServiceTrips(RunPlanInputData inputData, MapVO mapVO, RunPlanRoutingVO routing, Boolean outbound,
|
||||
Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, String> userReentryData,
|
||||
LinkedList<RunPlanTripVO> tripList, TripTempResult 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(inputData.getServiceNumber());
|
||||
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().getEndTime() : tempResult.getLastStationDepartTime().plusSeconds(inputData.getReentryTime())) : 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);
|
||||
setTripTerminalTime(tripVO, tripTimeList, inputData.getReentryTime());
|
||||
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 setTripTerminalTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, int reentryTime) {
|
||||
setTripStartTime(runPlanTripVO, tripTimeList, reentryTime);
|
||||
setTripEndTime(runPlanTripVO, tripTimeList, reentryTime);
|
||||
}
|
||||
|
||||
private void setTripEndTime(RunPlanTripVO lastRunPlanTrip, LinkedList<RunPlanTripTimeVO> tripTimeList, int reentryTime) {
|
||||
if (Objects.equals(lastRunPlanTrip.getEndSectionCode(), tripTimeList.getLast().getSectionCode())) {
|
||||
lastRunPlanTrip.setEndTime(tripTimeList.getLast().getDepartureTime());
|
||||
} else {
|
||||
lastRunPlanTrip.setEndTime(tripTimeList.getLast().getDepartureTime().plusSeconds(reentryTime / 2));
|
||||
}
|
||||
}
|
||||
|
||||
private void setTripStartTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, int reentryTime) {
|
||||
if (Objects.equals(runPlanTripVO.getStartSectionCode(), tripTimeList.getFirst().getSectionCode())) {
|
||||
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime());
|
||||
} else {
|
||||
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime().minusSeconds(reentryTime / 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
private class TripTempResult {
|
||||
private int tripNumber;
|
||||
private LocalTime lastStationDepartTime;
|
||||
|
||||
public void incrementTripNumber() {
|
||||
tripNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
private class ServiceTempResult {
|
||||
private LocalTime preServiceDepartTime;
|
||||
private LocalTime firstRoundTripTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.time.LocalTime;
|
||||
@ -15,67 +16,39 @@ import java.time.LocalTime;
|
||||
@Setter
|
||||
public class RunPlanInput {
|
||||
|
||||
// // 出库站
|
||||
// private String inboundStationCode;
|
||||
// // 入库站
|
||||
// private String outboundStationCode;
|
||||
/**环路1-运行交路code*/
|
||||
@ApiModelProperty(value = "运行交路code")
|
||||
@NotBlank(message= "环路不能为空")
|
||||
private String runningRouting1;
|
||||
|
||||
/**环路2-运行交路code*/
|
||||
@ApiModelProperty(value = "运行交路code")
|
||||
@NotBlank(message= "环路不能为空")
|
||||
private String runningRouting2;
|
||||
|
||||
/**往返车站-左向起始站*/
|
||||
@ApiModelProperty(value = "左向起始站")
|
||||
private String startStationCode;
|
||||
/**往返车站-右向起始站*/
|
||||
@ApiModelProperty(value = "右向起始站")
|
||||
private String endStationCode;
|
||||
/**折返时间*/
|
||||
@ApiModelProperty(value = "折返时间")
|
||||
private int reentryTime;
|
||||
// /**停站时间*/
|
||||
// @ApiModelProperty(value = "停站时间")
|
||||
// private int parkedTime;
|
||||
|
||||
/**运行等级默认-站间运行时间*/
|
||||
private int runLevel=3;
|
||||
|
||||
/**开始时间*/
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@NotNull(message = "开始时间不能为空")
|
||||
private LocalTime beginTime;
|
||||
|
||||
/**结束时间*/
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
@NotNull(message = "结束时间不能为空")
|
||||
private LocalTime overTime;
|
||||
|
||||
/**间隔发车时间*/
|
||||
@ApiModelProperty(value = "间隔时间")
|
||||
@Positive
|
||||
private int departureTimeInterval;
|
||||
|
||||
/**左右行,不设置为相向同时发车*/
|
||||
@ApiModelProperty(value = "向左/向右")
|
||||
private Boolean right;
|
||||
// /**初始服务号*/
|
||||
// @ApiModelProperty(value = "表号")
|
||||
// @NotBlank
|
||||
// @Length(min = 1, max = 3)
|
||||
// private String initialServiceNumber;
|
||||
|
||||
// private DepartureParam leftDepartureParam;
|
||||
// private DepartureParam rightDepartureParam;
|
||||
// // // 服务号数量
|
||||
//// private int serviceCount;
|
||||
//
|
||||
//// //同时发车
|
||||
//// private boolean simultaneousDepart;
|
||||
// @Setter
|
||||
// @Getter
|
||||
// public class DepartureParam{
|
||||
//// /**左右行*/
|
||||
//// @ApiModelProperty(value = "向左/向右")
|
||||
//// private boolean right;
|
||||
// /**开始时间*/
|
||||
// @ApiModelProperty(value = "开始时间")
|
||||
// @NotNull(message = "开始时间不能为空")
|
||||
// private LocalTime beginTime;
|
||||
// /**初始服务号*/
|
||||
// @ApiModelProperty(value = "表号")
|
||||
// @NotBlank
|
||||
// @Length(min = 1, max = 3)
|
||||
// private String initialServiceNumber;
|
||||
//}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
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.Min;
|
||||
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 = "表号")
|
||||
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;
|
||||
|
||||
/**发车间隔,s*/
|
||||
@ApiModelProperty(value = "发车间隔,s")
|
||||
private Integer departureInterval ;
|
||||
|
||||
/**折返时间*/
|
||||
@ApiModelProperty(value = "折返时间")
|
||||
private int reentryTime = 80;
|
||||
|
||||
/**运行等级默认-站间运行时间*/
|
||||
private int runLevel = 3;
|
||||
|
||||
public boolean hasOutbound(){
|
||||
return StringUtils.hasText(outboundRouting);
|
||||
}
|
||||
public boolean hasInbound(){
|
||||
return StringUtils.hasText(inboundRouting);
|
||||
}
|
||||
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package club.joylink.rtss.vo.runplan.newdraw.mainstack;
|
||||
|
||||
import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationStandNewVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DrawFuzhouRunPlan extends DrawRunPlan {
|
||||
|
||||
public DrawFuzhouRunPlan(int runLevel, MapVO mapVO) {
|
||||
super(runLevel,mapVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapStationNewVO> filterMainStackStations(List<MapStationNewVO> ascStationList) {
|
||||
return ascStationList.stream().filter((s)->{
|
||||
if(s.getName().equals("停车场")){
|
||||
return false;
|
||||
}
|
||||
if(s.getName().equals("车辆段")){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapStationStandNewVO> filterMainStackStands(List<MapStationStandNewVO> standList) {
|
||||
|
||||
// return standList.stream().filter((s) -> {
|
||||
//
|
||||
// if (s.getName().equals("psd1504")) { //太平桥
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }).collect(Collectors.toList());
|
||||
return standList;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripStartSectionCode(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isFirstTrip) {
|
||||
if (isFirstTrip) {
|
||||
runPlanTripVO.setStartSectionCode(isRight ? "T4" : "T305"); //TA0102:TA2125
|
||||
runPlanTripVO.setIsOutbound(true);
|
||||
} else {
|
||||
runPlanTripVO.setStartSectionCode(isRight ? "T10" : "T305"); //TA0108:TA2125
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripEndSectionInfo(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isLastTrip) {
|
||||
if (isLastTrip) {
|
||||
runPlanTripVO.setEndSectionCode(isRight ? "T299" : "T3");//TA2126:TA0101
|
||||
runPlanTripVO.setDestinationCode(isRight ? "218" : "011");//TA2126:TA0101
|
||||
} else {
|
||||
runPlanTripVO.setEndSectionCode(isRight ? "T305" : "T10");//TA2125:TA0108
|
||||
runPlanTripVO.setDestinationCode(isRight ? "219" : "012");//TA2125:TA0108
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripTimeSectionCode(MapStationNewVO stoppingStation, RunPlanTripTimeVO runPlanTripTime, boolean isFirstTrip, boolean isLastTrip) {
|
||||
// if (Objects.equals("哈东站", stoppingStation.getName())) {
|
||||
// runPlanTripTime.setSectionCode("T451");//G1805
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package club.joylink.rtss.vo.runplan.newdraw.mainstack;
|
||||
|
||||
import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationStandNewVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DrawHarbinRunPlan extends DrawRunPlan {
|
||||
|
||||
public DrawHarbinRunPlan(int runLevel, MapVO mapVO) {
|
||||
super(runLevel,mapVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapStationNewVO> filterMainStackStations(List<MapStationNewVO> ascStationList) {
|
||||
return ascStationList.stream().filter((s)->{
|
||||
if(s.getName().equals("太平桥车辆段")){
|
||||
return false;
|
||||
}
|
||||
if(s.getName().equals("哈南停车场")){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapStationStandNewVO> filterMainStackStands(List<MapStationStandNewVO> standList) {
|
||||
|
||||
return standList.stream().filter((s) -> {
|
||||
|
||||
if (s.getName().equals("psd1504")) { //太平桥
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripStartSectionCode(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isFirstTrip) {
|
||||
if (isFirstTrip) {
|
||||
runPlanTripVO.setStartSectionCode(isRight ? "T11" : "T451"); //G2115:G1805
|
||||
runPlanTripVO.setIsOutbound(true);
|
||||
} else {
|
||||
runPlanTripVO.setStartSectionCode(isRight ? "T16" : "T451"); //G2116:G1805
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripEndSectionInfo(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isLastTrip) {
|
||||
if (isLastTrip) {
|
||||
runPlanTripVO.setEndSectionCode(isRight ? "T451" : "T11");//G1805:G2115
|
||||
runPlanTripVO.setDestinationCode(isRight ? "181" : "213");//G1805:G2115
|
||||
} else {
|
||||
runPlanTripVO.setEndSectionCode(isRight ? "T451" : "T16");//G1805:G2116
|
||||
runPlanTripVO.setDestinationCode(isRight ? "181" : "214");//G1805:G2116
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTripTimeSectionCode(MapStationNewVO stoppingStation, RunPlanTripTimeVO runPlanTripTime, boolean isFirstTrip, boolean isLastTrip) {
|
||||
if (Objects.equals("哈东站", stoppingStation.getName())) {
|
||||
runPlanTripTime.setSectionCode("T451");//G1805
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,330 +0,0 @@
|
||||
package club.joylink.rtss.vo.runplan.newdraw.mainstack;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.map.RealLineConfigVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationStandNewVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.SectionParkingTimeVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class DrawRunPlan {
|
||||
|
||||
protected final Map<String, Integer> parkTime;
|
||||
protected final Map<String, Integer> runLevelTime;
|
||||
|
||||
protected DrawRunPlan(int runLevel, MapVO mapVO) {
|
||||
|
||||
//停站时间map:key-区段code/value-停站时间s
|
||||
parkTime = mapVO.getLogicDataNew().getParkingTimeList().stream().flatMap(parkingTimeVO -> parkingTimeVO.getParkingTimeVOList().stream()).collect(Collectors.toMap(SectionParkingTimeVO::getSectionCode, SectionParkingTimeVO::getParkingTime));
|
||||
//站间运行时间:key-起始区段-终点区段/value-时间
|
||||
runLevelTime = mapVO.getLogicDataNew().getRunLevelList().stream().collect(Collectors.toMap(runLevelVO -> String.format("%s-%s", runLevelVO.getStartSectionCode(), runLevelVO.getEndSectionCode()), runLevelVO -> runLevelVO.getLevelTime(runLevel)));
|
||||
}
|
||||
|
||||
public final List<RunPlanTripVO> generatorTrips(RunPlanInput runPlanInput, MapVO mapVO) {
|
||||
|
||||
//根据公里标升序的往返之间车站列表
|
||||
List<MapStationNewVO> runStationList = getMapStationNews(runPlanInput, mapVO);
|
||||
|
||||
List<RunPlanTripVO> tripList = new ArrayList<>(100);
|
||||
//是否同时相向发车
|
||||
boolean opposite = Objects.isNull(runPlanInput.getRight());
|
||||
if (opposite) {
|
||||
//相向发车
|
||||
int initialServiceNum = 1;
|
||||
/*分别先发一辆车,计算控制左右发车服务号*/
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
TempResult tempResultLeft = new TempResult(runPlanInput.getBeginTime(), null);
|
||||
serviceNumberDepart(runPlanInput, runStationList, initialServiceNum++, tripList, tempResultLeft, false, mapVO.getConfigVO());
|
||||
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
TempResult tempResultRight = new TempResult(runPlanInput.getBeginTime().minusSeconds(runPlanInput.getDepartureTimeInterval()), null);
|
||||
serviceNumberDepart(runPlanInput, runStationList, initialServiceNum++, tripList, tempResultRight, true, mapVO.getConfigVO());
|
||||
|
||||
LocalTime firstRoundTripTimeLeft = tempResultLeft.getFirstRoundTripTime();
|
||||
LocalTime firstRoundTripTimeRight = tempResultRight.getFirstRoundTripTime();
|
||||
tempResultRight.setFirstRoundTripTime(firstRoundTripTimeLeft);
|
||||
tempResultLeft.setFirstRoundTripTime(firstRoundTripTimeRight);
|
||||
//暂时先定义发完左行,再发右行..
|
||||
do {
|
||||
serviceNumberDepart(runPlanInput, runStationList, initialServiceNum++, tripList, tempResultLeft, false, mapVO.getConfigVO());
|
||||
} while (tempResultLeft.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResultLeft.getFirstRoundTripTime()) <= 0);
|
||||
//发完左行,再发右行
|
||||
do {
|
||||
serviceNumberDepart(runPlanInput, runStationList, initialServiceNum++, tripList, tempResultRight, true, mapVO.getConfigVO());
|
||||
} while (tempResultRight.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResultRight.getFirstRoundTripTime()) <= 0);
|
||||
|
||||
|
||||
} else {
|
||||
//单向发车
|
||||
allServiceNumberDepart(runPlanInput, runStationList, tripList, mapVO.getConfigVO());
|
||||
|
||||
}
|
||||
return tripList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单向发车
|
||||
*/
|
||||
private void allServiceNumberDepart(RunPlanInput runPlanInput, List<MapStationNewVO> runStationList, List<RunPlanTripVO> tripList, RealLineConfigVO lineConfigVO) {
|
||||
|
||||
|
||||
//设置初始服务号
|
||||
int initialServiceNum = 1;
|
||||
//上个服务号发车时刻
|
||||
//首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
TempResult tempResult = new TempResult(runPlanInput.getBeginTime(), null);
|
||||
do {
|
||||
serviceNumberDepart(runPlanInput, runStationList, initialServiceNum++, tripList, tempResult, runPlanInput.getRight(), lineConfigVO);
|
||||
} while (tempResult.getPreServiceDepartTime().minusSeconds(runPlanInput.getReentryTime()).plusSeconds(runPlanInput.getDepartureTimeInterval() * 2).compareTo(tempResult.getFirstRoundTripTime()) <= 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公里标升序的车站列表
|
||||
*/
|
||||
private List<MapStationNewVO> getMapStationNews(RunPlanInput runPlanInput, MapVO mapVO) {
|
||||
//根据公里标升序的车站列表
|
||||
//TODO ?? 存在车库或车辆段公里标大于的相邻车站与出库后的第一个目标车站不一致 的问题
|
||||
List<MapStationNewVO> ascStationList = mapVO.findSortedAllStationListNew();
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(ascStationList);
|
||||
// 获取站台
|
||||
List<MapStationStandNewVO> standList = mapVO.findAllStandListNew();
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(standList);
|
||||
|
||||
/*获取运行往返正线上的车站列表*/
|
||||
List<MapStationNewVO> mainStackStations = filterMainStackStations(ascStationList);
|
||||
for (MapStationNewVO station : mainStackStations) {
|
||||
for (MapStationStandNewVO stand : filterMainStackStands(standList)) {
|
||||
if (station.getCode().equals(stand.getStationCode())) {
|
||||
station.addStand(stand);
|
||||
}
|
||||
}
|
||||
}
|
||||
//先不考虑特殊发车
|
||||
String startStationCode = runPlanInput.getStartStationCode();//起始车站code
|
||||
String endStationCode = runPlanInput.getEndStationCode();//终点车站code
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
for (int i = 0, len = mainStackStations.size(); i < len; i++) {
|
||||
if (startIndex != -1 && endIndex != -1) {
|
||||
break;
|
||||
}
|
||||
if (startIndex == -1 && mainStackStations.get(i).getCode().equals(startStationCode)) {
|
||||
startIndex = i;
|
||||
}
|
||||
if (endIndex == -1 && mainStackStations.get(i).getCode().equals(endStationCode)) {
|
||||
endIndex = i;
|
||||
}
|
||||
}
|
||||
if (startIndex > endIndex) {
|
||||
return mainStackStations.subList(endIndex, startIndex + 1);
|
||||
}
|
||||
return mainStackStations.subList(startIndex, endIndex + 1);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
private class TempResult {
|
||||
private LocalTime preServiceDepartTime;
|
||||
private LocalTime firstRoundTripTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务号发车
|
||||
*
|
||||
* @param runPlanInput
|
||||
* @param runStationList
|
||||
* @param initialServiceNum
|
||||
* @param tripList
|
||||
* @param tempResult
|
||||
* @param isRight
|
||||
*/
|
||||
private void serviceNumberDepart(RunPlanInput runPlanInput, List<MapStationNewVO> runStationList, int initialServiceNum, List<RunPlanTripVO> tripList, TempResult tempResult, boolean isRight, RealLineConfigVO lineConfigVO) {
|
||||
String serviceNumber = String.format("%03d", initialServiceNum);
|
||||
int stationNum =runStationList.size();
|
||||
|
||||
//服务首班车次
|
||||
boolean isFirstTrip = true;
|
||||
//服务首班车次第一个计划到站
|
||||
boolean isFirstTripFirstStation = true;
|
||||
|
||||
//服务末班车次
|
||||
boolean isLastTrip = false;
|
||||
//首班右行
|
||||
// boolean isRight = Objects.nonNull(runPlanInput.getRightDepartureParam());
|
||||
//初始化车次号,右行偶数,左行奇数
|
||||
int initTripNumber = isRight ? 0 : 1;
|
||||
LocalTime lastTripEndTime = null;//一个车次终点时间
|
||||
List<RunPlanTripVO> tempTripList = new ArrayList<>();
|
||||
//根据运行时间判断结束末班车次
|
||||
do {
|
||||
//本车次首发车时间
|
||||
// LocalTime departTime = startTime;
|
||||
RunPlanTripVO runPlanTripVO = new RunPlanTripVO();
|
||||
runPlanTripVO.setServiceNumber(serviceNumber);
|
||||
runPlanTripVO.setRight(isRight);
|
||||
setDirectionCode(lineConfigVO.getUpRight(), runPlanTripVO);
|
||||
runPlanTripVO.setIsReentry(true);
|
||||
//车次号
|
||||
String tripNumber = String.format("%03d", initTripNumber++);
|
||||
runPlanTripVO.setTripNumber(tripNumber);
|
||||
setTripStartSectionCode(runPlanTripVO, isRight, isFirstTrip);
|
||||
//首班右行方向
|
||||
LinkedList<RunPlanTripTimeVO> tripTimeList = new LinkedList<>();//车次时刻表
|
||||
if (isRight) {
|
||||
for (int r = 1; r <= stationNum; r++) {
|
||||
MapStationNewVO stoppingStation = runStationList.get(r - 1);
|
||||
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
|
||||
runPlanTripTimeVO.setStationCode(stoppingStation.getCode());
|
||||
//TODO 需特别处理
|
||||
MapStationStandNewVO stand = stoppingStation.getStandList().stream().filter(s -> s.isRight()).findFirst().get();
|
||||
runPlanTripTimeVO.setSectionCode(stand.getStandTrackCode());
|
||||
setTripTimeSectionCode(stoppingStation,runPlanTripTimeVO, isFirstTrip, isLastTrip);
|
||||
//TODO 折返时间和站间运行时间恒定值 后续根据运行等级进行处理时间
|
||||
LocalTime arrivalTime = isFirstTripFirstStation ? initialServiceNum == 1 ? tempResult.getPreServiceDepartTime() : tempResult.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()) : r == 1 ? lastTripEndTime.plusSeconds(runPlanInput.getReentryTime()) : tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelTime.getOrDefault(tripTimeList.getLast().getSectionCode()+"-"+runPlanTripTimeVO.getSectionCode(),120));
|
||||
runPlanTripTimeVO.setArrivalTime(arrivalTime);
|
||||
LocalTime departureTime = arrivalTime.plusSeconds(parkTime.getOrDefault(runPlanTripTimeVO.getSectionCode(),30));
|
||||
runPlanTripTimeVO.setDepartureTime(departureTime);
|
||||
tripTimeList.add(runPlanTripTimeVO);
|
||||
|
||||
if (isFirstTripFirstStation) {
|
||||
// setTripStartSectionCode(runPlanTripVO, true);
|
||||
// runPlanTripVO.setIsOutbound(true);
|
||||
isFirstTripFirstStation = false;
|
||||
}
|
||||
if (r == stationNum) lastTripEndTime = departureTime;
|
||||
}
|
||||
} else {
|
||||
for (int l = stationNum; l > 0; l--) {
|
||||
MapStationNewVO stoppingStation = runStationList.get(l - 1);
|
||||
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
|
||||
runPlanTripTimeVO.setStationCode(stoppingStation.getCode());
|
||||
//TODO 需特别处理
|
||||
MapStationStandNewVO stand = stoppingStation.getStandList().stream().filter(s -> !s.isRight()).findFirst().get();
|
||||
runPlanTripTimeVO.setSectionCode(stand.getStandTrackCode());
|
||||
//TODO 折返时间和站间运行时间恒定值 后续根据运行等级进行处理时间
|
||||
LocalTime arrivalTime = isFirstTripFirstStation ? initialServiceNum == 1 ? tempResult.getPreServiceDepartTime() : tempResult.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()) : l == stationNum ? lastTripEndTime.plusSeconds(runPlanInput.getReentryTime()) : tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelTime.getOrDefault(tripTimeList.getLast().getSectionCode()+"-"+runPlanTripTimeVO.getSectionCode(),120));
|
||||
runPlanTripTimeVO.setArrivalTime(arrivalTime);
|
||||
LocalTime departureTime = arrivalTime.plusSeconds(parkTime.getOrDefault(runPlanTripTimeVO.getSectionCode(),30));
|
||||
runPlanTripTimeVO.setDepartureTime(departureTime);
|
||||
tripTimeList.add(runPlanTripTimeVO);
|
||||
|
||||
if (isFirstTripFirstStation) {
|
||||
// setTripStartSectionCode(runPlanTripVO, false);
|
||||
// runPlanTripVO.setIsOutbound(true);
|
||||
isFirstTripFirstStation = false;
|
||||
}
|
||||
if (l == 1) lastTripEndTime = departureTime;
|
||||
}
|
||||
}
|
||||
runPlanTripVO.setTimeList(tripTimeList);
|
||||
// //TODO 起始/结束区段未设置,需分别具体设置
|
||||
setTripEndSectionInfo(runPlanTripVO, isRight,false);
|
||||
setTripRunTime(runPlanTripVO, tripTimeList);
|
||||
|
||||
tempTripList.add(runPlanTripVO);
|
||||
if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
||||
|
||||
break;
|
||||
}
|
||||
//or 向前推后两小时后,最多跑到凌晨,跑过有可能运行时间过大需特殊处理偏移时间或死循环,停止发车。
|
||||
// if(lastTripEndTime.isBefore(LocalTime.of(2,0,0))){
|
||||
// break;
|
||||
// }
|
||||
isRight = !isRight;
|
||||
if (isFirstTrip) {
|
||||
isFirstTrip=false;
|
||||
}
|
||||
|
||||
} while (lastTripEndTime.isBefore(runPlanInput.getOverTime()));
|
||||
//设置服务号末班车次入库
|
||||
RunPlanTripVO lastrunPlanTrip = tempTripList.get(tempTripList.size() - 1);
|
||||
lastrunPlanTrip.setIsInbound(true);
|
||||
lastrunPlanTrip.setIsReentry(false);
|
||||
setTripEndSectionInfo(lastrunPlanTrip, lastrunPlanTrip.getRight(),true);
|
||||
LinkedList<RunPlanTripTimeVO> tripTimeList = (LinkedList<RunPlanTripTimeVO>) lastrunPlanTrip.getTimeList();
|
||||
setTripEndTime(lastrunPlanTrip, tripTimeList);
|
||||
tripList.addAll(tempTripList);
|
||||
if (Objects.isNull(tempResult.getFirstRoundTripTime())) {
|
||||
tempResult.setFirstRoundTripTime(Objects.isNull(runPlanInput.getRight()) ? ((RunPlanTripTimeVO) (((LinkedList) (tempTripList.get(0).getTimeList())).getLast())).getDepartureTime() : ((RunPlanTripTimeVO) (((LinkedList) (tempTripList.get(1).getTimeList())).getLast())).getDepartureTime());
|
||||
}
|
||||
tempResult.setPreServiceDepartTime(((RunPlanTripTimeVO) (((LinkedList) (tempTripList.get(0).getTimeList())).getFirst())).getArrivalTime());
|
||||
}
|
||||
|
||||
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 setTripRunTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList) {
|
||||
setTripStartTime(runPlanTripVO, tripTimeList);
|
||||
//车次 结束区段和最后一个到站区段相同,那么车次结束时间就是最后一个车站到站时间
|
||||
setTripEndTime(runPlanTripVO, tripTimeList);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
private void setDirectionCode(Boolean upRight, RunPlanTripVO runPlanTripVO) {
|
||||
if (runPlanTripVO.getRight()) {
|
||||
|
||||
if (upRight) {
|
||||
runPlanTripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
|
||||
} else {
|
||||
runPlanTripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
|
||||
}
|
||||
} else {
|
||||
if (upRight) {
|
||||
runPlanTripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
|
||||
} else {
|
||||
runPlanTripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 正线站
|
||||
*/
|
||||
abstract List<MapStationNewVO> filterMainStackStations(List<MapStationNewVO> ascStationList);
|
||||
|
||||
/**
|
||||
* 正线站台
|
||||
*/
|
||||
abstract List<MapStationStandNewVO> filterMainStackStands(List<MapStationStandNewVO> standList);
|
||||
|
||||
/**
|
||||
* 服务号 车次起始区段及出入库
|
||||
*/
|
||||
abstract void setTripStartSectionCode(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isFirstTrip);
|
||||
|
||||
/**
|
||||
* 服务号 车次结束区段和目的地
|
||||
*/
|
||||
abstract void setTripEndSectionInfo(RunPlanTripVO runPlanTripVO, boolean isRight, boolean isLastTrip);
|
||||
|
||||
/**车站停靠站台轨*/
|
||||
abstract void setTripTimeSectionCode(MapStationNewVO stoppingStation,RunPlanTripTimeVO runPlanTripTime, boolean isFirstTrip, boolean isLastTrip);
|
||||
}
|
228
src/main/resources/mybatis/mapper/RunPlanParktimeDAO.xml
Normal file
228
src/main/resources/mybatis/mapper/RunPlanParktimeDAO.xml
Normal 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>
|
421
src/main/resources/mybatis/mapper/RunPlanRoutingDAO.xml
Normal file
421
src/main/resources/mybatis/mapper/RunPlanRoutingDAO.xml
Normal 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>
|
355
src/main/resources/mybatis/mapper/RunPlanRunlevelDAO.xml
Normal file
355
src/main/resources/mybatis/mapper/RunPlanRunlevelDAO.xml
Normal 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>
|
244
src/main/resources/mybatis/mapper/RunPlanUserConfigDAO.xml
Normal file
244
src/main/resources/mybatis/mapper/RunPlanUserConfigDAO.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user