【列车运行方向逻辑重构】

This commit is contained in:
weizhihong 2022-04-27 17:08:19 +08:00
parent 5b6f5ab8df
commit ad19c56331
37 changed files with 1202 additions and 1016 deletions

View File

@ -1,37 +0,0 @@
package club.joylink.rtss.constants;
/**
* 按钮类型枚举
*/
public enum ButtonTypeEnum {
// 总辅助
MAIN_ASSIST,
// 接辅助
RECEIVE_ASSIST,
// 发辅助
DELIVER_ASSIST,
// 改方
CHANGE_DIRECTION,
NO;
/**
* 获取枚举信息
*
* @param type 类型
* @return 枚举
*/
public static ButtonTypeEnum getType(String type) {
switch (type) {
case "main_assist":
return ButtonTypeEnum.MAIN_ASSIST;
case "deliver_assist":
return ButtonTypeEnum.DELIVER_ASSIST;
case "receive_assist":
return ButtonTypeEnum.RECEIVE_ASSIST;
case "change_direction":
return ButtonTypeEnum.CHANGE_DIRECTION;
default:
return ButtonTypeEnum.NO;
}
}
}

View File

@ -9,5 +9,25 @@ public enum DirectionLabelEnum {
XD, XD,
S, S,
SF, SF,
SD SD,
NO;
public static DirectionLabelEnum getLabel(String label) {
switch (label) {
case "X":
return DirectionLabelEnum.X;
case "XF":
return DirectionLabelEnum.XF;
case "XD":
return DirectionLabelEnum.XD;
case "S":
return DirectionLabelEnum.S;
case "SF":
return DirectionLabelEnum.SF;
case "SD":
return DirectionLabelEnum.SD;
default:
return DirectionLabelEnum.NO;
}
}
} }

View File

@ -1,32 +0,0 @@
package club.joylink.rtss.constants;
/**
* 信号灯类型
*/
public enum IndicatorTypeEnum {
//
RECEIVE,
//
DELIVER,
// 区间
SECTION,
// 辅助
ASSIST,
// 无类型
NO;
public static IndicatorTypeEnum getType(String type) {
switch (type) {
case "receive":
return IndicatorTypeEnum.RECEIVE;
case "deliver":
return IndicatorTypeEnum.DELIVER;
case "section":
return IndicatorTypeEnum.SECTION;
case "assist":
return IndicatorTypeEnum.ASSIST;
default:
return IndicatorTypeEnum.NO;
}
}
}

View File

@ -1,69 +0,0 @@
package club.joylink.rtss.controller;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.services.IAssistButtonIndicatorService;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 地图草稿数据管理接口
*/
@RestController
@RequestMapping("/api/assist")
@Slf4j
public class AssistController {
@Autowired
private IAssistButtonIndicatorService assistButtonIndicatorService;
/**
* 查询地图下所有的指示灯区间进路等关系列表
*
* @param mapId 地图ID
* @param standCode 站台
* @param indicatorCode 指示灯ID
* @param routeCode 进路编码
* @return 关系列表
*/
@GetMapping(path = "/indicator/section/list/{mapId}")
public PageVO<IndicatorButton> indicatorSectionList(@PathVariable Long mapId, String standCode, String indicatorCode
, String routeCode, PageQueryVO queryVO) {
return assistButtonIndicatorService.indicatorSectionList(mapId, standCode, indicatorCode, routeCode, queryVO);
}
/**
* 根据ID查询单个指示灯区间进路等关系
*
* @param id 关系Id
* @return 关系实体
*/
@GetMapping(path = "/indicator/section/{id}")
public IndicatorButton queryIndicatorSection(@PathVariable Long id) {
return assistButtonIndicatorService.queryIndicatorSection(id);
}
/**
* 保存关联关系信息
*
* @param mapId 地图信息
* @param vo 关联关系
* @return 处理结果
*/
@PostMapping(path = "/indicator/section/save/{mapId}")
public String saveIndicatorSection(@PathVariable Long mapId, @RequestBody IndicatorButton vo) {
return assistButtonIndicatorService.saveIndicatorSection(mapId, vo);
}
/**
* 删除指示灯与区段关联关系
*
* @param id 主键
* @param user 用户
*/
@DeleteMapping(path = "/indicator/section/delete/{id}")
public void deleteIndicatorSection(@PathVariable Long id) {
assistButtonIndicatorService.deleteIndicatorSection(id);
}
}

View File

@ -0,0 +1,67 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.services.draftData.IDraftMapStationDirectionService;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 车站
*/
@RestController
@RequestMapping("/api/station/direction")
@Slf4j
public class DraftMapStationDirectionController {
@Autowired
private IDraftMapStationDirectionService draftMapStationDirectionLabelService;
/**
* 查询地图下车站 方向的逻辑数据列表
*
* @param mapId 地图ID
* @param code Code
* @param labelEnum 方向类型
* @return 数据列表
*/
@GetMapping(path = "/list/{mapId}")
public PageVO<DraftMapStationDirection> stationLabelList(@PathVariable Long mapId, String code
, String labelEnum, PageQueryVO queryVO) {
return draftMapStationDirectionLabelService.stationLabelList(mapId, code, labelEnum, queryVO);
}
/**
* 根据ID查询地图下车站 方向的逻辑数据
*
* @param id 关系Id
* @return 关系实体
*/
@GetMapping(path = "/{id}")
public DraftMapStationDirection queryStationLabel(@PathVariable Long id) {
return draftMapStationDirectionLabelService.queryStationLabel(id);
}
/**
* 保存关联关系信息
*
* @param mapId 地图信息
* @param vo 关联关系
* @return 处理结果
*/
@PostMapping(path = "/save/{mapId}")
public String saveStationLabel(@PathVariable Long mapId, @RequestBody DraftMapStationDirection vo) {
return draftMapStationDirectionLabelService.saveStationLabel(mapId, vo);
}
/**
* 删除车站 方向的逻辑数据
*
* @param id 主键
*/
@DeleteMapping(path = "/delete/{id}")
public void deleteStationLabel(@PathVariable Long id) {
draftMapStationDirectionLabelService.deleteStationLabel(id);
}
}

View File

@ -1,13 +0,0 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.entity.IndicatorButtonExample;
import org.springframework.stereotype.Repository;
/**
* AssistButtonDAO继承基类
*/
@Repository
public interface AssistIndicatorButtonDAO extends MyBatisBaseDao<IndicatorButton, Long, IndicatorButtonExample> {
}

View File

@ -0,0 +1,23 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.entity.DraftMapStationDirectionExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* AssistButtonDAO继承基类
*/
@Repository
public interface DraftMapStationDirectionDAO extends MyBatisBaseDao<DraftMapStationDirection, Long, DraftMapStationDirectionExample> {
/**
* 多数据保存
*
* @param record
* @return
*/
int insertList(@Param("list") List<DraftMapStationDirection> records);
}

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.entity; package club.joylink.rtss.entity;
import club.joylink.rtss.constants.DirectionLabelEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter; import lombok.Getter;
@ -16,7 +17,7 @@ import java.util.List;
*/ */
@Setter @Setter
@Getter @Getter
public class IndicatorButton { public class DraftMapStationDirection {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
@ -27,11 +28,16 @@ public class IndicatorButton {
private Long mapId; private Long mapId;
/** /**
* 指示灯 * 生成的编码
*/ */
@NotBlank(message = "编号不能为空")
private String code; private String code;
/**
* 车站
*/
@NotBlank(message = "车站编号不能为空")
private String stationCode;
/** /**
* 区间列表 * 区间列表
*/ */
@ -43,24 +49,14 @@ public class IndicatorButton {
private String sectionsCode; private String sectionsCode;
/** /**
* 所处站台 * 方向枚举
*/ */
private String standCode; private DirectionLabelEnum labelEnum;
/** /**
* 进路Code * 信号机Code
*/ */
private String routeCode; private String signalCode;
/**
* 关联实体类型
*/
private String modelType;
/**
* 灯类型
*/
private String type;
public void generateSectionList() { public void generateSectionList() {
if (StringUtils.isEmpty(sectionsCode)) { if (StringUtils.isEmpty(sectionsCode)) {

View File

@ -3,7 +3,7 @@ package club.joylink.rtss.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class IndicatorButtonExample { public class DraftMapStationDirectionExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
@ -14,7 +14,7 @@ public class IndicatorButtonExample {
private Long offset; private Long offset;
public IndicatorButtonExample() { public DraftMapStationDirectionExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -254,7 +254,7 @@ public class IndicatorButtonExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIndicatorCodeEqualTo(String value) { public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code"); addCriterion("code =", value, "code");
return (Criteria) this; return (Criteria) this;
} }
@ -279,84 +279,78 @@ public class IndicatorButtonExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeIsNull() { public Criteria andStationCodeIsNull() {
addCriterion("stand_code is null"); addCriterion("station_code is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeIsNotNull() { public Criteria andStationCodeIsNotNull() {
addCriterion("stand_code is not null"); addCriterion("station_code is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeEqualTo(String value) { public Criteria andStationCodeEqualTo(String value) {
addCriterion("stand_code =", value, "standCode"); addCriterion("station_code =", value, "stationCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeNotEqualTo(String value) { public Criteria andStationCodeLike(String value) {
addCriterion("stand_code <>", value, "standCode"); addCriterion("station_code like", value, "stationCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeLike(String value) { public Criteria andStationCodeNotLike(String value) {
addCriterion("stand_code like", value, "standCode"); addCriterion("station_code not like", value, "stationCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeNotLike(String value) { public Criteria andStationCodeIn(List<String> values) {
addCriterion("stand_code not like", value, "standCode"); addCriterion("station_code in", values, "stationCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeIn(List<String> values) { public Criteria andStationCodeNotIn(List<String> values) {
addCriterion("stand_code in", values, "standCode"); addCriterion("station_code not in", values, "stationCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStandCodeNotIn(List<String> values) { public Criteria andLabelEnumIsNull() {
addCriterion("stand_code not in", values, "standCode"); addCriterion("label_enum is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLabelEnumIsNotNull() {
public Criteria andRouteCodeIsNull() { addCriterion("label_enum is not null");
addCriterion("route_code is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeIsNotNull() { public Criteria andLabelEnumEqualTo(String value) {
addCriterion("route_code is not null"); addCriterion("label_enum =", value, "labelEnum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeEqualTo(String value) { public Criteria andLabelEnumNotEqualTo(String value) {
addCriterion("route_code =", value, "routeCode"); addCriterion("label_enum <>", value, "labelEnum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeNotEqualTo(String value) { public Criteria andLabelEnumLike(String value) {
addCriterion("route_code <>", value, "routeCode"); addCriterion("label_enum like", value, "labelEnum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeLike(String value) { public Criteria andLabelEnumNotLike(String value) {
addCriterion("route_code like", value, "routeCode"); addCriterion("label_enum not like", value, "labelEnum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeNotLike(String value) { public Criteria andLabelEnumIn(List<String> values) {
addCriterion("route_code not like", value, "routeCode"); addCriterion("label_enum in", values, "labelEnum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRouteCodeIn(List<String> values) { public Criteria andLabelEnumNotIn(List<String> values) {
addCriterion("route_code in", values, "routeCode"); addCriterion("label_enum not in", values, "labelEnum");
return (Criteria) this;
}
public Criteria andRouteCodeNotIn(List<String> values) {
addCriterion("route_code not in", values, "routeCode");
return (Criteria) this; return (Criteria) this;
} }
} }

View File

@ -1,80 +0,0 @@
package club.joylink.rtss.services;
import club.joylink.rtss.dao.AssistIndicatorButtonDAO;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.entity.IndicatorButtonExample;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class AssistButtonIndicatorService implements IAssistButtonIndicatorService {
@Autowired
private AssistIndicatorButtonDAO assistIndicatorButtonDAO;
@Override
public PageVO<IndicatorButton> indicatorSectionList(Long mapId, String standCode, String indicatorCode
, String routeCode, PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
IndicatorButtonExample indicatorButtonExample = new IndicatorButtonExample();
IndicatorButtonExample.Criteria criteria = indicatorButtonExample.createCriteria();
criteria.andMapIdEqualTo(mapId);
// 站台
if (!StringUtils.isEmpty(standCode)) {
criteria.andStandCodeEqualTo(standCode);
}
// 指示灯
if (!StringUtils.isEmpty(indicatorCode)) {
criteria.andIndicatorCodeEqualTo(indicatorCode);
}
// 进路
if (!StringUtils.isEmpty(routeCode)) {
criteria.andRouteCodeEqualTo(routeCode);
}
Page<IndicatorButton> page = (Page<IndicatorButton>) assistIndicatorButtonDAO.selectByExample(indicatorButtonExample);
page.getResult().forEach(IndicatorButton::generateSectionList);
return PageVO.convert(page, page.getResult());
}
@Override
public IndicatorButton queryIndicatorSection(Long id) {
return assistIndicatorButtonDAO.selectByPrimaryKey(id);
}
@Override
public String saveIndicatorSection(Long mapId, IndicatorButton vo) {
vo.setMapId(mapId);
if (!CollectionUtils.isEmpty(vo.getSectionList())) {
vo.setSectionsCode(String.join(",", vo.getSectionList()));
}
int line;
if (vo.getId() != null) {
line = assistIndicatorButtonDAO.updateByPrimaryKey(vo);
} else {
line = assistIndicatorButtonDAO.insert(vo);
}
return line != 0 ? "保存成功" : "保存失败";
}
@Override
public void deleteIndicatorSection(Long id) {
assistIndicatorButtonDAO.deleteByPrimaryKey(id);
}
@Override
public List<IndicatorButton> queryAllIndicatorSectionByMapId(Long mapId) {
IndicatorButtonExample indicatorButtonExample = new IndicatorButtonExample();
IndicatorButtonExample.Criteria criteria = indicatorButtonExample.createCriteria();
criteria.andMapIdEqualTo(mapId);
List<IndicatorButton> list = assistIndicatorButtonDAO.selectByExample(indicatorButtonExample);
list.forEach(IndicatorButton::generateSectionList);
return list;
}
}

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.draftData.DraftMapOverrunService; import club.joylink.rtss.services.draftData.DraftMapOverrunService;
import club.joylink.rtss.services.draftData.DraftMapRouteService; 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.RailwayRouteGenerator;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.CalculateService;
@ -98,7 +99,10 @@ public class DraftMapService implements IDraftMapService {
private DraftMapRouteService draftMapRouteService; private DraftMapRouteService draftMapRouteService;
@Autowired @Autowired
private IAssistButtonIndicatorService assistButtonIndicatorService; private IDraftMapStationDirectionService draftMapStationDirectionLabelService;
@Autowired
private DraftMapStationDirectionDAO draftMapStationDirectionDAO;
@Override @Override
public List<DraftMapVO> list(AccountVO accountVO) { public List<DraftMapVO> list(AccountVO accountVO) {
@ -510,7 +514,7 @@ public class DraftMapService implements IDraftMapService {
logicDataVO.setFlankProtectionList(MapRouteFlankProtectionNewVO.convert2VOList(draftMapRouteFlankProtections)); logicDataVO.setFlankProtectionList(MapRouteFlankProtectionNewVO.convert2VOList(draftMapRouteFlankProtections));
// 获取指示灯按钮等关联关系 // 获取指示灯按钮等关联关系
logicDataVO.setIndicatorButtonVOList(assistButtonIndicatorService.queryAllIndicatorSectionByMapId(id)); logicDataVO.setDraftMapStationDirectionList(draftMapStationDirectionLabelService.queryAllStationLabelByMapId(id));
return logicDataVO; return logicDataVO;
} }
@ -593,6 +597,11 @@ public class DraftMapService implements IDraftMapService {
this.draftMapRouteFlankProtectionDAO.insert(entity); this.draftMapRouteFlankProtectionDAO.insert(entity);
}); });
} }
// 车站 方向的逻辑数据数据
if (!CollectionUtils.isEmpty(logicDataVO.getDraftMapStationDirectionList())) {
draftMapStationDirectionDAO.insertList(logicDataVO.getDraftMapStationDirectionList());
}
} }
private void deleteMapLogicData(Long id) { private void deleteMapLogicData(Long id) {

View File

@ -1,56 +0,0 @@
package club.joylink.rtss.services;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import java.util.List;
public interface IAssistButtonIndicatorService {
/**
* 查找该地图下的指示灯区间站台进路关系信息列表
*
* @param mapId 地图ID
* @param standCode 站台
* @param indicatorCode 指示灯ID
* @param routeCode 进路编码
* @return 关系列表
*/
PageVO<IndicatorButton> indicatorSectionList(Long mapId, String standCode, String indicatorCode, String routeCode, PageQueryVO queryVO);
/**
* 查找该地图下的指示灯区间站台进路关系信息
*
* @param id 关系ID
* @return 关系信息
*/
IndicatorButton queryIndicatorSection(Long id);
/**
* 保存指示灯关系数据
*
* @param mapId 地图ID
* @param vo 实体类
* @return 保存结果
*/
String saveIndicatorSection(Long mapId, IndicatorButton vo);
/**
* 删除指示灯关系数据
*
* @param id 关系ID
*/
void deleteIndicatorSection(Long id);
/**
* 查找该地图下的指示灯区间站台进路关系信息列表
*
* @param mapId 地图Id
* @return 关系列表
*/
List<IndicatorButton> queryAllIndicatorSectionByMapId(Long mapId);
}

View File

@ -0,0 +1,78 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapStationDirectionDAO;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.entity.DraftMapStationDirectionExample;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class DraftMapStationDirectionServiceImpl implements IDraftMapStationDirectionService {
@Autowired
private DraftMapStationDirectionDAO draftMapStationDirectionDAO;
@Override
public PageVO<DraftMapStationDirection> stationLabelList(Long mapId, String code
, String labelEnum, PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapStationDirectionExample draftMapStationDirectionExample = new DraftMapStationDirectionExample();
DraftMapStationDirectionExample.Criteria criteria = draftMapStationDirectionExample.createCriteria();
criteria.andMapIdEqualTo(mapId);
// code
if (!StringUtils.isEmpty(code)) {
criteria.andCodeEqualTo(code);
}
// 指示灯
if (!StringUtils.isEmpty(labelEnum)) {
criteria.andLabelEnumEqualTo(labelEnum);
}
Page<DraftMapStationDirection> page = (Page<DraftMapStationDirection>) draftMapStationDirectionDAO.selectByExample(draftMapStationDirectionExample);
page.getResult().forEach(DraftMapStationDirection::generateSectionList);
return PageVO.convert(page, page.getResult());
}
@Override
public DraftMapStationDirection queryStationLabel(Long id) {
return draftMapStationDirectionDAO.selectByPrimaryKey(id);
}
@Override
public String saveStationLabel(Long mapId, DraftMapStationDirection vo) {
vo.setMapId(mapId);
if (!CollectionUtils.isEmpty(vo.getSectionList())) {
vo.setSectionsCode(String.join(",", vo.getSectionList()));
}
int line;
if (vo.getId() != null) {
line = draftMapStationDirectionDAO.updateByPrimaryKey(vo);
} else {
// 手动拼接Code
vo.setCode(vo.getStationCode() + "_" + vo.getLabelEnum());
line = draftMapStationDirectionDAO.insert(vo);
}
return line != 0 ? "保存成功" : "保存失败";
}
@Override
public void deleteStationLabel(Long id) {
draftMapStationDirectionDAO.deleteByPrimaryKey(id);
}
@Override
public List<DraftMapStationDirection> queryAllStationLabelByMapId(Long mapId) {
DraftMapStationDirectionExample draftMapStationDirectionExample = new DraftMapStationDirectionExample();
DraftMapStationDirectionExample.Criteria criteria = draftMapStationDirectionExample.createCriteria();
criteria.andMapIdEqualTo(mapId);
List<DraftMapStationDirection> list = draftMapStationDirectionDAO.selectByExample(draftMapStationDirectionExample);
list.forEach(DraftMapStationDirection::generateSectionList);
return list;
}
}

View File

@ -0,0 +1,54 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import java.util.List;
public interface IDraftMapStationDirectionService {
/**
* 查询地图下车站 方向下的逻辑数据列表
*
* @param mapId 地图ID
* @param code Code
* @param labelEnum 方向类型
* @return 数据列表
*/
PageVO<DraftMapStationDirection> stationLabelList(Long mapId, String code, String labelEnum, PageQueryVO queryVO);
/**
* 查找该地图下的指示灯区间站台进路关系信息
*
* @param id 关系ID
* @return 关系信息
*/
DraftMapStationDirection queryStationLabel(Long id);
/**
* 保存指示灯关系数据
*
* @param mapId 地图ID
* @param vo 实体类
* @return 保存结果
*/
String saveStationLabel(Long mapId, DraftMapStationDirection vo);
/**
* 删除指示灯关系数据
*
* @param id 关系ID
*/
void deleteStationLabel(Long id);
/**
* 查找该地图下的指示灯区间站台进路关系信息列表
*
* @param mapId 地图Id
* @return 关系列表
*/
List<DraftMapStationDirection> queryAllStationLabelByMapId(Long mapId);
}

View File

@ -195,11 +195,9 @@ public class ATSMessageCollectAndDispatcher {
case CATENARY: case CATENARY:
status = new CatenaryStatus((Catenary) device); status = new CatenaryStatus((Catenary) device);
break; break;
case INDICATOR:
status = new IndicatorStatus((Indicator) device); case STATION_DIRECTION:
break; status = new StationDirectionStatus((StationDirection) device);
case BUTTON:
status = new ButtonStatus((Button) device);
break; break;
} }
return status; return status;
@ -246,11 +244,8 @@ public class ATSMessageCollectAndDispatcher {
status = new CatenaryStatusVO((Catenary) device); status = new CatenaryStatusVO((Catenary) device);
break; break;
case INDICATOR: case STATION_DIRECTION:
status = new IndicatorStatusVO((Indicator) device); status = new StationDirectionStatusVO((StationDirection) device);
break;
case BUTTON:
status = new ButtonStatusVO((Button) device);
break; break;
} }
return status; return status;

View File

@ -1,21 +1,21 @@
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler; package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
import club.joylink.rtss.constants.ButtonTypeEnum;
import club.joylink.rtss.constants.DirectionLabelEnum; import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
import club.joylink.rtss.simulation.cbtc.ATS.service.assist.AssistService; import club.joylink.rtss.simulation.cbtc.ATS.service.assist.StationDirectionService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Button;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@Slf4j @Slf4j
@OperateHandler @OperateHandler
public class AssistOperateHandler { public class StationDirectionOperateHandler {
@Autowired @Autowired
private AssistService assistService; private StationDirectionService stationDirectionService;
/** /**
* 改方按钮按下操作 * 改方按钮按下操作
@ -26,9 +26,8 @@ public class AssistOperateHandler {
*/ */
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION) @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION)
public void pressDownTurnDirection(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) { public void pressDownTurnDirection(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) {
assistService.changeButtonAspect(simulation, stationDirectionService.changeButtonAspect(simulation,
stationCode, labelEnum, ButtonTypeEnum.CHANGE_DIRECTION, Boolean.TRUE stationCode, labelEnum, Button.ButtonTypeEnum.CHANGE_DIRECTION, Boolean.TRUE
, assistService.turnDirectionPressDownValid , stationDirectionService.turnDirectionPressDownValid, null);
, assistService.turnDirectionPressDownDo);
} }
} }

View File

@ -1,297 +0,0 @@
package club.joylink.rtss.simulation.cbtc.ATS.service.assist;
import club.joylink.rtss.constants.ButtonTypeEnum;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.constants.IndicatorTypeEnum;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.simulation.cbtc.CI.device.CiRouteService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Button;
import club.joylink.rtss.simulation.cbtc.data.map.Indicator;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
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 club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Optional;
/**
* 工具箱操作service
*/
@Component
@Slf4j
public class AssistService {
@Autowired
private ATPService atpService;
@Autowired
private CiRouteService routeService;
/**
* 修改按钮状态信息
*
* @param simulation 仿真数据
* @param stationCode 车站编码
* @param label 按钮类型
* @param type 类型
* @param pressDown true按下false抬起
* @param validMethod 操作检验
* @param buttonDoMethod 操作后触发动作
*/
public void changeButtonAspect(Simulation simulation, String stationCode,
DirectionLabelEnum label, ButtonTypeEnum type, boolean pressDown,
ButtonValidInterface validMethod, ButtonThenInterface buttonDoMethod) {
Station curStation = getStationByCode(simulation, stationCode);
Button curButton = getStationButtonByType(curStation, label, type);
// 检验操作
if (validMethod != null) {
validMethod.valid(simulation, curButton);
}
// 修改状态
curButton.setPressDown(pressDown);
// 后续动作
if (buttonDoMethod != null) {
buttonDoMethod.doThen(simulation, curButton);
}
}
/**
* 刷新区间灯状态
*/
public void refreshSectionLightStatus(Simulation simulation, IndicatorButton indicatorButton) {
Indicator indicator = simulation.getRepository().getByCode(indicatorButton.getCode(), Indicator.class);
if (indicator == null || CollectionUtils.isEmpty(indicator.getSectionList())) {
return;
}
// 是否被占用,TRUE 未占用,FALSE 占用
boolean isNotOccupied = indicator.getSectionList()
.stream()
.filter(section -> section.isOccupied()).findAny().isEmpty();
// 占用为红色
IndicatorStatusEnum statusEnum = isNotOccupied ? IndicatorStatusEnum.No : IndicatorStatusEnum.R;
// 占用点亮时灭掉改方按钮
if (IndicatorStatusEnum.R.equals(statusEnum)) {
indicator.getStation().getButtonsList()
.stream()
.filter(button -> indicator.getLabel().equals(button.getLabel()) && ButtonTypeEnum.CHANGE_DIRECTION.equals(button.getType()))
.forEach(button -> button.setPressDown(false));
}
indicator.setAspect(statusEnum);
}
/**
* 各方向接发车电灯状态刷新
*
* @param curStation 当前站
* @param labelEnum 方向标签
*/
public void refreshReceiveAndDeliverLightStatus(Station curStation, DirectionLabelEnum labelEnum) {
// 获取接车指示灯
Indicator receiveIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.RECEIVE);
// 获取发车指示灯
Indicator deliverIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.DELIVER);
// 如果都没有亮
if (deliverIndicator != null && receiveIndicator != null && !deliverIndicator.isOn() && !receiveIndicator.isOn()) {
// XS方向为接车方向默认亮起
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
receiveIndicator.setOn(true);
} else { // 其他方向默认发车灯亮起
deliverIndicator.setOn(true);
}
}
IndicatorStatusEnum receiveStatus = getRDIndicatorStatusEnum(receiveIndicator, deliverIndicator);
IndicatorStatusEnum deliverStatus = getRDIndicatorStatusEnum(deliverIndicator, receiveIndicator);
if (receiveIndicator != null) {
receiveIndicator.setAspect(receiveStatus);
}
if (deliverIndicator != null) {
deliverIndicator.setAspect(deliverStatus);
}
}
/**
* 改方按钮按下校验
*/
public ButtonValidInterface turnDirectionPressDownValid = (simulation, button) -> {
if (button == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
}
if (button.getStand() == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮未绑定站台");
}
// 由数据控制不做逻辑判断
// List<Station> stationList = simulation.getRepository().getStationList();
// // 当前站位置
// int index = stationList.indexOf(button.getStation());
// // 检查是否是首站
// if (index == 0 || index == stationList.size() - 1) {
// throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方");
// }
// 获取区间指示灯
Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION);
// 获取区间路径,判断本站台与相邻站台是否空闲
if (sectionIndicator != null && IndicatorStatusEnum.R.equals(sectionIndicator.getAspect())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲");
}
// 判断接车灯进路是否办理
Indicator receiveIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.RECEIVE);
if (receiveIndicator != null && receiveIndicator.getRoute() != null && receiveIndicator.getRoute().isLock()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:进路冲突");
}
// 获取靠停列车
VirtualRealityTrain train = getSandStopTrain(simulation, button.getStand().getSection().getCode());
if (train == null || !train.isStop()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:未停靠列车");
}
// 判断本站台是否是接车站台,这里不做判断在改方实际操作时判断列车
// boolean isReceive = button.getStand().isRight() == train.isRight();
// if (!isReceive) {
// throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:非接车方向");
// }
};
/**
* 改方按钮后续操作
*/
public ButtonThenInterface turnDirectionPressDownDo = (simulation, button) -> {
if (button == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
}
// 相邻站台是否也为接车状态如果是要做辅助操作目前不做
// 获取靠停列车
VirtualRealityTrain train = getSandStopTrain(simulation, button.getStand().getSection().getCode());
if (train == null || !train.isStop()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:未停靠列车");
}
// 判断列车是否要执行换端
if (button.getStand().isRight() == train.isRight()) {
// 列车换端
atpService.turnDirectionImmediately(train);
}
// 获取发车指示灯
Indicator deliverIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.DELIVER);
// 办进路
routeService.setRoute(simulation, deliverIndicator.getRoute());
};
/**
* 获取当前车站实体
*
* @param simulation 仿真实体数据
* @param stationCode 车站编码
* @return 车站实体
*/
private Station getStationByCode(Simulation simulation, String stationCode) {
Optional<Station> stationOptional = simulation.getRepository().getStationList()
.stream()
.filter(station -> stationCode.equals(station.getCode()))
.findFirst();
// 当前所在车站
Station station;
if (stationOptional.isPresent()) {
station = stationOptional.get();
} else {
throw new SimulationException(SimulationExceptionType.System_Fault, "操作异常:车站不存在");
}
return station;
}
/**
* 获取当前按钮实体
*
* @param station 车站编码
* @param label 按钮类型
* @param type 类型
* @return 操作按钮实体
*/
private Button getStationButtonByType(Station station, DirectionLabelEnum label, ButtonTypeEnum type) {
Optional<Button> buttonOptional = station.getButtonsList()
.stream()
.filter(button -> label.equals(button.getLabel()) && type.equals(button.getType()))
.findAny();
// 获取操作按钮
Button button;
if (buttonOptional.isPresent()) {
button = buttonOptional.get();
} else {
button = null;
}
return button;
}
/**
* 获取当前指示灯实体
*
* @param station 车站编码
* @param label 按钮类型
* @param type 类型
* @return 指示灯
*/
private Indicator getStationIndicatorByType(Station station, DirectionLabelEnum label, IndicatorTypeEnum type) {
Optional<Indicator> indicatorOptional = station.getIndicatorList()
.stream()
.filter(indicator -> label.equals(indicator.getLabel()) && type.equals(indicator.getType()))
.findAny();
// 获取操作按钮
Indicator indicator;
if (indicatorOptional.isPresent()) {
indicator = indicatorOptional.get();
} else {
indicator = null;
}
return indicator;
}
/**
* 获取停靠列车
*
* @param simulation 仿真对象
* @param sectionCode 区段编码
* @return 列车数据
*/
private VirtualRealityTrain getSandStopTrain(Simulation simulation, String sectionCode) {
Optional<VirtualRealityTrain> trainOptional = simulation.getRepository().getOnlineTrainList()
.stream()
.filter(trainInfo -> trainInfo != null && sectionCode.equals(trainInfo.getHeadPosition().getSection().getCode()))
.findAny();
VirtualRealityTrain train;
if (trainOptional.isPresent()) {
train = trainOptional.get();
} else {
train = null;
}
return train;
}
/**
* 获取接发车指示灯状态
*
* @param indicator 指示灯
* @param mutexIndicator 同组指示灯-
* @return 点灯状态
*/
private IndicatorStatusEnum getRDIndicatorStatusEnum(Indicator indicator, Indicator mutexIndicator) {
if (indicator == null) {
return IndicatorStatusEnum.No;
}
boolean isLock = indicator.getRoute() != null && indicator.getRoute().isLock();
if (isLock) {
indicator.setOn(true);
if (mutexIndicator != null) {
mutexIndicator.setOn(false);
}
}
IndicatorStatusEnum statusEnum = indicator.isOn() ?
(isLock ? IndicatorStatusEnum.R : indicator.getDefaultStatus())
: IndicatorStatusEnum.No;
return statusEnum;
}
}

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.simulation.cbtc.ATS.service.assist; package club.joylink.rtss.simulation.cbtc.ATS.service.assist;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Button; import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
/** /**
* 按钮操作后续操作 * 按钮操作后续操作
@ -11,8 +11,8 @@ public interface ButtonThenInterface {
/** /**
* 按钮状态改变的后续操作 * 按钮状态改变的后续操作
* *
* @param simulation 仿真实体 * @param simulation 仿真实体
* @param curButton 按钮实体 * @param stationDirection 按钮实体
*/ */
void doThen(Simulation simulation, Button curButton); void doThen(Simulation simulation, StationDirection stationDirection);
} }

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.simulation.cbtc.ATS.service.assist; package club.joylink.rtss.simulation.cbtc.ATS.service.assist;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Button; import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
/** /**
* 检验按钮是否可以操作 * 检验按钮是否可以操作
@ -11,8 +11,8 @@ public interface ButtonValidInterface {
/** /**
* 验证按钮是否可以操作 * 验证按钮是否可以操作
* *
* @param simulation 仿真数据 * @param simulation 仿真数据
* @param curButton 当前按钮 * @param stationDirection 关联数据
*/ */
void valid(Simulation simulation, Button curButton); void valid(Simulation simulation, StationDirection stationDirection);
} }

View File

@ -0,0 +1,133 @@
package club.joylink.rtss.simulation.cbtc.ATS.service.assist;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*;
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.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 车站行驶方向
*/
@Component
@Slf4j
public class StationDirectionService {
/**
* 修改按钮状态信息
*
* @param simulation 仿真数据
* @param stationCode 车站编码
* @param label 按钮类型
* @param type 类型
* @param pressDown true按下false抬起
* @param validMethod 操作检验
* @param buttonDoMethod 操作后触发动作
*/
public void changeButtonAspect(Simulation simulation, String stationCode, DirectionLabelEnum label, Button.ButtonTypeEnum type,
boolean pressDown, ButtonValidInterface validMethod, ButtonThenInterface buttonDoMethod) {
Station curStation = getStationByCode(simulation, stationCode);
StationDirection stationDirection = curStation.getStationDirectionMap().get(label);
// 检验操作
if (validMethod != null) {
validMethod.valid(simulation, stationDirection);
}
// 修改状态
stationDirection.modifyButtonStatus(type, pressDown);
// 后续动作
if (buttonDoMethod != null) {
buttonDoMethod.doThen(simulation, stationDirection);
}
}
/**
* 刷新区间灯状态
*/
public void refreshSectionLightStatus(Simulation simulation, DraftMapStationDirection draftMapStationDirection) {
Station station = getStationByCode(simulation, draftMapStationDirection.getStationCode());
StationDirection stationDirection = station.getStationDirectionMap().get(draftMapStationDirection.getLabelEnum());
if (stationDirection == null) {
return;
}
// 刷新接发车状态
stationDirection.refreshReceiveAndDeliverStatus();
// 刷新接发车点灯状态
stationDirection.refreshAspectStatus();
// 刷新区段占用状态
stationDirection.refreshSectionStatus();
}
/**
* 改方按钮按下校验
*/
public ButtonValidInterface turnDirectionPressDownValid = (simulation, stationLabelEnum) -> {
boolean isExist = stationLabelEnum.getButtonList()
.stream()
.anyMatch(button -> Button.ButtonTypeEnum.CHANGE_DIRECTION.equals(button.getType()));
if (!isExist) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
}
// 区间是否空闲
if (IndicatorStatusEnum.R.equals(stationLabelEnum.getSectionAspect())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲");
}
// 接车进路有锁闭有车进入
boolean isReceiveConflict = stationLabelEnum.getReceiveRouteList().stream().anyMatch(Route::isLock);
if (isReceiveConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在接车进路冲突");
}
// 查找发车进路方向的站台上是否有停靠列车
Optional<Route> routeOptional = stationLabelEnum.getReceiveRouteList().stream().findAny();
if (routeOptional.isEmpty()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:没有接车进路");
}
Route route = routeOptional.get();
List<Stand> standList;
if (route.isRight()) {
standList = stationLabelEnum.getStation().getRdStandList();
} else {
standList = stationLabelEnum.getStation().getLdStandList();
}
// 获取靠停列车
List<String> sectionCodeList = simulation.getRepository().getOnlineTrainList()
.stream()
.filter(VirtualRealityTrain::isStop)
.map(trainInfo -> trainInfo.getHeadPosition().getSection().getCode())
.collect(Collectors.toList());
boolean isStopTrain = standList.stream().anyMatch(stand -> sectionCodeList.contains(stand.getSection().getCode()));
if (!isStopTrain) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:未停靠列车");
}
};
/**
* 获取当前车站实体
*
* @param simulation 仿真实体数据
* @param stationCode 车站编码
* @return 车站实体
*/
private Station getStationByCode(Simulation simulation, String stationCode) {
Optional<Station> stationOptional = simulation.getRepository().getStationList()
.stream()
.filter(station -> stationCode.equals(station.getCode()))
.findFirst();
// 当前所在车站
Station station;
if (stationOptional.isPresent()) {
station = stationOptional.get();
} else {
throw new SimulationException(SimulationExceptionType.System_Fault, "操作异常:车站不存在");
}
return station;
}
}

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.simulation.cbtc.CI; package club.joylink.rtss.simulation.cbtc.CI;
import club.joylink.rtss.constants.DirectionLabelEnum; import club.joylink.rtss.simulation.cbtc.ATS.service.assist.StationDirectionService;
import club.joylink.rtss.simulation.cbtc.ATS.service.assist.AssistService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiDeviceStatusCollector; import club.joylink.rtss.simulation.cbtc.CI.device.CiDeviceStatusCollector;
import club.joylink.rtss.simulation.cbtc.CI.device.CiRouteService; import club.joylink.rtss.simulation.cbtc.CI.device.CiRouteService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiService; import club.joylink.rtss.simulation.cbtc.CI.device.CiService;
@ -14,10 +13,8 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
@Slf4j @Slf4j
@Component @Component
@ -31,7 +28,7 @@ public class CiLogic {
@Autowired @Autowired
private CiService ciService; private CiService ciService;
@Autowired @Autowired
private AssistService assistService; private StationDirectionService stationDirectionService;
public void run(Simulation simulation) { public void run(Simulation simulation) {
// 采集真实设备状态 // 采集真实设备状态
@ -53,20 +50,24 @@ public class CiLogic {
// 区间灯点灯逻辑 // 区间灯点灯逻辑
if (simulation.getRepository().getConfig().isHasCTC()) { if (simulation.getRepository().getConfig().isHasCTC()) {
// 区间灯点灯 // 联锁数据检查
simulation.getBuildParams().getMap().getLogicDataNew().getIndicatorButtonVOList() simulation.getBuildParams().getMap().getLogicDataNew().getDraftMapStationDirectionList()
.stream() .stream()
.filter(indicatorButton -> "indicator".equals(indicatorButton.getModelType()) && "section".equals(indicatorButton.getType())) .forEach(stationDirectionLabel -> stationDirectionService.refreshSectionLightStatus(simulation, stationDirectionLabel));
.forEach(indicatorSectionVO -> assistService.refreshSectionLightStatus(simulation, indicatorSectionVO)); // // 区间灯点灯
// simulation.getBuildParams().getMap().getLogicDataNew().getDraftMapStationDirectionLabelVOList()
// 接发车点灯 // .stream()
simulation.getRepository().getStationList() // .filter(indicatorButton -> "indicator".equals(indicatorButton.getModelType()) && "section".equals(indicatorButton.getType()))
.stream() // .forEach(indicatorSectionVO -> assistService.refreshSectionLightStatus(simulation, indicatorSectionVO));
.filter(station -> !CollectionUtils.isEmpty(station.getIndicatorList())) //
.forEach(station -> { // // 接发车点灯
Stream.of(DirectionLabelEnum.values()) // simulation.getRepository().getStationList()
.forEach(label -> assistService.refreshReceiveAndDeliverLightStatus(station, label)); // .stream()
}); // .filter(station -> !CollectionUtils.isEmpty(station.getIndicatorList()))
// .forEach(station -> {
// Stream.of(DirectionLabelEnum.values())
// .forEach(label -> assistService.refreshReceiveAndDeliverLightStatus(station, label));
// });
} }
} }

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.simulation.cbtc; package club.joylink.rtss.simulation.cbtc;
import club.joylink.rtss.entity.Ibp; import club.joylink.rtss.entity.Ibp;
import club.joylink.rtss.services.IAssistButtonIndicatorService;
import club.joylink.rtss.services.IVirtualRealityIbpService; import club.joylink.rtss.services.IVirtualRealityIbpService;
import club.joylink.rtss.services.IVoiceCommandService; import club.joylink.rtss.services.IVoiceCommandService;
import club.joylink.rtss.services.draftData.IDraftMapStationDirectionService;
import club.joylink.rtss.services.iscs.IscsDeviceService; import club.joylink.rtss.services.iscs.IscsDeviceService;
import club.joylink.rtss.services.iscs.IscsSystemResourcesService; import club.joylink.rtss.services.iscs.IscsSystemResourcesService;
import club.joylink.rtss.services.psl.IVirtualRealityPslService; import club.joylink.rtss.services.psl.IVirtualRealityPslService;
@ -133,7 +133,7 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic
private CTCLogicLoop ctcLogicLoop; private CTCLogicLoop ctcLogicLoop;
@Autowired @Autowired
private IAssistButtonIndicatorService assistButtonIndicatorService; private IDraftMapStationDirectionService assistButtonIndicatorService;
@Override @Override
public Simulation create(SimulationBuildParams params, String group) { public Simulation create(SimulationBuildParams params, String group) {

View File

@ -1,8 +1,6 @@
package club.joylink.rtss.simulation.cbtc.build; package club.joylink.rtss.simulation.cbtc.build;
import club.joylink.rtss.constants.ButtonTypeEnum; import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.constants.IndicatorTypeEnum;
import club.joylink.rtss.entity.IndicatorButton;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.draftData.RoutingGenerator; import club.joylink.rtss.services.draftData.RoutingGenerator;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
@ -245,7 +243,7 @@ public class InterlockBuilder2 {
// ------------目的地码end------------- // ------------目的地码end-------------
// 处理指示灯按钮逻辑信息 // 处理指示灯按钮逻辑信息
InterlockBuilder2.buildAssistIndicatorAndButtonLogic(elementMap, errMsgList, logicData.getIndicatorButtonVOList()); InterlockBuilder2.buildStationDirectionLabelLogic(elementMap, errMsgList, logicData.getDraftMapStationDirectionList());
// 根据站间运行等级数据构建路径单元 // 根据站间运行等级数据构建路径单元
// if (!errMsgList.isEmpty()) { // if (!errMsgList.isEmpty()) {
@ -1551,83 +1549,72 @@ public class InterlockBuilder2 {
InterlockBuilder2.log.debug("构建自动折返进路耗时:" + (System.currentTimeMillis() - start)); InterlockBuilder2.log.debug("构建自动折返进路耗时:" + (System.currentTimeMillis() - start));
} }
/** /**
* 构建指示灯按钮的逻辑信息 * 构建车站 方向联锁数据
* *
* @param elementMap 设备信息 * @param errMsgList 错误信息
* @param errMsgList 错误信息 * @param stationDirectionList 逻辑关联关系
* @param indicatorButtonVOList 逻辑关联关系 * @param elementMap 设备信息
*/ */
private static void buildAssistIndicatorAndButtonLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<IndicatorButton> indicatorButtonVOList) { private static void buildStationDirectionLabelLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<DraftMapStationDirection> stationDirectionList) {
if (!CollectionUtils.isEmpty(indicatorButtonVOList)) { if (!CollectionUtils.isEmpty(stationDirectionList)) {
indicatorButtonVOList.stream().forEach(indicatorButton -> { List<Route> routeList = elementMap.values().stream()
if ("indicator".equals(indicatorButton.getModelType())) { .filter(element -> MapElement.DeviceType.ROUTE.equals(element.getDeviceType()))
InterlockBuilder2.buildAssistIndicatorLogic(elementMap, elementMap.get(indicatorButton.getCode()), indicatorButton); .map(element -> (Route) element)
.collect(Collectors.toList());
// 首端信号机
Map<String, List<String>> startMap =
routeList.stream().collect(
Collectors.groupingBy((route) -> route.getStart().getCode(),
Collectors.mapping(route -> route.getCode(), Collectors.toList())));
// 末端信号机
Map<String, List<String>> endMap =
routeList.stream().collect(
Collectors.groupingBy((route) -> route.getDestination().getCode(),
Collectors.mapping(route -> route.getCode(), Collectors.toList())));
// 循环设置信息
stationDirectionList.stream().forEach(stationDirection -> {
if (elementMap.containsKey(stationDirection.getCode())) {
errMsgList.add("已经存在车站运行方向" + stationDirection.getCode());
} else { } else {
InterlockBuilder2.buildAssistButtonLogic(elementMap, elementMap.get(indicatorButton.getCode()), indicatorButton); StationDirection model = new StationDirection(stationDirection.getCode(), stationDirection.getCode(), stationDirection.getLabelEnum());
} Station station = (Station) elementMap.get(stationDirection.getStationCode());
model.setStation(station);
// 注入区间数据
if (!CollectionUtils.isEmpty(stationDirection.getSectionList())) {
List<Section> sectionList = stationDirection.getSectionList()
.stream()
.map(sectionCode -> (Section) elementMap.get(sectionCode))
.collect(Collectors.toList());
model.setSectionList(sectionList);
}
// 注入信号灯数据
if (!StringUtils.isEmpty(stationDirection.getSignalCode())) {
Signal signal = (Signal) elementMap.get(stationDirection.getSignalCode());
model.setSignal(signal);
// 以方向信号机为首的进路,接车进路
startMap.getOrDefault(signal.getCode(), new ArrayList<>(0)).forEach(code -> {
model.getReceiveRouteList().add((Route) elementMap.get(code));
});
// 以方向信号机为尾的进路发车进路
endMap.getOrDefault(signal.getCode(), new ArrayList<>(0)).forEach(code -> {
model.getDeliverRouteList().add((Route) elementMap.get(code));
});
}
// 放入按钮数据
station.getButtonList().stream()
.filter(button -> model.getLabelEnum().equals(button.getLabel()))
.forEach(button -> model.getButtonList().add(button));
// 放入指示灯数据
station.getIndicatorList().stream()
.filter(indicator -> model.getLabelEnum().equals(indicator.getLabel()))
.forEach(indicator -> model.getIndicatorList().add(indicator));
station.getStationDirectionMap().put(model.getLabelEnum(), model);
elementMap.put(model.getCode(), model);
}
}); });
} }
} }
/**
* 构建指示灯的逻辑信息
*
* @param elementMap 设备信息
* @param element 实体
* @param indicatorButton 逻辑关联关系
*/
private static void buildAssistIndicatorLogic(Map<String, MapElement> elementMap, MapElement element, IndicatorButton indicatorButton) {
if (element == null) {
return;
}
// 获取指示灯
Indicator indicator = (Indicator) element;
// 有关联的区间信息
if (!CollectionUtils.isEmpty(indicatorButton.getSectionList())) {
List<Section> sectionList = indicatorButton.getSectionList()
.stream()
.map(sectionCode -> (Section) elementMap.get(sectionCode))
.collect(Collectors.toList());
indicator.setSectionList(sectionList);
}
// 获取站台信息
if (!StringUtils.isEmpty(indicatorButton.getStandCode())) {
Stand stand = (Stand) elementMap.get(indicatorButton.getStandCode());
indicator.setStand(stand);
}
// 获取进路信息
if (!StringUtils.isEmpty(indicatorButton.getRouteCode())) {
Route route = (Route) elementMap.get(indicatorButton.getRouteCode());
indicator.setRoute(route);
}
// 指示灯类型
indicator.setType(IndicatorTypeEnum.getType(indicatorButton.getType()));
indicator.reset();
}
/**
* 构建按钮的逻辑信息
*
* @param elementMap 设备信息
* @param element 实体
* @param indicatorButton 逻辑关联关系
*/
private static void buildAssistButtonLogic(Map<String, MapElement> elementMap, MapElement element, IndicatorButton indicatorButton) {
// 获取指示灯
if (element == null) {
return;
}
Button button = (Button) element;
// 获取站台信息
if (!StringUtils.isEmpty(indicatorButton.getStandCode())) {
Stand stand = (Stand) elementMap.get(indicatorButton.getStandCode());
button.setStand(stand);
}
// 指示灯类型
button.setType(ButtonTypeEnum.getType(indicatorButton.getType()));
button.reset();
}
} }

View File

@ -701,10 +701,9 @@ public class MapDeviceBuilder {
} }
// 构建接区间辅助指示灯 // 构建接区间辅助指示灯
MapDeviceBuilder.buildAssistIndicator(elementMap, errMsgList, graphData.getIndicatorLightList()); MapDeviceBuilder.buildIndicatorList(elementMap, errMsgList, graphData.getIndicatorLightList());
// 构建辅助改方按钮 // 构建辅助改方按钮
MapDeviceBuilder.buildAssistButton(elementMap, errMsgList, graphData.getSignalButtonList()); MapDeviceBuilder.buildButtonList(elementMap, errMsgList, graphData.getSignalButtonList());
} }
private static List<MapStationStandNewVO> buildStand(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) { private static List<MapStationStandNewVO> buildStand(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) {
@ -1511,29 +1510,29 @@ public class MapDeviceBuilder {
* 构建指示灯 * 构建指示灯
* *
* @param elementMap 资源map * @param elementMap 资源map
* @param errMsgList 错误提示
* @param indicatorList 指示灯信息 * @param indicatorList 指示灯信息
*/ */
private static void buildAssistIndicator(Map<String, MapElement> elementMap private static void buildIndicatorList(Map<String, MapElement> elementMap, List<String> errMsgList
, List<String> errMsgList, List<MapIndicatorLightVO> indicatorList) { , List<MapIndicatorLightVO> indicatorList) {
// 区间占用\辅助状态\总辅助\发车辅助\接车辅助\发车箭头\复原\事故\闭塞 // 区间占用\辅助状态\总辅助\发车辅助\接车辅助\\发车箭头\复原\事故\闭塞
List<String> indicatorTypeList = Arrays.asList( List<String> indicatorTypeList = Arrays.asList(
"SectionOccupied", "AssistStatus", "TotalAssist", "DepartAssist", "PickAssist", "PickOrDepartArrow", "SectionOccupied", "AssistStatus", "TotalAssist", "DepartAssist", "PickAssist",
"Recovery", "Accident", "Occlusion" "PickArrow", "DepartArrow", "Recovery", "Accident", "Occlusion"
); );
indicatorList indicatorList
.stream() .stream()
.filter(mapIndicatorLightVO -> indicatorTypeList.contains(mapIndicatorLightVO.getType())) .filter(mapIndicatorLightVO -> indicatorTypeList.contains(mapIndicatorLightVO.getType()))
.forEach(mapSignalButtonVO -> { .forEach(mapSignalButtonVO -> {
if (elementMap.containsKey(mapSignalButtonVO.getCode())) { if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
errMsgList.add(String.format("指示灯[%s]必须唯一", mapSignalButtonVO.getCode())); errMsgList.add("已存在指示灯 " + mapSignalButtonVO.getStationCode());
} else { } else {
Indicator indicator = new Indicator(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName()); Indicator indicator = new Indicator(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName());
indicator.setLabel(mapSignalButtonVO.getLabelEnum()); indicator.setLabel(mapSignalButtonVO.getLabelEnum());
indicator.setTypeStr(mapSignalButtonVO.getType());
Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode()); Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode());
indicator.setStation(station); indicator.setStation(station);
station.getIndicatorList().add(indicator); station.getIndicatorList().add(indicator);
elementMap.put(indicator.getCode(), indicator); elementMap.put(mapSignalButtonVO.getCode(), indicator);
} }
}); });
} }
@ -1542,11 +1541,11 @@ public class MapDeviceBuilder {
* 构建按钮设备 * 构建按钮设备
* *
* @param elementMap 设备Map * @param elementMap 设备Map
* @param errMsgList 错误列表 * @param errMsgList 错误日志
* @param signalButtonList 按钮列表 * @param signalButtonList 按钮列表
*/ */
private static void buildAssistButton(Map<String, MapElement> elementMap private static void buildButtonList(Map<String, MapElement> elementMap, List<String> errMsgList
, List<String> errMsgList, List<MapSignalButtonVO> signalButtonList) { , List<MapSignalButtonVO> signalButtonList) {
// 改方 // 改方
List<MapSignalButtonVO.Type> buttonTypeList = Arrays.asList( List<MapSignalButtonVO.Type> buttonTypeList = Arrays.asList(
MapSignalButtonVO.Type.ASSIST, MapSignalButtonVO.Type.ASSIST,
@ -1559,14 +1558,15 @@ public class MapDeviceBuilder {
.filter(mapSignalButtonVO -> buttonTypeList.contains(mapSignalButtonVO.getType())) .filter(mapSignalButtonVO -> buttonTypeList.contains(mapSignalButtonVO.getType()))
.forEach(mapSignalButtonVO -> { .forEach(mapSignalButtonVO -> {
if (elementMap.containsKey(mapSignalButtonVO.getCode())) { if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
errMsgList.add(String.format("按钮[%s]必须唯一", mapSignalButtonVO.getCode())); errMsgList.add("已存在按钮 " + mapSignalButtonVO.getStationCode());
} else { } else {
Button button = new Button(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName()); Button button = new Button(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName());
button.setLabel(mapSignalButtonVO.getLabelEnum()); button.setLabel(mapSignalButtonVO.getLabelEnum());
Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode()); Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode());
button.setStation(station); button.setStation(station);
station.getButtonsList().add(button); button.setTypeStr(mapSignalButtonVO.getType());
elementMap.put(button.getCode(), button); station.getButtonList().add(button);
elementMap.put(mapSignalButtonVO.getCode(), button);
} }
}); });
} }

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.simulation.cbtc.data.map; package club.joylink.rtss.simulation.cbtc.data.map;
import club.joylink.rtss.constants.ButtonTypeEnum;
import club.joylink.rtss.constants.DirectionLabelEnum; import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.vo.map.graph.MapSignalButtonVO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -16,11 +16,6 @@ public class Button extends MapNamedElement {
*/ */
private Station station; private Station station;
/**
* 站台
*/
private Stand stand;
/** /**
* 当前信号显示 * 当前信号显示
*/ */
@ -49,4 +44,41 @@ public class Button extends MapNamedElement {
public void reset() { public void reset() {
isPressDown = Boolean.FALSE; isPressDown = Boolean.FALSE;
} }
public void setTypeStr(MapSignalButtonVO.Type typeStr) {
this.type = getType(typeStr);
}
/**
* 获取枚举信息
*
* @param type 类型
* @return 枚举
*/
public static ButtonTypeEnum getType(MapSignalButtonVO.Type type) {
switch (type) {
case ASSIST:
return ButtonTypeEnum.MAIN_ASSIST;
case PICK_ASSIST:
return ButtonTypeEnum.DELIVER_ASSIST;
case DEPART_ASSIST:
return ButtonTypeEnum.RECEIVE_ASSIST;
case CHANGE_DIRECTION:
return ButtonTypeEnum.CHANGE_DIRECTION;
default:
return ButtonTypeEnum.NO;
}
}
public enum ButtonTypeEnum {
// 总辅助
MAIN_ASSIST,
// 接辅助
RECEIVE_ASSIST,
// 发辅助
DELIVER_ASSIST,
// 改方
CHANGE_DIRECTION,
NO;
}
} }

View File

@ -3,12 +3,9 @@ package club.joylink.rtss.simulation.cbtc.data.map;
import club.joylink.rtss.constants.DirectionLabelEnum; import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum; import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.constants.IndicatorTypeEnum;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List;
/** /**
* 指示灯设备 * 指示灯设备
*/ */
@ -35,21 +32,6 @@ public class Indicator extends MapNamedElement {
*/ */
private boolean on; private boolean on;
/**
* 区段信息
*/
private List<Section> sectionList;
/**
* 站台
*/
private Stand stand;
/**
* 进路
*/
private Route route;
/** /**
* 灯类型 * 灯类型
*/ */
@ -60,16 +42,13 @@ public class Indicator extends MapNamedElement {
on = false; on = false;
} }
protected Indicator(String code, String name, DeviceType deviceType) {
super(code, name, deviceType);
}
@Override @Override
public void reset() { public void reset() {
on = false; on = false;
aspect = getDefaultStatus(); aspect = getDefaultStatus();
} }
/** /**
* 获取默认状态 * 获取默认状态
* *
@ -86,4 +65,69 @@ public class Indicator extends MapNamedElement {
return IndicatorStatusEnum.No; return IndicatorStatusEnum.No;
} }
} }
public void setTypeStr(String type) {
this.type = getType(type);
}
/**
* 枚举对应
*
* @param type 前端类型
* @return 枚举值
*/
public static IndicatorTypeEnum getType(String type) {
switch (type) {
//
case "receive":
case "PickArrow":
return IndicatorTypeEnum.RECEIVE;
//
case "deliver":
case "DepartArrow":
return IndicatorTypeEnum.DELIVER;
// 区间
case "section":
case "SectionOccupied":
return IndicatorTypeEnum.SECTION;
//辅助
case "assist":
case "AssistStatus":
case "TotalAssist":
case "DepartAssist":
case "PickAssist":
return IndicatorTypeEnum.ASSIST;
//复原
case "Recovery":
return IndicatorTypeEnum.RECOVERY;
//事故
case "Accident":
return IndicatorTypeEnum.ACCIDENT;
//闭塞
case "Occlusion":
return IndicatorTypeEnum.OCCLUSION;
default:
return IndicatorTypeEnum.NO;
}
}
public enum IndicatorTypeEnum {
//
RECEIVE,
//
DELIVER,
// 区间
SECTION,
// 辅助
ASSIST,
// 恢复
RECOVERY,
// 事故
ACCIDENT,
// 闭塞
OCCLUSION,
// 无类型
NO;
}
} }

View File

@ -132,7 +132,11 @@ public abstract class MapElement {
/** /**
* 操作按钮 * 操作按钮
*/ */
BUTTON BUTTON,
/**
* 车站_运行_方向
*/
STATION_DIRECTION
} }
/** /**

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.data.map; package club.joylink.rtss.simulation.cbtc.data.map;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.TurnBackStrategyType; import club.joylink.rtss.simulation.cbtc.constant.TurnBackStrategyType;
@ -28,6 +29,9 @@ public class Station extends MayOutOfOrderDevice {
rdStandList = new ArrayList<>(); rdStandList = new ArrayList<>();
ldStandList = new ArrayList<>(); ldStandList = new ArrayList<>();
controlMode = ControlMode.Center; controlMode = ControlMode.Center;
stationDirectionMap = new HashMap<>();
buttonList = new ArrayList<>();
indicatorList = new ArrayList<>();
} }
/** /**
@ -180,15 +184,20 @@ public class Station extends MayOutOfOrderDevice {
*/ */
private AtomicInteger preResetValidDuration = new AtomicInteger(0); private AtomicInteger preResetValidDuration = new AtomicInteger(0);
/**
* 车站4个方向的联锁数据
*/
private Map<DirectionLabelEnum, StationDirection> stationDirectionMap;
/** /**
* 按钮列表 * 按钮列表
*/ */
private List<Button> buttonsList = new ArrayList<>(); private List<Button> buttonList;
/** /**
* 指示灯列表 * 指示灯列表
*/ */
private List<Indicator> indicatorList = new ArrayList<>(); private List<Indicator> indicatorList;
@Override @Override
public void reset() { public void reset() {

View File

@ -0,0 +1,240 @@
package club.joylink.rtss.simulation.cbtc.data.map;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 指示灯设备
*/
@Setter
@Getter
@Slf4j
public class StationDirection extends MapNamedElement {
/**
* 车站
*/
private Station station;
/**
* 方向标签
*/
private DirectionLabelEnum labelEnum;
/**
* 指示灯实体
*/
private Signal signal;
/**
* 处于接发状态
*/
private ReceiveAndDeliverModel receiveAndDeliver;
/**
* 接车灯状态
*/
private IndicatorStatusEnum receiveAspect;
/**
* 发车灯状态
*/
private IndicatorStatusEnum deliverAspect;
/**
* 区间灯状态
*/
private IndicatorStatusEnum sectionAspect;
/**
* 辅助灯状态
*/
private IndicatorStatusEnum assistAspect;
/**
* 改方按钮状态
*/
private boolean changeDirectionStatus;
/**
* 总辅助
*/
private boolean mainAssistStatus;
/**
* 接辅助
*/
private boolean receiveAssistStatus;
/**
* 发辅助
*/
private boolean deliverAssistStatus;
/**
* 接车进路以指示灯为起点的进路
*/
private List<Route> receiveRouteList;
/**
* 发车进路以指示灯为终点的进路
*/
private List<Route> deliverRouteList;
/**
* 区段信息
*/
private List<Section> sectionList;
/**
* 按钮集合
*/
private List<Button> buttonList;
/**
* 指示灯集合
*/
private List<Indicator> indicatorList;
public StationDirection(String code, String name, DirectionLabelEnum labelEnum) {
this(code, name);
this.labelEnum = labelEnum;
this.getDefaultReceiveAndDeliver();
}
public StationDirection(String code, String name) {
super(code, name, DeviceType.STATION_DIRECTION);
setDefaultAttribute();
this.sectionList = new ArrayList<>();
this.receiveRouteList = new ArrayList<>();
this.deliverRouteList = new ArrayList<>();
this.buttonList = new ArrayList<>();
this.indicatorList = new ArrayList<>();
}
@Override
public void reset() {
this.setDefaultAttribute();
this.getDefaultReceiveAndDeliver();
}
/**
* 设置默认属性
*/
private void setDefaultAttribute() {
this.changeDirectionStatus = false;
this.mainAssistStatus = false;
this.receiveAssistStatus = false;
this.deliverAssistStatus = false;
this.receiveAspect = IndicatorStatusEnum.No;
this.deliverAspect = IndicatorStatusEnum.No;
this.sectionAspect = IndicatorStatusEnum.No;
this.assistAspect = IndicatorStatusEnum.No;
}
/**
* 默认亮灯设置
*/
private void getDefaultReceiveAndDeliver() {
// XS方向为接车方向默认亮起
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
this.receiveAndDeliver = ReceiveAndDeliverModel.RECEIVE;
} else { // 其他方向默认发车灯亮起
this.receiveAndDeliver = ReceiveAndDeliverModel.DELIVER;
}
}
/**
* 刷新接发车状态
*/
public void refreshReceiveAndDeliverStatus() {
boolean receiveFlag = this.receiveRouteList.stream().anyMatch(Route::isLock);
boolean deliverFlag = this.deliverRouteList.stream().anyMatch(Route::isLock);
if (receiveFlag) {
this.receiveAndDeliver = ReceiveAndDeliverModel.RECEIVE;
} else if (deliverFlag) {
this.receiveAndDeliver = ReceiveAndDeliverModel.DELIVER;
} else {
return;
}
}
/**
* 刷新接发车灯颜色
*/
public void refreshAspectStatus() {
if (ReceiveAndDeliverModel.RECEIVE.equals(this.receiveAndDeliver)) {
this.deliverAspect = IndicatorStatusEnum.No;
boolean isBlock = this.receiveRouteList
.stream()
.anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock));
if (isBlock) {
this.receiveAspect = IndicatorStatusEnum.R;
} else {
this.receiveAspect = IndicatorStatusEnum.Y;
}
} else if (ReceiveAndDeliverModel.DELIVER.equals(this.receiveAndDeliver)) {
this.receiveAspect = IndicatorStatusEnum.No;
boolean isBlock = this.deliverRouteList
.stream()
.anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock));
if (isBlock) {
this.deliverAspect = IndicatorStatusEnum.R;
} else {
this.deliverAspect = IndicatorStatusEnum.G;
}
} else {
return;
}
}
/**
* 区间灯状态
*/
public void refreshSectionStatus() {
if (CollectionUtils.isEmpty(sectionList)) {
return;
}
// 是否被占用,TRUE 未占用,FALSE 占用
boolean isNotOccupied = this.sectionList.stream().anyMatch(Section::isOccupied);
// 占用为红色
this.sectionAspect = isNotOccupied ? IndicatorStatusEnum.R : IndicatorStatusEnum.No;
}
/**
* 修改按钮状态
*
* @param type 按钮类型
* @param pressDown 按钮按下抬起
*/
public void modifyButtonStatus(Button.ButtonTypeEnum type, boolean pressDown) {
switch (type) {
case CHANGE_DIRECTION:
this.changeDirectionStatus = pressDown;
break;
case RECEIVE_ASSIST:
this.receiveAssistStatus = pressDown;
break;
case DELIVER_ASSIST:
this.deliverAssistStatus = pressDown;
break;
case MAIN_ASSIST:
this.mainAssistStatus = pressDown;
break;
}
}
public enum ReceiveAndDeliverModel {
//
RECEIVE,
//
DELIVER,
}
}

View File

@ -1,45 +0,0 @@
package club.joylink.rtss.simulation.cbtc.data.status;
import club.joylink.rtss.simulation.cbtc.data.map.Button;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.vo.ButtonStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import lombok.Getter;
import lombok.Setter;
import java.util.Objects;
/**
* 按钮设备状态信息
*/
@Setter
@Getter
public class ButtonStatus extends DeviceStatus {
private boolean pressDown;
public ButtonStatus(Button button) {
super(button.getCode(), button.getDeviceType());
pressDown = button.isPressDown();
}
@Override
public boolean compareAndChange(MapElement device, DeviceStatusVO statusVO) {
Button button = (Button) device;
ButtonStatusVO status = (ButtonStatusVO) statusVO;
boolean change = Boolean.FALSE;
if (!Objects.equals(pressDown, button.isPressDown())) {
change = Boolean.TRUE;
pressDown = button.isPressDown();
status.setPressDown(pressDown);
}
return change;
}
@Override
public DeviceStatusVO convert2VO(MapElement device) {
ButtonStatusVO statusVO = new ButtonStatusVO((Button) device);
statusVO.setPressDown(pressDown);
return statusVO;
}
}

View File

@ -1,47 +0,0 @@
package club.joylink.rtss.simulation.cbtc.data.status;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.simulation.cbtc.data.map.Indicator;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.IndicatorStatusVO;
import lombok.Getter;
import lombok.Setter;
/**
* 指示灯设备状态信息
*/
@Setter
@Getter
public class IndicatorStatus extends DeviceStatus {
/**
* 当前信号显示
*/
private IndicatorStatusEnum aspect;
public IndicatorStatus(Indicator indicator) {
super(indicator.getCode(), indicator.getDeviceType());
aspect = indicator.getAspect();
}
@Override
public boolean compareAndChange(MapElement device, DeviceStatusVO statusVO) {
Indicator indicator = (Indicator) device;
IndicatorStatusVO status = (IndicatorStatusVO) statusVO;
boolean change = Boolean.FALSE;
if (!indicator.getAspect().equals(aspect)) {
change = Boolean.TRUE;
aspect = indicator.getAspect();
status.setAspect(aspect);
}
return change;
}
@Override
public DeviceStatusVO convert2VO(MapElement device) {
IndicatorStatusVO statusVO = new IndicatorStatusVO((Indicator) device);
statusVO.setAspect(aspect);
return statusVO;
}
}

View File

@ -0,0 +1,153 @@
package club.joylink.rtss.simulation.cbtc.data.status;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.StationDirectionStatusVO;
import lombok.Getter;
import java.util.Objects;
/**
* 车站状态
*/
@Getter
public class StationDirectionStatus extends DeviceStatus {
private String stationCode;
private DirectionLabelEnum labelEnum;
/**
* 接车灯状态
*/
private IndicatorStatusEnum receiveAspect;
/**
* 发车灯状态
*/
private IndicatorStatusEnum deliverAspect;
/**
* 区间灯状态
*/
private IndicatorStatusEnum sectionAspect;
/**
* 辅助灯状态
*/
private IndicatorStatusEnum assistAspect;
/**
* 改方按钮状态
*/
private boolean changeDirectionStatus;
/**
* 总辅助
*/
private boolean mainAssistStatus;
/**
* 接辅助
*/
private boolean receiveAssistStatus;
/**
* 发辅助
*/
private boolean deliverAssistStatus;
public StationDirectionStatus(StationDirection stationDirection) {
super(stationDirection.getCode(), stationDirection.getDeviceType());
this.stationCode = stationDirection.getStation().getCode();
this.labelEnum = stationDirection.getLabelEnum();
this.receiveAspect = stationDirection.getReceiveAspect();
this.deliverAspect = stationDirection.getDeliverAspect();
this.sectionAspect = stationDirection.getSectionAspect();
this.assistAspect = stationDirection.getAssistAspect();
this.changeDirectionStatus = stationDirection.isChangeDirectionStatus();
this.mainAssistStatus = stationDirection.isMainAssistStatus();
this.receiveAssistStatus = stationDirection.isReceiveAssistStatus();
this.deliverAssistStatus = stationDirection.isDeliverAssistStatus();
}
@Override
public boolean compareAndChange(MapElement device, DeviceStatusVO statusVO) {
StationDirection labelEnum = (StationDirection) device;
StationDirectionStatusVO status = (StationDirectionStatusVO) statusVO;
boolean change = false;
// 接车
if (!Objects.equals(labelEnum.getReceiveAspect(), receiveAspect)) {
this.receiveAspect = labelEnum.getReceiveAspect();
status.setReceiveAspect(receiveAspect);
change = true;
}
// 接车
if (!Objects.equals(labelEnum.getDeliverAspect(), deliverAspect)) {
this.deliverAspect = labelEnum.getDeliverAspect();
status.setDeliverAspect(deliverAspect);
change = true;
}
// 区间
if (!Objects.equals(labelEnum.getSectionAspect(), sectionAspect)) {
this.sectionAspect = labelEnum.getSectionAspect();
status.setSectionAspect(sectionAspect);
change = true;
}
// 辅助灯
if (!Objects.equals(labelEnum.getAssistAspect(), assistAspect)) {
this.assistAspect = labelEnum.getAssistAspect();
status.setAssistAspect(assistAspect);
change = true;
}
// 改方按钮
if (!Objects.equals(labelEnum.isChangeDirectionStatus(), changeDirectionStatus)) {
this.changeDirectionStatus = labelEnum.isChangeDirectionStatus();
status.setChangeDirectionStatus(changeDirectionStatus);
change = true;
}
// 总辅助按钮
if (!Objects.equals(labelEnum.isMainAssistStatus(), mainAssistStatus)) {
this.mainAssistStatus = labelEnum.isMainAssistStatus();
status.setMainAssistStatus(mainAssistStatus);
change = true;
}
// 接辅助按钮
if (!Objects.equals(labelEnum.isReceiveAssistStatus(), receiveAssistStatus)) {
this.receiveAssistStatus = labelEnum.isReceiveAssistStatus();
status.setReceiveAssistStatus(receiveAssistStatus);
change = true;
}
// 发辅助按钮
if (!Objects.equals(labelEnum.isDeliverAssistStatus(), deliverAssistStatus)) {
this.deliverAssistStatus = labelEnum.isDeliverAssistStatus();
status.setDeliverAssistStatus(deliverAssistStatus);
change = true;
}
if (change) {
status.setStationCode(labelEnum.getStation().getCode());
status.setLabelEnum(labelEnum.getLabelEnum());
}
return change;
}
@Override
public DeviceStatusVO convert2VO(MapElement device) {
StationDirectionStatusVO statusVO = new StationDirectionStatusVO((StationDirection) device);
statusVO.setStationCode(stationCode);
statusVO.setLabelEnum(labelEnum);
statusVO.setReceiveAspect(receiveAspect);
statusVO.setDeliverAspect(deliverAspect);
statusVO.setSectionAspect(sectionAspect);
statusVO.setAssistAspect(assistAspect);
statusVO.setChangeDirectionStatus(changeDirectionStatus);
statusVO.setMainAssistStatus(mainAssistStatus);
statusVO.setReceiveAssistStatus(receiveAssistStatus);
statusVO.setDeliverAssistStatus(deliverAssistStatus);
return statusVO;
}
}

View File

@ -1,19 +0,0 @@
package club.joylink.rtss.simulation.cbtc.data.vo;
import club.joylink.rtss.simulation.cbtc.data.map.Button;
import lombok.Getter;
import lombok.Setter;
/**
* 按钮状态
*/
@Setter
@Getter
public class ButtonStatusVO extends DeviceStatusVO {
private Boolean pressDown;
public ButtonStatusVO(Button button) {
super(button.getCode(), button.getDeviceType());
}
}

View File

@ -1,28 +0,0 @@
package club.joylink.rtss.simulation.cbtc.data.vo;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.simulation.cbtc.data.map.Indicator;
import club.joylink.rtss.simulation.cbtc.data.status.IndicatorStatus;
import lombok.Getter;
import lombok.Setter;
/**
* 按钮状态
*/
@Setter
@Getter
public class IndicatorStatusVO extends DeviceStatusVO {
/**
* 当前信号显示
*/
private IndicatorStatusEnum aspect;
public IndicatorStatusVO(IndicatorStatus indicatorStatus) {
super(indicatorStatus.getCode(), indicatorStatus.getDeviceType());
}
public IndicatorStatusVO(Indicator indicator) {
super(indicator.getCode(), indicator.getDeviceType());
}
}

View File

@ -0,0 +1,63 @@
package club.joylink.rtss.simulation.cbtc.data.vo;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.constants.IndicatorStatusEnum;
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
import lombok.Getter;
import lombok.Setter;
/**
* 按钮状态
*/
@Setter
@Getter
public class StationDirectionStatusVO extends DeviceStatusVO {
private String stationCode;
private DirectionLabelEnum labelEnum;
/**
* 接车灯状态
*/
private IndicatorStatusEnum receiveAspect;
/**
* 发车灯状态
*/
private IndicatorStatusEnum deliverAspect;
/**
* 区间灯状态
*/
private IndicatorStatusEnum sectionAspect;
/**
* 辅助灯状态
*/
private IndicatorStatusEnum assistAspect;
/**
* 改方按钮状态
*/
private Boolean changeDirectionStatus;
/**
* 总辅助
*/
private Boolean mainAssistStatus;
/**
* 接辅助
*/
private Boolean receiveAssistStatus;
/**
* 发辅助
*/
private Boolean deliverAssistStatus;
public StationDirectionStatusVO(StationDirection stationDirection) {
super(stationDirection.getCode(), stationDirection.getDeviceType());
}
}

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.map; package club.joylink.rtss.vo.map;
import club.joylink.rtss.entity.IndicatorButton; import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.map.logic.*; import club.joylink.rtss.vo.map.logic.*;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
@ -74,7 +74,7 @@ public class MapLogicDataNewVO {
/** /**
* 信号灯站台进路关联的区段信息 * 信号灯站台进路关联的区段信息
*/ */
private List<IndicatorButton> indicatorButtonVOList; private List<DraftMapStationDirection> draftMapStationDirectionList;
public MapLogicDataNewVO() { public MapLogicDataNewVO() {
routeList = new ArrayList<>(); routeList = new ArrayList<>();
@ -88,7 +88,7 @@ public class MapLogicDataNewVO {
overlapList = new ArrayList<>(); overlapList = new ArrayList<>();
overrunList = new ArrayList<>(); overrunList = new ArrayList<>();
autoReentryList = new ArrayList<>(); autoReentryList = new ArrayList<>();
indicatorButtonVOList = new ArrayList<>(); draftMapStationDirectionList = new ArrayList<>();
} }
@JsonIgnore @JsonIgnore

View File

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.AssistIndicatorButtonDAO"> <mapper namespace="club.joylink.rtss.dao.DraftMapStationDirectionDAO">
<resultMap id="IndicatorBaseResultMap" type="club.joylink.rtss.entity.IndicatorButton"> <resultMap id="IndicatorBaseResultMap" type="club.joylink.rtss.entity.DraftMapStationDirection">
<id column="id" jdbcType="BIGINT" property="id"/> <id column="id" jdbcType="BIGINT" property="id"/>
<result column="map_id" jdbcType="BIGINT" property="mapId"/> <result column="map_id" jdbcType="BIGINT" property="mapId"/>
<result column="code" jdbcType="VARCHAR" property="code"/> <result column="code" jdbcType="VARCHAR" property="code"/>
<result column="station_code" jdbcType="VARCHAR" property="stationCode"/>
<result column="sections_code" jdbcType="VARCHAR" property="sectionsCode"/> <result column="sections_code" jdbcType="VARCHAR" property="sectionsCode"/>
<result column="stand_code" jdbcType="VARCHAR" property="standCode"/> <result column="label_enum" jdbcType="VARCHAR" property="labelEnum"/>
<result column="model_type" jdbcType="VARCHAR" property="modelType"/> <result column="signal_code" jdbcType="VARCHAR" property="signalCode"/>
<result column="route_code" jdbcType="VARCHAR" property="routeCode"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
@ -75,17 +74,17 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, map_id, code, sections_code, stand_code, model_type, route_code, type id, map_id, code, station_code, sections_code, label_enum, signal_code
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.IndicatorButtonExample" <select id="selectByExample" parameterType="club.joylink.rtss.entity.DraftMapStationDirectionExample"
resultMap="IndicatorBaseResultMap"> resultMap="IndicatorBaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from indicator_button_section_stand_route from draft_map_station_direction_label
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
@ -105,67 +104,81 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="IndicatorBaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="IndicatorBaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from indicator_button_section_stand_route from draft_map_station_direction_label
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from indicator_button_section_stand_route where id = #{id,jdbcType=BIGINT} delete from draft_map_station_direction_label where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.IndicatorButtonExample"> <delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DraftMapStationDirectionExample">
delete from indicator_button_section_stand_route delete from draft_map_station_direction_label
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.IndicatorButton" <insert id="insert" keyColumn="id" keyProperty="id"
parameterType="club.joylink.rtss.entity.DraftMapStationDirection"
useGeneratedKeys="true"> useGeneratedKeys="true">
insert into indicator_button_section_stand_route ( insert into draft_map_station_direction_label (
map_id, code, sections_code, stand_code, model_type, route_code,type map_id, code, station_code, sections_code, label_enum, signal_code
) )
values ( values (
#{mapId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{sectionsCode,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{stationCode,jdbcType=VARCHAR},
#{standCode,jdbcType=VARCHAR},#{modelType,jdbcType=VARCHAR}, #{sectionsCode,jdbcType=VARCHAR},
#{routeCode,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR} #{labelEnum,jdbcType=VARCHAR},#{signalCode,jdbcType=VARCHAR}
) )
</insert> </insert>
<insert id="insertList">
insert into draft_map_station_direction_label (
map_id, code, station_code, sections_code, label_enum, signal_code
)
values
<foreach collection="list" item="recode" separator=",">
(
#{record.mapId,jdbcType=BIGINT}, #{record.code,jdbcType=VARCHAR}, #{record.stationCode,jdbcType=VARCHAR},
#{record.sectionsCode,jdbcType=VARCHAR}, #{record.labelEnum,jdbcType=VARCHAR},
#{record.signalCode,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="club.joylink.rtss.entity.IndicatorButton" parameterType="club.joylink.rtss.entity.DraftMapStationDirection"
useGeneratedKeys="true"> useGeneratedKeys="true">
insert into indicator_button_section_stand_route insert into draft_map_station_direction_label
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">map_id,</if> <if test="mapId != null">map_id,</if>
<if test="code != null">code,</if> <if test="code != null">code,</if>
<if test="stationCode != null">station_code,</if>
<if test="sectionsCode != null">sections_code,</if> <if test="sectionsCode != null">sections_code,</if>
<if test="standCode != null">stand_code,</if> <if test="labelEnum != null">label_enum,</if>
<if test="modelType != null">model_type,</if> <if test="signalCode != null">signal_code,</if>
<if test="routeCode != null">route_code,</if>
<if test="type != null">type,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">#{mapId,jdbcType=BIGINT},</if> <if test="mapId != null">#{mapId,jdbcType=BIGINT},</if>
<if test="code != null">#{code,jdbcType=VARCHAR},</if> <if test="code != null">#{code,jdbcType=VARCHAR},</if>
<if test="stationCode != null">#{record.stationCode,jdbcType=VARCHAR},</if>
<if test="sectionsCode != null">#{sectionsCode,jdbcType=VARCHAR},</if> <if test="sectionsCode != null">#{sectionsCode,jdbcType=VARCHAR},</if>
<if test="standCode != null">#{standCode,jdbcType=VARCHAR},</if> <if test="labelEnum != null">#{labelEnum,jdbcType=VARCHAR},</if>
<if test="modelType != null">#{modelType,jdbcType=VARCHAR},</if> <if test="signalCode != null">#{signalCode,jdbcType=VARCHAR},</if>
<if test="routeCode != null">#{routeCode,jdbcType=VARCHAR},</if>
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.IndicatorButtonExample" <select id="countByExample" parameterType="club.joylink.rtss.entity.DraftMapStationDirectionExample"
resultType="java.lang.Long"> resultType="java.lang.Long">
select count(*) from indicator_button_section_stand_route select count(*) from draft_map_station_direction_label
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update indicator_button_section_stand_route update draft_map_station_direction_label
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
@ -176,17 +189,17 @@
<if test="record.code != null"> <if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR}, code = #{record.code,jdbcType=VARCHAR},
</if> </if>
<if test="record.stationCode != null">
station_code = #{record.stationCode,jdbcType=VARCHAR},
</if>
<if test="record.sectionsCode != null"> <if test="record.sectionsCode != null">
sections_code = #{record.sectionsCode,jdbcType=VARCHAR}, sections_code = #{record.sectionsCode,jdbcType=VARCHAR},
</if> </if>
<if test="record.standCode != null"> <if test="record.labelEnum != null">
stand_code = #{record.standCode,jdbcType=VARCHAR}, label_enum = #{record.labelEnum,jdbcType=VARCHAR},
</if> </if>
<if test="record.modelType != null"> <if test="record.signalCode != null">
model_type = #{record.modelType,jdbcType=VARCHAR}, signal_code = #{record.signalCode,jdbcType=VARCHAR},
</if>
<if test="record.routeCode != null">
route_code = #{record.routeCode,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
@ -195,22 +208,21 @@
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update indicator_button_section_stand_route update draft_map_station_direction_label
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT}, map_id = #{record.mapId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR}, code = #{record.code,jdbcType=VARCHAR},
station_code = #{record.stationCode,jdbcType=VARCHAR},
sections_code = #{record.sectionsCode,jdbcType=VARCHAR}, sections_code = #{record.sectionsCode,jdbcType=VARCHAR},
stand_code = #{record.standCode,jdbcType=VARCHAR}, label_enum = #{record.labelEnum,jdbcType=VARCHAR},
model_type = #{record.modelType,jdbcType=VARCHAR}, signal_code = #{record.signalCode,jdbcType=VARCHAR},
route_code = #{record.routeCode,jdbcType=VARCHAR},
type = #{record.type,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.IndicatorButton"> <update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DraftMapStationDirection">
update indicator_button_section_stand_route update draft_map_station_direction_label
<set> <set>
<if test="mapId != null"> <if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT}, map_id = #{mapId,jdbcType=BIGINT},
@ -218,35 +230,31 @@
<if test="code != null"> <if test="code != null">
code = #{code,jdbcType=VARCHAR}, code = #{code,jdbcType=VARCHAR},
</if> </if>
<if test="stationCode != null">
station_code = #{stationCode,jdbcType=VARCHAR},
</if>
<if test="sectionsCode != null"> <if test="sectionsCode != null">
sections_code = #{sectionsCode,jdbcType=VARCHAR}, sections_code = #{sectionsCode,jdbcType=VARCHAR},
</if> </if>
<if test="standCode != null"> <if test="labelEnum != null">
stand_code = #{standCode,jdbcType=VARCHAR}, label_enum = #{labelEnum,jdbcType=VARCHAR},
</if> </if>
<if test="modelType != null"> <if test="signalCode != null">
model_type = #{modelType,jdbcType=VARCHAR}, signal_code = #{signalCode,jdbcType=VARCHAR},
</if>
<if test="routeCode != null">
route_code = #{routeCode,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.IndicatorButton"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DraftMapStationDirection">
update indicator_button_section_stand_route update draft_map_station_direction_label
set set
map_id = #{mapId,jdbcType=BIGINT}, map_id = #{mapId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR}, code = #{code,jdbcType=VARCHAR},
station_code = #{stationCode,jdbcType=VARCHAR},
sections_code = #{sectionsCode,jdbcType=VARCHAR}, sections_code = #{sectionsCode,jdbcType=VARCHAR},
stand_code = #{standCode,jdbcType=VARCHAR}, label_enum = #{labelEnum,jdbcType=VARCHAR},
model_type = #{modelType,jdbcType=VARCHAR}, signal_code = #{signalCode,jdbcType=VARCHAR},
route_code = #{routeCode,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>