26-03-14-11:17:行为树-保存场景配置
This commit is contained in:
@@ -3,6 +3,7 @@ package com.solution.web.controller.behaviour;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.solution.system.domain.AfsimScenario;
|
||||||
import com.solution.web.core.BehaviortreeProcessor;
|
import com.solution.web.core.BehaviortreeProcessor;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -114,4 +115,16 @@ public class BehaviortreeController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
|
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存场景配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("保存场景配置")
|
||||||
|
@PostMapping("/saveSceneConfig")
|
||||||
|
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||||
|
public AjaxResult saveSceneConfig(@RequestBody AfsimScenario afsimScenario)
|
||||||
|
{
|
||||||
|
return toAjax(behaviortreeService.insert(afsimScenario));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,5 +52,4 @@ public class RuleController extends BaseController {
|
|||||||
public AjaxResult getCommPlatformComponentNames(Integer scenarioId){
|
public AjaxResult getCommPlatformComponentNames(Integer scenarioId){
|
||||||
return success(ruleService.getCommPlatformComponentNames(scenarioId));
|
return success(ruleService.getCommPlatformComponentNames(scenarioId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,4 +157,5 @@ public class BehaviortreeProcessor {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.solution.system.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场景配置表
|
||||||
|
* 对应表 afsim_scenario
|
||||||
|
*/
|
||||||
|
public class AfsimScenario {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String scenarioPath;
|
||||||
|
private String communicationGraph; // 用于存储场景中的通讯关系
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScenarioPath() {
|
||||||
|
return scenarioPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScenarioPath(String scenarioPath) {
|
||||||
|
this.scenarioPath = scenarioPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommunicationGraph() {
|
||||||
|
return communicationGraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommunicationGraph(String communicationGraph) {
|
||||||
|
this.communicationGraph = communicationGraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AfsimScenario{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", description='" + description + '\'' +
|
||||||
|
", scenarioPath='" + scenarioPath + '\'' +
|
||||||
|
", communicationGraph='" + communicationGraph + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.solution.system.mapper;
|
package com.solution.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.solution.system.domain.AfsimScenario;
|
||||||
import com.solution.system.domain.Behaviortree;
|
import com.solution.system.domain.Behaviortree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,4 +60,11 @@ public interface BehaviortreeMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBehaviortreeByIds(Long[] ids);
|
public int deleteBehaviortreeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存场景配置
|
||||||
|
* @param afsimScenario
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int insert(AfsimScenario afsimScenario);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.solution.system.service;
|
package com.solution.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.solution.system.domain.AfsimScenario;
|
||||||
import com.solution.system.domain.Behaviortree;
|
import com.solution.system.domain.Behaviortree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,4 +60,11 @@ public interface IBehaviortreeService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBehaviortreeById(Long id);
|
public int deleteBehaviortreeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存场景配置
|
||||||
|
* @param afsimScenario
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int insert(AfsimScenario afsimScenario);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.solution.system.service.impl;
|
package com.solution.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.solution.common.constant.ExceptionConstants;
|
||||||
|
import com.solution.system.domain.AfsimScenario;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.solution.system.mapper.BehaviortreeMapper;
|
import com.solution.system.mapper.BehaviortreeMapper;
|
||||||
@@ -90,4 +94,17 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
|
|||||||
{
|
{
|
||||||
return behaviortreeMapper.deleteBehaviortreeById(id);
|
return behaviortreeMapper.deleteBehaviortreeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存场景配置
|
||||||
|
* @param afsimScenario
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insert(AfsimScenario afsimScenario) {
|
||||||
|
if(ObjectUtil.isEmpty(afsimScenario) || ObjectUtil.isEmpty(afsimScenario.getCommunicationGraph())){
|
||||||
|
throw new RuntimeException(ExceptionConstants.SCENE_CONFIG_NOT_NULL);
|
||||||
|
}
|
||||||
|
return behaviortreeMapper.insert(afsimScenario);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.solution.system.domain.AfsimScenario">
|
||||||
|
INSERT INTO afsim_scenario (name, description, scenario_path, communication_graph)
|
||||||
|
VALUES (#{name}, #{description}, #{scenarioPath}, #{communicationGraph})
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateBehaviortree" parameterType="Behaviortree">
|
<update id="updateBehaviortree" parameterType="Behaviortree">
|
||||||
update behaviortree
|
update behaviortree
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|||||||
@@ -13,4 +13,6 @@ public class ExceptionConstants {
|
|||||||
|
|
||||||
public static final String NOT_FOUND_F22_COMPONENT = "未找到 F-22 组件";
|
public static final String NOT_FOUND_F22_COMPONENT = "未找到 F-22 组件";
|
||||||
|
|
||||||
|
public static final String SCENE_CONFIG_NOT_NULL = "场景配置不能为空";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user