通过地图逻辑数据存储调度台数据

This commit is contained in:
xzb 2022-09-19 15:05:58 +08:00
parent 9c14994eec
commit 4015a5f2fd
15 changed files with 1123 additions and 63 deletions

View File

@ -0,0 +1,33 @@
/*
Navicat Premium Data Transfer
Source Server : room
Source Server Type : MySQL
Source Server Version : 80029
Source Host : 192.168.3.233:3306
Source Schema : joylink
Target Server Type : MySQL
Target Server Version : 80029
File Encoding : 65001
Date: 19/09/2022 14:54:30
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for draft_map_dis_station
-- ----------------------------
DROP TABLE IF EXISTS `draft_map_dis_station`;
CREATE TABLE `draft_map_dis_station` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '调度台逻辑数据记录id',
`map_id` bigint NULL DEFAULT NULL COMMENT '所属地图id',
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '调度台编码',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '调度台名称',
`station_list` varchar(600) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '调度台下辖车站的code列表array json',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -0,0 +1,42 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapDisStationService;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 草稿地图 调度台 接口
* <p>
* 接口中路径参数id mapId
*/
@RestController
@RequestMapping("/api/draftMap/{id}/disStation")
@Slf4j
public class DraftMapDisStationController {
@Autowired
private DraftMapDisStationService draftMapDisStationService;
/**
* 创建调度台逻辑数据
*/
@PostMapping
public void create(@RequestBody MapDisStationNewVO disStationNewVO){
this.draftMapDisStationService.create(disStationNewVO);
}
/**
* 更新调度台业务
*/
@PutMapping
public void update(@RequestBody MapDisStationNewVO vo){
this.draftMapDisStationService.update(vo);
}
/**
* 删除调度台业务
*/
@DeleteMapping("/{code}")
public void delete(@PathVariable("id") Long mapId,@PathVariable("code") String code){
this.draftMapDisStationService.delete(mapId,code);
}
}

View File

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

View File

@ -0,0 +1,38 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import lombok.Data;
/**
* @author
*
*/
@Data
public class DraftMapDisStation implements Serializable {
/**
* 调度台逻辑数据记录id
*/
private Long id;
/**
* 所属地图id
*/
private Long mapId;
/**
* 调度台编码
*/
private String code;
/**
* 调度台名称
*/
private String name;
/**
* 调度台下辖车站的code列表,array json
*/
private String stationList;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,552 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class DraftMapDisStationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DraftMapDisStationExample() {
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 andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andStationListIsNull() {
addCriterion("station_list is null");
return (Criteria) this;
}
public Criteria andStationListIsNotNull() {
addCriterion("station_list is not null");
return (Criteria) this;
}
public Criteria andStationListEqualTo(String value) {
addCriterion("station_list =", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListNotEqualTo(String value) {
addCriterion("station_list <>", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListGreaterThan(String value) {
addCriterion("station_list >", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListGreaterThanOrEqualTo(String value) {
addCriterion("station_list >=", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListLessThan(String value) {
addCriterion("station_list <", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListLessThanOrEqualTo(String value) {
addCriterion("station_list <=", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListLike(String value) {
addCriterion("station_list like", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListNotLike(String value) {
addCriterion("station_list not like", value, "stationList");
return (Criteria) this;
}
public Criteria andStationListIn(List<String> values) {
addCriterion("station_list in", values, "stationList");
return (Criteria) this;
}
public Criteria andStationListNotIn(List<String> values) {
addCriterion("station_list not in", values, "stationList");
return (Criteria) this;
}
public Criteria andStationListBetween(String value1, String value2) {
addCriterion("station_list between", value1, value2, "stationList");
return (Criteria) this;
}
public Criteria andStationListNotBetween(String value1, String value2) {
addCriterion("station_list not between", value1, value2, "stationList");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -4,10 +4,7 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.draftData.DraftMapOverrunService;
import club.joylink.rtss.services.draftData.DraftMapRouteService;
import club.joylink.rtss.services.draftData.IDraftMapStationDirectionService;
import club.joylink.rtss.services.draftData.RailwayRouteGenerator;
import club.joylink.rtss.services.draftData.*;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
@ -101,6 +98,9 @@ public class DraftMapService implements IDraftMapService {
@Autowired
private IDraftMapStationDirectionService draftMapStationDirectionLabelService;
@Autowired
private DraftMapDisStationService draftMapDisStationService;
@Override
public List<DraftMapVO> list(AccountVO accountVO) {
DraftMapExample example = new DraftMapExample();
@ -444,7 +444,9 @@ public class DraftMapService implements IDraftMapService {
private MapLogicDataNewVO getMapLogicDataNew(Long id) {
MapLogicDataNewVO logicDataVO = new MapLogicDataNewVO();
// 调度台逻辑数据
List<MapDisStationNewVO> disStationNewList = draftMapDisStationService.getAll(id);
logicDataVO.setDisStationList(disStationNewList);
// 进路
DraftMapRouteExample routeExample = new DraftMapRouteExample();
routeExample.createCriteria().andMapIdEqualTo(id);
@ -520,6 +522,13 @@ public class DraftMapService implements IDraftMapService {
if (Objects.isNull(logicDataVO)) {
return;
}
//调度台
if (!CollectionUtils.isEmpty(logicDataVO.getDisStationList())){
logicDataVO.getDisStationList().forEach(mapDisStationVo->{
mapDisStationVo.setMapId(id);
draftMapDisStationService.store(mapDisStationVo);
});
}
if (!CollectionUtils.isEmpty(logicDataVO.getRouteList())) {
logicDataVO.getRouteList().forEach(mapRouteVO -> {
mapRouteVO.setMapId(id);

View File

@ -0,0 +1,118 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapDisStationDAO;
import club.joylink.rtss.entity.DraftMapDisStation;
import club.joylink.rtss.entity.DraftMapDisStationExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@Service
public class DraftMapDisStationService {
@Autowired
private DraftMapDisStationDAO draftMapDisStationDAO;
/**
* 新建调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void create(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(find), String.format("草稿[mapId=%s code=%s]调度台逻辑数据已经存在",vo.getMapId(),vo.getCode()));
DraftMapDisStation entity = convert(vo);
draftMapDisStationDAO.insertSelective(entity);
}
/**
* 存储
*/
@Transactional(rollbackFor = Exception.class)
public void store(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
if(CollectionUtils.isEmpty(find)){
DraftMapDisStation entity = convert(vo);
this.draftMapDisStationDAO.insert(entity);
}else{
DraftMapDisStation entity = convert(vo);
entity.setId(find.get(0).getId());
this.draftMapDisStationDAO.updateByPrimaryKey(entity);
}
}
/**
* 更新调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void update(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && find.size()==1, String.format("草稿[mapId=%s code=%s]调度台逻辑数据不存在或不唯一",vo.getMapId(),vo.getCode()));
DraftMapDisStation entity = convert(vo);
entity.setId(find.get(0).getId());
//
this.draftMapDisStationDAO.updateByPrimaryKeySelective(entity);
}
/**
* 删除调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void delete(Long mapId,String code){
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId).andCodeEqualTo(code);
this.draftMapDisStationDAO.deleteByExample(example);
}
@Transactional(readOnly = true)
public MapDisStationNewVO getByMapIdAndCode(Long mapId, String code){
List<DraftMapDisStation> list = this.findByMapIdAndCode(mapId,code);
if(!CollectionUtils.isEmpty(list)){
DraftMapDisStation entity = list.get(0);
return convert(entity);
}
return null;
}
@Transactional(readOnly = true)
public List<MapDisStationNewVO> getAll(Long mapId){
List<MapDisStationNewVO> list = new ArrayList<>();
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId);
List<DraftMapDisStation> find = draftMapDisStationDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(find)){
find.forEach(entity->{
list.add(convert(entity));
});
}
return list;
}
@Transactional(readOnly = true)
private List<DraftMapDisStation> findByMapIdAndCode(Long mapId, String code){
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId).andCodeEqualTo(code);
return draftMapDisStationDAO.selectByExample(example);
}
//////////////////////////////////////////////////////////////////////
public static MapDisStationNewVO convert(DraftMapDisStation from){
MapDisStationNewVO vo = new MapDisStationNewVO();
vo.setId(from.getId());
vo.setCode(from.getCode());
vo.setMapId(from.getMapId());
vo.setStationList(JsonUtils.readCollection(from.getStationList(),ArrayList.class,String.class));
vo.setName(from.getName());
return vo;
}
public static DraftMapDisStation convert(MapDisStationNewVO from){
DraftMapDisStation entity = new DraftMapDisStation();
if(null!=from.getId()){
entity.setId(from.getId());
}
entity.setMapId(from.getMapId());
entity.setCode(from.getCode());
entity.setName(from.getName());
entity.setStationList(JsonUtils.writeValueAsString(from.getStationList()));
return entity;
}
}

View File

@ -8,7 +8,10 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption;
import club.joylink.rtss.simulation.cbtc.data.vr.*;
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
import club.joylink.rtss.vo.map.MapLogicDataNewVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.*;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -26,7 +29,8 @@ public class MapDeviceBuilder {
/**
* 校验并构建设备数据
*/
static void checkAndBuildMapDeviceData(MapGraphDataNewVO graphData, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) {
static void checkAndBuildMapDeviceData(MapVO mapVo, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) {
final MapGraphDataNewVO graphData = mapVo.getGraphDataNew();
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
Map<String, VirtualRealityDevice> deviceMap = mapDataBuildResult.getVrDeviceMap();
List<String> errMsgList = mapDataBuildResult.getErrMsgList();
@ -38,7 +42,7 @@ public class MapDeviceBuilder {
// 车站
MapDeviceBuilder.buildStation(graphData, elementMap, deviceMap, errMsgList);
// 调度台
MapDeviceBuilder.buildDisStation(graphData,elementMap,errMsgList);
MapDeviceBuilder.buildDisStation(mapVo.getLogicDataNew().getDisStationList(),elementMap,errMsgList);
// 区段
List<MapSectionNewVO> sectionList = graphData.getSectionList();
MapDeviceBuilder.buildSections(elementMap, deviceMap, errMsgList, sectionList);
@ -739,10 +743,9 @@ public class MapDeviceBuilder {
/**
* 构建调度台
*/
private static List<MapDisStationNewVO> buildDisStation(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList){
List<MapDisStationNewVO> disStationList = graphData.getDisStationList();
private static List<MapDisStationNewVO> buildDisStation(List<MapDisStationNewVO> disStationList, Map<String, MapElement> elementMap, List<String> errMsgList){
disStationList.forEach(disStationVo->{
DisStation disStation = new DisStation(disStationVo.getCode(),disStationVo.getName(), MapElement.DeviceType.DIS_STATION);
DisStation disStation = new DisStation(disStationVo.getCode(),disStationVo.getName());
if (Objects.nonNull(elementMap.get(disStationVo.getCode()))) {
errMsgList.add(String.format("编码为[%s]的调度台不唯一", disStationVo.getCode()));
}

View File

@ -537,7 +537,7 @@ public class SimulationBuilder {
*/
public static SimulationDeviceBuildResult checkAndBuildBasicMapData(MapVO map) {
SimulationDeviceBuildResult mapDataBuildResult = new SimulationDeviceBuildResult();
MapDeviceBuilder.checkAndBuildMapDeviceData(map.getGraphDataNew(), mapDataBuildResult);
MapDeviceBuilder.checkAndBuildMapDeviceData(map, mapDataBuildResult);
return mapDataBuildResult;
}
@ -549,7 +549,7 @@ public class SimulationBuilder {
*/
public static SimulationDeviceBuildResult checkAndBuildMapData(MapVO map) {
SimulationDeviceBuildResult mapDataBuildResult = new SimulationDeviceBuildResult();
MapDeviceBuilder.checkAndBuildMapDeviceData(map.getGraphDataNew(), mapDataBuildResult);
MapDeviceBuilder.checkAndBuildMapDeviceData(map, mapDataBuildResult);
if (CollectionUtils.isEmpty(mapDataBuildResult.getErrMsgList())) { // 基础数据没有问题再构建逻辑数据
// InterlockBuilder.checkAndBuildMapCILogicData(map.getLogicDataNew(), mapDataBuildResult);
InterlockBuilder2.checkAndBuildMapCILogicData(map, mapDataBuildResult);
@ -563,7 +563,7 @@ public class SimulationBuilder {
public static SimulationDeviceBuildResult checkAndBuildMapDeviceData(MapVO map) {
SimulationDeviceBuildResult mapDataBuildResult = new SimulationDeviceBuildResult();
MapDeviceBuilder.checkAndBuildMapDeviceData(map.getGraphDataNew(), mapDataBuildResult);
MapDeviceBuilder.checkAndBuildMapDeviceData(map, mapDataBuildResult);
return mapDataBuildResult;
}

View File

@ -2,20 +2,20 @@ package club.joylink.rtss.simulation.cbtc.data.map;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
* 调度台
*/
@Getter
@Setter
public class DisStation extends MayOutOfOrderDevice{
public DisStation(String code, String name, DeviceType deviceType) {
super(code, name, deviceType);
}
/**
* 调度台下辖车站
*/
public class DisStation extends MapNamedElement{
private List<Station> stationList = new ArrayList<>();
public DisStation(String code,String name){
super(code,name, DeviceType.DIS_STATION);
}
@Override
public void reset() {
}
}

View File

@ -1,11 +1,10 @@
package club.joylink.rtss.vo.map;
import club.joylink.rtss.entity.Ibp;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.ibp.IbpVO;
import club.joylink.rtss.vo.map.display.DisplayVO;
import club.joylink.rtss.vo.map.display.PictureVO;
import club.joylink.rtss.vo.map.graph.*;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
@ -79,12 +78,6 @@ public class MapGraphDataNewVO {
@Valid
private List<MapSignalNewVO> signalList;
/**
*调度台列表
*/
@Valid
private List<MapDisStationNewVO> disStationList;
/**
*车站列表
*/
@ -267,7 +260,6 @@ public class MapGraphDataNewVO {
this.arrowList = new ArrayList<>();
this.directionRodList = new ArrayList<>();
this.responderList = new ArrayList<>();
this.disStationList = new ArrayList<>();
}
public static MapGraphDataNewVO parse(String graphData) {

View File

@ -2,11 +2,13 @@ package club.joylink.rtss.vo.map;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import club.joylink.rtss.vo.map.logic.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -15,7 +17,11 @@ import java.util.List;
@Getter
@Setter
public class MapLogicDataNewVO {
/**
* 调度台列表
*/
@Valid
private List<MapDisStationNewVO> disStationList;
/**
* 进路数据列表
*/
@ -89,6 +95,7 @@ public class MapLogicDataNewVO {
overrunList = new ArrayList<>();
autoReentryList = new ArrayList<>();
draftMapStationDirectionList = new ArrayList<>();
disStationList = new ArrayList<>();
}
@JsonIgnore

View File

@ -1,30 +0,0 @@
package club.joylink.rtss.vo.map.graph;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 调度台
*/
@Getter
@Setter
public class MapDisStationNewVO {
/**
* 编码
*/
@NotBlank(message="编码不能为空")
private String code;
/**
* 名称
*/
@NotBlank(message="名称不能为空")
private String name;
/**
* 下辖车站
*/
@NotBlank(message="下辖车站编码不能为空")
private List<String> stationList;
}

View File

@ -0,0 +1,43 @@
package club.joylink.rtss.vo.map.logic;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* 调度台
*/
@Getter
@Setter
public class MapDisStationNewVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 所属地图ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@NotNull(message = "地图id不能为空")
private Long mapId;
/**
* 调度台编码
*/
@NotBlank(message="编码不能为空")
private String code;
/**
* 调度台名称
*/
@NotBlank(message="名称不能为空")
private String name;
/**
* 调度台下辖车站
*/
@NotBlank(message="下辖车站编码不能为空")
private List<String> stationList = new ArrayList<>();
}

View File

@ -0,0 +1,219 @@
<?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.DraftMapDisStationDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DraftMapDisStation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="station_list" jdbcType="VARCHAR" property="stationList" />
</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, code, `name`, station_list
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DraftMapDisStationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from draft_map_dis_station
<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 draft_map_dis_station
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from draft_map_dis_station
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DraftMapDisStationExample">
delete from draft_map_dis_station
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.DraftMapDisStation">
insert into draft_map_dis_station (id, map_id, code,
`name`, station_list)
values (#{id,jdbcType=BIGINT}, #{mapId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{stationList,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.DraftMapDisStation">
insert into draft_map_dis_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="mapId != null">
map_id,
</if>
<if test="code != null">
code,
</if>
<if test="name != null">
`name`,
</if>
<if test="stationList != null">
station_list,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="stationList != null">
#{stationList,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DraftMapDisStationExample" resultType="java.lang.Long">
select count(*) from draft_map_dis_station
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update draft_map_dis_station
<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.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.stationList != null">
station_list = #{record.stationList,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update draft_map_dis_station
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
station_list = #{record.stationList,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DraftMapDisStation">
update draft_map_dis_station
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="stationList != null">
station_list = #{stationList,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DraftMapDisStation">
update draft_map_dis_station
set map_id = #{mapId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
station_list = #{stationList,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>