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

This commit is contained in:
joylink_zhangsai 2023-02-01 17:51:11 +08:00
commit fff58f8ec4
11 changed files with 1260 additions and 79 deletions

View File

@ -16,11 +16,11 @@ import java.util.Map;
@Repository
public interface PublishedTraining2DAO {
@Select("<script>select label_json from rts_published_training2 where 1 = 1 " +
/* @Select("<script>select label_json from rts_published_training2 where 1 = 1 " +
"<if test=\"orgId != null\"> " +
" and org_id = #{orgId} " +
" </if> and type = #{type} and map_id = #{mapId}</script>")
List<String> selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);
List<String> selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);*/
long countByExample(PublishedTraining2Example example);
int deleteByExample(PublishedTraining2Example example);

View File

@ -47,14 +47,10 @@ public class PagerQuestionService {
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
* @return
*/
private PaperQuestionExample createQueryExample(QuestionQueryVO queryVO, boolean orgIdCanNull,boolean queryLabelIsNull){
public void createQueryExample(PaperQuestionExample.Criteria criteria,QuestionQueryVO queryVO, boolean orgIdCanNull,boolean queryLabelIsNull){
if(Objects.equals(false,orgIdCanNull)){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空");
}
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(queryVO.getTopic())) {
criteria.andQuestionLike(String.format("%%%s%%", queryVO.getTopic()));
}
@ -65,7 +61,33 @@ public class PagerQuestionService {
if(Objects.nonNull(queryVO.getOrgId())){
criteria.andOrgIdEqualTo(queryVO.getOrgId());
}
if(!StringUtils.hasText(queryVO.getLabels())){
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
if(Objects.equals(false,queryLabelIsNull) && StringUtils.hasText(queryVO.getLabels())){
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){
StringBuilder sqlBuilder = new StringBuilder("(");
for(var i = 0 ; i < tmpLableList.size();i++){
String data = tmpLableList.get(i);
if(i != 0){
sqlBuilder.append(" and ");
}
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ",data));
}
sqlBuilder.append(")");
Class<?> criteriaCls = criteria.getClass();
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
try{
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString());
}catch (Exception e){
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
}
}
}else {
criteria.andTagsIsNull();
}
/* if(!StringUtils.hasText(queryVO.getLabels())){
if(queryLabelIsNull) {
criteria.andTagsIsNull();
}
@ -91,9 +113,8 @@ public class PagerQuestionService {
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
}
}
}
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
return example;
}*/
}
/**
@ -112,7 +133,9 @@ public class PagerQuestionService {
queryVO.setOrgId(orgId);
queryVO.setType(type.name());
queryVO.setLabels(labels);
PaperQuestionExample example = this.createQueryExample(queryVO,false,true);
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,false,false);
return this.questionDAO.countByExample(example);
}
@ -124,7 +147,9 @@ public class PagerQuestionService {
*/
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
PaperQuestionExample example = this.createQueryExample(queryVO,companyIdCanNull,false);
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
Page<PaperQuestionWithBLOBs> page = (Page<PaperQuestionWithBLOBs>)this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
return PageVO.convert(page, questionVOS);
@ -138,7 +163,9 @@ public class PagerQuestionService {
* @return
*/
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
PaperQuestionExample example = this.createQueryExample(queryVO,companyIdCanNull,false);
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
List<PaperQuestionWithBLOBs> list = this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS;

View File

@ -8,8 +8,10 @@ import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.exception.PaperExceptionAssert;
import club.joylink.rtss.services.training2.Training2PublishService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.pager.question.QuestionQueryVO;
import club.joylink.rtss.vo.paper.*;
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
import com.google.common.base.Joiner;
@ -20,6 +22,7 @@ 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.lang.reflect.Method;
import java.time.LocalDateTime;
@ -48,6 +51,10 @@ public class PaperUserCreateService {
private PaperQuestionDAO questionDAO;
@Autowired
private PublishedTraining2DAO trainingDAO;
@Autowired
private Training2PublishService training2PublishService;
@Autowired
private PagerQuestionService pagerQuestionService;
private void resetPaperRecord(Long pcId, Long userId){
@ -120,6 +127,7 @@ public class PaperUserCreateService {
/**
* 根据试卷蓝图和规则来为用户试卷分配题目
*/
@Deprecated
private void dispatcherQuestion(PaperUser pu, PaperComposition pc, List<PaperRule> ruleList) {
for (PaperRule rule : ruleList) {
String tags = rule.getTags();//规则标签list json
@ -168,8 +176,10 @@ public class PaperUserCreateService {
*/
private List<Long> dispatcherCommonQuestion2(PaperUser pu, PaperComposition pc, PaperCompositionWithRuleVo.PaperRuleVo ruleVO,List<Long> notInList) {
final int qSum = ruleVO.getAmount();//该类型问题个数
PaperQuestionExample questionExample = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = questionExample.createCriteria();
PaperQuestionExample questionExample = this.commonQuestionExample2(pu, pc, ruleVO,notInList);
this.commonQuestionExample2(criteria,pu, pc, ruleVO,notInList);
//符合条件的题目数目
long count = questionDAO.countByExample(questionExample);
PaperExceptionAssert.PqEnough.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " orgId = " + pc.getOrgId() + " ruleType = " + ruleVO.getSubtype().name() + " ruleSum = " + qSum);
@ -195,6 +205,7 @@ public class PaperUserCreateService {
/**
* 随机选择理论题目
*/
@Deprecated
private List<Long> dispatcherCommonQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
final int qSum = rule.getAmount();//该类型问题个数
//
@ -259,26 +270,25 @@ public class PaperUserCreateService {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
String subTypeStr = this.paperUserService.getTrainingType(subType);
PublishedTraining2Example questionExample = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = questionExample.createCriteria();
//针对实训添加mapId 的过滤
criteria.andMapIdEqualTo(pc.getMapId());
// criteria.andOrgIdEqualTo(pc.getOrgId());
if (null == tagArray) {
criteria.andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1);//1-上架
} else {
this.training2PublishService.basicQueryCriteria(criteria,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null);
if(!CollectionUtils.isEmpty(tagArray)){
for (String tag : tagArray) {
questionExample.or().andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1).andLabelJsonLike(String.format("%%%s%%", tag));
criteria.andLabelJsonLike(String.format("%%%s%%", tag));
}
}
return questionExample;
}
/**
* 生成根据tag查询的条件
*/
@Deprecated
private PaperQuestionExample commonQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule) {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
@ -296,42 +306,16 @@ public class PaperUserCreateService {
}
return questionExample;
}
private PaperQuestionExample commonQuestionExample2(PaperUser pu, PaperComposition pc, PaperCompositionWithRuleVo.PaperRuleVo ruleVO,List<Long> notInList) {
// String tags = rule.getTags();//规则标签list json
// List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
// PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
PaperQuestionExample questionExample = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = questionExample.createCriteria();
criteria.andOrgIdEqualTo(pc.getOrgId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(ruleVO.getSubtype()).name()).andIsDelEqualTo(0);
private void commonQuestionExample2(PaperQuestionExample.Criteria criteria,PaperUser pu, PaperComposition pc, PaperCompositionWithRuleVo.PaperRuleVo ruleVO,List<Long> notInList) {
QuestionQueryVO queryVO = new QuestionQueryVO();
if(!CollectionUtils.isEmpty(ruleVO.getTags())){
queryVO.setLabels(Joiner.on(",").skipNulls().join(ruleVO.getTags()));
}
queryVO.setType(this.paperUserService.getPaperQuestionType(ruleVO.getSubtype()).name());
queryVO.setOrgId(pc.getOrgId());
if(!CollectionUtils.isEmpty(notInList)){
criteria.andIdNotIn(notInList);
}
List<String> tagArray = ruleVO.getTags();
if (!CollectionUtils.isEmpty(tagArray)) {
StringBuilder sqlBuilder = new StringBuilder("(");
for (var i = 0 ; i < tagArray.size();i++) {
String data = tagArray.get(i);
if(i != 0){
sqlBuilder.append(" and ");
}
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ",data));
}
sqlBuilder.append(")");
Class<?> criteriaCls = PaperQuestionExample.Criteria.class;
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
try{
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString());
}catch (Exception e){
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
}
}else{
criteria.andTagsIsNull();
}
return questionExample;
this.pagerQuestionService.createQueryExample(criteria,queryVO,false,false);
}
}

View File

@ -1,17 +1,16 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessException;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.training2.publish.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -22,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -49,16 +47,9 @@ public class Training2PublishService {
*/
public Long queryCountForLabel(Long mapId,@Deprecated Long orgId,String type,String label){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"没有关联对应的地图");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria();
//针对实训只过滤对应的线路
c.andMapIdEqualTo(mapId);
// c.andOrgIdEqualTo(orgId);
c.andTypeEqualTo(type);
this.basicQueryCriteria(c,mapId,orgId,type);
if(Objects.nonNull(label)){
c.andLabelJsonLike(String.format("%%%s%%", label));
}
@ -69,20 +60,29 @@ public class Training2PublishService {
* 根据 组织类型单操作实操 获取标签
*/
public Collection<String> findAllLabel(Long mapId,Long orgId, String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
//针对实训只过滤关联的线路
List<String> list = this.publishedDao.selectAllLabel(mapId,null,type);
if(CollectionUtils.isEmpty(list)){
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria();
this.basicQueryCriteria(c,mapId,orgId,type);
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
if(CollectionUtils.isEmpty(dataList)){
return Collections.emptyList();
}
return list.stream().filter(StringUtils::hasText).map(d->{
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText).map(d->{
List<String> l = JsonUtils.readCollection(d,List.class,String.class);
return l;
}).flatMap(d->d.stream()).collect(Collectors.toSet());
}
public void basicQueryCriteria(PublishedTraining2Example.Criteria criteria, Long mapId, Long orgId, String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
criteria.andMapIdEqualTo(mapId);
// c.andOrgIdEqualTo(orgId);
criteria.andTypeEqualTo(type);
criteria.andStateEqualTo(1);//上架
}
/**
* 已发布实训分页列表
*/

View File

@ -1399,6 +1399,92 @@ public class Operation {
REGULAR_TRAIN_LINE_STATION_UPDATE(new Label[]{Label.CLIENT},true),
REGULAR_TRAIN_LINE_STATION_UPDATE_LIST(new Label[]{Label.CLIENT},true),
REGULAR_TRAIN_LINE_STATION_UPDATE_LOAD(new Label[]{Label.CLIENT},true),
/**
* 非正常情况接发列车关键环节控制表信息保存
*/
KEY_LINK_CONTROL_INFO_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 非正常情况接发列车关键环节控制表信息更新
*/
KEY_LINK_CONTROL_INFO_UPDATE(new Label[]{Label.CLIENT}, true),
/**
* 非正常情况接发列车关键环节控制表信息查询
*/
KEY_LINK_CONTROL_INFO_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存行车设备施工登记信息
*/
EQUIPMENT_CONSTRUCTION_INFO_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 查询行车设备施工登记信息
*/
EQUIPMENT_CONSTRUCTION_INFO_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存区段站交接班记录
*/
HAND_OVER_SECTION_STATION_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取区间站交接班记录
*/
HAND_OVER_SECTION_STATION_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存中间站交接班记录
*/
HAND_OVER_MIDDLE_STATION_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取中间站交接班记录
*/
HAND_OVER_MIDDLE_STATION_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存外勤助理值班员交接班记录
*/
HAND_OVER_FIELD_PERSONNEL_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取外勤助理值班员交接班记录
*/
HAND_OVER_FIELD_PERSONNEL_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存调车区长交接班记录
*/
HAND_OVER_SHUT_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取调车区长交接班记录
*/
HAND_OVER_SHUT_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存车站调度员交接班记录
*/
HAND_OVER_DISPATCHER_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取车站调度员交接班记录
*/
HAND_OVER_DISPATCHER_QUERY(new Label[]{Label.CLIENT}, true),
/**
* 保存车号长交接班记录
*/
HAND_OVER_STATION_MASTER_SAVE(new Label[]{Label.CLIENT}, true),
/**
* 获取车号长交接班记录
*/
HAND_OVER_STATION_MASTER_QUERY(new Label[]{Label.CLIENT}, true),
//----------------------------会话信息------------------------------
/**
* 电话创建电话消息

View File

@ -1,6 +1,9 @@
package club.joylink.rtss.simulation.cbtc.CTC.data;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.EquipmentConstructionInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.KeyLinkControlInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.SupervisorHandOverInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO;
@ -139,6 +142,21 @@ public class CtcRepository {
*/
private final CopyOnWriteArrayList<Ticket> tickets = new CopyOnWriteArrayList<>();
/**
* 非正常情况接发列车关键环节控制表
*/
private final KeyLinkControlInfo keyLinkControlInfo = new KeyLinkControlInfo();
/**
* 行车设备施工登记簿
*/
private final EquipmentConstructionInfo equipmentConstructionInfo = new EquipmentConstructionInfo();
/**
* 交接班记录登记薄
*/
private final SupervisorHandOverInfo supervisorHandOverInfo = new SupervisorHandOverInfo();
public void reset(Simulation simulation) {
MapConfig config = simulation.getRepository().getConfig();
// 仿真运行数据直接清空

View File

@ -0,0 +1,116 @@
package club.joylink.rtss.simulation.cbtc.CTC.data.book;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 行车设备施工登记簿
*/
@Data
public class EquipmentConstructionInfo {
@JsonIgnore
private final AtomicInteger idGenerator = new AtomicInteger(0);
/**
* 各个车站的行车设备施工登记簿
*/
private Map<String, List<ConstructionInfo>> stationDetailInfoMap = new HashMap<>();
/**
* 保存行车设备施工登记
*/
public void saveDetailInfo(ConstructionInfo detailInfo) {
if (StringUtils.isEmpty(detailInfo.getStationCode())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "车站信息为空");
}
List<ConstructionInfo> dataList = null;
if (stationDetailInfoMap.containsKey(detailInfo.getStationCode())) {
dataList = stationDetailInfoMap.get(detailInfo.getStationCode());
} else {
dataList = new LinkedList<>();
stationDetailInfoMap.put(detailInfo.getStationCode(), dataList);
}
detailInfo.setId(idGenerator.incrementAndGet());
dataList.add(detailInfo);
}
/**
* 获取信息列表
*/
public List<ConstructionInfo> getDetailInfoList(String stationCode) {
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
}
/**
* 施工登记信息
*/
@Data
public static class ConstructionInfo {
private Integer id;
/**
* 车站信息
*/
private String stationCode;
/**
* 本月施工编号
*/
private String no;
/**
* 施工项目
*/
private String projectName;
/**
* 请求施工登记时间
*/
private String requestDate;
/**
* 请求施工登记详情信息
*/
private String requestDetails;
/**
* 请求施工登记所需时间
*/
private String planSpendTime;
/**
* 承认施工详情信息
*/
private String acceptDetail;
/**
* 施工后开通检查确认销记 时间
*/
private String confirmReviewDate;
/**
* 施工后开通检查确认销记 详情
*/
private String confirmReviewDetail;
/**
* 施工开通
*/
private String constructionOpenDetail;
/**
* 备注
*/
private String remark;
}
}

View File

@ -0,0 +1,232 @@
package club.joylink.rtss.simulation.cbtc.CTC.data.book;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.IdGenerator;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 非正常情况接发列车关键环节控制表
*/
@Data
public class KeyLinkControlInfo {
@JsonIgnore
private final AtomicInteger idGenerator = new AtomicInteger(0);
/**
* 各个车站的关键环节控制信息
*/
private Map<String, List<DetailInfo>> stationDetailInfoMap = new HashMap<>();
/**
* 保存关键环节控制信息
* @param detailInfo 详情信息
*/
public void saveDetailInfo(DetailInfo detailInfo) {
if (StringUtils.isEmpty(detailInfo.getStationCode())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "车站信息为空");
}
List<DetailInfo> dataList = null;
if (stationDetailInfoMap.containsKey(detailInfo.getStationCode())) {
dataList = stationDetailInfoMap.get(detailInfo.getStationCode());
} else {
dataList = new LinkedList<>();
stationDetailInfoMap.put(detailInfo.getStationCode(), dataList);
}
detailInfo.setId(idGenerator.incrementAndGet());
dataList.add(detailInfo);
}
/**
* 更新信息
* @param detailInfo 详情信息
*/
public void updateDetailInfo(DetailInfo detailInfo) {
List<DetailInfo> dataList = stationDetailInfoMap.get(detailInfo.getStationCode());
if (CollectionUtils.isEmpty(dataList)) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "无效数据");
}
DetailInfo oldDetailInfo = dataList.stream().filter(d -> Objects.equals(d.getId(), detailInfo.getId()))
.findFirst().orElse(null);
if (oldDetailInfo == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist);
}
dataList.set(dataList.indexOf(oldDetailInfo), detailInfo);
}
/**
* 获取信息列表
* @param stationCode 车站
* @return 信息列表
*/
public List<DetailInfo> getDetailInfoList(String stationCode) {
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
}
/**
* 表详情
*/
@Data
public static class DetailInfo {
/**
* 主键
*/
private Integer id;
/**
* 车站编码
*/
private String stationCode;
/**
* 值班员
*/
private String supervisor;
/**
* 干部上岗是由
*/
private String cadresPost;
/**
* 监控干部
*/
private String monitorCadres;
/**
* 天气
*/
private String weather;
/**
* 日期
*/
private String registerDate;
/**
* 通知干部时间
*/
private TimeStructure noticeCadresTime;
/**
* 报告列车调度员时间
*/
private TimeStructure reportDispatcherTime;
/**
* 报告指挥中心时间
*/
private TimeStructure reportCommandCentreTime;
/**
* 监控干部到岗时间
*/
private TimeStructure monitorArriveTime;
/**
* 登记列表
*/
private List<RegisterInfo> registerInfoList;
/**
* 故障内容
*/
private String faultContent;
/**
* 区间闭塞封闭情况
*/
private String sectionContent;
/**
* 接车进路准备方式
*/
private String pickRoutePrepareContent;
/**
* 接车信号
*/
private String pickSignal;
/**
* 发车进路准备方式
*/
private String departRoutePrepareContent;
/**
* 其他关键环节
*/
private String otherKeyLinkContent;
}
/**
* 登记信息
*/
@Data
public static class RegisterInfo {
/**
* 登记单位
*/
private String departmentName;
/**
* 运统46登记(通知干部上岗)
*/
private String registration;
/**
* 运统46签认(报告列车调度员)
*/
private boolean reportSign;
/**
* 报告列车调度员(报告列车调度员)
*/
private boolean reportDispatcher;
/**
* 调度命令核对接收报告指挥中心
*/
private boolean centerDispatchCommandCheck;
/**
* 运统46到点签认(监控干部到岗)
*/
private boolean monitorArrive;
/**
* 运统46销记签认(安排工作人员)
*/
private boolean writeOff;
/**
* 调度命令核对接收安排工作人员
*/
private boolean workerDispatchCommandCheck;
}
/**
* 时分数据格式
*/
@Data
public static class TimeStructure {
/**
*
*/
private String hour;
/**
*
*/
private String minute;
}
}

View File

@ -0,0 +1,510 @@
package club.joylink.rtss.simulation.cbtc.CTC.data.book;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 交接班记录簿
*/
@Data
public class SupervisorHandOverInfo {
@JsonIgnore
private final AtomicInteger idGenerator = new AtomicInteger(0);
/**
* 各个车站的交接班信息
*/
private Map<String, List<CommonInfo>> handOverDetailInfoMap = new HashMap<>();
/**
* 保存交接班信息
* @param detailInfo 详情信息
*/
public void saveDetailInfo(CommonInfo detailInfo) {
if (StringUtils.isEmpty(detailInfo.getStationCode())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "车站信息为空");
}
List<CommonInfo> dataList = null;
if (handOverDetailInfoMap.containsKey(detailInfo.getStationCode())) {
dataList = handOverDetailInfoMap.get(detailInfo.getStationCode());
} else {
dataList = new LinkedList<>();
handOverDetailInfoMap.put(detailInfo.getStationCode(), dataList);
}
detailInfo.setId(idGenerator.incrementAndGet());
dataList.add(detailInfo);
}
/**
* 筛选出交接班信息
*/
public List<CommonInfo> getDetailInfoList(String stationCode, HandOverType clsType) {
if (!handOverDetailInfoMap.containsKey(stationCode)) {
return new LinkedList<>();
}
return handOverDetailInfoMap.get(stationCode).stream().filter(d -> Objects.equals(clsType, d.getType())).collect(Collectors.toList());
}
/**
* 一些公共属性
*/
@Data
public static abstract class CommonInfo {
/**
* 主键
*/
private Integer id;
/**
* 交接班薄类型
*/
private HandOverType type;
/**
* 车站编码
*/
private String stationCode;
/**
* 日期
*/
private String dateStr;
/**
* 时间
*/
private String timeStr;
/**
* 交班者名字
*/
private String shifterName;
/**
* 接班者名字
*/
private String takerName;
}
/**
* 表详情
*/
@Data
public static abstract class DetailInfo extends CommonInfo {
/**
* 文电指示
*/
private String messageContent;
/**
* 行车设备
*/
private String travelEquipment;
/**
* 行车备品
*/
private String travelSparePart;
/**
* 路票
*/
private String ticketContent;
/**
* 班前预想
*/
private String workExpect;
/**
* 班后总结
*/
private String workSummary;
/**
* 操作计数器
*/
private List<CounterItem> counterItemList;
}
/**
* 区段站值班员交班详情
*/
@Data
public static class SectionStationDetailInfo extends DetailInfo {
/**
* 左侧列车占线情况
*/
private FieldInfo leftField;
/**
* 右侧列车占线情况
*/
private FieldInfo rightField;
public SectionStationDetailInfo() {
this.setType(HandOverType.SECTION_STATION);
}
}
/**
* 中间站值班员交班详情
*/
@Data
public static class MiddleStationDetailInfo extends DetailInfo {
/**
* 日班计划
*/
private List<DayShiftPlan> dayShiftPlanList;
/**
* 当前车情况
*/
private String currentSituation;
/**
* 齿轮工具
*/
private List<GearTool> gearToolList;
public MiddleStationDetailInfo() {
this.setType(HandOverType.MIDDLE_STATION);
}
}
/**
* 外勤助理值班员交接班记录
*/
@Data
public static class FieldPersonnelDetailInfo extends CommonInfo {
/**
* 站内车
*/
private String stationCar;
/**
* 行车备品
*/
private String travelSparePart;
/**
* 路票
*/
private String ticketContent;
/**
* 止轮工具
*/
private String gearToolContent;
public FieldPersonnelDetailInfo() {
this.setType(HandOverType.FIELD_PERSONNEL);
}
}
/**
* 调车区长交接班记录簿填写样式
*/
@Data
public static class ShuntDetailInfo extends CommonInfo {
/**
* 待编列车
*/
private WaitTrainInfo waitTrainInfo;
/**
* 待解列车
*/
private WaitTrainInfo unblockTrainInfo;
/**
* 待取车
*/
private WaitTrainInfo fetchTrainInfo;
/**
* 代送车
*/
private WaitTrainInfo deliverTrainInfo;
/**
* 重点挂运车辆
*/
private WaitTrainInfo priorityTrainInfo;
/**
* 确报份数
*/
private String confirmNumber;
/**
* 调车机整备时间
*/
private String shutPrepareTime;
/**
* 设备备品
*/
private String travelSparePart;
public ShuntDetailInfo() {
this.setType(HandOverType.SHUNT);
}
}
/**
* 车站调度员交接班记录簿样式
*/
@Data
public static class StationDispatcherDetailInfo extends CommonInfo {
/**
* 命令指示
*/
private String commandInstructs;
/**
* 重点工作
*/
private String priorityWork;
/**
* 调车机停留线路
*/
private String shutStayLine;
/**
* 整备时间
*/
private String shutSetupTime;
/**
* 车站施工地点
*/
private String constructionLocation;
/**
* 车站施工起止时间
*/
private String constructionStartEndTime;
/**
* 设备备品
*/
private String travelSparePart;
public StationDispatcherDetailInfo() {
this.setType(HandOverType.DISPATCHER);
}
}
/**
* 车号长交接班记录簿填写样式
*/
@Data
public static class StationMasterDetailInfo extends CommonInfo {
/**
* 待发列车车次
*/
private String waitTripNumber;
/**
* 待发列车时间
*/
private String waitTime;
/**
* 上行票据张数
*/
private String upTicket;
/**
* 下行票据张数
*/
private String downTicket;
/**
* 行车设备
*/
private String travelEquipment;
/**
* 行车备品
*/
private String travelSparePart;
/**
* 列车编组顺序表-待接车
*/
private String groupReceiveTrain;
/**
* 列车编组顺序表-待发车
*/
private String groupDepartTrain;
/**
* 列车确报-待接车
*/
private String confirmReceiveTrain;
/**
* 列车确报-待发车
*/
private String confirmDepartTrain;
/**
* 记事
*/
private String remark;
public StationMasterDetailInfo() {
this.setType(HandOverType.STATION_MASTER);
}
}
/**
* 占线情况详情
*/
@Data
public static class FieldInfo {
private String name;
private List<FieldItem> fieldItemList;
}
/**
* 占线情况条目
*/
@Data
public static class FieldItem {
/**
* 线别
*/
private String lineCode;
/**
* 车次
*/
private String tripNumber;
/**
* 闭塞状态
*/
private boolean blocked;
/**
* 挂头状态
*/
private boolean hung;
/**
* 编完状态
*/
private boolean complete;
}
/**
* 计数器示例
*/
@Data
public static class CounterItem {
/**
* 名称
*/
private String name;
/**
* 号码
*/
private String number;
}
/**
* 日班计划
*/
@Data
public static class DayShiftPlan {
/**
* 名称
*/
private String name;
/**
* 内容
*/
private String content;
}
/**
* 齿轮工具
*/
@Data
public static class GearTool {
/**
* 名称
*/
private String name;
/**
* 地点
*/
private String location;
/**
* 齿轮工具
*/
private String amount;
}
/**
* 等待列车信息
*/
@Data
public static class WaitTrainInfo {
/**
* 车次
*/
private String tripNumber;
/**
* 股道
*/
private String section;
/**
* 数量
*/
private String count;
/**
* 时间字符串
*/
private String timeStr;
}
/**
* 交接班薄类型
*/
public enum HandOverType {
SECTION_STATION("区段车站的交接班记录"), MIDDLE_STATION("中间车站的交接班记录"),
FIELD_PERSONNEL("外勤助理值班员的交接班记录"), SHUNT("调车区长交接班记录"),
DISPATCHER("车站调度员交接班记录"), STATION_MASTER("车号长(员)交接班记录");
/**
* 描述
*/
private String describe;
HandOverType(String describe) {
this.describe = describe;
}
}
}

View File

@ -3,7 +3,11 @@ package club.joylink.rtss.simulation.cbtc.CTC.operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.EquipmentConstructionInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.KeyLinkControlInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.Ticket;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.SupervisorHandOverInfo;
import club.joylink.rtss.simulation.cbtc.CTC.service.RailBookService;
import club.joylink.rtss.simulation.cbtc.CTC.service.RailRegisterService;
import club.joylink.rtss.simulation.cbtc.CTC.data.Register;
import club.joylink.rtss.simulation.cbtc.CTC.service.RailTicketService;
@ -23,6 +27,8 @@ public class RailOperateHandler {
private RailRegisterService railRegisterService;
@Autowired
private RailTicketService railTicketService;
@Autowired
private RailBookService railBookService;
/**
* 填写行车簿册
@ -63,4 +69,140 @@ public class RailOperateHandler {
public void giveTicketTo(Simulation simulation, SimulationMember member, String ticketId, String memberId) {
railTicketService.giveTicketTo(simulation, member, ticketId, memberId);
}
/**
* 保存非正常情况接发列车关键环节控制表
*/
@OperateHandlerMapping(type = Operation.Type.KEY_LINK_CONTROL_INFO_SAVE)
public void saveKeyLinkControlInfo(Simulation simulation, KeyLinkControlInfo.DetailInfo detailInfo) {
railBookService.saveKeyLine(simulation, detailInfo);
}
/**
* 更新非正常情况接发列车关键环节控制表
*/
@OperateHandlerMapping(type = Operation.Type.KEY_LINK_CONTROL_INFO_UPDATE)
public void updateKeyLinkControlInfo(Simulation simulation, KeyLinkControlInfo.DetailInfo detailInfo) {
railBookService.updateKeyLine(simulation, detailInfo);
}
/**
* 查询非正常情况接发列车关键环节控制表
*/
@OperateHandlerMapping(type = Operation.Type.KEY_LINK_CONTROL_INFO_QUERY)
public List<KeyLinkControlInfo.DetailInfo> queryKeyLinkControlInfo(Simulation simulation, String stationCode) {
return railBookService.queryKeyLine(simulation, stationCode);
}
/**
* 保存行车设备施工登记信息
*/
@OperateHandlerMapping(type = Operation.Type.EQUIPMENT_CONSTRUCTION_INFO_SAVE)
public void saveConstructionInfo(Simulation simulation, EquipmentConstructionInfo.ConstructionInfo detailInfo) {
railBookService.saveEquipmentConstructionInfo(simulation, detailInfo);
}
/**
* 查询行车设备施工登记信息
*/
@OperateHandlerMapping(type = Operation.Type.EQUIPMENT_CONSTRUCTION_INFO_QUERY)
public List<EquipmentConstructionInfo.ConstructionInfo> queryConstructionInfo(Simulation simulation, String stationCode) {
return railBookService.queryEquipmentConstructionInfo(simulation, stationCode);
}
/**
* 保存区段站交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_SECTION_STATION_SAVE)
public void saveSectionStationHandOverInfo(Simulation simulation, SupervisorHandOverInfo.SectionStationDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取区间站交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_SECTION_STATION_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> querySectionStationHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.SECTION_STATION);
}
/**
* 保存中间站交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_MIDDLE_STATION_SAVE)
public void saveMiddleStationHandOverInfo(Simulation simulation, SupervisorHandOverInfo.MiddleStationDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取中间站交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_MIDDLE_STATION_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> queryMiddleStationHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.MIDDLE_STATION);
}
/**
* 保存外勤助理值班员交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_FIELD_PERSONNEL_SAVE)
public void saveFieldPersonnelHandOverInfo(Simulation simulation, SupervisorHandOverInfo.FieldPersonnelDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取外勤助理值班员交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_FIELD_PERSONNEL_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> queryFieldPersonnelHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.FIELD_PERSONNEL);
}
/**
* 保存调车区长交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_SHUT_SAVE)
public void saveShutHandOverInfo(Simulation simulation, SupervisorHandOverInfo.ShuntDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取调车区长交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_SHUT_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> queryShutHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.SHUNT);
}
/**
* 保存车站调度员交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_DISPATCHER_SAVE)
public void saveDispatcherHandOverInfo(Simulation simulation, SupervisorHandOverInfo.StationDispatcherDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取车站调度员交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_DISPATCHER_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> queryDispatcherHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.DISPATCHER);
}
/**
* 保存车号长交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_STATION_MASTER_SAVE)
public void saveStationMasterHandOverInfo(Simulation simulation, SupervisorHandOverInfo.StationMasterDetailInfo detailInfo) {
railBookService.saveHandOverInfo(simulation, detailInfo);
}
/**
* 获取车号长交接班记录
*/
@OperateHandlerMapping(type = Operation.Type.HAND_OVER_STATION_MASTER_QUERY)
public List<SupervisorHandOverInfo.CommonInfo> queryStationMasterHandOverInfo(Simulation simulation, String stationCode) {
return railBookService.queryHandOverInfo(simulation, stationCode, SupervisorHandOverInfo.HandOverType.STATION_MASTER);
}
}

View File

@ -0,0 +1,66 @@
package club.joylink.rtss.simulation.cbtc.CTC.service;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.EquipmentConstructionInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.KeyLinkControlInfo;
import club.joylink.rtss.simulation.cbtc.CTC.data.book.SupervisorHandOverInfo;
import club.joylink.rtss.simulation.cbtc.Simulation;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 非正常情况接发列车关键环节控制表
*/
@Service
public class RailBookService {
/**
* 保存非正常情况接发列车关键环节控制表
*/
public void saveKeyLine(Simulation simulation, KeyLinkControlInfo.DetailInfo detailInfo) {
simulation.getCtcRepository().getKeyLinkControlInfo().saveDetailInfo(detailInfo);
}
/**
* 更新非正常情况接发列车关键环节控制表
*/
public void updateKeyLine(Simulation simulation, KeyLinkControlInfo.DetailInfo detailInfo) {
simulation.getCtcRepository().getKeyLinkControlInfo().updateDetailInfo(detailInfo);
}
/**
* 查询非正常情况接发列车关键环节控制表
*/
public List<KeyLinkControlInfo.DetailInfo> queryKeyLine(Simulation simulation, String stationCode) {
return simulation.getCtcRepository().getKeyLinkControlInfo().getDetailInfoList(stationCode);
}
/**
* 保存行车设备施工登记
*/
public void saveEquipmentConstructionInfo(Simulation simulation, EquipmentConstructionInfo.ConstructionInfo detailInfo) {
simulation.getCtcRepository().getEquipmentConstructionInfo().saveDetailInfo(detailInfo);
}
/**
* 获取行车设备施工登记信息列表
*/
public List<EquipmentConstructionInfo.ConstructionInfo> queryEquipmentConstructionInfo(Simulation simulation, String stationCode) {
return simulation.getCtcRepository().getEquipmentConstructionInfo().getDetailInfoList(stationCode);
}
/**
* 保存交接班记录信息
*/
public void saveHandOverInfo(Simulation simulation, SupervisorHandOverInfo.CommonInfo handoverInfo) {
simulation.getCtcRepository().getSupervisorHandOverInfo().saveDetailInfo(handoverInfo);
}
/**
* 获取车站对应类型的交接薄记录信息
*/
public List<SupervisorHandOverInfo.CommonInfo> queryHandOverInfo(Simulation simulation, String stationCode, SupervisorHandOverInfo.HandOverType type) {
return simulation.getCtcRepository().getSupervisorHandOverInfo().getDetailInfoList(stationCode, type);
}
}