轨道交通项目迁出问题修改2
This commit is contained in:
parent
d761ef143b
commit
4f0dd338dd
@ -35,6 +35,7 @@ public enum BusinessExceptionAssertEnum implements BusinessExceptionAssert {
|
||||
CI_GENERATE_ERROR(11001, "ci data generate error"),
|
||||
MAP_PASSENGER_FLOW_DATA_ERROR(11002, "map passenger flow data error"),
|
||||
DATA_UNIQUE_PROPERTY_REPEAT(10013, "data unique property repeat"),
|
||||
DATA_BEEN_USED(11005, "data has been used"),
|
||||
|
||||
// 运行图工具
|
||||
BEYOND_RECEPTION(101, "beyond station reception"),
|
||||
|
@ -1,24 +0,0 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.vo.client.BaseUserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* websocket消息推送服务
|
||||
*/
|
||||
public interface IMessagePushService {
|
||||
|
||||
boolean push(SocketMessageVO messageVO);
|
||||
|
||||
boolean push(String user, SocketMessageVO messageVO);
|
||||
|
||||
void push(Collection<String> user, SocketMessageVO messageVO);
|
||||
|
||||
void push2User(BaseUserVO user, SocketMessageVO messageVO);
|
||||
|
||||
void push2User(List<? extends BaseUserVO> userList, SocketMessageVO messageVO);
|
||||
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.simulation.UserSimulationCache;
|
||||
import club.joylink.rtss.simulation.websocket.entity.SubscribeDestination;
|
||||
import club.joylink.rtss.vo.client.BaseUserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MessagePushService implements IMessagePushService {
|
||||
|
||||
@Autowired
|
||||
private UserSimulationCache userSimulationCache;
|
||||
|
||||
@Autowired
|
||||
private SimpMessagingTemplate simpMessagingTemplate;
|
||||
|
||||
@Override
|
||||
public boolean push(SocketMessageVO messageVO) {
|
||||
if (Objects.nonNull(messageVO) && Objects.nonNull(messageVO.getBody())) {
|
||||
if (!(messageVO.getBody() instanceof Collection) || !CollectionUtils.isEmpty((Collection<?>) messageVO.getBody())) {
|
||||
Object send = getPayload(messageVO);
|
||||
boolean push = false;
|
||||
for (Object topic : messageVO.getTopicList()) {
|
||||
this.simpMessagingTemplate.convertAndSend((String) topic, send);
|
||||
log.info("broadcast to destination {} success.",topic);
|
||||
push = true;
|
||||
}
|
||||
return push;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Object getPayload(SocketMessageVO messageVO) {
|
||||
Object send = messageVO;
|
||||
if (messageVO.getBody() instanceof String) {
|
||||
String body = (String) messageVO.getBody();
|
||||
if (!body.startsWith("{") && !body.startsWith("[")) {
|
||||
body = JSONObject.quote(body);
|
||||
}
|
||||
send = "{\"type\":\"" + messageVO.getType() + "\",\"body\":" + body + "}";
|
||||
}
|
||||
return send;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean push(String user, SocketMessageVO messageVO) {
|
||||
if (Objects.nonNull(messageVO) && Objects.nonNull(messageVO.getBody()) && StringUtils.hasText(user)) {
|
||||
if (!(messageVO.getBody() instanceof Collection) || !CollectionUtils.isEmpty((Collection<?>) messageVO.getBody())) {
|
||||
Object send = getPayload(messageVO);
|
||||
boolean push = false;
|
||||
for (Object o : messageVO.getTopicList()) {
|
||||
String topic = (String) o;
|
||||
Set<SubscribeDestination> subDestList = this.userSimulationCache.getSubDestsByUserId(user);
|
||||
if (!CollectionUtils.isEmpty(subDestList)) { // 用户订阅了topic
|
||||
for (SubscribeDestination subscribeDestination : subDestList) {
|
||||
if (subscribeDestination.getDestination().equals(topic)) {
|
||||
this.simpMessagingTemplate.convertAndSendToUser(user, topic, send);
|
||||
push = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
push = false;
|
||||
}
|
||||
}
|
||||
return push;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void push(Collection<String> userList, SocketMessageVO messageVO) {
|
||||
if (!CollectionUtils.isEmpty(userList)) {
|
||||
userList.forEach(user -> this.push(user, messageVO));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void push2User(BaseUserVO user, SocketMessageVO messageVO) {
|
||||
this.push(user.getIdStr(), messageVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void push2User(List<? extends BaseUserVO> userList, SocketMessageVO messageVO) {
|
||||
if (!CollectionUtils.isEmpty(userList)) {
|
||||
userList.forEach(userVO -> this.push2User(userVO, messageVO));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.dao.OrganizationDAO;
|
||||
import club.joylink.rtss.entity.Organization;
|
||||
import club.joylink.rtss.entity.OrganizationExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.client.OrganizationVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -34,18 +33,15 @@ public class OrganizationService implements IOrganizationService {
|
||||
@Override
|
||||
public OrganizationVO queryOrganizationById(Long id) {
|
||||
Organization organization = this.organizationDAO.selectByPrimaryKey(id);
|
||||
if(null == organization) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(organization);
|
||||
return new OrganizationVO(organization);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrganizationVO getById(Long id) {
|
||||
Organization organization = organizationDAO.selectByPrimaryKey(id);
|
||||
if (organization == null) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的组织/机构不存在", id));
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(organization,
|
||||
String.format("id为[%s]的组织/机构不存在", id));
|
||||
return new OrganizationVO(organization);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.dao.RealLineDAO;
|
||||
import club.joylink.rtss.entity.RealLine;
|
||||
import club.joylink.rtss.entity.RealLineExample;
|
||||
@ -33,9 +32,7 @@ public class RealLineService implements IRealLineService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(RealLineVO skinVO, UserVO userVO) {
|
||||
if (checkCodeExist(skinVO.getCode())) {
|
||||
throw new DBException(ExceptionMapping.DATA_EXISTS);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(checkCodeExist(skinVO.getCode()));
|
||||
RealLine realLine = skinVO.convert2DB();
|
||||
realLine.setCreateTime(LocalDateTime.now());
|
||||
realLine.setCreatorId(userVO.getId());
|
||||
@ -85,9 +82,7 @@ public class RealLineService implements IRealLineService {
|
||||
RealLineExample example = new RealLineExample();
|
||||
example.createCriteria().andCodeEqualTo(code);
|
||||
List<RealLine> realLineList = this.realLineDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(realLineList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(realLineList);
|
||||
return new RealLineVO(realLineList.get(0));
|
||||
}
|
||||
|
||||
@ -95,9 +90,7 @@ public class RealLineService implements IRealLineService {
|
||||
@Transactional
|
||||
public void update(Long id, RealLineVO skinVO, UserVO userVO) {
|
||||
RealLine realLine = this.realLineDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(realLine)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(realLine);
|
||||
realLine.setName(skinVO.getName());
|
||||
realLine.setUpdateTime(LocalDateTime.now());
|
||||
realLine.setUpdaterId(userVO.getId());
|
||||
@ -112,9 +105,7 @@ public class RealLineService implements IRealLineService {
|
||||
}
|
||||
// 判断地图是否使用
|
||||
List<MapVO> mapList = this.iMapService.getMapListByLineCode(realLine.getCode());
|
||||
if (!CollectionUtils.isEmpty(mapList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_EXISTS);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_BEEN_USED.assertCollectionEmpty(mapList);
|
||||
this.realLineDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@ -138,9 +129,7 @@ public class RealLineService implements IRealLineService {
|
||||
RealLineExample example = new RealLineExample();
|
||||
example.createCriteria().andCodeEqualTo(code);
|
||||
List<RealLine> realLines = this.realLineDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(realLines)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(realLines);
|
||||
RealLine realLine = realLines.get(0);
|
||||
realLine.setUpdaterId(userVO.getId());
|
||||
realLine.setCreateTime(LocalDateTime.now());
|
||||
@ -151,9 +140,7 @@ public class RealLineService implements IRealLineService {
|
||||
@Transactional
|
||||
public void saveLineConfig(Long id, RealLineConfigVO configVO) {
|
||||
RealLine realLine = this.realLineDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(realLine)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(realLine);
|
||||
realLine.setConfigData(JsonUtils.writeValueAsString(configVO));
|
||||
this.realLineDAO.updateByPrimaryKeyWithBLOBs(realLine);
|
||||
}
|
||||
@ -162,8 +149,8 @@ public class RealLineService implements IRealLineService {
|
||||
public RealLineConfigVO getLineConfigById(Long id) {
|
||||
RealLine realLine = this.realLineDAO.selectByPrimaryKey(id);
|
||||
RealLineConfigVO lineConfigVO = new RealLineConfigVO();
|
||||
if (Objects.isNull(realLine)) throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
if (StringUtils.isBlank(realLine.getConfigData())) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(realLine);
|
||||
if (!StringUtils.hasText(realLine.getConfigData())) {
|
||||
realLine.setConfigData(JsonUtils.writeValueAsString(lineConfigVO));
|
||||
this.realLineDAO.updateByPrimaryKeyWithBLOBs(realLine);
|
||||
}
|
||||
@ -175,10 +162,7 @@ public class RealLineService implements IRealLineService {
|
||||
RealLineExample example = new RealLineExample();
|
||||
example.createCriteria().andCodeEqualTo(lineCode);
|
||||
List<RealLine> realLineList = this.realLineDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(realLineList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST,
|
||||
String.format("code为[%s]的线路数据不存在", lineCode));
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(realLineList, String.format("code为[%s]的线路数据不存在", lineCode));
|
||||
RealLine realLine = realLineList.get(0);
|
||||
if (Objects.nonNull(realLine.getConfigData())) {
|
||||
return RealLineConfigVO.parseJsonStr(realLine.getConfigData());
|
||||
@ -191,10 +175,8 @@ public class RealLineService implements IRealLineService {
|
||||
RealLineExample example = new RealLineExample();
|
||||
example.createCriteria().andCodeEqualTo(lineCode);
|
||||
List<RealLine> realLineList = this.realLineDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(realLineList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST,
|
||||
String.format("code为[%s]的线路数据不存在", lineCode));
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(realLineList,
|
||||
String.format("code为[%s]的线路数据不存在", lineCode));
|
||||
RealLine realLine = realLineList.get(0);
|
||||
RealLineVO realLineVO = new RealLineVO(realLine);
|
||||
realLineVO.setConfigVO(RealLineConfigVO.parseJsonStr(realLine.getConfigData()));
|
||||
|
@ -1,10 +1,5 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.SysDictionaryDetailMapper;
|
||||
import club.joylink.rtss.dao.SysDictionaryMapper;
|
||||
@ -13,13 +8,15 @@ import club.joylink.rtss.entity.SysDictionaryDetail;
|
||||
import club.joylink.rtss.entity.SysDictionaryDetailExample;
|
||||
import club.joylink.rtss.entity.SysDictionaryExample;
|
||||
import club.joylink.rtss.entity.SysDictionaryExample.Criteria;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.client.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -56,9 +53,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void createDic(DictionaryVO dicVO) {
|
||||
if(checkByCode(dicVO.getCode())) {
|
||||
throw new DBException(ExceptionMapping.CODE_REPEAT);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(checkByCode(dicVO.getCode()));
|
||||
SysDictionary sysDic = new SysDictionary(dicVO);
|
||||
this.sysDictionaryMapper.insertSelective(sysDic);
|
||||
}
|
||||
@ -67,18 +62,16 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
public boolean checkByCode(String code) {
|
||||
SysDictionaryExample example = new SysDictionaryExample();
|
||||
example.createCriteria().andCodeEqualTo(code);
|
||||
List<SysDictionary> list = this.sysDictionaryMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(list)) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.sysDictionaryMapper.countByExample(example) > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictionaryVO queryData(Long id) {
|
||||
SysDictionary dic = this.sysDictionaryMapper.selectByPrimaryKey(id);
|
||||
if(null == dic) throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(dic);
|
||||
DictionaryVO dicVo = new DictionaryVO(dic);
|
||||
return dicVo;
|
||||
}
|
||||
@ -87,12 +80,8 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
@Transactional
|
||||
public void updateDic(Long id, DictionaryVO dicVo) {
|
||||
SysDictionary dic = this.sysDictionaryMapper.selectByPrimaryKey(id);
|
||||
if(null == dic) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
if(!StringUtils.isEmpty(dicVo.getCode()) && !dic.getCode().equals(dicVo.getCode())) {
|
||||
throw new BusinessException(ExceptionMapping.CODE_CANNOT_UPDATE);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(dic);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(dic.getCode(), dicVo.getCode());
|
||||
dic.setName(dicVo.getName());
|
||||
dic.setStatus(dicVo.getStatus());
|
||||
this.sysDictionaryMapper.updateByPrimaryKeySelective(dic);
|
||||
@ -134,14 +123,9 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
@Transactional
|
||||
public void createDicDetail(DictionaryDetailVO detailVo) {
|
||||
SysDictionary dic = this.sysDictionaryMapper.selectByPrimaryKey(detailVo.getDicId());
|
||||
if(null == dic) {
|
||||
log.warn("字典目录数据不存在");
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
if(checkDetailByCode(detailVo.getDicId(), detailVo.getCode())) {
|
||||
log.warn("字典明细同一目录下code相同的数据已存在");
|
||||
throw new DBException(ExceptionMapping.DATA_EXISTS);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(dic);
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(checkDetailByCode(detailVo.getDicId(), detailVo.getCode()),
|
||||
"字典明细同一目录下code相同的数据已存在");
|
||||
SysDictionaryDetail dicDetail = new SysDictionaryDetail(detailVo);
|
||||
this.sysDictionaryDetailMapper.insert(dicDetail);
|
||||
}
|
||||
@ -150,18 +134,17 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
public boolean checkDetailByCode(Long dicId, String code) {
|
||||
SysDictionaryDetailExample example = new SysDictionaryDetailExample();
|
||||
example.createCriteria().andDicIdEqualTo(dicId).andCodeEqualTo(code);
|
||||
List<SysDictionaryDetail> dicDetail = this.sysDictionaryDetailMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(dicDetail)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if (this.sysDictionaryDetailMapper.countByExample(example) > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictionaryDetailVO getDetailData(Long dicId, Long id) {
|
||||
SysDictionaryDetail dicDetail = this.sysDictionaryDetailMapper.selectByPrimaryKey(id);
|
||||
if(null == dicDetail || !dicDetail.getDicId().equals(dicId)) throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(dicDetail);
|
||||
DictionaryDetailVO detailVo = new DictionaryDetailVO(dicDetail);
|
||||
return detailVo;
|
||||
}
|
||||
@ -170,12 +153,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
@Transactional
|
||||
public void updateDicDetail(Long id, DictionaryDetailVO detailVo) {
|
||||
SysDictionaryDetail dicDetail = this.sysDictionaryDetailMapper.selectByPrimaryKey(id);
|
||||
if(null == dicDetail) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
if(!dicDetail.getCode().equals(detailVo.getCode())) {
|
||||
throw new DBException(ExceptionMapping.CODE_CANNOT_UPDATE);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(dicDetail);
|
||||
dicDetail.setName(detailVo.getName());
|
||||
dicDetail.setStatus(detailVo.getStatus());
|
||||
this.sysDictionaryDetailMapper.updateByPrimaryKeySelective(dicDetail);
|
||||
@ -192,7 +170,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
||||
SysDictionaryExample example = new SysDictionaryExample();
|
||||
example.createCriteria().andCodeEqualTo(code).andStatusEqualTo(BusinessConsts.STATUS_USE);
|
||||
List<SysDictionary> dicList = this.sysDictionaryMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(dicList)) throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(dicList);
|
||||
SysDictionary dic = dicList.get(0);
|
||||
SysDictionaryDetailExample detailExample = new SysDictionaryDetailExample();
|
||||
detailExample.createCriteria().andDicIdEqualTo(dic.getId()).andStatusEqualTo(BusinessConsts.STATUS_USE);
|
||||
|
@ -1,10 +1,10 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.configuration.configProp.TencentCloudConfig;
|
||||
import club.joylink.rtss.constants.TencentSMSTemplate;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.util.RandomGenerator;
|
||||
import club.joylink.rtss.vo.InternationalMobile;
|
||||
import club.joylink.rtss.vo.SmsResponse;
|
||||
@ -12,7 +12,6 @@ import club.joylink.rtss.vo.tc.TcMultiSmsReq;
|
||||
import club.joylink.rtss.vo.tc.TcSendsmsResp;
|
||||
import club.joylink.rtss.vo.tc.TcSmsReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -39,10 +38,8 @@ public class TcSmsService implements ISmsService {
|
||||
private TencentCloudConfig tencentCloudConfig;
|
||||
|
||||
private SmsResponse sendToOneOnTpl(TencentSMSTemplate template, String mobile, String nationCode, List<String> params, long ts) {
|
||||
if(!template.validateParamsCount(params.size())) {
|
||||
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL,
|
||||
String.format("模板需要的参数数量和实际传递参数数量不一致:require[%s],actual[%s]", template.getParamsCount(), params.size()));
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(template.validateParamsCount(params.size()),
|
||||
String.format("模板需要的参数数量和实际传递参数数量不一致:require[%s],actual[%s]", template.getParamsCount(), params.size()));
|
||||
SmsResponse sr = new SmsResponse();
|
||||
sr.setMobile(mobile);
|
||||
sr.setNationcode(nationCode);
|
||||
@ -59,8 +56,7 @@ public class TcSmsService implements ISmsService {
|
||||
reqObj.setTel(new InternationalMobile(mobile, nationCode));
|
||||
reqObj.setParams(params);
|
||||
reqObj.setSig(sig);
|
||||
JSONObject jo = new JSONObject(reqObj);
|
||||
String reqJson = jo.toString();
|
||||
String reqJson = JsonUtils.writeValueAsString(reqObj);
|
||||
log.info(String.format("发送短信请求到%s %s: %s", nationCode, mobile, reqJson));
|
||||
// 发送短信请求
|
||||
TcSendsmsResp resp = restTemplate.postForObject(url, reqJson, TcSendsmsResp.class);
|
||||
@ -72,10 +68,8 @@ public class TcSmsService implements ISmsService {
|
||||
|
||||
private SmsResponse sendToMultiOnTpl(TencentSMSTemplate template, List<InternationalMobile> internationalMobileList, List<String> params) {
|
||||
if(CollectionUtils.isEmpty(internationalMobileList)) return null;
|
||||
if(!template.validateParamsCount(params.size())) {
|
||||
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL,
|
||||
String.format("模板需要的参数数量和实际传递参数数量不一致:require[%s],actual[%s]", template.getParamsCount(), params.size()));
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(template.validateParamsCount(params.size()),
|
||||
String.format("模板需要的参数数量和实际传递参数数量不一致:require[%s],actual[%s]", template.getParamsCount(), params.size()));
|
||||
if(!tencentCloudConfig.getAllowSend()) {
|
||||
return null;
|
||||
}
|
||||
@ -96,8 +90,7 @@ public class TcSmsService implements ISmsService {
|
||||
reqObj.setTel(internationalMobileList);
|
||||
reqObj.setParams(params);
|
||||
reqObj.setSig(sig);
|
||||
JSONObject jo = new JSONObject(reqObj);
|
||||
String reqJson = jo.toString();
|
||||
String reqJson = JsonUtils.writeValueAsString(reqObj);
|
||||
log.info("发送短信请求: " + reqJson);
|
||||
// 发送短信请求
|
||||
TcSendsmsResp resp = restTemplate.postForObject(url, reqJson, TcSendsmsResp.class);
|
||||
|
@ -1,7 +1,5 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.UserExamMapper;
|
||||
import club.joylink.rtss.dao.UserTrainingStatsMapper;
|
||||
@ -9,6 +7,8 @@ import club.joylink.rtss.entity.UserExam;
|
||||
import club.joylink.rtss.entity.UserExamExample;
|
||||
import club.joylink.rtss.entity.UserTrainingStats;
|
||||
import club.joylink.rtss.entity.UserTrainingStatsExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.user.IUserSimulationStatService;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.LessonVO;
|
||||
import club.joylink.rtss.vo.client.UsageTotalStatsVO;
|
||||
@ -60,9 +60,7 @@ public class UserUsageStatsService implements IUserUsageStatsService {
|
||||
@Override
|
||||
public List<UserRankStatsVO> personalLessonStats(Long lessonId, UserVO userVO) {
|
||||
List<UserRankStatsVO> rankList = this.userTrainingStatsMapper.selectStatsByLessonId(lessonId, userVO.getId());
|
||||
if(CollectionUtils.isEmpty(rankList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(rankList);
|
||||
return rankList;
|
||||
}
|
||||
|
||||
@ -91,9 +89,7 @@ public class UserUsageStatsService implements IUserUsageStatsService {
|
||||
.andResultNotEqualTo(BusinessConsts.Exam.Result.Result01)
|
||||
.andResultNotEqualTo(BusinessConsts.Exam.Result.Result04);
|
||||
List<UserExam> userExamList = this.userExamMapper.selectByExample(examExample);
|
||||
if(userExamList == null || userExamList.isEmpty()) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(userExamList);
|
||||
userExamList.forEach(userExam -> {
|
||||
UserRankStatsVO userRankStatsVO = new UserRankStatsVO();
|
||||
userRankStatsVO.setExamTime(userExam.getEndTime());
|
||||
@ -147,9 +143,7 @@ public class UserUsageStatsService implements IUserUsageStatsService {
|
||||
}
|
||||
|
||||
public static void addMyRank(List<UserRankStatsVO> rankList, UserVO userVO) {
|
||||
if(CollectionUtils.isEmpty(rankList)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(rankList);
|
||||
for(int i = 0; i < rankList.size(); i++) {
|
||||
if(rankList.get(i).getUserId().equals(userVO.getId())) {
|
||||
// rankList.subList(0, Math.min(rankList.size(), RANK_NUM));
|
||||
|
@ -1,7 +1,6 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.cache.ICacheService;
|
||||
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
||||
import club.joylink.rtss.vo.wx.WmUserSession;
|
||||
@ -12,6 +11,7 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 和微信对接api的服务
|
||||
@ -32,7 +32,7 @@ public class WxApiService implements IWxApiService {
|
||||
public WxApiService(RestTemplate restTemplate, WeChatConfig weChatConfig, ICacheService iCacheService) {
|
||||
this.restTemplate = restTemplate;
|
||||
this.weChatConfig = weChatConfig;
|
||||
this.iCacheService = ICacheService;
|
||||
this.iCacheService = iCacheService;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,17 +42,13 @@ public class WxApiService implements IWxApiService {
|
||||
*/
|
||||
@Override
|
||||
public WmUserSession getWmUserSession(String wmCode) {
|
||||
if(StringUtils.isEmpty(wmCode)) {
|
||||
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "wmCode不能为空");
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(wmCode,"wmCode不能为空");
|
||||
WmUserSession wmUserSession = (WmUserSession) this.iCacheService.get(WmUserSession.getCacheKey(wmCode));
|
||||
if(Objects.isNull(wmUserSession)) {
|
||||
wmUserSession = restTemplate.getForObject(weChatConfig.getCode2SessionUrl(wmCode), WmUserSession.class);
|
||||
if(StringUtils.isEmpty(wmUserSession.getOpenid())) {
|
||||
throw new BusinessException(wmUserSession.getErrcode(),
|
||||
String.format("小程序code为:‘%s’,微信返回的错误消息:errcode:'%s', errmsg:‘%s’", wmCode, wmUserSession.getErrcode(), wmUserSession.getErrmsg()));
|
||||
}
|
||||
ICacheService.put(WmUserSession.getCacheKey(wmCode), wmUserSession);
|
||||
BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.assertHasText(wmUserSession.getOpenid(),
|
||||
String.format("小程序code为:‘%s’,微信返回的错误消息:errcode:'%s', errmsg:‘%s’", wmCode, wmUserSession.getErrcode(), wmUserSession.getErrmsg()));
|
||||
iCacheService.putExpired(WmUserSession.getCacheKey(wmCode), wmUserSession, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
return wmUserSession;
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
package club.joylink.rtss.services.draftData;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.dao.DraftIbpDAO;
|
||||
import club.joylink.rtss.entity.DraftIbp;
|
||||
import club.joylink.rtss.entity.DraftIbpExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.publishData.IbpService;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -15,9 +11,11 @@ import club.joylink.rtss.vo.client.ibp.IbpCopyVO;
|
||||
import club.joylink.rtss.vo.client.ibp.IbpCreateVO;
|
||||
import club.joylink.rtss.vo.client.ibp.IbpQueryVO;
|
||||
import club.joylink.rtss.vo.client.ibp.IbpVO;
|
||||
import org.springframework.util.StringUtils;
|
||||
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.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -94,18 +92,14 @@ public class DraftIbpServiceImpl implements DraftIbpService {
|
||||
@Override
|
||||
public void publish(Long id, UserVO user) {
|
||||
IbpVO ibpVO = this.getById(id);
|
||||
if (StringUtils.isBlank(ibpVO.getData())) {
|
||||
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "绘图数据不能为空");
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertHasText(ibpVO.getData(), "绘图数据不能为空");
|
||||
this.ibpService.publish(ibpVO, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IbpVO getById(Long id) {
|
||||
DraftIbp draftIbp = this.draftIbpDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(draftIbp)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(draftIbp);
|
||||
return new IbpVO(draftIbp);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
package club.joylink.rtss.services.draftData;
|
||||
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||
@ -37,10 +35,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
// 先校验地图基础数据
|
||||
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
|
||||
if (!CollectionUtils.isEmpty(buildResult.getErrMsgList())) {
|
||||
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION,
|
||||
String.format("地图基础数据有错误"));
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
String.format("地图基础数据有错误"));
|
||||
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
// 联锁关系数据生成
|
||||
@ -573,7 +569,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
}
|
||||
// 未生成过,生成
|
||||
Station routingStation = (Station) deviceMap.get(stationCode);
|
||||
BusinessExceptionAssertEnum.MAP_DATA_ERROR.assertNotNull(routingStation);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(routingStation);
|
||||
List<Section> otherSectionList = stationSectionMap.get(routingStation.getCode());
|
||||
if (CollectionUtils.isEmpty(otherSectionList)) {
|
||||
log.warn(String.format("车站[%s(%s)]没有折返轨和转换轨", routingStation.getName(), routingStation.getCode()));
|
||||
@ -2053,10 +2049,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION,
|
||||
throw BusinessExceptionAssertEnum.DATA_ERROR.exception(
|
||||
String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
|
||||
section.getName(), section.getCode(),
|
||||
relSwitch.getName(), relSwitch.getCode()));
|
||||
section.getName(), section.getCode(),
|
||||
relSwitch.getName(), relSwitch.getCode()));
|
||||
}
|
||||
} else {
|
||||
tempPath.addSection(section);
|
||||
|
@ -1,9 +1,8 @@
|
||||
package club.joylink.rtss.services.publishData;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.joylink.base.exception.DBException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.dao.IbpDAO;
|
||||
import club.joylink.rtss.entity.Ibp;
|
||||
import club.joylink.rtss.entity.IbpExample;
|
||||
@ -61,9 +60,7 @@ public class IbpServiceImpl implements IbpService {
|
||||
@Override
|
||||
public IbpVO getById(Long id) {
|
||||
Ibp ibp = this.ibpDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(ibp)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ibp);
|
||||
return new IbpVO(ibp);
|
||||
}
|
||||
|
||||
@ -79,9 +76,7 @@ public class IbpServiceImpl implements IbpService {
|
||||
@Override
|
||||
public IbpVO getBy(IbpQueryVO queryVO) {
|
||||
Ibp ibp = this.queryEntityBy(queryVO.getMapId(), queryVO.getStationCode());
|
||||
if (Objects.isNull(ibp)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ibp);
|
||||
return new IbpVO(ibp);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
package club.joylink.rtss.services.training.generatornew.base;
|
||||
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Cycle;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
|
||||
import club.joylink.rtss.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package club.joylink.rtss.services.training.generatornew.base;
|
||||
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package club.joylink.rtss.services.training.generatornew.base;
|
||||
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package club.joylink.rtss.services.training.generatornew.base;
|
||||
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||
import club.joylink.rtss.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package club.joylink.rtss.services.training.generatornew.base;
|
||||
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsSectionService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
|
||||
import club.joylink.rtss.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package club.joylink.rtss.services.voice.baidu;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
@ -9,6 +9,8 @@ import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 百度语音识别服务调用(当前为极速版)
|
||||
@ -40,7 +42,7 @@ public class AsrService {
|
||||
byte[] content = getFileContent(file);
|
||||
String speech = base64Encode(content);
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("dev_pid", DEV_PID);
|
||||
params.put("format", FORMAT);
|
||||
params.put("rate", RATE);
|
||||
@ -49,13 +51,14 @@ public class AsrService {
|
||||
params.put("channel", "1");
|
||||
params.put("len", content.length);
|
||||
params.put("speech", speech);
|
||||
String json = JsonUtils.writeValueAsString(params);
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(ASR_URL).openConnection();
|
||||
conn.setConnectTimeout(10000);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.getOutputStream().write(params.toString().getBytes());
|
||||
conn.getOutputStream().write(json.getBytes());
|
||||
conn.getOutputStream().close();
|
||||
String result = ConnUtil.getResponseString(conn);
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
package club.joylink.rtss.services.voice.baidu;
|
||||
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* token的获取类
|
||||
@ -121,23 +122,32 @@ public class TokenHolder {
|
||||
|
||||
/**
|
||||
* @param result token接口获得的result
|
||||
* result示例:
|
||||
* {
|
||||
* "access_token": "1.a6b7dbd428f731035f771b8d********.86400.1292922000-2346678-124328",
|
||||
* "expires_in": 86400,
|
||||
* "refresh_token": "2.385d55f8615fdfd9edb7c4b********.604800.1293440400-2346678-124328",
|
||||
* "scope": "public audio_voice_assistant_get 。。。",
|
||||
* "session_key": "ANXxSNjwQDugf8615Onqeik********CdlLxn",
|
||||
* "session_secret": "248APxvxjCZ0VEC********aK4oZExMB",
|
||||
* }
|
||||
*/
|
||||
private void parseJson(String result) {
|
||||
JSONObject json = new JSONObject(result);
|
||||
if (!json.has("access_token")) {
|
||||
Map<String, Object> map = JsonUtils.read(result, JsonUtils.getCollectionType(Map.class, String.class, Object.class));
|
||||
if (!map.containsKey("access_token")) {
|
||||
// 返回没有access_token字段
|
||||
throw new RuntimeException("access_token not obtained, " + result);
|
||||
}
|
||||
if (!json.has("scope")) {
|
||||
if (!map.containsKey("scope")) {
|
||||
// 返回没有scope字段
|
||||
throw new RuntimeException("scopenot obtained, " + result);
|
||||
}
|
||||
// scope = null, 忽略scope检查
|
||||
|
||||
if (scope != null && !json.getString("scope").contains(scope)) {
|
||||
if (scope != null && !((String)map.get("scope")).contains(scope)) {
|
||||
throw new RuntimeException("scope not exist, " + scope + "," + result);
|
||||
}
|
||||
token = json.getString("access_token");
|
||||
expiresAt = System.currentTimeMillis() + json.getLong("expires_in") * 1000;
|
||||
token = (String)map.get("access_token");
|
||||
expiresAt = System.currentTimeMillis() + ((Long)map.get("expires_in")) * 1000;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import club.joylink.rtss.simulation.cbtc.data.vo.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationOperationMessageEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.event.simulation.DeviceStatusChangeEvent;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
@ -56,7 +55,6 @@ public class ATSMessageCollectAndDispatcher {
|
||||
this.stompMessageService.sendToUser(sessions, deviceStatusMessage);
|
||||
// long end = System.currentTimeMillis();
|
||||
// System.out.println(String.format("收集并发送设备状态用时: [%s ms]", (end - start)));
|
||||
applicationContext.publishEvent(new DeviceStatusChangeEvent(this,simulation, filterList));
|
||||
}
|
||||
|
||||
private void trainTracking(Simulation simulation) {
|
||||
|
@ -5,7 +5,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@ -34,14 +34,14 @@ public class TrainTypeUpdateParam {
|
||||
}
|
||||
switch (this.type) {
|
||||
case PLAN:{
|
||||
if (StringUtils.isBlank(this.serviceNumber)) {
|
||||
if (!StringUtils.hasText(this.serviceNumber)) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||
String.format("服务号不能为空"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEAD:{
|
||||
if (StringUtils.isBlank(this.destinationCode)) {
|
||||
if (!StringUtils.hasText(this.destinationCode)) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||
String.format("目的地号不能为空"));
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -125,7 +125,7 @@ public class AtsStandService {
|
||||
public void setJumpStop(Simulation simulation, String standCode, String trainGroupNumber) {
|
||||
Stand stand = getStand(simulation, standCode);
|
||||
//TrainCodes为空?全部跳停:指定列车跳停
|
||||
if (StringUtils.isBlank(trainGroupNumber)) {
|
||||
if (!StringUtils.hasText(trainGroupNumber)) {
|
||||
stand.setAllSkip(true);
|
||||
stand.getSkipSet().clear();
|
||||
} else {
|
||||
@ -203,7 +203,7 @@ public class AtsStandService {
|
||||
if (!stand.isJumpStop()) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Repetition);
|
||||
}
|
||||
if (StringUtils.isBlank(trainGroupNumber)) { //如果是取消站台跳停
|
||||
if (!StringUtils.hasText(trainGroupNumber)) { //如果是取消站台跳停
|
||||
stand.setAllSkip(false);
|
||||
stand.getSkipSet().clear();
|
||||
} else { //如果是取消指定列车跳停
|
||||
|
@ -154,7 +154,7 @@ public class AtsStationService {
|
||||
boolean exist = tempTargetMembers.stream().anyMatch(m ->
|
||||
{
|
||||
if (Objects.equals(s, m.getDevice().getCode())) {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("stationCodes", Arrays.asList(s));
|
||||
atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(),
|
||||
new HashSet<>(Collections.singleton(m)), operate, params, null));
|
||||
@ -171,12 +171,12 @@ public class AtsStationService {
|
||||
}
|
||||
//无人车站由机器人处理
|
||||
SimulationMember robotStationMember = targetMembers.stream().filter(t -> t.isRobot()).findFirst().orElse(null);
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("stationCodes", robotStations);
|
||||
atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(robotStationMember)), operate, params, null));
|
||||
} else {
|
||||
//现地请求,直接推送给中心调度员
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("stationCodes", stationCodes);
|
||||
atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), new HashSet<>(targetMembers), operate, params, null));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package club.joylink.rtss.simulation.cbtc;
|
||||
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.services.auth.ProjectDeviceLogoutEvent;
|
||||
import club.joylink.rtss.services.auth.UserLogoutEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1IbpConfig;
|
||||
@ -15,8 +15,6 @@ import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.constants.ProjectDeviceType;
|
||||
import club.joylink.rtss.event.ProjectDeviceLogoutEvent;
|
||||
import club.joylink.rtss.event.UserLogoutEvent;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
import club.joylink.rtss.services.project.DeviceService;
|
||||
@ -74,10 +72,8 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
|
||||
|
||||
// 查询项目地图,默认取第一个(暂时这样处理,后面考虑配置实训室-地图对应?)
|
||||
List<MapVO> mapList = this.iMapService.findOnlineMapByProjectCode(project.name());
|
||||
if (CollectionUtils.isEmpty(mapList)) {
|
||||
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION,
|
||||
String.format("项目[%s]无地图", project));
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapList,
|
||||
String.format("项目[%s]无地图", project));
|
||||
// 查询项目设备
|
||||
List<ProjectDeviceVO> projectDeviceList = this.deviceService
|
||||
.queryDetailByTypes(ProjectDeviceType.PlcDeviceList(), project);
|
||||
@ -110,7 +106,7 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
|
||||
log.error("仿真加载真实设备异常", e);
|
||||
// 清理仿真
|
||||
this.groupSimulationService.clearSimulation(simulation.getGroup(), simulation.getCreator());
|
||||
throw BusinessExceptionAssertEnum.TRAINING_ROOM_SIMULATION_LOAD_DEVICE_ERROR.buildException(e);
|
||||
throw BusinessExceptionAssertEnum.TRAINING_ROOM_SIMULATION_LOAD_DEVICE_ERROR.exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RouteUnit;
|
||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -490,14 +490,14 @@ public class InterlockBuilder2 {
|
||||
switch (type) {
|
||||
case NORMAL_OPERATION:
|
||||
description = vo.getDescription();
|
||||
if (StringUtils.isBlank(description)) {
|
||||
if (!StringUtils.hasText(description)) {
|
||||
errMsgList.add(String.format("目的地码[%s]没有描述", code));
|
||||
}
|
||||
if (StringUtils.isBlank(vo.getStationACode())) {
|
||||
if (!StringUtils.hasText(vo.getStationACode())) {
|
||||
errMsgList.add(String.format("环路类目的地码[%s]没有车站A", code));
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isBlank(vo.getStationBCode())) {
|
||||
if (!StringUtils.hasText(vo.getStationBCode())) {
|
||||
errMsgList.add(String.format("环路类目的地码[%s]没有车站B", code));
|
||||
continue;
|
||||
}
|
||||
@ -508,7 +508,7 @@ public class InterlockBuilder2 {
|
||||
case NON_OPERATION:
|
||||
case LAST_NON_OPERATION:
|
||||
description = vo.getDescription();
|
||||
if (StringUtils.isBlank(description)) {
|
||||
if (!StringUtils.hasText(description)) {
|
||||
errMsgList.add(String.format("目的地码[%s]没有描述", code));
|
||||
}
|
||||
if (right == null) {
|
||||
@ -516,7 +516,7 @@ public class InterlockBuilder2 {
|
||||
continue;
|
||||
}
|
||||
case OTHER:
|
||||
if (StringUtils.isBlank(vo.getSectionCode())) {
|
||||
if (!StringUtils.hasText(vo.getSectionCode())) {
|
||||
errMsgList.add(String.format("交路类目的地码[%s]没有目标区段", code));
|
||||
continue;
|
||||
}
|
||||
|
@ -9,9 +9,8 @@ import club.joylink.rtss.vo.client.map.MapTrainModelVO;
|
||||
import club.joylink.rtss.vo.client.map.MapTrainVO;
|
||||
import club.joylink.rtss.vo.client.map.MapZcVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -145,10 +144,10 @@ public class MapDeviceBuilder {
|
||||
} else {
|
||||
section.setDeviceStation(deviceStation);
|
||||
}
|
||||
section.setStandTrack(BooleanUtils.toBooleanDefaultIfNull(sectionVO.isStandTrack(), false));
|
||||
section.setTurnBackTrack(BooleanUtils.toBooleanDefaultIfNull(sectionVO.isReentryTrack(), false));
|
||||
section.setStandTrack(sectionVO.isStandTrack());
|
||||
section.setTurnBackTrack(sectionVO.isReentryTrack());
|
||||
section.setFirstTurnBack(sectionVO.isFirstTurnBack());
|
||||
section.setTransferTrack(BooleanUtils.toBooleanDefaultIfNull(sectionVO.isTransferTrack(), false));
|
||||
section.setTransferTrack(sectionVO.isTransferTrack());
|
||||
if (section.isTransferTrack()) {
|
||||
if (section.isTurnBackTrack() || section.isStandTrack()) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]是转换轨,就不能再设置为站台轨或折返轨",
|
||||
@ -169,7 +168,7 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
// 转换轨/折返轨,构建关联车站,站台轨在后面处理站台逻辑里做了
|
||||
if (section.isStandTrack() || section.isTransferTrack() || section.isTurnBackTrack()) {
|
||||
if (StringUtils.isBlank(sectionVO.getBelongStation())) {
|
||||
if (!StringUtils.hasText(sectionVO.getBelongStation())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]是站台轨或转换轨或折返轨,却未设置关联车站",
|
||||
sectionVO.getName(), sectionVO.getCode()));
|
||||
} else {
|
||||
|
@ -1,8 +1,5 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.joylink.base.exception.BusinessException;
|
||||
import com.joylink.base.exception.constant.ExceptionMapping;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
@ -324,7 +321,7 @@ public class CalculateService {
|
||||
//计算完成后对减去起始区段的值/加上终点区段的值
|
||||
Float distance = recursiveCalculate(startSection, endSection, isRight, frequency);
|
||||
if (Objects.isNull(distance)) {
|
||||
throw new BusinessException(ExceptionMapping.DATA_EXCEPTION, String.format("根据起始区段[%s(%s)]找不到对应方向(%s)的目标区段[%s(%s)]", startSection.getName(), startSection.getCode(), isRight ? "右向" : "左向", endSection.getName(), endSection.getCode()));
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, String.format("根据起始区段[%s(%s)]找不到对应方向(%s)的目标区段[%s(%s)]", startSection.getName(), startSection.getCode(), isRight ? "右向" : "左向", endSection.getName(), endSection.getCode()));
|
||||
}
|
||||
distance = distance - startSection.getLen() + endSection.getLen();
|
||||
return distance;
|
||||
@ -345,7 +342,7 @@ public class CalculateService {
|
||||
}
|
||||
if (0 == last) {
|
||||
// list.add(endSection);
|
||||
return Lists.newLinkedList();
|
||||
return list;
|
||||
}
|
||||
|
||||
Section targetSection = list.removeLast();
|
||||
@ -368,7 +365,7 @@ public class CalculateService {
|
||||
return null;
|
||||
}
|
||||
if (0 == distance) {
|
||||
return Lists.newLinkedList();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
startSection = list.getLast();
|
||||
} while (!startSection.equals(targetSection));
|
||||
|
@ -10,10 +10,10 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -201,7 +201,7 @@ public class MemberManager {
|
||||
this.playRole(simulation, userId, memberId);
|
||||
} else if (Objects.isNull(userId)) {
|
||||
this.cancelMemberPlayed(simulation, memberId);
|
||||
} else if(StringUtils.isBlank(memberId)) {
|
||||
} else if(!StringUtils.hasText(memberId)) {
|
||||
this.cancelPlay(simulation, userId);
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +0,0 @@
|
||||
package club.joylink.rtss.vo.client;
|
||||
|
||||
import club.joylink.rtss.simulation.data.DeviceType;
|
||||
import club.joylink.rtss.simulation.failure.FailureGenerateRule;
|
||||
import club.joylink.rtss.simulation.failure.FailureTriggerCondition;
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FailureGenerateRuleVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String skinCode;
|
||||
|
||||
/**
|
||||
* 触发条件列表
|
||||
*/
|
||||
private FailureTriggerConditionVO condition;
|
||||
|
||||
/**
|
||||
* 目标设备类型
|
||||
*/
|
||||
private DeviceType targetDeviceType;
|
||||
|
||||
/**
|
||||
* 目标设备编码
|
||||
*/
|
||||
private String targetDeviceCode;
|
||||
|
||||
/**
|
||||
* 故障类型
|
||||
*/
|
||||
private String failureType;
|
||||
|
||||
public FailureGenerateRuleVO(FailureGenerateRule rule) {
|
||||
this.id = ConvertUtil.long2Str(rule.getId());
|
||||
this.skinCode = rule.getSkinCode();
|
||||
this.condition = convertCondition(rule.getCondition());
|
||||
this.targetDeviceType = rule.getTargetDeviceType();
|
||||
this.targetDeviceCode = rule.getTargetDeviceCode();
|
||||
this.failureType = rule.getFailureType();
|
||||
}
|
||||
|
||||
private FailureTriggerConditionVO convertCondition(FailureTriggerCondition condition) {
|
||||
FailureTriggerConditionVO conditionVO = new FailureTriggerConditionVO();
|
||||
conditionVO.setType(condition.getType());
|
||||
conditionVO.setTriggerDeviceType(condition.getTriggerDeviceType());
|
||||
conditionVO.setTriggerDeviceCode(condition.getTriggerDeviceCode());
|
||||
conditionVO.setTriggerDeviceStatus(condition.getTriggerDeviceStatus());
|
||||
return conditionVO;
|
||||
}
|
||||
|
||||
public static List<FailureGenerateRuleVO> convert2VO(List<FailureGenerateRule> ruleList) {
|
||||
List<FailureGenerateRuleVO> voList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(ruleList)) {
|
||||
ruleList.forEach(rule -> voList.add(new FailureGenerateRuleVO(rule)));
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package club.joylink.rtss.vo.client;
|
||||
|
||||
import club.joylink.rtss.simulation.data.DeviceType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FailureTriggerConditionVO {
|
||||
|
||||
/**
|
||||
* 触发类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 触发设备类型
|
||||
*/
|
||||
private DeviceType triggerDeviceType;
|
||||
|
||||
/**
|
||||
* 触发设备编码
|
||||
*/
|
||||
private String triggerDeviceCode;
|
||||
|
||||
/**
|
||||
* 触发设备状态
|
||||
*/
|
||||
private String triggerDeviceStatus;
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package club.joylink.rtss.vo.client;
|
||||
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@MappedJdbcTypes({JdbcType.VARCHAR})
|
||||
@MappedTypes(Point.class)
|
||||
public class PointTypeHandler extends BaseTypeHandler<Point> {
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, Point point, JdbcType jdbcType) throws SQLException {
|
||||
preparedStatement.setString(i, ConvertUtil.obj2JsonStr(point));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(ResultSet resultSet, String s) throws SQLException {
|
||||
return new Point(resultSet.getString(s));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(ResultSet resultSet, int i) throws SQLException {
|
||||
return new Point(resultSet.getString(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
|
||||
return (Point) callableStatement.getObject(i);
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package club.joylink.rtss.vo.client;
|
||||
|
||||
import club.joylink.rtss.entity.UserSimulationStats;
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
@ -20,21 +21,24 @@ import java.util.List;
|
||||
@Setter
|
||||
public class UserSimulationStatsVO {
|
||||
|
||||
private String id;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@NotBlank(message = "用户ID不能为空")
|
||||
private String userId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 地图ID
|
||||
*/
|
||||
@ApiModelProperty(value = "地图ID")
|
||||
@NotBlank(message = "地图ID不能为空")
|
||||
private String mapId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mapId;
|
||||
|
||||
@ApiModelProperty(value = "产品类型")
|
||||
private String prdType;
|
||||
@ -53,17 +57,17 @@ public class UserSimulationStatsVO {
|
||||
private String role;
|
||||
|
||||
public UserSimulationStatsVO(UserSimulationStats stats) {
|
||||
this.setId(ConvertUtil.long2Str(stats.getId()));
|
||||
this.setUserId(ConvertUtil.long2Str(stats.getUserId()));
|
||||
this.setMapId(ConvertUtil.long2Str(stats.getMapId()));
|
||||
this.setId(stats.getId());
|
||||
this.setUserId(stats.getUserId());
|
||||
this.setMapId(stats.getMapId());
|
||||
this.setPrdType(stats.getPrdType());
|
||||
this.setDuration(stats.getDuration());
|
||||
}
|
||||
|
||||
public UserSimulationStats convert2DB() {
|
||||
UserSimulationStats stats = new UserSimulationStats();
|
||||
stats.setUserId(ConvertUtil.str2Long(this.getUserId()));
|
||||
stats.setMapId(ConvertUtil.str2Long(this.getMapId()));
|
||||
stats.setUserId(this.getUserId());
|
||||
stats.setMapId(this.getMapId());
|
||||
stats.setPrdType(this.getPrdType());
|
||||
stats.setDuration(this.getDuration());
|
||||
stats.setRole(this.getRole());
|
||||
|
@ -12,8 +12,6 @@ import club.joylink.rtss.simulation.cbtc.data.vo.TrainIsAbout2ArriveVO;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||
import club.joylink.rtss.constants.BusinessConsts.WebSocketSubscribeTopic;
|
||||
import club.joylink.rtss.record.SimulationRecordEvent;
|
||||
import club.joylink.rtss.record.SocketMessagePO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||
@ -49,8 +47,6 @@ public class SocketMessageFactory {
|
||||
public static <T> SocketMessageVO<T> build(WebSocketMessageType messageType, String group, T body) {
|
||||
List<String> topicList = getTopicsBy(messageType, group);
|
||||
SocketMessageVO<T> socketMessageVO = new SocketMessageVO<>(messageType, topicList, body);
|
||||
SimulationRecordEvent recordEvent = new SimulationRecordEvent(group, LocalDateTime.now(), new SocketMessagePO(socketMessageVO));
|
||||
SpringContextUtil.applicationContext.publishEvent(recordEvent);
|
||||
return socketMessageVO;
|
||||
}
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.room;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import club.joylink.rtss.entity.SimulationRoomRealDevice;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@ApiModel(value = "房间仿真真实设备连接关系对象")
|
||||
public class RoomSimulationRealDeviceVO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long roomId;
|
||||
|
||||
@ApiModelProperty(value = "项目真实设备id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@NotNull(message = "真实设备id不能为空")
|
||||
private Long projectDeviceId;
|
||||
|
||||
@ApiModelProperty(value = "仿真设备编码")
|
||||
private String deviceCode;
|
||||
|
||||
public RoomSimulationRealDeviceVO(SimulationRoomRealDevice device) {
|
||||
this.id = device.getId();
|
||||
this.roomId = device.getRoomId();
|
||||
this.projectDeviceId = device.getProjectDeviceId();
|
||||
this.deviceCode = device.getDeviceCode();
|
||||
}
|
||||
|
||||
public static List<RoomSimulationRealDeviceVO> convert2VOList(List<SimulationRoomRealDevice> list) {
|
||||
List<RoomSimulationRealDeviceVO> voList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(device -> voList.add(new RoomSimulationRealDeviceVO(device)));
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public SimulationRoomRealDevice toDB() {
|
||||
SimulationRoomRealDevice device = new SimulationRoomRealDevice();
|
||||
device.setId(this.getId());
|
||||
device.setRoomId(this.getRoomId());
|
||||
device.setProjectDeviceId(this.getProjectDeviceId());
|
||||
device.setDeviceCode(this.getDeviceCode());
|
||||
return device;
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training;
|
||||
|
||||
import club.joylink.rtss.simulation.Simulation;
|
||||
import club.joylink.rtss.simulation.data.DataService;
|
||||
import club.joylink.rtss.simulation.data.device.MapDevice;
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.*;
|
||||
import club.joylink.rtss.simulation.data.repository.DeviceRepository;
|
||||
import club.joylink.rtss.simulation.data.virtual.VirtualTrain;
|
||||
import club.joylink.rtss.vo.client.training.deviceStatus.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrainingDeviceStatusVO {
|
||||
|
||||
/** 进路状态列表 */
|
||||
private List<RouteStatusVO> routeStatusList;
|
||||
|
||||
/** 区段状态列表 */
|
||||
private List<SectionStatusVO> sectionStatusList;
|
||||
|
||||
/** 信号机状态列表 */
|
||||
private List<SignalStatusVO> signalStatusList;
|
||||
|
||||
/** 站台状态列表 */
|
||||
private List<StandStatusVO> standStatusList;
|
||||
|
||||
/** 车站控制模式状态列表 */
|
||||
private List<StationControlStatusVO> stationControlStatusList;
|
||||
|
||||
/** 车站计数器状态列表 */
|
||||
private List<StationCounterStatusVO> stationCounterStatusList;
|
||||
|
||||
/** 车站设备延时显示器状态列表 */
|
||||
private List<StationDisplayStatusVO> stationDisplayStatusList;
|
||||
|
||||
/** 道岔状态列表 */
|
||||
private List<SwitchStatusVO> switchStatusList;
|
||||
|
||||
/** 列车状态列表 */
|
||||
private List<TrainStatusVO> trainStatusList;
|
||||
|
||||
public TrainingDeviceStatusVO() {
|
||||
this.routeStatusList = new ArrayList<>();
|
||||
this.sectionStatusList = new ArrayList<>();
|
||||
this.signalStatusList = new ArrayList<>();
|
||||
this.standStatusList = new ArrayList<>();
|
||||
this.stationControlStatusList = new ArrayList<>();
|
||||
this.stationCounterStatusList = new ArrayList<>();
|
||||
this.stationDisplayStatusList = new ArrayList<>();
|
||||
this.switchStatusList = new ArrayList<>();
|
||||
this.trainStatusList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static TrainingDeviceStatusVO fromSimulation(Simulation simulation) {
|
||||
DeviceRepository deviceRepository = simulation.getDeviceRepository();
|
||||
TrainingDeviceStatusVO deviceStatus = new TrainingDeviceStatusVO();
|
||||
List<MapDevice> allDevice = deviceRepository.getAllDevice();
|
||||
for (MapDevice device : allDevice) {
|
||||
if(Objects.nonNull(device.getDeviceStatus())) {
|
||||
switch (device._type) {
|
||||
case Section: {
|
||||
SectionStatus sectionStatus = (SectionStatus) device.getDeviceStatus();
|
||||
if(!sectionStatus.isDefault()) {
|
||||
deviceStatus.addSectionStatus(new SectionStatusVO(sectionStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Switch: {
|
||||
SwitchStatus switchStatus = (SwitchStatus) device.getDeviceStatus();
|
||||
if(!switchStatus.isDefault()) {
|
||||
deviceStatus.addSwitchStatus(new SwitchStatusVO(switchStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Signal: {
|
||||
SignalStatus signalStatus = (SignalStatus) device.getDeviceStatus();
|
||||
if(!signalStatus.isDefault()) {
|
||||
deviceStatus.addSignalStatus(new SignalStatusVO(signalStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StationStand: {
|
||||
deviceStatus.addStandStatus(new StandStatusVO((StandStatus) device.getDeviceStatus()));
|
||||
break;
|
||||
}
|
||||
case Train: {
|
||||
VirtualTrain virtualTrain = DataService.getVirtualDevice(simulation, device.getCode(), VirtualTrain.class);
|
||||
deviceStatus.addTrainStatus(new TrainStatusVO(virtualTrain));
|
||||
break;
|
||||
}
|
||||
case StationControl: {
|
||||
StationControlStatus controlStatus = (StationControlStatus) device.getDeviceStatus();
|
||||
if(!controlStatus.isDefault()) {
|
||||
deviceStatus.addStationControlStatus(new StationControlStatusVO(controlStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StationCounter: {
|
||||
StationCounterStatus counterStatus = (StationCounterStatus) device.getDeviceStatus();
|
||||
if(!counterStatus.isDefault()) {
|
||||
deviceStatus.addStationCounterStatus(new StationCounterStatusVO(counterStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StationDelayUnlockDisplay: {
|
||||
deviceStatus.addStationDisplayStatus(new StationDisplayStatusVO((DelayUnlockDisplayStatus) device.getDeviceStatus()));
|
||||
break;
|
||||
}
|
||||
case Route: {
|
||||
RouteStatus routeStatus = (RouteStatus) device.getDeviceStatus();
|
||||
if(!routeStatus.isDefault()) {
|
||||
deviceStatus.addRouteStatus(new RouteStatusVO(routeStatus));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return deviceStatus;
|
||||
}
|
||||
|
||||
public void addRouteStatus(RouteStatusVO routeStatusVO) {
|
||||
this.routeStatusList.add(routeStatusVO);
|
||||
}
|
||||
|
||||
public void addSectionStatus(SectionStatusVO sectionStatusVO) {
|
||||
this.sectionStatusList.add(sectionStatusVO);
|
||||
}
|
||||
|
||||
public void addSignalStatus(SignalStatusVO signalStatusVO) {
|
||||
this.signalStatusList.add(signalStatusVO);
|
||||
}
|
||||
|
||||
public void addStandStatus(StandStatusVO standStatusVO) {
|
||||
this.standStatusList.add(standStatusVO);
|
||||
}
|
||||
|
||||
public void addStationControlStatus(StationControlStatusVO stationControlStatusVO) {
|
||||
this.stationControlStatusList.add(stationControlStatusVO);
|
||||
}
|
||||
|
||||
public void addStationCounterStatus(StationCounterStatusVO stationCounterStatusVO) {
|
||||
this.stationCounterStatusList.add(stationCounterStatusVO);
|
||||
}
|
||||
|
||||
public void addStationDisplayStatus(StationDisplayStatusVO stationDisplayStatusVO) {
|
||||
this.stationDisplayStatusList.add(stationDisplayStatusVO);
|
||||
}
|
||||
|
||||
public void addSwitchStatus(SwitchStatusVO switchStatusVO) {
|
||||
this.switchStatusList.add(switchStatusVO);
|
||||
}
|
||||
|
||||
public void addTrainStatus(TrainStatusVO trainStatusVO) {
|
||||
this.trainStatusList.add(trainStatusVO);
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.RouteStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 进路状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class RouteStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 进路状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 进路控制类型(自动?人工?)
|
||||
*/
|
||||
private String controlType;
|
||||
|
||||
/**
|
||||
* 联锁自动进路
|
||||
*/
|
||||
private Boolean ciAutoRoute;
|
||||
|
||||
/**
|
||||
* 联锁自动触发
|
||||
*/
|
||||
private Boolean ciAutoTrigger;
|
||||
|
||||
/**
|
||||
* 是否办理中
|
||||
*/
|
||||
private Boolean setting;
|
||||
|
||||
/**
|
||||
* 延时释放剩余时间
|
||||
*/
|
||||
private Integer releaseRemainTime;
|
||||
|
||||
public RouteStatusVO(RouteStatus routeStatus) {
|
||||
this.code = routeStatus.getCode();
|
||||
this.status = routeStatus.getStatus();
|
||||
this.controlType = routeStatus.getControlType();
|
||||
this.ciAutoRoute = routeStatus.isCiAutoRoute();
|
||||
this.ciAutoTrigger = routeStatus.isCiAutoTrigger();
|
||||
this.setting = routeStatus.isSetting();
|
||||
if(Objects.nonNull(routeStatus.getReleaseRemainTime())) {
|
||||
this.releaseRemainTime = routeStatus.getReleaseRemainTime().intValue();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.SectionStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 区段状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SectionStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 速度上限
|
||||
*/
|
||||
private Integer speedUpperLimit;
|
||||
|
||||
/**
|
||||
* 是否切除
|
||||
*/
|
||||
private Boolean cutOff;
|
||||
|
||||
/**
|
||||
* 是否故障
|
||||
*/
|
||||
private Boolean fault;
|
||||
|
||||
public SectionStatusVO(SectionStatus sectionStatus) {
|
||||
this.code = sectionStatus.getCode();
|
||||
this.status = sectionStatus.getStatus();
|
||||
this.speedUpperLimit = sectionStatus.getSpeedUpperLimit();
|
||||
this.cutOff = sectionStatus.isCutOff();
|
||||
this.fault = sectionStatus.isFault();
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.SignalStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 信号机状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SignalStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 点灯类型
|
||||
*/
|
||||
private String lightType;
|
||||
|
||||
/**
|
||||
* 延时状态类型-数据字典值
|
||||
*/
|
||||
private String delayType;
|
||||
|
||||
/**
|
||||
* 自动信号状态类型-数据字典值
|
||||
*/
|
||||
private String autoType;
|
||||
|
||||
/**
|
||||
* 自动通过信号状态类型-数据字典值
|
||||
*/
|
||||
private String autoAccess;
|
||||
|
||||
/**
|
||||
* 按钮状态类型-数据字典值
|
||||
*/
|
||||
private String buttonStatus;
|
||||
|
||||
/**
|
||||
* 引导信号按钮状态类型-数据字典值
|
||||
*/
|
||||
private String guideStatus;
|
||||
|
||||
/**
|
||||
* 进路是否正在办理中
|
||||
*/
|
||||
private Boolean routeSetting;
|
||||
|
||||
/**
|
||||
* 是否故障
|
||||
*/
|
||||
private Boolean fault;
|
||||
|
||||
public SignalStatusVO(SignalStatus signalStatus) {
|
||||
this.code = signalStatus.getCode();
|
||||
this.status = signalStatus.getStatus();
|
||||
this.lightType = signalStatus.getLightType();
|
||||
this.delayType = signalStatus.getDelayType();
|
||||
this.autoType = signalStatus.getAutoType();
|
||||
this.autoAccess = signalStatus.getAutoAccess();
|
||||
this.buttonStatus = signalStatus.getButtonStatus();
|
||||
this.routeSetting = signalStatus.isRouteSetting();
|
||||
this.fault = signalStatus.isFault();
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.StandStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class StandStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 扣车状态
|
||||
*/
|
||||
private String holdStatus;
|
||||
|
||||
/**
|
||||
* 跳停状态
|
||||
*/
|
||||
private String jumpStopStatus;
|
||||
|
||||
/**
|
||||
* 屏蔽门状态
|
||||
*/
|
||||
private String screenDoorStatus;
|
||||
|
||||
/**
|
||||
* 屏蔽门开启/关闭状态
|
||||
*/
|
||||
private String screenDoorOpenStatus;
|
||||
|
||||
/**
|
||||
* 跳停方向
|
||||
*/
|
||||
private String jumpStopDirection;
|
||||
|
||||
/**
|
||||
* 指定跳停车辆编号(车组号)
|
||||
*/
|
||||
private Set<String> trainCodeSet;
|
||||
|
||||
/**
|
||||
* 计划停车时长
|
||||
*/
|
||||
private Integer planParkingDuration;
|
||||
|
||||
/**
|
||||
* 停车剩余时间
|
||||
*/
|
||||
private Integer remainTime;
|
||||
|
||||
/**
|
||||
* 停靠到本站的列车
|
||||
*/
|
||||
private String stoppedTrainCode;
|
||||
|
||||
/**
|
||||
* 停车时间
|
||||
*/
|
||||
private Integer parkingTime;
|
||||
|
||||
/**
|
||||
* 停车设置状态(是否一直有效)
|
||||
*/
|
||||
private Boolean parkingValidStatus;
|
||||
|
||||
/**
|
||||
* 区间运行时间
|
||||
*/
|
||||
private Integer intervalRunTime;
|
||||
|
||||
/**
|
||||
* 区间运行时间是否一直有效
|
||||
*/
|
||||
private Boolean intervalRunTimeValidStatus;
|
||||
|
||||
/**
|
||||
* 折返策略
|
||||
*/
|
||||
private String reentryStrategy;
|
||||
|
||||
/**
|
||||
* 是否故障
|
||||
*/
|
||||
private Boolean fault;
|
||||
|
||||
public StandStatusVO(StandStatus standStatus) {
|
||||
this.code = standStatus.getCode();
|
||||
this.status = standStatus.getStatus();
|
||||
this.holdStatus = standStatus.getHoldStatus();
|
||||
this.jumpStopStatus = standStatus.getJumpStopStatus();
|
||||
this.screenDoorStatus = standStatus.getScreenDoorStatus();
|
||||
this.screenDoorOpenStatus = standStatus.getScreenDoorOpenStatus();
|
||||
this.jumpStopDirection = standStatus.getJumpStopDirection();
|
||||
this.trainCodeSet = standStatus.getTrainCodeSet();
|
||||
// this.planParkingDuration = standStatus.getPlanParkingDuration();
|
||||
// this.remainTime = standStatus.getRemainTime();
|
||||
// this.stoppedTrainCode = standStatus.getStoppedTrainCode();
|
||||
this.parkingTime = standStatus.getParkingTime();
|
||||
this.parkingValidStatus = standStatus.isParkingValidStatus();
|
||||
this.intervalRunTime = standStatus.getIntervalRunTime();
|
||||
this.intervalRunTimeValidStatus = standStatus.isIntervalRunTimeValidStatus();
|
||||
this.reentryStrategy = standStatus.getReentryStrategy();
|
||||
this.fault = standStatus.isFault();
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.StationControlStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 车站控制模式状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class StationControlStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
private String status;
|
||||
|
||||
public StationControlStatusVO(StationControlStatus controlStatus) {
|
||||
this.code = controlStatus.getCode();
|
||||
this.status = controlStatus.getStatus();
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.StationCounterStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 车站计数器状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class StationCounterStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 计数值
|
||||
*/
|
||||
private Integer val;
|
||||
|
||||
public StationCounterStatusVO(StationCounterStatus counterStatus) {
|
||||
this.code = counterStatus.getCode();
|
||||
this.val = counterStatus.getVal();
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.DelayUnlockDisplayStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 车站设备延时显示状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class StationDisplayStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 倒计时剩余时间
|
||||
*/
|
||||
private Integer remainTime;
|
||||
|
||||
public StationDisplayStatusVO(DelayUnlockDisplayStatus displayStatus) {
|
||||
this.code = displayStatus.getCode();
|
||||
this.status = displayStatus.getStatus();
|
||||
this.deviceCode = displayStatus.getSignal().getCode();
|
||||
this.remainTime = displayStatus.getRemainTime().intValue();
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.deviceStatus.SwitchStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 道岔状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SwitchStatusVO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 位置类型
|
||||
*/
|
||||
private String locateType;
|
||||
|
||||
/**
|
||||
* 延续保护解锁剩余时间
|
||||
*/
|
||||
private Integer unlockRemainTime;
|
||||
|
||||
/**
|
||||
* 是否故障
|
||||
*/
|
||||
private Boolean fault;
|
||||
|
||||
public SwitchStatusVO(SwitchStatus switchStatus) {
|
||||
this.code = switchStatus.getCode();
|
||||
this.status = switchStatus.getStatus();
|
||||
this.locateType = switchStatus.getLocateType();
|
||||
if(Objects.nonNull(switchStatus.getUnlockRemainTime())) {
|
||||
this.unlockRemainTime = switchStatus.getUnlockRemainTime().intValue();
|
||||
}
|
||||
this.fault = switchStatus.isFault();
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.training.deviceStatus;
|
||||
|
||||
import club.joylink.rtss.simulation.data.runPlan.RunDiagramTrip;
|
||||
import club.joylink.rtss.simulation.data.support.LinkPosition;
|
||||
import club.joylink.rtss.simulation.data.virtual.VirtualTrain;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 列车状态
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrainStatusVO {
|
||||
|
||||
/**
|
||||
* 列车编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 车组号
|
||||
*/
|
||||
private String groupNumber;
|
||||
|
||||
/**
|
||||
* 服务号
|
||||
*/
|
||||
private String serviceNumber;
|
||||
|
||||
/**
|
||||
* 方向码
|
||||
*/
|
||||
private String directionCode;
|
||||
|
||||
/**
|
||||
* 车次号
|
||||
*/
|
||||
private String tripNumber;
|
||||
|
||||
/**
|
||||
* 计划索引
|
||||
*/
|
||||
private Integer planIndex;
|
||||
|
||||
/**
|
||||
* 计划是否完成
|
||||
*/
|
||||
private Boolean tripFinish;
|
||||
|
||||
/**
|
||||
* 车头所在link编号
|
||||
*/
|
||||
private String headLinkCode;
|
||||
|
||||
/**
|
||||
* 车头所在link偏移
|
||||
*/
|
||||
private Float headLinkOffset;
|
||||
|
||||
/**
|
||||
* 车尾所在link编号
|
||||
*/
|
||||
private String tailLinkCode;
|
||||
|
||||
/**
|
||||
* 车尾所在link偏移
|
||||
*/
|
||||
private Float tailLinkOffset;
|
||||
|
||||
/**
|
||||
* 是否上行方向
|
||||
*/
|
||||
private Boolean up;
|
||||
|
||||
/**
|
||||
* 是否通信
|
||||
*/
|
||||
private Boolean communicate;
|
||||
|
||||
/**
|
||||
* 是否人工驾驶
|
||||
*/
|
||||
private Boolean humanControl;
|
||||
|
||||
/**
|
||||
* 剩余停站时间
|
||||
*/
|
||||
private Float remainStandParkTime;
|
||||
|
||||
/**
|
||||
* 是否故障
|
||||
*/
|
||||
private Boolean fault;
|
||||
|
||||
public TrainStatusVO(VirtualTrain train) {
|
||||
this.code = train.getCode();
|
||||
this.groupNumber = train.getGroupNumber();
|
||||
RunDiagramTrip trip = train.getRunDiagramTripPlan();
|
||||
if(Objects.nonNull(trip)) {
|
||||
this.serviceNumber = trip.getServiceNumber();
|
||||
this.directionCode = trip.getDirectionCode();
|
||||
this.tripNumber = trip.getTripNumber();
|
||||
}
|
||||
this.planIndex = train.getPlanIndex();
|
||||
this.tripFinish = train.isTripFinish();
|
||||
LinkPosition headPosition = train.getHeadPosition();
|
||||
LinkPosition tailPosition = train.getTailPosition();
|
||||
this.headLinkCode = headPosition.getLink().getCode();
|
||||
this.headLinkOffset = headPosition.getOffset();
|
||||
this.tailLinkCode = tailPosition.getLink().getCode();
|
||||
this.tailLinkOffset = tailPosition.getOffset();
|
||||
this.up = train.isUp();
|
||||
this.communicate = train.isCommunicationTrain();
|
||||
this.humanControl = !train.isATOControl();
|
||||
this.remainStandParkTime = train.getRemainStandParkTime();
|
||||
this.fault = train.isFault();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取方向车次号
|
||||
* @return
|
||||
*/
|
||||
public String getSDTNumber() {
|
||||
String serviceNumber = Objects.nonNull(this.serviceNumber) ? this.serviceNumber : "";
|
||||
String direction = Objects.nonNull(this.directionCode) ? this.directionCode : "";
|
||||
String tripNumber = Objects.nonNull(this.tripNumber) ? this.tripNumber : "";
|
||||
return serviceNumber + direction + tripNumber;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user