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

This commit is contained in:
walker-sheng 2021-03-12 18:54:30 +08:00
commit 1f94e0ff6d
30 changed files with 1239 additions and 205 deletions

10
sql/20210312-zhangsai.sql Normal file
View File

@ -0,0 +1,10 @@
-- auto-generated definition
create table cgy_record
(
id int not null
primary key,
browse_count int null comment '浏览次数',
download_count int null comment '百度网盘链接打开次数'
)
comment '成都工业项目使用记录';

View File

@ -56,6 +56,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/learn/{postId}/message/pagedQuery/postId");
whiteList.add("/api/learn/{messageId}/comment");
whiteList.add("/api/learn/cgy/updateMessageTime");
// 成都工业使用记录
whiteList.add("/api/cgy/**");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
}

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.controller;
import club.joylink.rtss.services.CgyRecordService;
import club.joylink.rtss.vo.client.CgyRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 成都工业
*/
@RestController
@RequestMapping("/api/cgy")
public class CGYController {
@Autowired
private CgyRecordService cgyRecordService;
@GetMapping("/record")
public CgyRecordVO getBrowseCount() {
return cgyRecordService.getRecord();
}
@PutMapping("/browse")
public void browseCount() {
cgyRecordService.browseCount();
}
@PutMapping("/download")
public void downloadCount() {
cgyRecordService.downloadCount();
}
}

View File

@ -40,7 +40,7 @@ public class IscsController {
@ApiOperation(value = "根据条件获取iscs数据")
@GetMapping
public IscsVO getIscsDataBy(IscsVO iscsVO, @ApiIgnore @RequestAttribute UserVO user) {
public IscsVO getIscsDataBy(@Validated IscsVO iscsVO, @ApiIgnore @RequestAttribute UserVO user) {
return this.iscsService.getIscsDataBy(iscsVO);
}

View File

@ -146,7 +146,7 @@ public class RunPlanDraftController {
return this.iRunPlanDraftService.ifServerExists(planId, serviceNumber);
}
@ApiOperation(value = "查询交路列表")
@ApiOperation(value = "查询地图默认交路列表")
@GetMapping(path = "/{planId}/routingList")
public List getRoutingList(@PathVariable Long planId) {
return this.iRunPlanDraftService.getRoutingList(planId);

View File

@ -37,13 +37,13 @@ public class RunPlanUserDataController {
@PostMapping(path = "/routing")
public void createUserRouting(@RequestBody @Validated RunPlanRoutingVO routingVO, @RequestAttribute UserVO user) {
routingVO.setUserId(user.getId());
iRunPlanRoutingService.createUserRouting(routingVO);
iRunPlanRoutingService.createUserRouting(routingVO);
}
@ApiOperation(value = "生成通用交路区段数据")
@PostMapping(path = "/routing/path/generate")
public RunPlanRoutingVO generateUserRoutingPath(@RequestBody @Validated RunPlanRoutingVO routingVO) {
return iRunPlanRoutingService.generateUserRoutingSections(routingVO);
return iRunPlanRoutingService.generateUserRoutingData(routingVO);
}
@ApiOperation(value = "分页获取用户交路")
@ -52,6 +52,18 @@ public class RunPlanUserDataController {
return iRunPlanRoutingService.queryPagedUserRouting(user.getId(), mapId, queryVO);
}
@ApiOperation(value = "分页获取地图默认交路")
@GetMapping(path = "/{mapId}/default/routing/page")
public PageVO<RunPlanRoutingVO> queryPagedDefaultRouting(@PathVariable Long mapId, RunPlanRoutingQueryVO queryVO) {
return iRunPlanRoutingService.queryPagedUserRouting(null, mapId, queryVO);
}
@ApiOperation(value = "用户拉取地图默认交路")
@PutMapping(path = "/{mapId}/default/routing/pull")
public void pullDefaultRouting(@PathVariable Long mapId, @RequestBody List<Long> routings,@RequestAttribute UserVO user) {
iRunPlanRoutingService.pullDefaultRoutings(user.getId(), mapId, routings);
}
@ApiOperation(value = "获取用户交路数据")
@GetMapping(path = "/{mapId}/routing")
public List<RunPlanRoutingVO> queryUserRoutings(@PathVariable Long mapId, @RequestAttribute UserVO user) {

View File

@ -64,7 +64,10 @@ public class SimulationV1Controller {
public String simulation(Long mapId, String prdType,
@ApiIgnore @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO loginUserInfoVO) {
return this.groupSimulationService.simulation(mapId, prdType, loginUserInfoVO);
String simulation = this.groupSimulationService.simulation(mapId, prdType, loginUserInfoVO);
long end = System.currentTimeMillis();
System.out.println(end);
return simulation;
}
@ApiOperation(value = "创建实训仿真")

View File

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

View File

@ -42,7 +42,12 @@ public interface RunPlanRoutingDAO {
"SELECT COUNT(*) " +
"FROM run_plan_routing " +
"WHERE map_id = #{mapId} " +
"AND user_id = #{userId} " +
"<if test=\"userId == null\">\n" +
"AND user_id IS NULL " +
"</if> " +
"<if test=\"userId != null\">\n" +
"AND user_id = #{userId}\n" +
"</if> " +
"AND section_data = #{sectionData} " +
"</script>")
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
@ -56,4 +61,5 @@ public interface RunPlanRoutingDAO {
"AND section_data = #{sectionData} " +
"</script>")
RunPlanRouting getUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
}

View File

@ -0,0 +1,88 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* @author
* 成都工业项目使用记录
*/
public class CgyRecord implements Serializable {
private Integer id;
/**
* 浏览次数
*/
private Integer browseCount;
/**
* 百度网盘链接打开次数
*/
private Integer downloadCount;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBrowseCount() {
return browseCount;
}
public void setBrowseCount(Integer browseCount) {
this.browseCount = browseCount;
}
public Integer getDownloadCount() {
return downloadCount;
}
public void setDownloadCount(Integer downloadCount) {
this.downloadCount = downloadCount;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
CgyRecord other = (CgyRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getBrowseCount() == null ? other.getBrowseCount() == null : this.getBrowseCount().equals(other.getBrowseCount()))
&& (this.getDownloadCount() == null ? other.getDownloadCount() == null : this.getDownloadCount().equals(other.getDownloadCount()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getBrowseCount() == null) ? 0 : getBrowseCount().hashCode());
result = prime * result + ((getDownloadCount() == null) ? 0 : getDownloadCount().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", browseCount=").append(browseCount);
sb.append(", downloadCount=").append(downloadCount);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,402 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class CgyRecordExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CgyRecordExample() {
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(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andBrowseCountIsNull() {
addCriterion("browse_count is null");
return (Criteria) this;
}
public Criteria andBrowseCountIsNotNull() {
addCriterion("browse_count is not null");
return (Criteria) this;
}
public Criteria andBrowseCountEqualTo(Integer value) {
addCriterion("browse_count =", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountNotEqualTo(Integer value) {
addCriterion("browse_count <>", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountGreaterThan(Integer value) {
addCriterion("browse_count >", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountGreaterThanOrEqualTo(Integer value) {
addCriterion("browse_count >=", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountLessThan(Integer value) {
addCriterion("browse_count <", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountLessThanOrEqualTo(Integer value) {
addCriterion("browse_count <=", value, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountIn(List<Integer> values) {
addCriterion("browse_count in", values, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountNotIn(List<Integer> values) {
addCriterion("browse_count not in", values, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountBetween(Integer value1, Integer value2) {
addCriterion("browse_count between", value1, value2, "browseCount");
return (Criteria) this;
}
public Criteria andBrowseCountNotBetween(Integer value1, Integer value2) {
addCriterion("browse_count not between", value1, value2, "browseCount");
return (Criteria) this;
}
public Criteria andDownloadCountIsNull() {
addCriterion("download_count is null");
return (Criteria) this;
}
public Criteria andDownloadCountIsNotNull() {
addCriterion("download_count is not null");
return (Criteria) this;
}
public Criteria andDownloadCountEqualTo(Integer value) {
addCriterion("download_count =", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountNotEqualTo(Integer value) {
addCriterion("download_count <>", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountGreaterThan(Integer value) {
addCriterion("download_count >", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountGreaterThanOrEqualTo(Integer value) {
addCriterion("download_count >=", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountLessThan(Integer value) {
addCriterion("download_count <", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountLessThanOrEqualTo(Integer value) {
addCriterion("download_count <=", value, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountIn(List<Integer> values) {
addCriterion("download_count in", values, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountNotIn(List<Integer> values) {
addCriterion("download_count not in", values, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountBetween(Integer value1, Integer value2) {
addCriterion("download_count between", value1, value2, "downloadCount");
return (Criteria) this;
}
public Criteria andDownloadCountNotBetween(Integer value1, Integer value2) {
addCriterion("download_count not between", value1, value2, "downloadCount");
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

@ -14,6 +14,9 @@ public class RunPlanRouting implements Serializable {
*/
private Long mapId;
/**
* 空值为地图默认生成的交路
*/
private Long userId;
/**

View File

@ -0,0 +1,68 @@
package club.joylink.rtss.services;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.CgyRecordDAO;
import club.joylink.rtss.dao.SysUserLoginDAO;
import club.joylink.rtss.entity.CgyRecord;
import club.joylink.rtss.entity.SysUserLoginExample;
import club.joylink.rtss.vo.client.CgyRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 成都工业项目使用记录
*/
@Service
public class CgyRecordService {
@Autowired
private SysUserLoginDAO sysUserLoginDAO;
@Autowired
private CgyRecordDAO cgyRecordDAO;
public CgyRecordVO getRecord() {
long loginCount = getLoginCount();
CgyRecord entity = findEntity();
if (entity == null) {
return new CgyRecordVO(loginCount, 0, 0);
} else {
return new CgyRecordVO(loginCount, entity.getBrowseCount(), entity.getDownloadCount());
}
}
public void browseCount() {
CgyRecord entity = findEntity();
if (entity == null) {
CgyRecord cgyRecord = new CgyRecord();
cgyRecord.setBrowseCount(1);
cgyRecord.setDownloadCount(0);
cgyRecordDAO.insert(cgyRecord);
} else {
entity.setBrowseCount(entity.getBrowseCount() + 1);
cgyRecordDAO.updateByPrimaryKey(entity);
}
}
public void downloadCount() {
CgyRecord entity = findEntity();
if (entity == null) {
CgyRecord cgyRecord = new CgyRecord();
cgyRecord.setBrowseCount(0);
cgyRecord.setDownloadCount(1);
cgyRecordDAO.insert(cgyRecord);
} else {
entity.setDownloadCount(entity.getDownloadCount() + 1);
cgyRecordDAO.updateByPrimaryKey(entity);
}
}
private long getLoginCount() {
SysUserLoginExample example = new SysUserLoginExample();
example.createCriteria().andProjectEqualTo(Project.CGY.name());
return sysUserLoginDAO.countByExample(example);
}
private CgyRecord findEntity() {
return cgyRecordDAO.selectByPrimaryKey(1);
}
}

View File

@ -203,6 +203,7 @@ public class DraftMapService implements IDraftMapService {
@Override
public void saveMapElsDetail(Long id, String shapeData) {
DraftMapWithBLOBs draftMap = draftMapDAO.selectByPrimaryKey(id);
System.out.println(shapeData);
MapGraphDataNewVO graphDataNewVO = JsonUtils.read(shapeData, MapGraphDataNewVO.class);
this.handleSectionData(graphDataNewVO);
draftMap.setGraphData(JsonUtils.writeValueAsString(graphDataNewVO));
@ -226,8 +227,7 @@ public class DraftMapService implements IDraftMapService {
section.setDestinationCode(null);
section.setDestinationCodePoint(null);
}
if (Objects.equals(section.getType(), BusinessConsts.Section.SectionType.Type04) ||
Objects.equals(section.getType(), BusinessConsts.Section.SectionType.Type05)) {
if (Objects.equals(section.getType(), BusinessConsts.Section.SectionType.Type04)) {
section.setParentCode(null);
}
}
@ -1122,7 +1122,7 @@ public class DraftMapService implements IDraftMapService {
}
/**
* 创建交路时检查站间运行等级不存在就创建
* 创建交路
*/
@Override
@Transactional

View File

@ -10,6 +10,7 @@ import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.services.simulation.SchedulingService;
import club.joylink.rtss.services.training.ITrainingV1Service;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
@ -22,12 +23,10 @@ import club.joylink.rtss.vo.client.MapQueryVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.*;
import club.joylink.rtss.vo.client.map.newmap.MapPSDVO;
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationStandNewVO;
import club.joylink.rtss.vo.client.map.newmap.*;
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -43,6 +42,7 @@ import java.text.Collator;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
@ -99,6 +99,9 @@ public class MapService implements IMapService {
@Autowired
private IPermissionService iPermissionService;
@Autowired
private IRunPlanRoutingService runPlanDataService;
@Override
public List<DictionaryDetailVO> queryCityHasMap(String dicCode) {
MapInfoExample example = new MapInfoExample();
@ -344,9 +347,7 @@ public class MapService implements IMapService {
public MapVO publish(MapVO mapVO, MapDataVO mapDataVO, UserVO userVO) {
//地图信息
MapInfoExample infoExample = new MapInfoExample();
infoExample.createCriteria()
.andNameEqualTo(mapVO.getName())
.andStatusNotEqualTo(MapStatus.Delete.getCode());
infoExample.createCriteria().andNameEqualTo(mapVO.getName()).andStatusNotEqualTo(MapStatus.Delete.getCode());
List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(infoExample);
MapInfo map;
if (ObjectUtils.isEmpty(mapInfoList)) {
@ -381,6 +382,8 @@ public class MapService implements IMapService {
// 更新地图当前使用的地图数据版本
map.setVersion(mapData.getVersion());
mapInfoDAO.updateByPrimaryKey(map);
//更新系统默认交路及相关运行图基础数据
createDefaultRouting(mapDataVO, map.getId());
// 保存站间运行数据
iCacheService.remove(BusinessConsts.CachePrefix.Map + map.getId()); //删除地图数据缓存
MapVO newMapVO = new MapVO(map);
@ -459,6 +462,15 @@ public class MapService implements IMapService {
// return newMapVO;
}
private void createDefaultRouting(MapDataVO mapDataVO,Long mapId) {
runPlanDataService.deleteDefaultRouting(mapId);
List<MapRoutingDataVO> routingList = mapDataVO.getLogicDataNew().getRoutingList();
if (!CollectionUtils.isEmpty(routingList)) {
List<RunPlanRoutingVO> defaultRoutings = routingList.stream().map(r-> RunPlanRoutingVO.fromMapRoutingData(r, mapId)).collect(Collectors.toList());
runPlanDataService.createDefaultRoutings(defaultRoutings);
}
}
@Override
public void publish3DData(MapVO mapVO, Map3dDataVO map3dDataVO, UserVO user) {
// 地图信息
@ -721,26 +733,30 @@ public class MapService implements IMapService {
}
@Override
@Transactional
public void updateBasicInfo(Long id, MapInfoUpdateVO updateVO, UserVO user) {
MapInfo mapInfo = findMapInfoEntity(id);
boolean update = false;
if (StringUtils.hasText(updateVO.getName())) {
if (StringUtils.hasText(updateVO.getName()) && !Objects.equals(mapInfo.getName(), updateVO.getName())) {
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(isNameExistExcept(updateVO.getName(), id),
"名称已存在");
mapInfo.setName(updateVO.getName());
update = true;
}
if (StringUtils.hasText(updateVO.getCityCode())) {
if (StringUtils.hasText(updateVO.getCityCode()) && !Objects.equals(mapInfo.getCityCode(), updateVO.getCityCode())) {
mapInfo.setCityCode(updateVO.getCityCode());
update = true;
}
if (StringUtils.hasText(updateVO.getLineCode()) &&
this.iRealLineService.checkCodeExist(updateVO.getLineCode())) {
if (StringUtils.hasText(updateVO.getLineCode()) && !Objects.equals(mapInfo.getLineCode(), updateVO.getLineCode())
&& this.iRealLineService.checkCodeExist(updateVO.getLineCode())) {
mapInfo.setLineCode(updateVO.getLineCode());
update = true;
}
if (StringUtils.hasText(updateVO.getVersion()) && versionExist(id, updateVO.getVersion())) {
if (StringUtils.hasText(updateVO.getVersion()) /*&& !Objects.equals(mapInfo.getVersion(), updateVO.getVersion())*/
&& versionExist(id, updateVO.getVersion())) {
mapInfo.setVersion(updateVO.getVersion());
MapDataVO mapDataVO = getMapData(id, updateVO.getVersion());
createDefaultRouting(mapDataVO, id);
update = true;
}
if (update) {

View File

@ -123,7 +123,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<MapStationRunLevelVO> stationRunLevelList;
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, List<AutoSignal> autoSignalList, List<Route> routeList,
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList, /*List<MapRoutingDataVO> routingList,*/
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList, List<MapRoutingDataVO> routingList,
List<MapStationRunLevelVO> stationRunLevelList, List<DestinationCodeDefinition> destinationCodeDefinitionList) {
this.errMsgList = errMsgList;
this.approachList = approachList;
@ -133,7 +133,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
this.flsList = flsList;
this.cycleList = generateCycleList;
this.destinationCodeDefinitionList = destinationCodeDefinitionList;
// this.routingList = routingList;
this.routingList = routingList;
this.stationRunLevelList = stationRunLevelList;
log.info(String.format("生成信号机接近区段数据[%s]条", approachList.size()));
log.info(String.format("生成进路数据总计[%s]条", routeList.size()));
@ -141,7 +141,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
log.info(String.format("生成侧防数据[%s]条", flsList.size()));
log.info(String.format("生成自动信号数据[%s]条", autoSignalList.size()));
log.info(String.format("生成自动折返数据[%s]条", generateCycleList.size()));
// log.info(String.format("生成交路数据[%s]条", routingList.size()));
log.info(String.format("生成交路数据[%s]条", routingList.size()));
log.info(String.format("生成站间运行数据[%s]条", stationRunLevelList.size()));
}
@ -151,7 +151,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
resultVO.setOverlapCount(this.overlapList.size());
resultVO.setCycleCount(this.cycleList.size());
resultVO.setAutoSignalCount(this.autoSignalList.size());
// resultVO.setRoutingCount(this.routingList.size());
resultVO.setRoutingCount(this.routingList.size());
resultVO.setStationRunlevelCount(this.stationRunLevelList.size());
resultVO.setDestinationCodeDefinitionCount(this.destinationCodeDefinitionList.size());
return resultVO;
@ -299,8 +299,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
autoSignal.getSignal().setAutoSignal(autoSignal);
}
// // 生成交路数据
// List<MapRoutingDataVO> generateRoutingList = this.generateRoutings(deviceMap, generatedRouteList, autoSignalList, errorList);
// 生成交路数据
List<MapRoutingDataVO> generateRoutingList = this.generateRoutings(deviceMap, generatedRouteList, autoSignalList, errorList);
//站间运行等级生成
List<MapStationRunLevelVO> generatedStationRunLevelList = new ArrayList<>();
@ -370,7 +370,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return new CiGenerateResult(errorList, approachList,
autoSignalList, generatedRouteList, generatedOverlapList, flsList,
generateCycleList, generatedStationRunLevelList, destinationCodeDefinitionList);
generateCycleList, generateRoutingList,generatedStationRunLevelList, destinationCodeDefinitionList);
}
/**

View File

@ -20,6 +20,8 @@ public interface IRunPlanRoutingService {
void deleteUserRouting(Long routingId);
void deleteDefaultRouting(Long mapId);
PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO);
List<RunPlanRoutingVO> getUserRoutingBy(Long userId, Long mapId);
@ -30,5 +32,11 @@ public interface IRunPlanRoutingService {
List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long planId, String routingCode);
RunPlanRoutingVO generateUserRoutingSections(RunPlanRoutingVO routingVO);
@Transactional
void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings);
@Transactional
void pullDefaultRoutings(Long userId, Long mapId, List<Long> defaultRoutingIds);
RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO);
}

View File

@ -1,17 +1,12 @@
package club.joylink.rtss.services.runplan;
import club.joylink.rtss.dao.RunPlanParktimeDAO;
import club.joylink.rtss.dao.RunPlanRunlevelDAO;
import club.joylink.rtss.entity.RunPlanParktime;
import club.joylink.rtss.entity.RunPlanParktimeExample;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.entity.RunPlanRunlevelExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParktimeQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunLevelQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.dao.RunPlanRoutingDAO;
import club.joylink.rtss.entity.RunPlanDraft;
import club.joylink.rtss.entity.RunPlanRouting;
import club.joylink.rtss.entity.RunPlanRoutingExample;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
@ -55,48 +56,90 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Transactional
@Override
public void createUserRouting(RunPlanRoutingVO routingVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO), "存在相同经停轨道的交路");
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO), "交路数据重复");
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
if (startSection.isTransferTrack() && endSection.isTurnBackTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OUTBOUND);
} else if (startSection.isTurnBackTrack() && endSection.isTransferTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.INBOUND);
} else if (startSection.isTurnBackTrack() && endSection.isTurnBackTrack()) {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.LOOP);
} else {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OTHER);
}
setRoutingType(routingVO, deviceMap);
RunPlanRouting routing = routingVO.convert2Entity();
runPlanRoutingDAO.insert(routing);
createRoutingRefData(deviceMap, routingVO);
if (Objects.equals(RunPlanRoutingVO.UserRoutingType.LOOP, routingVO.getRoutingType())) {
RunPlanRoutingVO routingDataLoop = routingVO.getRoutingDataLoop();
generateUserRoutingSections(routingDataLoop, deviceMap);
if (routingDataExist(routingDataLoop)) return;
runPlanRoutingDAO.insert(routingDataLoop.convert2Entity());
createRoutingRefData(deviceMap, routingDataLoop);
}
}
@Override
@Transactional
public void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings) {
if (CollectionUtils.isEmpty(defaultRoutings)) return;
MapVO map = this.iMapService.getMapDetail(defaultRoutings.get(0).getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
defaultRoutings.forEach(routingVO -> {
routingVO.setUserId(null);
if (routingDataExist(routingVO)) return;
setRoutingType(routingVO, deviceMap);
RunPlanRouting routing = routingVO.convert2Entity();
runPlanRoutingDAO.insert(routing);
});
}
@Override
@Transactional
public void pullDefaultRoutings(Long userId, Long mapId, List<Long> defaultRoutingIds) {
if (CollectionUtils.isEmpty(defaultRoutingIds)) return;
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(this.iMapService.getMapDetail(mapId));
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
defaultRoutingIds.forEach(id -> {
RunPlanRoutingVO defaultRouting = getUserRouting(id);
if(Objects.equals(defaultRouting.getMapId(),mapId) && Objects.isNull(defaultRouting.getUserId()) ){
defaultRouting.setUserId(userId);
if (routingDataExist(defaultRouting)) return;
RunPlanRouting routing = defaultRouting.convert2Entity();
defaultRouting.setId(null);
runPlanRoutingDAO.insert(routing);
createRoutingRefData(deviceMap, defaultRouting);
}
});
}
private void createRoutingRefData(Map<String, MapElement> deviceMap, RunPlanRoutingVO routingVO) {
generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap);
generateUserStationReentryTimes(routingVO, deviceMap);
}
@Override
public RunPlanRoutingVO generateUserRoutingSections(RunPlanRoutingVO routingVO) {
public RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO) {
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
generateUserRoutingSections(routingVO, deviceMap);
return routingVO;
}
private void generateUserRoutingSections(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
//中间经停所有站台轨
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
"没有找到对应方向的中间经停区段,是否需要更换方向/手动添加/直接保存交路");
String.format("没有找到线路方向[%s]的中间经停区段,是否需要更换方向/手动添加/直接保存交路", routingVO.getRight() ? "右向" : "左向"));
LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(section -> new RunPlanRoutingSection(section.getStation().getCode(), section.getCode())).collect(Collectors.toCollection(LinkedList::new));
parkSectionCodeList.addFirst(new RunPlanRoutingSection(routingVO.getStartStationCode(), routingVO.getStartSectionCode()));
parkSectionCodeList.addLast(new RunPlanRoutingSection(routingVO.getEndStationCode(), routingVO.getEndSectionCode()));
routingVO.setParkSectionCodeList(parkSectionCodeList);
return routingVO;
}
@Override
@ -108,12 +151,25 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Transactional
@Override
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO),"存在相同经停轨道的交路");
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
setRoutingType(routingVO, deviceMap);
RunPlanRouting newRouting = routingVO.convert2Entity();
newRouting.setId(routingId);
if (routingDataExist(routingVO)) {
runPlanRoutingDAO.updateByPrimaryKey(newRouting);
return;
}
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap);
generateUserStationReentryTimes(routingVO, deviceMap);
}
private void setRoutingType(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
if (startSection.isTransferTrack() && endSection.isTurnBackTrack()) {
@ -125,18 +181,11 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} else {
routingVO.setRoutingType(RunPlanRoutingVO.UserRoutingType.OTHER);
}
RunPlanRouting newRouting = routingVO.convert2Entity();
newRouting.setId(routingId);
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap);
generateUserStationReentryTimes(routingVO, deviceMap);
}
private void generateUserParktimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO);
parkingTimeVOS.forEach(p -> {
// if (!((Section) deviceMap.get(p.getSectionCode())).isTransferTrack() && !planParktimeService.isExisted(p)) {
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack() && !planParktimeService.isExisted(p)) {
planParktimeService.createUserParktime(p);
}
@ -146,13 +195,13 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
private void generateUserRunlevels(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
levels.forEach(l -> {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
return;
}
if (!planRunlevelService.isExisted(l)) {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
return;
}
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())) {
Float distance;
try {
@ -200,13 +249,25 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
runPlanRoutingDAO.deleteByPrimaryKey(routingId);
}
@Override
public void deleteDefaultRouting(Long mapId) {
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull();
runPlanRoutingDAO.deleteByExample(example);
}
@Override
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
RunPlanRoutingExample example = new RunPlanRoutingExample();
example.setOrderByClause("id");
RunPlanRoutingExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
criteria.andMapIdEqualTo(mapId);
if(Objects.isNull(userId)){
criteria.andUserIdIsNull();
}else{
criteria.andUserIdEqualTo(userId);
}
if (StringUtils.hasText(queryVO.getStartStationCode())) {
criteria.andStartStationCodeEqualTo(queryVO.getStartStationCode());
}
@ -266,13 +327,13 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
}
private boolean ifRoutingDataExist(RunPlanRoutingVO routingVO) {
private boolean routingDataExist(RunPlanRoutingVO routingVO) {
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
}
private RunPlanRouting getRunPlanRoutingData(Long routingId) {
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing,String.format("交路[%s]不存在",routingId));
return routing;
}

View File

@ -624,18 +624,15 @@ public class CiApiServiceImpl implements CiApiService {
*/
private VirtualRealitySectionAxleCounter getAxleCounterAndCheck4Reset(Simulation simulation, String sectionCode) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
Section chooseSection = section;
if (!section.isAxleCounter()) {
section = section.getParent();
}
Section axleSection = section.findAxleCounterSection();
//条件检查
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section != null && section.isAxleCounter(),
chooseSection.debugStr() + "不是计轴区段");
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), chooseSection.debugStr() + "计轴未占用,无需预复位");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(),
section.debugStr() + "不是计轴区段也不归属于任何计轴区段");
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), section.debugStr() + "计轴未占用,无需预复位");
if (simulation.getRepository().getConfig().isStationPreResetBeforeAxlePreReset()) {
Station station = section.getStation();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(station, chooseSection.debugStr() + "没有所属车站");
Station station = axleSection.getStation();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(station, section.debugStr() + "没有所属车站");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(station.isPreReset(), station.debugStr() + "需处于预复位状态");
}
return virtualAxleCounter;

View File

@ -299,6 +299,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
Simulation simulation = this.create(loginUserInfoVO, mapId,
prdType,
Simulation.FunctionalType.SIMULATION);
if (Objects.equals(MapPrdTypeEnum.BIG_SCREEN, prdType)) {
// 大屏仿真直接按计划行车
RunAsPlanParam param = new RunAsPlanParam();

View File

@ -34,6 +34,7 @@ public class InterlockBuilder2 {
// ------------侧防end-------------
// ------------延续保护start-------------
long overlapStart = System.currentTimeMillis();
List<MapOverlapVO> overlapList = logicData.getOverlapList();
for (MapOverlapVO mapOverlapVO : overlapList) {
RouteOverlap routeOverlap = new RouteOverlap(mapOverlapVO.getCode(), mapOverlapVO.getName());
@ -99,6 +100,7 @@ public class InterlockBuilder2 {
}
}
}
log.debug("构建延续保护耗时:" + (System.currentTimeMillis() - overlapStart));
// ------------延续保护end-------------
// 接近区段
List<MapSignalApproachSectionVO> signalApproachSectionList = logicData.getSignalApproachSectionList();
@ -128,6 +130,7 @@ public class InterlockBuilder2 {
}
}
// ------------进路start-------------
long routeStart = System.currentTimeMillis();
List<MapRouteNewVO> routeList = logicData.getRouteList();
for (MapRouteNewVO mapRouteVO : routeList) {
Route route = new Route(mapRouteVO.getCode(), mapRouteVO.getName());
@ -245,6 +248,7 @@ public class InterlockBuilder2 {
}
}
}
log.debug("构建进路耗时:" + (System.currentTimeMillis() - routeStart));
// 敌对进路关系构建
for (MapRouteNewVO mapRouteVO : routeList) {
Route route = (Route) elementMap.get(mapRouteVO.getCode());
@ -485,6 +489,7 @@ public class InterlockBuilder2 {
}
private static Map<String, RouteFls> checkAndBuildRouteFls(List<MapRouteFlankProtectionNewVO> flankProtectionList, Map<String, MapElement> elementMap) {
long start = System.currentTimeMillis();
Map<String, RouteFls> map = new HashMap<>();
for (MapRouteFlankProtectionNewVO fpVO : flankProtectionList) {
RouteFls routeFls = new RouteFls(fpVO.getCode(), new SwitchElement((Switch) elementMap.get(fpVO.getSource().getSwitchCode()), fpVO.getSource().isNormal()));
@ -494,6 +499,7 @@ public class InterlockBuilder2 {
routeFls.setLevel2List(level2List);
map.put(routeFls.getCode(), routeFls);
}
log.debug("构建侧防耗时:" + (System.currentTimeMillis() - start));
return map;
}
@ -861,6 +867,8 @@ public class InterlockBuilder2 {
private static void buildRoutePathFromStationRunLevel(List<StationRunLevel> stationRunLevelList,
SimulationBuilder.SimulationDeviceBuildResult buildResult,
List<String> errMsgList) {
long start = System.currentTimeMillis();
log.debug("构建进路路径开始:" + start);
if (CollectionUtils.isEmpty(stationRunLevelList)) {
return;
}
@ -877,6 +885,7 @@ public class InterlockBuilder2 {
routePathMap.put(routePaths.get(0).getKey(), routePaths);
}
}
log.debug("构建进路路径耗时:" + (System.currentTimeMillis() - start));
}
// /**
@ -1291,6 +1300,8 @@ public class InterlockBuilder2 {
}
private static void checkBetweenRouteSameDirectionSignal(Map<String, MapElement> elementMap, List<String> errMsgList) {
long start = System.currentTimeMillis();
log.debug("构建自动折返进路开始");
if (!CollectionUtils.isEmpty(errMsgList)) { // 数据中本身存在错误不检查
return;
}
@ -1323,5 +1334,6 @@ public class InterlockBuilder2 {
}
}
}
log.debug("构建自动折返进路耗时:" + (System.currentTimeMillis() - start));
}
}

View File

@ -42,110 +42,7 @@ public class MapDeviceBuilder {
buildStation(graphData, elementMap, errMsgList);
// 区段
List<MapSectionNewVO> sectionList = graphData.getSectionList();
Map<String, Section> desCodeSectionMap = new HashMap<>();
for (MapSectionNewVO sectionVO : sectionList) {
Section section = new Section(sectionVO.getCode(), sectionVO.getName());
if (Objects.nonNull(elementMap.get(section.getCode()))) {
errMsgList.add(String.format("编码为[%s]的区段不唯一", section.getCode()));
}
elementMap.put(section.getCode(), section);
section.setRoadType(sectionVO.getRoadType());
section.setPhysical(isPhysicalSection(sectionVO.getType()));
section.setAxleCounter(isAxleCounterSection(sectionVO.getType()));
section.setCross(isCross(sectionVO.getType()));
// 计轴区段和道岔区段校验实际长度
if (isPhysicalSection(sectionVO.getType()) &&
(Objects.isNull(sectionVO.getLengthFact()) ||
sectionVO.getLengthFact() <= 0 ||
Float.isInfinite(sectionVO.getLengthFact()) ||
Float.isNaN(sectionVO.getLengthFact()))) {
errMsgList.add(String.format("区段[%s(%s)]实际距离未设置或不为正数", sectionVO.getName(), sectionVO.getCode()));
} else if (isPhysicalSection(sectionVO.getType())) {
section.setLen(sectionVO.getLengthFact());
}
if (Objects.equals(sectionVO.getType(), BusinessConsts.Section.SectionType.Type02)) { // 逻辑区段
Float startOffset = sectionVO.getLogicSectionStartOffset();
Float endOffset = sectionVO.getLogicSectionEndOffset();
section.setLen(sectionVO.getLengthFact());
if ((Objects.isNull(sectionVO.getLengthFact()) || sectionVO.getLengthFact() <= 0) &&
(Objects.isNull(startOffset) || Objects.isNull(endOffset))) {
errMsgList.add(String.format("逻辑区段[%s(%s)]既没有设置实际长度且所在物理区段起始/终止偏移量也未设置",
section.getName(), section.getCode()));
} else {
float max = Math.max(startOffset, endOffset);
float min = Math.min(startOffset, endOffset);
section.setMaxOffset(max);
section.setMinOffset(min);
}
}
// 所属设备集中站
Station deviceStation = (Station) elementMap.get(sectionVO.getStationCode());
if (Objects.isNull(deviceStation)) {
errMsgList.add(String.format("区段[%s(%s)]未关联设备集中站或设备集中站不存在", section.getName(), section.getCode()));
} else {
section.setDeviceStation(deviceStation);
}
section.setStandTrack(sectionVO.isStandTrack());
section.setTurnBackTrack(sectionVO.isReentryTrack());
section.setFirstTurnBack(sectionVO.isFirstTurnBack());
section.setTransferTrack(sectionVO.isTransferTrack());
if (section.isTransferTrack()) {
if (section.isTurnBackTrack() || section.isStandTrack()) {
errMsgList.add(String.format("区段[%s(%s)]是转换轨,就不能再设置为站台轨或折返轨",
section.getName(), section.getCode()));
}
}
// 是站台轨/折返轨/转换轨校验左右停车点
if ((section.isStandTrack() || section.isTransferTrack() || section.isTurnBackTrack())
&&
(Objects.isNull(sectionVO.getLeftStopPointOffset()) ||
Objects.isNull(sectionVO.getRightStopPointOffset()) ||
(0 == sectionVO.getLeftStopPointOffset().floatValue() &&
0 == sectionVO.getRightStopPointOffset().floatValue()))) {
errMsgList.add(String.format("区段[%s(%s)]是站台轨/折返轨/转换轨却未设置左右停车点偏移量或左右停车点偏移量都为0", sectionVO.getName(), sectionVO.getCode()));
} else {
section.setStopPointLeft(sectionVO.getLeftStopPointOffset());
section.setStopPointRight(sectionVO.getRightStopPointOffset());
}
// 转换轨/折返轨构建关联车站,站台轨在后面处理站台逻辑里做了
if (section.isStandTrack() || section.isTransferTrack() || section.isTurnBackTrack()) {
if (!StringUtils.hasText(sectionVO.getBelongStation())) {
errMsgList.add(String.format("区段[%s(%s)]是站台轨或转换轨或折返轨,却未设置关联车站",
sectionVO.getName(), sectionVO.getCode()));
} else {
//归属车站
Station station = (Station) elementMap.get(sectionVO.getBelongStation());
if (Objects.isNull(station)) {
errMsgList.add(String.format("折返轨/转换轨/站台轨区段[%s(%s)]关联的车站[(%s)]不存在", section.getName(), section.getCode(), sectionVO.getBelongStation()));
} else {
section.setStation(station);
if (section.isTransferTrack()) {
station.addTransferTrack(section);
}
if (section.isTurnBackTrack()) {
station.addTurnBackSection(section);
}
}
}
}
section.setDestinationCode(sectionVO.getDestinationCode());
if (StringUtils.hasText(sectionVO.getDestinationCode())) {
Section section1 = desCodeSectionMap.get(sectionVO.getDestinationCode());
if (Objects.nonNull(section1)) {
errMsgList.add(String.format("区段[%s(%s)]和区段[%s(%s)]目的地码相同[%s],目的地码必须唯一",
section.getName(), section.getCode(),
section1.getName(), section1.getCode(),
sectionVO.getDestinationCode()));
}
desCodeSectionMap.put(sectionVO.getDestinationCode(), section);
}
// 如果区段是计轴区段构建区段虚拟真实计轴器
if (section.isAxleCounter()) {
VirtualRealitySectionAxleCounter axleCounter = new VirtualRealitySectionAxleCounter(section.getCode(), section.getName());
section.setVirtualAxleCounter(axleCounter);
deviceMap.put(axleCounter.getCode(), axleCounter);
}
}
buildSections(elementMap, deviceMap, errMsgList, sectionList);
// 道岔
List<MapSwitchVO> switchList = graphData.getSwitchList();
switchList.forEach(switchVO -> {
@ -200,10 +97,11 @@ public class MapDeviceBuilder {
sectionList.forEach(sectionVO -> {
Section section = (Section) elementMap.get(sectionVO.getCode());
if (Objects.equals(BusinessConsts.Section.SectionType.Type02, sectionVO.getType()) ||
Objects.equals(BusinessConsts.Section.SectionType.Type03, sectionVO.getType())) { // 逻辑区段/道岔区段
Objects.equals(BusinessConsts.Section.SectionType.Type03, sectionVO.getType()) ||
isCross(sectionVO.getType())) { // 逻辑区段/道岔区段/岔心
Section parent = (Section) elementMap.get(sectionVO.getParentCode());
if (Objects.isNull(parent)) {
errMsgList.add(String.format("逻辑区段/道岔区段[%s(%s)]没用关联(道岔)计轴区段或关联的(道岔)计轴区段不存在",
errMsgList.add(String.format("逻辑区段/道岔区段/岔心[%s(%s)]没用关联(道岔)计轴区段或关联的(道岔)计轴区段不存在",
section.getName(), section.getCode()));
} else {
parent.addLogicSection(section);
@ -256,8 +154,8 @@ public class MapDeviceBuilder {
if (Objects.isNull(physicalSectionOfCross)) {
errMsgList.add(String.format("岔心[%s(%s)]关联的物理区段[(%s)]不存在",
section.getName(), section.getCode(), s));
} else if (!physicalSectionOfCross.isAxleCounterSection()) {
errMsgList.add(String.format("岔心[%s(%s)]关联的区段[%s(%s)]不是一般计轴物理区段",
} else if (!physicalSectionOfCross.isPhysical()) {
errMsgList.add(String.format("岔心[%s(%s)]关联的区段[%s(%s)]不是物理区段",
section.getName(), section.getCode(), physicalSectionOfCross.getName(), s));
}
});
@ -846,6 +744,117 @@ public class MapDeviceBuilder {
buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
}
/**
* 构建区段数据
*/
private static void buildSections(Map<String, MapElement> elementMap, Map<String, VirtualRealityDevice> deviceMap,
List<String> errMsgList, List<MapSectionNewVO> sectionList) {
Map<String, Section> desCodeSectionMap = new HashMap<>();
for (MapSectionNewVO sectionVO : sectionList) {
Section section = new Section(sectionVO.getCode(), sectionVO.getName());
if (Objects.nonNull(elementMap.get(section.getCode()))) {
errMsgList.add(String.format("编码为[%s]的区段不唯一", section.getCode()));
}
elementMap.put(section.getCode(), section);
section.setRoadType(sectionVO.getRoadType());
section.setPhysical(isPhysicalSection(sectionVO.getType()));
section.setAxleCounter(isAxleCounterSection(sectionVO, sectionList));
section.setCross(isCross(sectionVO.getType()));
// 计轴区段和道岔区段校验实际长度
if (isPhysicalSection(sectionVO.getType()) &&
(Objects.isNull(sectionVO.getLengthFact()) ||
sectionVO.getLengthFact() <= 0 ||
Float.isInfinite(sectionVO.getLengthFact()) ||
Float.isNaN(sectionVO.getLengthFact()))) {
errMsgList.add(String.format("区段[%s(%s)]实际距离未设置或不为正数", sectionVO.getName(), sectionVO.getCode()));
} else if (isPhysicalSection(sectionVO.getType())) {
section.setLen(sectionVO.getLengthFact());
}
if (Objects.equals(sectionVO.getType(), BusinessConsts.Section.SectionType.Type02)) { // 逻辑区段
Float startOffset = sectionVO.getLogicSectionStartOffset();
Float endOffset = sectionVO.getLogicSectionEndOffset();
section.setLen(sectionVO.getLengthFact());
if ((Objects.isNull(sectionVO.getLengthFact()) || sectionVO.getLengthFact() <= 0) &&
(Objects.isNull(startOffset) || Objects.isNull(endOffset))) {
errMsgList.add(String.format("逻辑区段[%s(%s)]既没有设置实际长度且所在物理区段起始/终止偏移量也未设置",
section.getName(), section.getCode()));
} else {
float max = Math.max(startOffset, endOffset);
float min = Math.min(startOffset, endOffset);
section.setMaxOffset(max);
section.setMinOffset(min);
}
}
// 所属设备集中站
Station deviceStation = (Station) elementMap.get(sectionVO.getStationCode());
if (Objects.isNull(deviceStation)) {
errMsgList.add(String.format("区段[%s(%s)]未关联设备集中站或设备集中站不存在", section.getName(), section.getCode()));
} else {
section.setDeviceStation(deviceStation);
}
section.setStandTrack(sectionVO.isStandTrack());
section.setTurnBackTrack(sectionVO.isReentryTrack());
section.setFirstTurnBack(sectionVO.isFirstTurnBack());
section.setTransferTrack(sectionVO.isTransferTrack());
if (section.isTransferTrack()) {
if (section.isTurnBackTrack() || section.isStandTrack()) {
errMsgList.add(String.format("区段[%s(%s)]是转换轨,就不能再设置为站台轨或折返轨",
section.getName(), section.getCode()));
}
}
// 是站台轨/折返轨/转换轨校验左右停车点
if ((section.isStandTrack() || section.isTransferTrack() || section.isTurnBackTrack())
&&
(Objects.isNull(sectionVO.getLeftStopPointOffset()) ||
Objects.isNull(sectionVO.getRightStopPointOffset()) ||
(0 == sectionVO.getLeftStopPointOffset().floatValue() &&
0 == sectionVO.getRightStopPointOffset().floatValue()))) {
errMsgList.add(String.format("区段[%s(%s)]是站台轨/折返轨/转换轨却未设置左右停车点偏移量或左右停车点偏移量都为0", sectionVO.getName(), sectionVO.getCode()));
} else {
section.setStopPointLeft(sectionVO.getLeftStopPointOffset());
section.setStopPointRight(sectionVO.getRightStopPointOffset());
}
// 转换轨/折返轨构建关联车站,站台轨在后面处理站台逻辑里做了
if (section.isStandTrack() || section.isTransferTrack() || section.isTurnBackTrack()) {
if (!StringUtils.hasText(sectionVO.getBelongStation())) {
errMsgList.add(String.format("区段[%s(%s)]是站台轨或转换轨或折返轨,却未设置关联车站",
sectionVO.getName(), sectionVO.getCode()));
} else {
//归属车站
Station station = (Station) elementMap.get(sectionVO.getBelongStation());
if (Objects.isNull(station)) {
errMsgList.add(String.format("折返轨/转换轨/站台轨区段[%s(%s)]关联的车站[(%s)]不存在", section.getName(), section.getCode(), sectionVO.getBelongStation()));
} else {
section.setStation(station);
if (section.isTransferTrack()) {
station.addTransferTrack(section);
}
if (section.isTurnBackTrack()) {
station.addTurnBackSection(section);
}
}
}
}
section.setDestinationCode(sectionVO.getDestinationCode());
if (StringUtils.hasText(sectionVO.getDestinationCode())) {
Section section1 = desCodeSectionMap.get(sectionVO.getDestinationCode());
if (Objects.nonNull(section1)) {
errMsgList.add(String.format("区段[%s(%s)]和区段[%s(%s)]目的地码相同[%s],目的地码必须唯一",
section.getName(), section.getCode(),
section1.getName(), section1.getCode(),
sectionVO.getDestinationCode()));
}
desCodeSectionMap.put(sectionVO.getDestinationCode(), section);
}
// 如果区段是计轴区段构建区段虚拟真实计轴器
if (section.isAxleCounter()) {
VirtualRealitySectionAxleCounter axleCounter = new VirtualRealitySectionAxleCounter(section.getCode(), section.getName());
section.setVirtualAxleCounter(axleCounter);
deviceMap.put(axleCounter.getCode(), axleCounter);
}
}
}
private static void buildSignal(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, Map<String, VirtualRealityDevice> deviceMap, List<String> errMsgList) {
List<MapSignalNewVO> signalList = graphData.getSignalList();
@ -1186,8 +1195,16 @@ public class MapDeviceBuilder {
return Objects.equals(type, BusinessConsts.Section.SectionType.Type01) || Objects.equals(type, BusinessConsts.Section.SectionType.Type03);
}
private static boolean isAxleCounterSection(String type) {
return Objects.equals(type, BusinessConsts.Section.SectionType.Type01) || Objects.equals(type, BusinessConsts.Section.SectionType.Type04);
private static boolean isAxleCounterSection(MapSectionNewVO sectionVO, List<MapSectionNewVO> sectionList) {
String type = sectionVO.getType();
if (Objects.equals(type, BusinessConsts.Section.SectionType.Type04))
return true;
if (Objects.equals(type, BusinessConsts.Section.SectionType.Type01)) {
String parentCode = sectionVO.getParentCode();
return sectionList.stream().noneMatch(section -> isCross(section.getType()) && section.getCode().equals(parentCode));
} else {
return false;
}
}
private static boolean isCross(String type) {

View File

@ -88,7 +88,7 @@ public class Section extends MayOutOfOrderDevice {
private Section parent;
/**
* 岔心关联的计轴区段道岔计轴区段关联的道岔区段物理区段关联的逻辑区段
* 岔心关联的物理区段道岔计轴区段关联的道岔区段岔心物理区段关联的逻辑区段
*/
private List<Section> logicList;
@ -740,6 +740,10 @@ public class Section extends MayOutOfOrderDevice {
aSwitch.getC().setNctOccupied(true);
}
}
Section cross = queryCross();
if (cross != null) {
cross.crossJudgeInvalid();
}
} else if (!CollectionUtils.isEmpty(this.logicList)) {
for (Section logic : this.logicList) {
logic.setNctOccupied(true);
@ -778,6 +782,21 @@ public class Section extends MayOutOfOrderDevice {
// }
}
/**
* 岔心判断失效
*/
private void crossJudgeInvalid(){
if (!this.cross)
return;
this.logicList.forEach(logic->{
Section leftSection = logic.getLeftSection();
boolean leftSectionNctOccupied = leftSection.isNctOccupied() && leftSection.getParent().equals(this.parent);
Section rightSection = logic.getRightSection();
boolean rightSectionNctOccupied = rightSection.isNctOccupied() && rightSection.getParent().equals(this.parent);
logic.setNctOccupied(leftSectionNctOccupied || rightSectionNctOccupied);
});
}
/**
* 判定为有效
*/
@ -806,6 +825,13 @@ public class Section extends MayOutOfOrderDevice {
}
}
/**
* 查询道岔计轴区段关联的岔心
*/
private Section queryCross() {
return this.logicList.stream().filter(Section::isCross).limit(1).findAny().orElse(null);
}
/**
* 确认计轴有效
*/
@ -952,12 +978,25 @@ public class Section extends MayOutOfOrderDevice {
if (switchTrack) {
return false;
}
if (virtualAxleCounter == null) {
if (parent != null)
return parent.isPreReset();
Section axleCounterSection = findAxleCounterSection();
if (axleCounterSection != null) {
return axleCounterSection.getVirtualAxleCounter().isPreReset() && this.isNctOccupied();
} else{
return false;
}
}
/**
* 查找计轴区段
* @return
*/
public Section findAxleCounterSection() {
if (this.isAxleCounter()) {
return this;
} else if (parent != null) {
return parent.findAxleCounterSection();
} else {
return virtualAxleCounter.isPreReset();
return null;
}
}

View File

@ -128,6 +128,9 @@ public class VRTrainRunningService {
if (!headAxleCounterSectionNew.isAxleCounter()) {
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (!headAxleCounterSectionNew.isAxleCounter()) { //当是物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
Section headSectionOld = headPosition.getSection();
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样

View File

@ -0,0 +1,25 @@
package club.joylink.rtss.vo.client;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 成都工业使用记录
*/
@Getter
@Setter
@NoArgsConstructor
public class CgyRecordVO {
private long loginCount;
private int browseCount;
private int downloadCount;
public CgyRecordVO(long loginCount, int browseCount, int downloadCount) {
this.loginCount = loginCount;
this.browseCount = browseCount;
this.downloadCount = downloadCount;
}
}

View File

@ -167,9 +167,14 @@ public class MapSectionNewVO {
/**
* 岔心关联计轴区段列表
*/
@ApiModelProperty(value = "岔心关联计轴区段列表")
@ApiModelProperty(value = "岔心关联物理区段列表")
List<String> relateSectionList;
/**
* 道岔计轴区段关联的岔心区段
*/
String relCrossSection;
/**
* 是否站台轨
*/

View File

@ -3,6 +3,7 @@ package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanRouting;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
@ -15,7 +16,6 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -140,6 +140,21 @@ public class RunPlanRoutingVO {
return routing;
}
public static RunPlanRoutingVO fromMapRoutingData(MapRoutingDataVO mapRoutingDataVO,Long mapId){
RunPlanRoutingVO routingVO = new RunPlanRoutingVO();
routingVO.setMapId(mapId);
routingVO.setName(mapRoutingDataVO.getName());
routingVO.setCode(mapRoutingDataVO.getCode());
routingVO.setStartStationCode(mapRoutingDataVO.getStartStationCode());
routingVO.setStartSectionCode(mapRoutingDataVO.getStartSectionCode());
routingVO.setEndStationCode(mapRoutingDataVO.getEndStationCode());
routingVO.setEndSectionCode(mapRoutingDataVO.getEndSectionCode());
routingVO.setRight(mapRoutingDataVO.getRight());
routingVO.setDestinationCode(mapRoutingDataVO.getDestinationCode());
routingVO.setRemarks(mapRoutingDataVO.getDescription());
routingVO.setParkSectionCodeList(JsonUtils.readCollection(JsonUtils.writeValueAsString(mapRoutingDataVO.getParkSectionCodeList()), List.class, RunPlanRoutingSection.class));
return routingVO;
}
// public RunPlanRoutingVO generateLoopRoutingBasicData(){
// RunPlanRoutingVO routing = new RunPlanRoutingVO();
// routing.setMapId(mapId);
@ -186,7 +201,26 @@ public class RunPlanRoutingVO {
startTbFront = startReentrySection.isReentryTrack() && startReentrySection.isStandTrack();
}
}
public enum UserRoutingType{
private final static String LOOP_MARK = "-LOOP";
@JsonIgnore
public RunPlanRoutingVO getRoutingDataLoop() {
RunPlanRoutingVO routing = new RunPlanRoutingVO();
routing.setMapId(mapId);
routing.setUserId(userId);
routing.setName(name);
routing.setCode(code + LOOP_MARK);
routing.setRoutingType(routingType);
routing.setStartStationCode(endStationCode);
routing.setStartSectionCode(endSectionCode);
routing.setEndStationCode(startStationCode);
routing.setEndSectionCode(startSectionCode);
routing.setRight(!right);
routing.setRemarks(remarks + LOOP_MARK);
return routing;
}
public enum UserRoutingType {
OUTBOUND,
INBOUND,
LOOP,

View File

@ -0,0 +1,181 @@
<?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.CgyRecordDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CgyRecord">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="browse_count" jdbcType="INTEGER" property="browseCount" />
<result column="download_count" jdbcType="INTEGER" property="downloadCount" />
</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, browse_count, download_count
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from cgy_record
<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.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cgy_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from cgy_record
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample">
delete from cgy_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CgyRecord" useGeneratedKeys="true">
insert into cgy_record (browse_count, download_count)
values (#{browseCount,jdbcType=INTEGER}, #{downloadCount,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CgyRecord" useGeneratedKeys="true">
insert into cgy_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="browseCount != null">
browse_count,
</if>
<if test="downloadCount != null">
download_count,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="browseCount != null">
#{browseCount,jdbcType=INTEGER},
</if>
<if test="downloadCount != null">
#{downloadCount,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample" resultType="java.lang.Long">
select count(*) from cgy_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update cgy_record
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.browseCount != null">
browse_count = #{record.browseCount,jdbcType=INTEGER},
</if>
<if test="record.downloadCount != null">
download_count = #{record.downloadCount,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update cgy_record
set id = #{record.id,jdbcType=INTEGER},
browse_count = #{record.browseCount,jdbcType=INTEGER},
download_count = #{record.downloadCount,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CgyRecord">
update cgy_record
<set>
<if test="browseCount != null">
browse_count = #{browseCount,jdbcType=INTEGER},
</if>
<if test="downloadCount != null">
download_count = #{downloadCount,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CgyRecord">
update cgy_record
set browse_count = #{browseCount,jdbcType=INTEGER},
download_count = #{downloadCount,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>