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