用户考试调整,支持"单操"绑定客户端的操作
This commit is contained in:
parent
877372b2cd
commit
7f0cb1e41b
1
sql/20230520-zhou-paper-rule.sql
Normal file
1
sql/20230520-zhou-paper-rule.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `rts_paper_rule` ADD COLUMN `sub_type_param` varchar(255) NULL COMMENT '规则参数';
|
@ -99,4 +99,14 @@ public class SimulationTrainingV2Controller {
|
||||
public void drawTraining(@PathVariable String group, @PathVariable Long trainingId) {
|
||||
training2Service.drawTraining(group, trainingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载实训到第{stepId}步
|
||||
* @param group 仿真ID
|
||||
* @param stepId 步数ID
|
||||
*/
|
||||
@PutMapping("/{group}/jumpTo/{stepId}")
|
||||
public void jumpToStep(@PathVariable String group, @PathVariable Long stepId){
|
||||
training2Service.jumpToStep(group, stepId);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package club.joylink.rtss.entity.paper;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -32,9 +29,6 @@ public class PaperRule implements Serializable {
|
||||
*/
|
||||
private Integer subtype;
|
||||
|
||||
/**
|
||||
* 筛选题目的标签,即根据标签来筛选题目;List<String>的json
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
@ -47,12 +41,13 @@ public class PaperRule implements Serializable {
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 实训考试的规则
|
||||
* {@link List <PaperCompositionWithRuleVo.ScenePagerRuleVO>}
|
||||
*/
|
||||
|
||||
private String sceneDetail;
|
||||
|
||||
/**
|
||||
* 规则参数
|
||||
* {@link club.joylink.rtss.vo.paper.PaperRuleVo.SubTypeParam}
|
||||
*/
|
||||
private String subTypeParam;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -623,6 +623,76 @@ public class PaperRuleExample {
|
||||
addCriterion("scene_detail not between", value1, value2, "sceneDetail");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamIsNull() {
|
||||
addCriterion("sub_type_param is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamIsNotNull() {
|
||||
addCriterion("sub_type_param is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamEqualTo(String value) {
|
||||
addCriterion("sub_type_param =", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamNotEqualTo(String value) {
|
||||
addCriterion("sub_type_param <>", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamGreaterThan(String value) {
|
||||
addCriterion("sub_type_param >", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("sub_type_param >=", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamLessThan(String value) {
|
||||
addCriterion("sub_type_param <", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamLessThanOrEqualTo(String value) {
|
||||
addCriterion("sub_type_param <=", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamLike(String value) {
|
||||
addCriterion("sub_type_param like", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamNotLike(String value) {
|
||||
addCriterion("sub_type_param not like", value, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamIn(List<String> values) {
|
||||
addCriterion("sub_type_param in", values, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamNotIn(List<String> values) {
|
||||
addCriterion("sub_type_param not in", values, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamBetween(String value1, String value2) {
|
||||
addCriterion("sub_type_param between", value1, value2, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubTypeParamNotBetween(String value1, String value2) {
|
||||
addCriterion("sub_type_param not between", value1, value2, "subTypeParam");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,6 +315,11 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemIsNull() {
|
||||
addCriterion("map_system is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemIsNotNull() {
|
||||
addCriterion("map_system is not null");
|
||||
return (Criteria) this;
|
||||
@ -330,6 +335,61 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemGreaterThan(String value) {
|
||||
addCriterion("map_system >", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("map_system >=", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemLessThan(String value) {
|
||||
addCriterion("map_system <", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemLessThanOrEqualTo(String value) {
|
||||
addCriterion("map_system <=", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemLike(String value) {
|
||||
addCriterion("map_system like", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemNotLike(String value) {
|
||||
addCriterion("map_system not like", value, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemIn(List<String> values) {
|
||||
addCriterion("map_system in", values, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemNotIn(List<String> values) {
|
||||
addCriterion("map_system not in", values, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemBetween(String value1, String value2) {
|
||||
addCriterion("map_system between", value1, value2, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMapSystemNotBetween(String value1, String value2) {
|
||||
addCriterion("map_system not between", value1, value2, "mapSystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalIsNull() {
|
||||
addCriterion("terminal is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalIsNotNull() {
|
||||
addCriterion("terminal is not null");
|
||||
return (Criteria) this;
|
||||
@ -345,6 +405,56 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalGreaterThan(String value) {
|
||||
addCriterion("terminal >", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("terminal >=", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalLessThan(String value) {
|
||||
addCriterion("terminal <", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalLessThanOrEqualTo(String value) {
|
||||
addCriterion("terminal <=", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalLike(String value) {
|
||||
addCriterion("terminal like", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalNotLike(String value) {
|
||||
addCriterion("terminal not like", value, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalIn(List<String> values) {
|
||||
addCriterion("terminal in", values, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalNotIn(List<String> values) {
|
||||
addCriterion("terminal not in", values, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalBetween(String value1, String value2) {
|
||||
addCriterion("terminal between", value1, value2, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTerminalNotBetween(String value1, String value2) {
|
||||
addCriterion("terminal not between", value1, value2, "terminal");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
@ -1055,6 +1165,76 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientIsNull() {
|
||||
addCriterion("client is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientIsNotNull() {
|
||||
addCriterion("client is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientEqualTo(String value) {
|
||||
addCriterion("client =", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientNotEqualTo(String value) {
|
||||
addCriterion("client <>", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientGreaterThan(String value) {
|
||||
addCriterion("client >", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("client >=", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientLessThan(String value) {
|
||||
addCriterion("client <", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientLessThanOrEqualTo(String value) {
|
||||
addCriterion("client <=", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientLike(String value) {
|
||||
addCriterion("client like", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientNotLike(String value) {
|
||||
addCriterion("client not like", value, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientIn(List<String> values) {
|
||||
addCriterion("client in", values, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientNotIn(List<String> values) {
|
||||
addCriterion("client not in", values, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientBetween(String value1, String value2) {
|
||||
addCriterion("client between", value1, value2, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClientNotBetween(String value1, String value2) {
|
||||
addCriterion("client not between", value1, value2, "client");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSharedIsNull() {
|
||||
addCriterion("shared is null");
|
||||
return (Criteria) this;
|
||||
@ -1117,7 +1297,6 @@ public class PublishedTraining2Example {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
|
@ -431,14 +431,19 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
|
||||
if (StringUtils.hasText(defaultClientType)) {
|
||||
String deviceCode = defaultMember != null ? defaultMember.getDeviceCode() : null;
|
||||
Optional<MapClientVO> defaultClientOptional = clientVOList.stream()
|
||||
.filter(c -> Objects.equals(c.getType(), defaultClientType)
|
||||
&& (StringUtils.isEmpty(deviceCode) || Objects.equals(deviceCode, c.getDeviceCode())
|
||||
)).findFirst();
|
||||
.filter(c -> Objects.equals(c.getType(), defaultClientType) && Objects.equals(deviceCode, c.getDeviceCode()))
|
||||
.findFirst();
|
||||
// 没有找到默认获取一个
|
||||
if (defaultClientOptional.isEmpty()) {
|
||||
defaultClientOptional = clientVOList.stream().filter(c -> Objects.equals(c.getType(), defaultClientType)).findFirst();
|
||||
}
|
||||
if (defaultClientOptional.isEmpty()) {
|
||||
msgList.add(String.format("地图[名:%s]设备[%s]不存在客户端类型[%s]", mapDetail.getName(), deviceCode, defaultClientType));
|
||||
} else {
|
||||
mapFunctionParam.getParamVO().getDomConfig().setClient(defaultClientOptional.get().getId());
|
||||
}
|
||||
} else {
|
||||
mapFunctionParam.getParamVO().getDomConfig().setClient("");
|
||||
}
|
||||
// 关联的客户端列表
|
||||
List<String> clientTypeList = template.getAssistantParam().getClientTypeList();
|
||||
|
@ -50,11 +50,13 @@ public class PaperCompositionService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
//根据项目和名称来查,如果存在则结束
|
||||
// long sceneCount = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Scene).count();
|
||||
// PaperExceptionAssert.PcRepeatScene.assertTrue(sceneCount > 1,"场景数据规则只能有一个");
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
|
||||
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
//
|
||||
PaperComposition newPc = new PaperComposition();
|
||||
newPc.setMapId(req.getMapId());
|
||||
@ -101,6 +103,7 @@ public class PaperCompositionService {
|
||||
|
||||
for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) {
|
||||
req.setPcId(pcId);
|
||||
|
||||
//
|
||||
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
|
||||
String key = this.ruleMapKey(req);
|
||||
|
@ -276,7 +276,7 @@ public class PaperUserCreateService {
|
||||
puq.setSubType(rule.getSubtype().getValue());
|
||||
paperUserQuestionDAO.insertSelective(puq);
|
||||
});
|
||||
return findRand.stream().map(d->d.getId()).collect(Collectors.toList());
|
||||
return findRand.stream().map(PublishedTraining2::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void dispatcherTrainScene(PaperUser pu, PaperCompositionWithRuleVo.PaperRuleVo rule){
|
||||
@ -317,7 +317,9 @@ public class PaperUserCreateService {
|
||||
criteria.andIdNotIn(existTrainIds);
|
||||
}*/
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = this.training2PublishService.basicQueryCriteria(questionExample,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null,rule.getTags());
|
||||
subTypeStr = StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null;
|
||||
PaperQType.TrainingClient client = Objects.nonNull(rule.getSubTypeParam()) ? rule.getSubTypeParam().getClient() : null;
|
||||
PublishedTraining2Example.Criteria criteria = this.training2PublishService.basicQueryCriteria(questionExample,pc.getMapId(),pc.getOrgId(), subTypeStr,rule.getTags(),client);
|
||||
if(!CollectionUtils.isEmpty(existTrainIds)){
|
||||
criteria.andIdNotIn(existTrainIds);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class PaperUserService {
|
||||
return paperQuestionService.findAllLable(req.getOrgId(),req.getSubType().name().toLowerCase());
|
||||
}else if(PaperQType.GroupType.Training.equals(req.getGroupType())){
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(req.getSubType() == PaperQType.SubType.Scene,"不支持此操作");
|
||||
return this.training2PublishService.findAllLabel(req.getMapId(),req.getOrgId(),req.getSubType().name().toUpperCase());
|
||||
return this.training2PublishService.findAllLabel(req.getMapId(),req.getOrgId(),req.getSubType().name().toUpperCase(),req.getTrainingClient());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class PaperUserService {
|
||||
}else if(PaperQType.GroupType.Training.equals(req.getGroupType())){
|
||||
// PaperExceptionAssert.PdValid.assertTrue(!PaperQType.GroupType.Training.equals(groupType),"不支持查询实训题数量");
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(req.getSubType() == PaperQType.SubType.Scene,"不支持此操作");
|
||||
return training2PublishService.queryCountForLabel(req.getMapId(), req.getOrgId(), req.getSubType().name().toUpperCase(),req.getTags());
|
||||
return training2PublishService.queryCountForLabel(req);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
@ -115,6 +115,7 @@ public class PaperUserService {
|
||||
rsp.setQuestionList(userQuestionList.stream().map(puq -> {
|
||||
return PaperUserQuestionConvertor.convert(puq);
|
||||
}).collect(Collectors.toList()));
|
||||
rsp.setSystemTime(System.currentTimeMillis());
|
||||
return rsp;
|
||||
}
|
||||
|
||||
@ -220,12 +221,13 @@ public class PaperUserService {
|
||||
if(score >= sumScore){
|
||||
return ruleScore;
|
||||
}
|
||||
// int d = sumScore >=10 ? sumScore : sumScore * 100;
|
||||
double t = score / sumScore;
|
||||
return new BigDecimal((score / sumScore) * ruleScore).setScale(0,RoundingMode.HALF_UP).intValue();
|
||||
|
||||
/*double t = score / sumScore;
|
||||
if(t <=0.5){
|
||||
return (int)Math.round(t * ruleScore);
|
||||
}
|
||||
return (int)Math.floor(t * ruleScore);
|
||||
return (int)Math.floor(t * ruleScore);*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,28 +261,6 @@ public class PaperUserService {
|
||||
example.createCriteria().andPuIdEqualTo(puId);
|
||||
example.setOrderByClause(" id asc ");
|
||||
List<PaperUserQuestion> findList = paperUserQuestionDAO.selectByExample(example);
|
||||
/* List<PaperUserQuestion> commonList = new ArrayList<>();
|
||||
List<PaperUserQuestion> trainingList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(findList)) {
|
||||
findList.forEach(puq -> {
|
||||
PaperQType.GroupType type = PaperQType.GroupType.getItem(puq.getType());
|
||||
switch (type) {
|
||||
case Common:
|
||||
commonList.add(puq);
|
||||
break;
|
||||
case Training:
|
||||
trainingList.add(puq);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
commonList.sort(Comparator.comparing(PaperUserQuestion::getId));
|
||||
trainingList.sort(Comparator.comparing(PaperUserQuestion::getId));
|
||||
|
||||
List<PaperUserQuestion> rt = new ArrayList<>(commonList.size() + trainingList.size());
|
||||
rt.addAll(commonList);
|
||||
rt.addAll(trainingList);*/
|
||||
findList.sort(Comparator.comparing(PaperUserQuestion::getId));
|
||||
return findList;
|
||||
}
|
||||
|
@ -66,8 +66,9 @@ public class PaperUserSubmitAnswerService {
|
||||
final PaperUser pu = paperUserDAO.selectByPrimaryKey(req.getPuId());
|
||||
//生成试卷的试卷蓝图
|
||||
final PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(pu.getPcId());
|
||||
//2023.5.20 用户交卷不进行验证时效性,改为前端处理
|
||||
//校验
|
||||
this.assertCanSubmitAnswer(pc, pu, puq, user);
|
||||
// this.assertCanSubmitAnswer(pc, pu, puq, user);
|
||||
//
|
||||
final PaperSubmitAnswerRspVo rsp = new PaperSubmitAnswerRspVo();
|
||||
rsp.setPuId(req.getPuId());
|
||||
|
@ -11,6 +11,8 @@ import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.paper.FindCountForQuestionReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperQType;
|
||||
import club.joylink.rtss.vo.training2.publish.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@ -47,10 +49,10 @@ public class Training2PublishService {
|
||||
* 根据组织,类型(单操作,实操),标签获取对应的数量
|
||||
|
||||
*/
|
||||
public Long queryCountForLabel(Long mapId,@Deprecated Long orgId,String type,String label){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
public Long queryCountForLabel(FindCountForQuestionReqVo reqVo){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
// PublishedTraining2Example.Criteria c = example.createCriteria();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type,Arrays.asList(label));
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,reqVo.getMapId(),reqVo.getOrgId(),reqVo.getSubType().name().toUpperCase(),Arrays.asList(reqVo.getTags()),reqVo.getTrainingClient());
|
||||
// if(Objects.nonNull(label)){
|
||||
// c.andLabelJsonLike(String.format("%%%s%%", label));
|
||||
// }
|
||||
@ -60,10 +62,10 @@ public class Training2PublishService {
|
||||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
public Collection<String> findAllLabel(Long mapId,Long orgId, String type){
|
||||
public Collection<String> findAllLabel(Long mapId, Long orgId, String type, PaperQType.TrainingClient client){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
// PublishedTraining2Example.Criteria c = example.createCriteria();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type,null);
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type,null,client);
|
||||
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(dataList)){
|
||||
return Collections.emptyList();
|
||||
@ -71,10 +73,10 @@ public class Training2PublishService {
|
||||
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());
|
||||
}).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, Long mapId, Long orgId, String type,List<String> lables){
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, Long mapId, Long orgId, String type, List<String> lables, PaperQType.TrainingClient client){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
|
||||
@ -91,8 +93,13 @@ public class Training2PublishService {
|
||||
or.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(mapId);
|
||||
or.andTypeEqualTo(type);
|
||||
// or.andOrgIdNotEqualTo(orgId);
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
|
||||
if(Objects.nonNull(client)){
|
||||
criteria.andClientEqualTo(client.name());
|
||||
or.andClientEqualTo(client.name());
|
||||
}
|
||||
// or.andOrgIdNotEqualTo(orgId);
|
||||
if(!CollectionUtils.isEmpty(lables)){
|
||||
for (String tag : lables) {
|
||||
if(StringUtils.hasText(tag)){
|
||||
|
@ -216,7 +216,7 @@ public class Training2RuleService {
|
||||
// 地图列表
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
MapInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(MapStatus.Online.getCode());
|
||||
criteria.andLineCodeIn(lineCodeRuleMap.keySet().stream().collect(Collectors.toList()));
|
||||
criteria.andLineCodeIn(new ArrayList<>(lineCodeRuleMap.keySet()));
|
||||
List<MapInfo> mapList = mapInfoDAO.selectByExample(example);
|
||||
|
||||
// 需要删除的发布的实训
|
||||
@ -401,7 +401,6 @@ public class Training2RuleService {
|
||||
RtsMapFunctionExample.Criteria rtsCriteria = rtsExample.createCriteria();
|
||||
rtsCriteria.andMapIdEqualTo(k);
|
||||
rtsCriteria.andNameEqualTo("单操实训");
|
||||
List<RtsMapFunction> entities = rtsMapFunctionDAO.selectByExampleWithBLOBs(rtsExample);
|
||||
return entities;
|
||||
return rtsMapFunctionDAO.selectByExampleWithBLOBs(rtsExample);
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,6 @@ import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.*;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
|
||||
@ -26,7 +23,6 @@ import club.joylink.rtss.simulation.cbtc.member.MemberManager;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.Operation2;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.ScoringRule2;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.Step2;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.index.Index;
|
||||
@ -37,7 +33,6 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
|
||||
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
|
||||
import club.joylink.rtss.websocket.StompMessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -48,6 +43,8 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Semaphore;
|
||||
@ -151,6 +148,18 @@ public class Training2Service {
|
||||
Step2 step = getNextStepAndCheckTrainingStatus(training2, simulation);
|
||||
// 如果步骤执行完毕 或者 步骤内操作全部是前端操作则直接返回交于前端操作 || step.allClientOperation()
|
||||
if (step == null) {
|
||||
if (training2.haveJumpStep()) { // 当跳转步骤是最后一步时,结束需要做额外清空
|
||||
clearJumpStep(simulation);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 因为是跳转,前端不需要操作,直接置成成功
|
||||
if (training2.isJumpStep(step)) {
|
||||
step.getOperations().forEach(Operation2::doSuccessVail);
|
||||
}
|
||||
// 如果跳转到目标步骤,停止加速并置空跳转步骤
|
||||
if (training2.haveJumpStep() && !training2.isJumpStep(step)) {
|
||||
clearJumpStep(simulation);
|
||||
return;
|
||||
}
|
||||
// 尝试触发步骤
|
||||
@ -247,20 +256,7 @@ public class Training2Service {
|
||||
if (training2 == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "实训数据不存在");
|
||||
}
|
||||
if (!StringUtils.isEmpty(training2.getBgSceneJson())) {
|
||||
if (training2.isNeedReloadScenes()) {
|
||||
groupSimulationService.loadScenes(simulation.getId(), training2.getBgSceneJson());
|
||||
}
|
||||
} else {
|
||||
// 重置仿真状态
|
||||
simulationService.reset(simulation.getId());
|
||||
}
|
||||
atsMessageCollectAndDispatcher.collectAllAndSend(simulation);
|
||||
// 增加实训任务
|
||||
training2.start(mode);
|
||||
addTrainingJob(simulation, training2);
|
||||
// 启动仿真
|
||||
simulationLifeCycleService.resume(simulation);
|
||||
doStartTraining(mode, simulation, training2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -437,6 +433,9 @@ public class Training2Service {
|
||||
simCommand2.doCompletion();
|
||||
startFlag = Boolean.TRUE;
|
||||
}
|
||||
if (training2.getJumpToStep() != null) { // 处于跳转状态下,下边步骤不执行
|
||||
return;
|
||||
}
|
||||
// 指令执行后启动仿真
|
||||
if (simulation.isPause() && startFlag) {
|
||||
simulation.start();
|
||||
@ -538,6 +537,26 @@ public class Training2Service {
|
||||
sendSimulationConversation(simulation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载实训到第几步
|
||||
* @param group 仿真
|
||||
* @param stepId 实训步数ID
|
||||
*/
|
||||
public void jumpToStep(String group, Long stepId) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
Training2 training2 = simulation.getTraining2();
|
||||
try {
|
||||
Step2 step2 = training2.getStep(stepId.intValue()); // 跳转目标步骤
|
||||
training2.setJumpToStep(step2);
|
||||
doStartTraining(null, simulation, training2); // 开始执行
|
||||
simulation.updateSpeed(Simulation.MAX_SPEED);
|
||||
} catch (Exception e) {
|
||||
log.error("loadTrainingToStep is error", e);
|
||||
training2.finish();
|
||||
removeTrainingJob(simulation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训时创建仿真对象
|
||||
*/
|
||||
@ -591,7 +610,8 @@ public class Training2Service {
|
||||
*/
|
||||
private boolean checkTrainStepCompletion(Step2 step, Simulation simulation) {
|
||||
boolean result = step.doCompletionVail();
|
||||
if (result) {
|
||||
// 如果实在跳过过程中,不需要发消息信息
|
||||
if (result && !simulation.getTraining2().isJumpStep(step)) {
|
||||
// 发送步骤完成信息
|
||||
applicationContext.publishEvent(new SimulationStepFinishEvent(this, simulation, step));
|
||||
}
|
||||
@ -635,8 +655,8 @@ public class Training2Service {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发送步骤提示信息
|
||||
if (!step.isPrompt()) {
|
||||
// 发送步骤提示信息,需要跳过步骤不发消息
|
||||
if (!step.isPrompt() && !simulation.getTraining2().isJumpStep(step)) {
|
||||
step.setPrompt(true); // 标识已发送过消息
|
||||
applicationContext.publishEvent(new SimulationStepTipEvent(this, simulation, step));
|
||||
}
|
||||
@ -676,7 +696,7 @@ public class Training2Service {
|
||||
isExec = (simCurTime == operation2.getSimTime() || operation2.getSimTime() < simCurTime);
|
||||
}
|
||||
if (isExec) {
|
||||
if (isRobot || operation2.isSpecial()) { // 特殊操作直接执行
|
||||
if (isRobot || operation2.isSpecial() || simulation.getTraining2().isJumpStep(step)) { // 特殊操作直接执行
|
||||
atsOperationDispatcher.execute(simulation, step.getSimulationMember(), operation2.getOperationType().name()
|
||||
, operation2.getParams());
|
||||
return true;
|
||||
@ -782,17 +802,19 @@ public class Training2Service {
|
||||
ConversationMessageVO message = (ConversationMessageVO) event.getResult();
|
||||
String source = String.valueOf(simOperation2.getParams().get("content"));
|
||||
String target = message.getContent();
|
||||
boolean doCompletion = false;
|
||||
if (CONVERSATION_TEXT_LIST.contains(event.getOperate())) {
|
||||
if (Objects.equals(source,target)) {
|
||||
simOperation2.doOperated();
|
||||
}
|
||||
doCompletion = Objects.equals(source,target);
|
||||
} else {
|
||||
boolean result = StrUtils.isMatch(source, target, 20);
|
||||
if (result) {
|
||||
simOperation2.doOperated();
|
||||
}
|
||||
// 发送步骤完成信息
|
||||
applicationContext.publishEvent(new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, result));
|
||||
doCompletion = StrUtils.isMatch(source, target, 20);
|
||||
}
|
||||
if (doCompletion) {
|
||||
simOperation2.doOperated();
|
||||
simOperation2.doCompletion();
|
||||
}
|
||||
// 发送步骤完成信息
|
||||
if (!simulation.getTraining2().isJumpStep(step) && !step.getSimulationMember().isRobot()) {
|
||||
applicationContext.publishEvent(new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, doCompletion));
|
||||
}
|
||||
}
|
||||
|
||||
@ -866,4 +888,37 @@ public class Training2Service {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始执行实训
|
||||
*
|
||||
* @param mode 模式
|
||||
* @param simulation 仿真
|
||||
* @param training2 实训
|
||||
*/
|
||||
private void doStartTraining(ScriptBO.Mode mode, Simulation simulation, Training2 training2) {
|
||||
if (!StringUtils.isEmpty(training2.getBgSceneJson())) {
|
||||
if (training2.isNeedReloadScenes() || training2.getJumpToStep() != null) {
|
||||
groupSimulationService.loadScenes(simulation.getId(), training2.getBgSceneJson());
|
||||
}
|
||||
} else {
|
||||
// 重置仿真状态
|
||||
simulationService.reset(simulation.getId());
|
||||
}
|
||||
atsMessageCollectAndDispatcher.collectAllAndSend(simulation);
|
||||
// 增加实训任务
|
||||
training2.start(mode);
|
||||
addTrainingJob(simulation, training2);
|
||||
// 启动仿真
|
||||
simulationLifeCycleService.resume(simulation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除当前实训跳转步骤信息
|
||||
*/
|
||||
private void clearJumpStep(Simulation simulation) {
|
||||
simulation.updateSpeed(Simulation.MIN_SPEED);
|
||||
simulation.getTraining2().setJumpToStep(null);
|
||||
simulation.getTraining2().finish();
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public abstract class Simulation<U extends SimulationUser, M extends SimulationM
|
||||
*/
|
||||
private volatile int speed;
|
||||
public static final int MIN_SPEED = 1;
|
||||
public static final int MAX_SPEED = 100;
|
||||
public static final int MAX_SPEED = 10;
|
||||
/**
|
||||
* 仿真系统时间
|
||||
*/
|
||||
|
@ -116,6 +116,8 @@ public class AtsAlarm {
|
||||
Conflict_Route_Set,
|
||||
/** 列车延误 */
|
||||
TRAIN_DELAY,
|
||||
/** 设备故障 */
|
||||
DEVICE_FAULT,
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,23 +81,26 @@ public class SortDiagramStation {
|
||||
}*/
|
||||
public Station findNext(Station station,boolean isRight){
|
||||
int index = this.findIndex(station);
|
||||
|
||||
|
||||
if(isRight){
|
||||
int findIndex = isRight ? index + 1 : index - 1;
|
||||
return this.findNotDepotStation(isRight,findIndex);
|
||||
/*if(isRight){
|
||||
return this.findNotDepotStation(isRight,index + 1);
|
||||
}else{
|
||||
|
||||
return this.findNotDepotStation(isRight,index -1);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
public Station findPre(Station station,boolean isRight){
|
||||
int index = this.findIndex(station);
|
||||
if(isRight){
|
||||
int findIndex = isRight ? index -1 : index +1;
|
||||
return this.findNotDepotStation(isRight,findIndex);
|
||||
|
||||
/*if(isRight){
|
||||
return this.findNotDepotStation(isRight,index - 1);
|
||||
}else{
|
||||
return this.findNotDepotStation(isRight,index + 1);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
public Station find(Station station){
|
||||
int index = this.findIndex(station);
|
||||
|
@ -17,22 +17,19 @@ public class StationDiagram {
|
||||
public StationDiagram(VirtualRealityTrain train){
|
||||
this.groupNum = train.getGroupNumber();
|
||||
this.right = train.isRight();
|
||||
this.stationComplateRatio = 0F;
|
||||
this.stationCompleteRatio = 0F;
|
||||
this.finalStation = false;
|
||||
}
|
||||
|
||||
public StationDiagram(VirtualRealityTrain train,Float stationComplateRatio, Boolean finalStation){
|
||||
public StationDiagram(VirtualRealityTrain train,Float stationCompleteRatio, Boolean finalStation){
|
||||
this.groupNum = train.getGroupNumber();
|
||||
this.right = train.isRight();
|
||||
this.stationComplateRatio = stationComplateRatio;
|
||||
this.stationCompleteRatio = stationCompleteRatio;
|
||||
this.finalStation = finalStation;
|
||||
}
|
||||
|
||||
public StationDiagram(VirtualRealityTrain train,boolean showTrainDiagram,Float stationComplateRatio, Boolean finalStation){
|
||||
this.groupNum = train.getGroupNumber();
|
||||
this.right = train.isRight();
|
||||
this.stationComplateRatio = stationComplateRatio;
|
||||
this.finalStation = finalStation;
|
||||
public StationDiagram(VirtualRealityTrain train,boolean showTrainDiagram,Float stationCompleteRatio, Boolean finalStation){
|
||||
this(train,stationCompleteRatio,finalStation);
|
||||
this.showTrainDiagram = showTrainDiagram;
|
||||
}
|
||||
|
||||
@ -48,7 +45,7 @@ public class StationDiagram {
|
||||
/**
|
||||
* 运行完成度
|
||||
*/
|
||||
private Float stationComplateRatio;
|
||||
private Float stationCompleteRatio;
|
||||
|
||||
/**
|
||||
* 是否到达终点车站
|
||||
|
@ -29,7 +29,7 @@ public class AtsAlarmService {
|
||||
Simulation simulation = event.getSimulation();
|
||||
DeviceFaultInfo deviceFaultInfo = event.getDeviceFaultInfo();
|
||||
AtsAlarm alarm = new AtsAlarm(String.valueOf(simulation.getIdGenerator().generateAlarmId()),
|
||||
simulation.getCorrectSystemTime(), null, "A",
|
||||
simulation.getCorrectSystemTime(), AtsAlarm.Type.DEVICE_FAULT, "A",
|
||||
deviceFaultInfo.getCode(), deviceFaultInfo.getFault());
|
||||
simulation.getRepository().addAtsAlarm(alarm);
|
||||
SocketMessageVO<Collection<AtsAlarm>> alarmMessage
|
||||
@ -55,7 +55,7 @@ public class AtsAlarmService {
|
||||
Simulation simulation = event.getSimulation();
|
||||
DeviceFaultInfo deviceFaultInfo = event.getDeviceFaultInfo();
|
||||
List<AtsAlarm> list = simulation.getRepository().getAlarmList().stream()
|
||||
.filter(atsAlarm -> !atsAlarm.getRecovered() && atsAlarm.getDeviceCode().equals(deviceFaultInfo.getCode()))
|
||||
.filter(atsAlarm -> (atsAlarm.getRecovered() == null || !atsAlarm.getRecovered()) && atsAlarm.getDeviceCode().equals(deviceFaultInfo.getCode()))
|
||||
.peek(atsAlarm -> atsAlarm.recover(simulation.getCorrectSystemTime()))
|
||||
.collect(Collectors.toList());
|
||||
SocketMessageVO<Collection<AtsAlarm>> messageVO = SocketMessageFactory
|
||||
|
@ -93,7 +93,7 @@ public class NccAlarmService {
|
||||
repository.addAtsAlarm(atsAlarm);
|
||||
SocketMessageVO<Collection<AtsAlarm>> messageVO =
|
||||
SocketMessageFactory.buildAtsAlarmMessage(simulation.getId(), Collections.singletonList(atsAlarm));
|
||||
stompMessageService.sendToUser(simulation.getCreatorId(), messageVO);
|
||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), messageVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,38 +61,28 @@ public class RuningService implements CalculateDiagram{
|
||||
private Float calculateStationRatio(Simulation simulation,Section begin,Section end,VirtualRealityTrain train){
|
||||
Long mapId = simulation.getBuildParams().getMap().getId();
|
||||
LocalDateTime simulationDateTime = simulation.getCorrectSystemTime();
|
||||
Float totalDis;
|
||||
Float runOffset;
|
||||
try{
|
||||
totalDis = CalculateService.calculateDistance(begin,end,train.isRight());
|
||||
if(totalDis == 0F){
|
||||
//车辆已经到达站点
|
||||
return 1F;
|
||||
}
|
||||
float off = begin.getStopPointByDirection(train.isRight());
|
||||
runOffset = CalculateService.calculateDistanceIgnoreSwitchFromStationToTrainHead(new SectionPosition(begin,off),train.getHeadPosition(),train.isRight());
|
||||
}catch (Exception e){
|
||||
log.debug("计算失败 线路id:{} 仿真时间:{} 车次[{}] 方向[{}] 车头区段[{}] 车头位置[{}] 车尾区段[{}] 查找开始区段[{}] 结束区段[{}] 错误信息[{}] "
|
||||
,mapId,simulationDateTime
|
||||
,train.getGroupNumber(),train.isRight(),train.getHeadPosition().getSection().getCode(),train.getHeadPosition().getOffset()
|
||||
,train.getTailPosition().getSection().getCode(),begin.getCode(),end.getCode(),e.getMessage(),e);
|
||||
return null;
|
||||
}
|
||||
|
||||
try{
|
||||
double t = runOffset / totalDis;
|
||||
float d = new BigDecimal(t).setScale(3, RoundingMode.HALF_UP).floatValue();
|
||||
if(d >= 1F){
|
||||
d = 1F;
|
||||
Float totalDis = CalculateService.calculateDistance(begin,end,train.isRight());
|
||||
Float runOffset = 0F;
|
||||
float stationCompleteRatio = 1F;
|
||||
if(totalDis != 0F){
|
||||
float off = begin.getStopPointByDirection(train.isRight());
|
||||
runOffset = CalculateService.calculateDistanceIgnoreSwitchFromStationToTrainHead(new SectionPosition(begin,off),train.getHeadPosition(),train.isRight());
|
||||
if(runOffset != 1F){
|
||||
stationCompleteRatio = new BigDecimal(runOffset / totalDis).setScale(3, RoundingMode.HALF_UP).floatValue();
|
||||
if(stationCompleteRatio >= 1F){
|
||||
stationCompleteRatio = 1F;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("线路id:{} 仿真时间:{} 车次[{}] 方向[{}] 车头区段[{}] 车头位置[{}] 车尾区段[{}] 查找开始区段[{}] 结束区段[{}] 距离总长[{}] 剩余距离[{}] 已行驶[{}] 行驶完成度[{}]"
|
||||
,mapId,simulationDateTime
|
||||
,train.getGroupNumber(),train.isRight(),train.getHeadPosition().getSection().getCode(),train.getHeadPosition().getOffset()
|
||||
,train.getTailPosition().getSection().getCode(), begin.getCode(),end.getCode() , totalDis ,(totalDis - runOffset),runOffset ,d);
|
||||
return Math.abs(d);
|
||||
,train.getTailPosition().getSection().getCode(), begin.getCode(),end.getCode() , totalDis ,(totalDis - runOffset),runOffset ,stationCompleteRatio);
|
||||
return Math.abs(stationCompleteRatio);
|
||||
}catch (Exception e){
|
||||
log.error("计算失败 线路id:{} 仿真时间:{} groupNum:{},isRight:{},begin:{},end:{},totalDis:{},targetDis:{} 错误信息:{}",mapId,simulationDateTime
|
||||
,train.getGroupNumber() ,train.isRight(),begin.getCode() ,end.getCode() ,totalDis , runOffset,e.getMessage(),e);
|
||||
log.error("计算失败 线路id:{} 仿真时间:{} groupNum:{},isRight:{},begin:{},end:{}, 错误信息:{}",mapId,simulationDateTime
|
||||
,train.getGroupNumber() ,train.isRight(),begin.getCode() ,end.getCode() ,e.getMessage(),e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ public class CiService {
|
||||
public void checkAndTrySettingOverlap(Simulation simulation, RouteOverlap overlap) {
|
||||
if (overlap != null && !overlap.isSetting() && !overlap.isLock() &&
|
||||
!overlap.isForbidden()) {
|
||||
if (overlap.getSection().isRouteLock()) {
|
||||
//添加后半条件为解决宁波一S011003信号机延续保护可能在反向进路S011007-S011001办理时触发的问题
|
||||
if (overlap.getSection().isRouteLock() && overlap.isRight() == overlap.getSection().isLockRight()) {
|
||||
SectionPath sectionPath = overlap.selectPath();
|
||||
for (SwitchElement switchElement : sectionPath.getSwitchList()) {
|
||||
Switch aSwitch = switchElement.getASwitch();
|
||||
@ -51,6 +52,11 @@ public class CiService {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果延续保护区段被占用,则不触发(为解决宁波一列车停站结束后离开站台轨导致延续保护重新办理的问题)
|
||||
if (sectionPath.getSectionList().stream().anyMatch(Section::isOccupied)) {
|
||||
log.debug("延续保护区段占用,不能触发");
|
||||
return;
|
||||
}
|
||||
overlap.startSetting(simulation.getSystemTime());
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
|
||||
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
|
||||
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||
import club.joylink.rtss.vo.project.ProjectVO;
|
||||
@ -87,7 +88,7 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
/**
|
||||
* 功能id
|
||||
*/
|
||||
private Long mapFunctionId;
|
||||
private MapFunctionVO mapFunctionVO;
|
||||
|
||||
/**
|
||||
* 数据仓库
|
||||
@ -297,7 +298,6 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
|
||||
/**
|
||||
* 初始化群组信息
|
||||
* @param map 群组信息Map
|
||||
*/
|
||||
public void initDefaultConversationGroupMap() {
|
||||
SimulationBuildParams buildParams = this.getBuildParams();
|
||||
@ -306,11 +306,12 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
if (CollectionUtils.isEmpty(conversationGroupVOList)) {
|
||||
return;
|
||||
}
|
||||
Map<Long, ConversationGroup> groupMap = conversationGroupVOList.stream().map(g ->{
|
||||
ConversationGroup group = new ConversationGroup(this, g);
|
||||
group.initGroupType();
|
||||
return group;
|
||||
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
|
||||
Map<Long, ConversationGroup> groupMap = conversationGroupVOList.stream().filter(ConversationGroupVO::isValid)
|
||||
.map(g ->{
|
||||
ConversationGroup group = new ConversationGroup(this, g);
|
||||
group.initGroupType();
|
||||
return group;
|
||||
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
|
||||
overCoverConversationGroupMap(groupMap);
|
||||
}
|
||||
|
||||
@ -805,6 +806,10 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
return this.querySimulationMemberByUserId(uid);
|
||||
}
|
||||
|
||||
public Long getMapFunctionId() {
|
||||
return mapFunctionVO == null ? null : mapFunctionVO.getId();
|
||||
}
|
||||
|
||||
public interface JobName {
|
||||
String script = "Script";
|
||||
String checkLpf = "checkLpf";
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||
import lombok.NonNull;
|
||||
|
||||
@ -14,7 +15,7 @@ public interface SimulationService {
|
||||
/**
|
||||
* 创建仿真
|
||||
*/
|
||||
String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType);
|
||||
String createSimulation(long mapId, MapFunctionVO mapFunctionVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String, Boolean> createUserType);
|
||||
|
||||
String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo);
|
||||
|
||||
@ -60,7 +61,7 @@ public interface SimulationService {
|
||||
*/
|
||||
void monitor(String simulationId, AccountVO user);
|
||||
|
||||
Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType);
|
||||
Simulation createSimulationPojo(long mapId, MapFunctionVO mapFunctionVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String, Boolean> createUserType);
|
||||
|
||||
/**
|
||||
* 后台创建仿真
|
||||
|
@ -32,6 +32,7 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.NonNull;
|
||||
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.Service;
|
||||
@ -75,8 +76,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
|
||||
|
||||
@Override
|
||||
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
|
||||
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId();
|
||||
public String createSimulation(long mapId, MapFunctionVO mapFunctionVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String, Boolean> createUserType) {
|
||||
return createSimulationPojo(mapId,mapFunctionVO, loginUserInfoVO, createUserType).getId();
|
||||
}
|
||||
|
||||
//只获取所有与该功能相关的权限信息
|
||||
@ -193,24 +194,29 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String checkUserExistSimulation(MapFunctionVO mapFunctionVO, AccountVO user){
|
||||
List<String> userExistGroup = this.groupSimulationService.getUserRunningSimulationGroups(user);
|
||||
if(!CollectionUtils.isEmpty(userExistGroup)){
|
||||
Optional<Simulation> optional = userExistGroup.stream()
|
||||
.map(d->this.groupSimulationService.getSimulationByGroup(d))
|
||||
.filter(d->Objects.equals(d.getMapFunctionId(), mapFunctionVO.getId())).findAny();
|
||||
if(optional.isPresent()){
|
||||
BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(mapFunctionVO.getParamVO().getDomConfig().isHasExam(),"考试只能单独用户操作");
|
||||
Simulation simulation = optional.get();
|
||||
return simulation.getId();
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(userExistGroup.size() >= 1,"用户重复创建仿真");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo) {
|
||||
MapFunctionVO mapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
||||
// List<String> userExistGroup = this.groupSimulationService.getUserRunningSimulationGroups(loginInfo.getAccountVO());
|
||||
// if(!CollectionUtils.isEmpty(userExistGroup)){
|
||||
// String group = userExistGroup.get(0);
|
||||
// Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
|
||||
// if(Objects.equals(simulation.getMapFunctionId(), mapFunctionId)){
|
||||
// BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(mapFunctionVO.getParamVO().getDomConfig().isHasExam(),"考试只能单独用户操作");
|
||||
// return group;
|
||||
// }else{
|
||||
// BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(!CollectionUtils.isEmpty(userExistGroup),"用户重复创建仿真");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/* String group = this.checkUserExistSimulation(mapFunctionVO,loginInfo.getAccountVO());
|
||||
if(StringUtils.isNotEmpty(group)){
|
||||
return group;
|
||||
}*/
|
||||
Long mapId = mapFunctionVO.getMapId();
|
||||
|
||||
Map<String,Boolean> createUserType = this.checkUserPermission(mapFunctionVO,loginInfo);
|
||||
SimulationWorkParamVO workParamVO = mapFunctionVO.getParamVO();
|
||||
|
||||
@ -223,7 +229,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
||||
}
|
||||
|
||||
return createSimulation(mapId, mapFunctionId, workParamVO, loginInfo,createUserType);
|
||||
return createSimulation(mapId, mapFunctionVO, loginInfo,createUserType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -307,7 +313,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String,Boolean> createUserType) {
|
||||
public Simulation createSimulationPojo(long mapId, MapFunctionVO mapFunctionVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String, Boolean> createUserType) {
|
||||
SimulationWorkParamVO workParamVO = mapFunctionVO.getParamVO();
|
||||
//获取仿真工作服务
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
|
||||
|
||||
@ -319,7 +326,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
List<VoiceDiscriminateRule> ruleList = this.discriminateRule.findRuleByMapId(mapId);
|
||||
simulation.setVoiceRuleList(ruleList);
|
||||
|
||||
simulation.setMapFunctionId(mapFunctionId);
|
||||
simulation.setMapFunctionVO(mapFunctionVO);
|
||||
simulation.setCreateUserType(createUserType);
|
||||
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();
|
||||
if (Objects.nonNull(loginUserInfo)) {
|
||||
@ -366,7 +373,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
||||
}
|
||||
|
||||
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginInfo, createUserType);
|
||||
return createSimulationPojo(mapId, mapFunctionVO, loginInfo, createUserType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,6 +94,7 @@ public class ConversationGroup extends Chat {
|
||||
List<ConversationMember> memberList = new ArrayList<>(size);
|
||||
ConversationMember conversationLeader = new ConversationMember(leader);
|
||||
conversationLeader.setLeader();
|
||||
conversationLeader.setTime(time);
|
||||
memberList.add(conversationLeader);
|
||||
// 处理群成员
|
||||
if (size > 1) {
|
||||
@ -170,10 +171,7 @@ public class ConversationGroup extends Chat {
|
||||
* @param member 角色
|
||||
*/
|
||||
public void setLeader(SimulationMember member) {
|
||||
ConversationMember leader = getMemberList().stream().filter(ConversationMember::isLeader).findFirst().orElse(null);
|
||||
if (leader != null) {
|
||||
leader.setMember();
|
||||
}
|
||||
getMemberList().stream().filter(ConversationMember::isLeader).findFirst().ifPresent(ConversationMember::setMember);
|
||||
ConversationMember conversationMember = getConversionMember(member);
|
||||
conversationMember.setLeader();
|
||||
}
|
||||
|
@ -1257,10 +1257,12 @@ public class CalculateService {
|
||||
} else {
|
||||
offset = startPosition.getOffset() - endPosition.getOffset();
|
||||
}
|
||||
if (offset > 0) {
|
||||
if (offset >= 0) {
|
||||
return offset;
|
||||
} else {
|
||||
return null;
|
||||
return 1F;
|
||||
// return Math.abs(offset);
|
||||
// return null;
|
||||
}
|
||||
} else {
|
||||
Float distance = recursiveCalculate(startPosition.getSection(), endPosition.getSection(), right, (byte) 51);
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import lombok.Builder;
|
||||
@ -59,6 +60,8 @@ public class SimulationVO {
|
||||
|
||||
private Map<String, String> linkSwitchMap;
|
||||
|
||||
private MapFunctionVO mapFunctionVO;
|
||||
|
||||
public static SimulationVO buildBasicInfo(Simulation simulation) {
|
||||
MapVO map = simulation.getBuildParams().getMap();
|
||||
MapVO mapVO = new MapVO();
|
||||
@ -103,6 +106,7 @@ public class SimulationVO {
|
||||
.delTime(simulation.getDelBaseTime())
|
||||
.paramVO(workParamVO)
|
||||
.linkSwitchMap(linkSwitchMap)
|
||||
.mapFunctionVO(simulation.getMapFunctionVO())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -126,12 +126,12 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
|
||||
return this.name;
|
||||
}
|
||||
StringBuilder memberName = new StringBuilder();
|
||||
if (device instanceof MapNamedElement) {
|
||||
memberName.append(((MapNamedElement) device).getName());
|
||||
}
|
||||
if (this.type != null) {
|
||||
memberName.append(this.type.getDescription());
|
||||
}
|
||||
if (device instanceof MapNamedElement) {
|
||||
memberName.append(((MapNamedElement) device).getName());
|
||||
}
|
||||
return memberName.toString();
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,10 @@ public abstract class Operation2 {
|
||||
this.operatedTime = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return Step2.StepStatus.isSuccess(this.status);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.startTime = null;
|
||||
this.operatedTime = null;
|
||||
|
@ -104,6 +104,10 @@ public class Training2 {
|
||||
*/
|
||||
private Map<String, IndexAlgorithmService> indexAlgorithmMap;
|
||||
|
||||
/**
|
||||
* 跳转至第几步
|
||||
*/
|
||||
private Step2 jumpToStep;
|
||||
|
||||
public Training2(DraftTraining2WithBLOBs draftTraining2, Simulation simulation) {
|
||||
this.id = draftTraining2.getId();
|
||||
@ -232,6 +236,22 @@ public class Training2 {
|
||||
return Type.SCENE.equals(this.type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是跳转步骤
|
||||
*
|
||||
* @return true | false
|
||||
*/
|
||||
public boolean isJumpStep(Step2 step) {
|
||||
if (jumpToStep == null) {
|
||||
return false;
|
||||
}
|
||||
return steps.indexOf(step) <= steps.indexOf(jumpToStep);
|
||||
}
|
||||
|
||||
public boolean haveJumpStep() {
|
||||
return jumpToStep != null;
|
||||
}
|
||||
|
||||
private void resetStepAndIndex() {
|
||||
if (this.steps != null) {
|
||||
this.steps.forEach(Step2::reset);
|
||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.vo.conversation;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -35,4 +36,8 @@ public class ConversationGroupVO {
|
||||
* 群成员ID
|
||||
*/
|
||||
private List<String> memberIds;
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNoneBlank(name) && StringUtils.isNotEmpty(leaderId);
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,9 @@ public class FindCountForQuestionReqVo {
|
||||
*/
|
||||
// private List<String> tags = new ArrayList<>();
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
* dispatchWork = 行调 ,localWork=现地
|
||||
*/
|
||||
private PaperQType.TrainingClient trainingClient;
|
||||
}
|
||||
|
@ -152,6 +152,8 @@ public class PaperCompositionWithRuleVo {
|
||||
* 每题分值
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
private club.joylink.rtss.vo.paper.PaperRuleVo.SubTypeParam subTypeParam;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@ -20,6 +20,10 @@ public class PaperQType {
|
||||
}
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(match,"试卷试题小类型["+sub.name()+"]与大类型["+type.name()+"]不匹配");
|
||||
}
|
||||
|
||||
public enum TrainingClient{
|
||||
localWork,dispatchWork
|
||||
}
|
||||
/**
|
||||
* 试卷试题大类型:1-理论题,2-实训题
|
||||
*/
|
||||
|
@ -49,4 +49,9 @@ public class PaperRuleVo {
|
||||
*/
|
||||
@NotNull
|
||||
private Integer score;
|
||||
|
||||
@Data
|
||||
public static class SubTypeParam{
|
||||
private PaperQType.TrainingClient client;
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,9 @@ public class PaperUserWholeVo {
|
||||
* 试题列表
|
||||
*/
|
||||
private List<PaperUserQuestionVo> questionList;
|
||||
|
||||
/**
|
||||
* 当前系统时间
|
||||
*/
|
||||
private Long systemTime;
|
||||
}
|
||||
|
@ -32,7 +32,10 @@ public class PaperRuleConvertor {
|
||||
List<PaperCompositionWithRuleVo.ScenePagerRuleVO> sceneRuleList = JsonUtils.readCollection(from.getSceneDetail(),ArrayList.class, PaperCompositionWithRuleVo.ScenePagerRuleVO.class);
|
||||
to.setSceneInfo(sceneRuleList);
|
||||
}
|
||||
|
||||
if(StringUtils.hasText(from.getSubTypeParam())){
|
||||
PaperRuleVo.SubTypeParam subTypeParam = JsonUtils.read(from.getSubTypeParam(),PaperRuleVo.SubTypeParam.class);
|
||||
to.setSubTypeParam(subTypeParam);
|
||||
}
|
||||
to.setScore(from.getScore());
|
||||
to.setAmount(from.getAmount());
|
||||
return to;
|
||||
@ -50,6 +53,9 @@ public class PaperRuleConvertor {
|
||||
to.setPcId(from.getPcId());
|
||||
to.setType(from.getType().getValue());
|
||||
to.setSubtype(from.getSubtype().getValue());
|
||||
if(Objects.nonNull(from.getSubTypeParam())){
|
||||
to.setSubTypeParam(JsonUtils.writeValueAsString(from.getSubTypeParam()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(from.getTags())) {
|
||||
List<String> newTagList = from.getTags().stream().filter(StringUtils::hasText)/*.filter(d->!Objects.equals(d,"无"))*/.collect(Collectors.toList());
|
||||
to.setTags(JsonUtils.writeValueAsString(newTagList));
|
||||
|
@ -33,25 +33,22 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
ROUTE_SET_BG_SCENE("排列进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Route route = (Route) mapElement;
|
||||
route.getSwitchList().forEach(switchElement -> switchElement.getASwitch().setSingleLock(false));
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
ROUTE_CANCEL_BG_SCENE("取消进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
openRouteDirect(simulation, (Route) mapElement);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
ROUTE_OPEN_AUTO_SETTING_BG_SCENE("进路交自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Route route = (Route) mapElement;
|
||||
route.setAtsControl(false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -59,10 +56,9 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
BUTTON_BLOCK_BG_SCENE("解封按钮背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setBlockade(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -70,10 +66,9 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_NP_BG_SCENE("道岔定位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
setSingleSwitchPositionDirectly(iSwitch, false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -81,20 +76,18 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_RP_BG_SCENE("道岔反位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
setSingleSwitchPositionDirectly(iSwitch, true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_NP_NB_BG_SCENE("宁波道岔定位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setAuto(false);
|
||||
iSwitch.setDispatcherReserve(true);
|
||||
setSingleSwitchPositionDirectly(iSwitch, false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -102,12 +95,11 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_UNBLOCK_BG_SCENE("道岔解封背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setBlockade(true);
|
||||
iSwitch.getAllSections().stream().forEach(section -> section.setBlockade(true));
|
||||
iSwitch.getAllSections().forEach(section -> section.setBlockade(true));
|
||||
iSwitch.setInit(false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -115,57 +107,52 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setSingleLock(false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setSingleLock(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_FAULT_UNLOCK_BG_SCENE("道岔故障解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setRouteLock(true);
|
||||
iSwitch.getAllSections().forEach(section -> section.setRouteLock(true));
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_AXLE_FAULT_PRE_RESET_BG_SCENE("道岔计轴预复位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
Switch.SwitchFault.AXLE_FAULT.apply(iSwitch);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_SECTION_ACTIVE_BG_SCENE("道岔区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
return SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA(), client);
|
||||
SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA(), client);
|
||||
}
|
||||
},
|
||||
SWITCH_SECTION_LIMIT_SPEED("道岔区段速度限制背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.getAllSections().forEach(section -> section.setSpeedUpLimit(5));
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SWITCH_ACTIVE_BG_SCENE("道岔区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
return BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA(), client);
|
||||
BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA(), client);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -173,12 +160,11 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_TURN_ON_BG_SCENE("信号机点灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setAspect(SignalAspect.No);
|
||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||
vrSignal.setAspect(SignalAspect.No);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -186,12 +172,11 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_TURN_OFF_BG_SCENE("信号机灭灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||
signal.setAspect(vrSignal.getModel().getDefaultAspect());
|
||||
vrSignal.setAspect(vrSignal.getModel().getDefaultAspect());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -199,7 +184,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_REOPEN_BG_SCENE("信号机重开背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -207,7 +192,6 @@ public enum BgSceneStatusRule {
|
||||
signal.setForbidden(true);
|
||||
signal.setAspect(signal.getDefaultAspect());
|
||||
vrSignal.setAspect(signal.getDefaultAspect());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -215,7 +199,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_CLOSE_BG_SCENE("信号机关灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().stream()
|
||||
// .filter(r -> r.getSwitchList().stream().allMatch(switchElement -> switchElement.isNormal()))
|
||||
@ -224,7 +208,6 @@ public enum BgSceneStatusRule {
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
}
|
||||
openRouteDirect(simulation, route);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -232,7 +215,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_GUIDE_BG_SCENE("信号机引导背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
// 开放进路
|
||||
Route route = signal.getRouteList().get(0);
|
||||
@ -247,7 +230,6 @@ public enum BgSceneStatusRule {
|
||||
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||
Section section = route.getStart().getSection();
|
||||
trainOnline(simulation, train, section, route.isRight());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -255,25 +237,23 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_ROUTE_AUTO_SET_BG_SCENE("进路交自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
route.setAtsControl(false);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_ROUTE_CANCEL_AUTO_SET_BG_SCENE("取消联锁自动触发背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
route.setCiControl(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_SET_CI_AUTO_BG_SCENE("联锁自动进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
List<Route> fltRouteList = signal.getRouteList().stream().filter(Route::isFlt).collect(Collectors.toList());
|
||||
boolean isSetFlt = simulation.getRepository().getConfig().isSetRouteBeforeSetFlt();
|
||||
@ -282,30 +262,27 @@ public enum BgSceneStatusRule {
|
||||
openRouteDirect(simulation, route);
|
||||
}
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_CANCEL_SET_CI_AUTO_BG_SCENE("取消联锁自动进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
route.setFleetMode(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_UN_BLOCK_BG_SCENE("信号机解封锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setBlockade(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_HUMAN_RELEASE_BG_SCENE("信号机总人解背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -315,18 +292,16 @@ public enum BgSceneStatusRule {
|
||||
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||
Section section = route.getStart().getSection();
|
||||
trainOnline(simulation, train, section, route.isRight());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SIGNAL_HUMAN_RELEASE_NB_BG_SCENE("宁波信号机总人解背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
closeSignalDirectly(route.getStart());
|
||||
Section.AxleFault.FAULT.apply(route.getStart().getSection());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -334,10 +309,9 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_FAULT_LOCK_BG_SCENE("区段区故解背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Section.AxleFault.FAULT_LOCK.apply(section);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -345,7 +319,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_FAULT_UNLOCK_BG_SCENE("区段故障解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setRouteLock(true);
|
||||
if (section.isCross()) {
|
||||
@ -353,12 +327,11 @@ public enum BgSceneStatusRule {
|
||||
} else if (section.isShowLogic()) {
|
||||
section.getLogicList().forEach(s -> s.setRouteLock(true));
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SECTION_UNLOCK_BG_SCENE("区段解封背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setBlockade(true);
|
||||
if (!CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
@ -366,7 +339,6 @@ public enum BgSceneStatusRule {
|
||||
logic.setBlockade(true);
|
||||
}
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -374,7 +346,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_ACTIVE_BG_SCENE("区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Section axleSection = section;
|
||||
if (Objects.nonNull(section.getParent())) {
|
||||
@ -384,7 +356,6 @@ public enum BgSceneStatusRule {
|
||||
for (Section logic : axleSection.getLogicList()) {
|
||||
logic.setCutOff(true);
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -392,27 +363,25 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_CANCEL_LIMIT_SPEED_BG_SCENE("区段取消限速背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setSpeedUpLimit(5);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SECTION_CONFIRM_AXIS_VALID_BG_SCENE("设置计轴生效背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
if (Objects.nonNull(section.getParent())) {
|
||||
section.getParent().judgeAsNctOccupied(simulation);
|
||||
} else {
|
||||
section.judgeAsNctOccupied(simulation);
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SECTION_AXIS_PRE_RESET_BG_SCENE("计轴预复位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
if(!section.isAxleCounter() && !section.isCross()){
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -422,12 +391,11 @@ public enum BgSceneStatusRule {
|
||||
virtualAxleCounter.setPreReset(false);
|
||||
virtualAxleCounter.setLeftCount(2);
|
||||
virtualAxleCounter.setRightCount(2);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SECTION_TURN_BACK_REENTRY_STRATEGY("区段折返策略修改背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Stand stand = section.getStandList().get(0);
|
||||
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
|
||||
@ -435,16 +403,14 @@ public enum BgSceneStatusRule {
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream()
|
||||
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||
BgSceneStatusRule.trainOnline(simulation, train, section, stand.isRight());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
SECTION_CLOSE_BG_SCENE("轨道开放背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setCloseInit(false);
|
||||
section.setClosed(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -452,15 +418,14 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
STATION_POWER_ON_UNLOCK("车站上电解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
restartInterlock(simulation, station);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
if(!station.isInterlock()) {
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -480,12 +445,11 @@ public enum BgSceneStatusRule {
|
||||
}
|
||||
}
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STATION_CLOSE_AUTO_SETTING_BG_SCENE("全站进路交人工控背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = (Station) mapElement;
|
||||
if(!station.isInterlock()) {
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -505,28 +469,25 @@ public enum BgSceneStatusRule {
|
||||
}
|
||||
}
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") {
|
||||
STATION_CENTER_CONTROL_BG_SCENE ("车站转换中控设置的背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
station.setControlMode(Station.ControlMode.Local);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") {
|
||||
STATION_STATION_CONTROL_BG_SCENE("车站转为站控设置的背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
station.setControlMode(Station.ControlMode.Center);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STAND_EARLY_DEPART_BG_SCENE("提前发车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
Section section = stand.getSection();
|
||||
Route route = stand.getSection().getSignalToRight().getRouteList().stream().filter(r ->
|
||||
@ -540,12 +501,11 @@ public enum BgSceneStatusRule {
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream()
|
||||
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||
BgSceneStatusRule.trainOnline(simulation,train,section,route.isRight());
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STAND_CANCEL_HOLD_TRAIN_BG_SCENE("站台取消扣车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
if ("localWork".equals(client)) {
|
||||
// 现地,设置背景为现地扣车
|
||||
@ -554,31 +514,27 @@ public enum BgSceneStatusRule {
|
||||
// 行调,设置背景为中心扣车
|
||||
stand.setCenterHoldTrain(true);
|
||||
}
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STAND_FORCE_CANCEL_HOLD_TRAIN_BG_SCENE("强制取消扣车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setCenterHoldTrain(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setAllSkip(true);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
STAND_STRATEGY_BG_SCENE("人工折返策略设置背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
public void doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
}
|
||||
;
|
||||
@ -595,7 +551,7 @@ public enum BgSceneStatusRule {
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
public abstract String doHandle(Simulation simulation, MapElement mapElement, String client);
|
||||
public abstract void doHandle(Simulation simulation, MapElement mapElement, String client);
|
||||
|
||||
/**
|
||||
* 直接开放进路
|
||||
@ -644,7 +600,7 @@ public enum BgSceneStatusRule {
|
||||
/**
|
||||
* 获取仿真背景
|
||||
*/
|
||||
public String getBgScene(Simulation simulation) {
|
||||
public static String getBgScene(Simulation simulation) {
|
||||
return JsonUtils.writeValueAsString(new StorageSimulation(simulation, false));
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@ -65,7 +62,7 @@ public class Training2Rule {
|
||||
/**
|
||||
* 设置状态处理方法
|
||||
*/
|
||||
private BgSceneStatusRule sceneRule;
|
||||
private List<BgSceneStatusRule> sceneRule;
|
||||
|
||||
/**
|
||||
* 步骤列表
|
||||
@ -101,7 +98,7 @@ public class Training2Rule {
|
||||
this.labels = JsonUtils.readCollection(rule.getLabels(), List.class, String.class);
|
||||
}
|
||||
if (StringUtils.hasText(rule.getSceneRule())) {
|
||||
this.sceneRule = BgSceneStatusRule.valueOf(rule.getSceneRule());
|
||||
this.sceneRule = Arrays.stream(rule.getSceneRule().split(",")).map(BgSceneStatusRule::valueOf).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.hasText(rule.getSteps())) {
|
||||
this.steps = JsonUtils.readCollection(rule.getSteps(), List.class, StepRule.class);
|
||||
@ -139,7 +136,8 @@ public class Training2Rule {
|
||||
}
|
||||
// 背景设置
|
||||
if (sceneRule != null) {
|
||||
copyTraining2.setBgSceneJson(sceneRule.doHandle(simulation, mapElement, this.client));
|
||||
sceneRule.forEach(rule -> rule.doHandle(simulation, mapElement, this.client));
|
||||
copyTraining2.setBgSceneJson(BgSceneStatusRule.getBgScene(simulation));
|
||||
}
|
||||
List<Step2VO> step2VOList = null;
|
||||
// 步骤
|
||||
|
@ -10,6 +10,7 @@
|
||||
<result column="amount" jdbcType="INTEGER" property="amount" />
|
||||
<result column="score" jdbcType="INTEGER" property="score" />
|
||||
<result column="scene_detail" jdbcType="VARCHAR" property="sceneDetail" />
|
||||
<result column="sub_type_param" jdbcType="VARCHAR" property="subTypeParam" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -70,7 +71,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, pc_id, `type`, subType, tags, amount, score, scene_detail
|
||||
id, pc_id, `type`, subType, tags, amount, score, scene_detail, sub_type_param
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperRuleExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -113,10 +114,10 @@
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperRule" useGeneratedKeys="true">
|
||||
insert into rts_paper_rule (pc_id, `type`, subType,
|
||||
tags, amount, score,
|
||||
scene_detail)
|
||||
scene_detail, sub_type_param)
|
||||
values (#{pcId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{subtype,jdbcType=INTEGER},
|
||||
#{tags,jdbcType=VARCHAR}, #{amount,jdbcType=INTEGER}, #{score,jdbcType=INTEGER},
|
||||
#{sceneDetail,jdbcType=VARCHAR})
|
||||
#{sceneDetail,jdbcType=VARCHAR}, #{subTypeParam,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperRule" useGeneratedKeys="true">
|
||||
insert into rts_paper_rule
|
||||
@ -142,6 +143,9 @@
|
||||
<if test="sceneDetail != null">
|
||||
scene_detail,
|
||||
</if>
|
||||
<if test="subTypeParam != null">
|
||||
sub_type_param,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="pcId != null">
|
||||
@ -165,6 +169,9 @@
|
||||
<if test="sceneDetail != null">
|
||||
#{sceneDetail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="subTypeParam != null">
|
||||
#{subTypeParam,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.paper.PaperRuleExample" resultType="java.lang.Long">
|
||||
@ -200,6 +207,9 @@
|
||||
<if test="record.sceneDetail != null">
|
||||
scene_detail = #{record.sceneDetail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.subTypeParam != null">
|
||||
sub_type_param = #{record.subTypeParam,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -214,7 +224,8 @@
|
||||
tags = #{record.tags,jdbcType=VARCHAR},
|
||||
amount = #{record.amount,jdbcType=INTEGER},
|
||||
score = #{record.score,jdbcType=INTEGER},
|
||||
scene_detail = #{record.sceneDetail,jdbcType=VARCHAR}
|
||||
scene_detail = #{record.sceneDetail,jdbcType=VARCHAR},
|
||||
sub_type_param = #{record.subTypeParam,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -243,6 +254,9 @@
|
||||
<if test="sceneDetail != null">
|
||||
scene_detail = #{sceneDetail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="subTypeParam != null">
|
||||
sub_type_param = #{subTypeParam,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@ -254,7 +268,8 @@
|
||||
tags = #{tags,jdbcType=VARCHAR},
|
||||
amount = #{amount,jdbcType=INTEGER},
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
scene_detail = #{sceneDetail,jdbcType=VARCHAR}
|
||||
scene_detail = #{sceneDetail,jdbcType=VARCHAR},
|
||||
sub_type_param = #{subTypeParam,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user