【实训增加验证参数val】

This commit is contained in:
weizhihong 2023-01-09 10:58:22 +08:00
parent 70b3bbd11e
commit 0cb9f412f2
4 changed files with 18 additions and 1 deletions

View File

@ -21,7 +21,6 @@ public class TrainingRuleController {
@Autowired
private Training2RuleService training2RuleService;
/**
* 根据仿真生成
*/
@ -38,17 +37,26 @@ public class TrainingRuleController {
return training2RuleService.generateTrainingByMapIdAndFunId(mapId, functionId);
}
/**
* 生成所有地图实训
*/
@PostMapping("generate/all")
public List<String> generateAllTraining(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
return training2RuleService.generateAllTrainingByRule(loginUserInfoVO);
}
/**
* 根据地图ID生成实训
*/
@PostMapping("generate/mapId")
public List<String> generateTrainingByMapId(@RequestBody List<Long> mapIdList
, @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
return training2RuleService.generateTrainingByMapId(mapIdList, loginUserInfoVO);
}
/**
* 根据线路编号生成实训
*/
@PostMapping("generate/lineCode")
public List<String> generateTrainingByLineCode(@RequestBody List<String> lineCodeList
, @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) {

View File

@ -170,6 +170,8 @@ public abstract class Operation2 {
private String subType;
private String val;
public ClientOperation2(Operation2VO.ClientOperation2VO vo, Simulation simulation) {
super(vo.getId());
this.deviceCode = vo.getDeviceCode();
@ -179,6 +181,7 @@ public abstract class Operation2 {
this.params = vo.getParams();
this.commandId = vo.getCommandId();
this.subType = vo.getSubType();
this.val = vo.getVal();
if (vo.getTriggerCondition() != null) {
this.setTriggerCondition(vo.getTriggerCondition().convert2BO(simulation.getRepository()));
}

View File

@ -79,6 +79,8 @@ public abstract class Operation2VO {
private String subType;
private String val;
@Override
public Operation2 convert2BO(Simulation simulation) {
return new Operation2.ClientOperation2(this, simulation);

View File

@ -94,6 +94,8 @@ public abstract class OperationRule {
private String subType;
private String val;
@Override
public Operation2VO.ClientOperation2VO convert2BO(Simulation simulation, Object mapElement) {
Operation2VO.ClientOperation2VO operation2 = new Operation2VO.ClientOperation2VO();
@ -113,6 +115,8 @@ public abstract class OperationRule {
operation2.setParams(new HashMap<>());
// 二级定位
operation2.setSubType(subType);
// 参数校验
operation2.setVal(val);
if (!CollectionUtils.isEmpty(params)) {
params.forEach((k, v) -> {
String vStr = String.valueOf(v);