Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -3,6 +3,7 @@ package com.solution.web.controller.behaviour;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.system.domain.AfsimScenario;
|
||||
import com.solution.web.core.BehaviortreeProcessor;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -114,4 +115,16 @@ public class BehaviortreeController extends BaseController
|
||||
{
|
||||
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存场景配置
|
||||
*/
|
||||
@ApiOperation("保存场景配置")
|
||||
@PostMapping("/saveSceneConfig")
|
||||
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||
public AjaxResult saveSceneConfig(@RequestBody AfsimScenario afsimScenario)
|
||||
{
|
||||
return toAjax(behaviortreeService.insert(afsimScenario));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.solution.web.controller.rule;
|
||||
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.rule.domain.FireRuleExecuteDTO;
|
||||
import com.solution.rule.service.FireRuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
@Api("火力规则")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/firerule")
|
||||
public class FireRuleController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FireRuleService ruleService;
|
||||
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param fireRuleExecuteDTO 敌方参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/start")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult execute(@RequestBody FireRuleExecuteDTO fireRuleExecuteDTO){
|
||||
return success(ruleService.execute(fireRuleExecuteDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/weapon")
|
||||
@ApiOperation("获取所有武器平台和组件")
|
||||
public AjaxResult getPlatformComponentNames(){
|
||||
return success(ruleService.getPlatformComponentNames());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通信组件的所有平台和组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/comm")
|
||||
@ApiOperation("获取通信组件的所有平台和组件")
|
||||
public AjaxResult getCommPlatformComponentNames(Integer scenarioId){
|
||||
return success(ruleService.getCommPlatformComponentNames(scenarioId));
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,65 @@
|
||||
package com.solution.web.controller.rule;
|
||||
|
||||
import com.solution.common.annotation.Log;
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.rule.domain.dto.RequestDTO;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.service.RuleService;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
import com.solution.common.enums.BusinessType;
|
||||
import com.solution.rule.domain.Rule;
|
||||
import com.solution.rule.service.IRuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Api("火力规则")
|
||||
@Api("红蓝对抗规则管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/firerule")
|
||||
@RequestMapping("/api/system/rule")
|
||||
public class RuleController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
private IRuleService ruleService;
|
||||
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param sceneType 场景参数
|
||||
* @param weaponModelDTO 敌方参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/start")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult execute(Integer sceneType, WeaponModelDTO weaponModelDTO){
|
||||
return success(ruleService.execute(sceneType,weaponModelDTO));
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询规则列表")
|
||||
public TableDataInfo list(Rule rule) {
|
||||
startPage();
|
||||
List<Rule> list = ruleService.selectRuleList(rule);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/weapon")
|
||||
@ApiOperation("获取所有武器平台和组件")
|
||||
public AjaxResult getPlatformComponentNames(){
|
||||
return success(ruleService.getPlatformComponentNames());
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:query')")
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("获取规则详情")
|
||||
public AjaxResult getInfo(@PathVariable Integer id) {
|
||||
return success(ruleService.selectRuleById(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:add')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增规则")
|
||||
public AjaxResult add(@RequestBody Rule rule) {
|
||||
return toAjax(ruleService.insertRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:edit')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改规则")
|
||||
public AjaxResult edit(@RequestBody Rule rule) {
|
||||
return toAjax(ruleService.updateRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:remove')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除规则")
|
||||
public AjaxResult remove(@PathVariable Integer[] ids) {
|
||||
return toAjax(ruleService.deleteRuleByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -170,4 +170,5 @@ public class BehaviortreeProcessor {
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.solution.system.domain.AfsimScenario;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
|
||||
/**
|
||||
@@ -58,4 +60,11 @@ public interface BehaviortreeMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 保存场景配置
|
||||
* @param afsimScenario
|
||||
* @return
|
||||
*/
|
||||
int insert(AfsimScenario afsimScenario);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.solution.system.domain.AfsimScenario;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
|
||||
/**
|
||||
@@ -58,4 +60,11 @@ public interface IBehaviortreeService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 保存场景配置
|
||||
* @param afsimScenario
|
||||
* @return
|
||||
*/
|
||||
int insert(AfsimScenario afsimScenario);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
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.stereotype.Service;
|
||||
import com.solution.system.mapper.BehaviortreeMapper;
|
||||
@@ -90,4 +94,17 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
|
||||
{
|
||||
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>
|
||||
</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 behaviortree
|
||||
<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 SCENE_CONFIG_NOT_NULL = "场景配置不能为空";
|
||||
|
||||
}
|
||||
|
||||
@@ -3,5 +3,7 @@ package com.solution.common.constant;
|
||||
|
||||
public class PlatformAndModuleConstants {
|
||||
|
||||
public static final String F22 = "f22";
|
||||
public static final String RED_NEBO_M_1 = "red_nebo_m_1";
|
||||
|
||||
public static final String RED_NEBO_M_2 = "red_nebo_m_2";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FireRuleExecuteDTO {
|
||||
|
||||
@ApiModelProperty("场景类型")
|
||||
private Integer sceneType;
|
||||
|
||||
@ApiModelProperty("武器模型数据")
|
||||
private List<WeaponModelDTO> weaponModelDTOs;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel("红蓝对抗规则")
|
||||
public class Rule {
|
||||
@ApiModelProperty("规则ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("规则名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("场景类型:0-防御,1-空降,null表示通用")
|
||||
private Integer sceneType;
|
||||
|
||||
@ApiModelProperty("触发条件(JSON格式)")
|
||||
private String conditions;
|
||||
|
||||
@ApiModelProperty("响应动作(JSON格式)")
|
||||
private String actions;
|
||||
|
||||
@ApiModelProperty("优先级(数值越小优先级越高)")
|
||||
private Integer priority;
|
||||
|
||||
@ApiModelProperty("是否启用(0禁用,1启用)")
|
||||
private Boolean enabled;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.ComponentCountVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class RuleParam {
|
||||
|
||||
private List<PlatformWeaponAggregateVO> resultWeapons;
|
||||
|
||||
private WeaponModelVO weaponModelVO;
|
||||
|
||||
private List<WeaponModelDTO> weaponModelDTOList;
|
||||
|
||||
private List<ComponentCountVO> databaseWeapons;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.solution.rule.domain.vo;
|
||||
|
||||
import com.solution.rule.domain.PlatformComponent;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -14,5 +15,8 @@ public class PlatformWeaponAggregateVO {
|
||||
private String platformName;
|
||||
|
||||
@ApiModelProperty("该平台下的组件列表")
|
||||
private List<ComponentCountVO> components;
|
||||
private List<PlatformComponent> components;
|
||||
|
||||
@ApiModelProperty("返回数据库数据")
|
||||
private List<ComponentCountVO> componentCountVOS;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.solution.rule.domain.vo;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.solution.rule.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.common.constant.PlatformAndModuleConstants;
|
||||
import com.solution.rule.domain.PlatformComponent;
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.ComponentCountVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 战斗机处理链
|
||||
* 规则:针对 F22 平台,后端返回的组件数量比前端传递的大1,
|
||||
* 如果数据库中 F22 平台所有组件总数小于前端数量+1,则返回该总数。
|
||||
*/
|
||||
@Component
|
||||
public class WarplaneHandler extends AbstractRuleChainHandler {
|
||||
|
||||
// 组件数量增量常量
|
||||
private static final long COMPONENT_COUNT_INCREMENT = 1;
|
||||
|
||||
@Override
|
||||
public RuleParam doHandler(RuleParam ruleParam) {
|
||||
// 1. 参数校验
|
||||
if (ObjectUtil.isEmpty(ruleParam) || CollUtil.isEmpty(ruleParam.getWeaponModelDTOList())) {
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
|
||||
List<WeaponModelDTO> dtoList = ruleParam.getWeaponModelDTOList();
|
||||
List<ComponentCountVO> databaseWeapons = ruleParam.getDatabaseWeapons();
|
||||
|
||||
List<PlatformWeaponAggregateVO> resultWeapons = new ArrayList<>();
|
||||
|
||||
//TODO获取所有组件以及count
|
||||
|
||||
Iterator<WeaponModelDTO> iterator = dtoList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
WeaponModelDTO dto = iterator.next();
|
||||
if(PlatformAndModuleConstants.RED_NEBO_M_1.equals(dto.getName())){
|
||||
List<PlatformComponent> components = dto.getComponents();
|
||||
List<PlatformComponent> componentList = new ArrayList<>();
|
||||
|
||||
//遍历前端数据的组件
|
||||
for (PlatformComponent component : components) {
|
||||
//遍历数据库数据
|
||||
for (ComponentCountVO databaseWeapon : databaseWeapons) {
|
||||
if(component.getName().equals(databaseWeapon.getComponentName())){
|
||||
PlatformComponent component1 = new PlatformComponent();
|
||||
component1.setName(databaseWeapon.getComponentName());
|
||||
if(databaseWeapon.getCount() > component.getNum()){
|
||||
component1.setNum(component.getNum() + COMPONENT_COUNT_INCREMENT);
|
||||
}else {
|
||||
component1.setNum(databaseWeapon.getCount());
|
||||
}
|
||||
//TODO 补充基本信息 暂未完成
|
||||
componentList.add(component1);
|
||||
}
|
||||
}
|
||||
}
|
||||
PlatformWeaponAggregateVO platformVO = new PlatformWeaponAggregateVO();
|
||||
platformVO.setPlatformName(dto.getName());
|
||||
platformVO.setComponents(componentList);
|
||||
resultWeapons.add(platformVO);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
ruleParam.setResultWeapons(resultWeapons);
|
||||
return ruleParam;
|
||||
|
||||
// return super.doNextHandler(ruleParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.solution.rule.mapper;
|
||||
|
||||
import com.solution.rule.domain.vo.ComponentCountVO;
|
||||
import com.solution.rule.domain.vo.PlatformComponentNamesVO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FireRuleMapper {
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
List<WeaponModelVO> getWeapon();
|
||||
|
||||
List<WeaponModelVO> getPlatformComponentNames();
|
||||
|
||||
/**
|
||||
* 获取所有组件以及数量
|
||||
* @return
|
||||
*/
|
||||
List<ComponentCountVO> getModuleAndCount();
|
||||
|
||||
/**
|
||||
* 获取通信组件的所有平台和组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
List<PlatformComponentNamesVO> getCommPlatformComponentNames(Integer scenarioId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.solution.rule.mapper;
|
||||
|
||||
import com.solution.rule.domain.Rule;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RuleMapper {
|
||||
/**
|
||||
* 根据ID查询规则
|
||||
*/
|
||||
Rule selectRuleById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询规则列表(支持分页)
|
||||
*/
|
||||
List<Rule> selectRuleList(Rule rule);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*/
|
||||
int insertRule(Rule rule);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*/
|
||||
int updateRule(Rule rule);
|
||||
|
||||
/**
|
||||
* 删除规则
|
||||
*/
|
||||
int deleteRuleById(Integer id);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*/
|
||||
int deleteRuleByIds(@Param("ids")Integer[] ids);
|
||||
}
|
||||
@@ -1,23 +1,19 @@
|
||||
package com.solution.rule.service;
|
||||
|
||||
import com.solution.rule.domain.dto.RequestDTO;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.FireRuleExecuteDTO;
|
||||
import com.solution.rule.domain.vo.PlatformComponentNamesVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface RuleService {
|
||||
public interface FireRuleService {
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param sceneType
|
||||
* @param weaponModelDTO
|
||||
* @param fireRuleExecuteDTO
|
||||
* @return
|
||||
*/
|
||||
WeaponModelVO execute(Integer sceneType, WeaponModelDTO weaponModelDTO);
|
||||
List<PlatformWeaponAggregateVO> execute(FireRuleExecuteDTO fireRuleExecuteDTO);
|
||||
|
||||
List<PlatformWeaponAggregateVO> getWeapon();
|
||||
|
||||
@@ -26,4 +22,11 @@ public interface RuleService {
|
||||
* @return
|
||||
*/
|
||||
List<PlatformComponentNamesVO> getPlatformComponentNames();
|
||||
|
||||
/**
|
||||
* 获取通信组件的所有平台和组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
List<PlatformComponentNamesVO> getCommPlatformComponentNames(Integer scenarioId);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.solution.rule.service;
|
||||
|
||||
import com.solution.rule.domain.Rule;
|
||||
import java.util.List;
|
||||
|
||||
public interface IRuleService {
|
||||
/**
|
||||
* 根据ID查询规则
|
||||
*/
|
||||
Rule selectRuleById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*/
|
||||
List<Rule> selectRuleList(Rule rule);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*/
|
||||
int insertRule(Rule rule);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*/
|
||||
int updateRule(Rule rule);
|
||||
|
||||
/**
|
||||
* 删除规则
|
||||
*/
|
||||
int deleteRuleById(Integer id);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*/
|
||||
int deleteRuleByIds(Integer[] ids);
|
||||
}
|
||||
@@ -3,13 +3,15 @@ package com.solution.rule.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.rule.domain.FireRuleExecuteDTO;
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.ComponentCountVO;
|
||||
import com.solution.rule.domain.vo.PlatformComponentNamesVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.mapper.RuleMapper;
|
||||
import com.solution.rule.service.RuleService;
|
||||
import com.solution.rule.mapper.FireRuleMapper;
|
||||
import com.solution.rule.service.FireRuleService;
|
||||
import com.solution.rule.strategy.SceneStrategy;
|
||||
import com.solution.rule.strategy.SceneStrategyFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -21,15 +23,17 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class RuleServiceImpl implements RuleService {
|
||||
public class FireRuleServiceImpl implements FireRuleService {
|
||||
|
||||
private static final long COMPONENT_QUANTITY_THRESHOLD = 1;
|
||||
|
||||
@Autowired
|
||||
private SceneStrategyFactory strategyFactory;
|
||||
|
||||
@Autowired
|
||||
private RuleMapper ruleMapper;
|
||||
private FireRuleMapper ruleMapper;
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public WeaponModelVO execute(Integer sceneType, WeaponModelDTO weaponModelDTO) {
|
||||
if(ObjectUtil.isNull(sceneType) || ObjectUtil.isEmpty(weaponModelDTO)){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
@@ -43,12 +47,33 @@ public class RuleServiceImpl implements RuleService {
|
||||
throw new RuntimeException(ExceptionConstants.RESULT_EXCEPTION);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlatformWeaponAggregateVO> getWeapon() {
|
||||
public List<PlatformWeaponAggregateVO> execute(FireRuleExecuteDTO fireRuleExecuteDTO) {
|
||||
if(ObjectUtil.isEmpty(fireRuleExecuteDTO)){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
List<WeaponModelDTO> weaponModelDTOs = fireRuleExecuteDTO.getWeaponModelDTOs();
|
||||
Integer sceneType = fireRuleExecuteDTO.getSceneType();
|
||||
// 查数据库获取我方装备
|
||||
List<ComponentCountVO> weapon = this.getModuleAndCount();
|
||||
|
||||
// 创建RuleParam并设置数据
|
||||
RuleParam ruleParam = new RuleParam();
|
||||
ruleParam.setWeaponModelDTOList(weaponModelDTOs);
|
||||
ruleParam.setDatabaseWeapons(weapon);
|
||||
|
||||
// 执行策略
|
||||
SceneStrategy strategy = strategyFactory.getStrategy(sceneType);
|
||||
List<PlatformWeaponAggregateVO> result = strategy.execute(ruleParam);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlatformWeaponAggregateVO> getWeapon() {
|
||||
List<WeaponModelVO> flatList = ruleMapper.getWeapon();
|
||||
if (CollUtil.isEmpty(flatList)) {
|
||||
throw new RuntimeException(ExceptionConstants.RESULT_EXCEPTION);
|
||||
@@ -70,7 +95,7 @@ public class RuleServiceImpl implements RuleService {
|
||||
return comp;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
platformVO.setComponents(components);
|
||||
platformVO.setComponentCountVOS(components);
|
||||
|
||||
result.add(platformVO);
|
||||
}
|
||||
@@ -106,4 +131,26 @@ public class RuleServiceImpl implements RuleService {
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通信组件的所有平台和组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PlatformComponentNamesVO> getCommPlatformComponentNames(Integer scenarioId) {
|
||||
return ruleMapper.getCommPlatformComponentNames(scenarioId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有组件以及数量
|
||||
* @return
|
||||
*/
|
||||
private List<ComponentCountVO> getModuleAndCount(){
|
||||
List<ComponentCountVO> componentCountVOS = ruleMapper.getModuleAndCount();
|
||||
if(CollUtil.isEmpty(componentCountVOS)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return componentCountVOS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.solution.rule.service.impl;
|
||||
|
||||
import com.solution.rule.domain.Rule;
|
||||
import com.solution.rule.mapper.RuleMapper;
|
||||
import com.solution.rule.service.IRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class RuleServiceImpl implements IRuleService {
|
||||
|
||||
@Autowired
|
||||
private RuleMapper ruleMapper;
|
||||
|
||||
@Override
|
||||
public Rule selectRuleById(Integer id) {
|
||||
return ruleMapper.selectRuleById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Rule> selectRuleList(Rule rule) {
|
||||
return ruleMapper.selectRuleList(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRule(Rule rule) {
|
||||
return ruleMapper.insertRule(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRule(Rule rule) {
|
||||
return ruleMapper.updateRule(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRuleById(Integer id) {
|
||||
return ruleMapper.deleteRuleById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRuleByIds(Integer[] ids) {
|
||||
return ruleMapper.deleteRuleByIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.solution.rule.strategy;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.enums.SceneType;
|
||||
import com.solution.rule.handler.RuleChainHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
public class AirborneStrategy implements SceneStrategy{
|
||||
@@ -19,21 +21,20 @@ public class AirborneStrategy implements SceneStrategy{
|
||||
private RuleChainHandler ruleChainHandler;
|
||||
/**
|
||||
* 空降场景处理
|
||||
* @param weaponModelDTO
|
||||
* @param ruleParam
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public WeaponModelVO execute(WeaponModelDTO weaponModelDTO) {
|
||||
if(ObjectUtil.isEmpty(weaponModelDTO)){
|
||||
public List<PlatformWeaponAggregateVO> execute(RuleParam ruleParam) {
|
||||
if(ObjectUtil.isEmpty(ruleParam) || CollUtil.isEmpty(ruleParam.getWeaponModelDTOList())){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
RuleParam ruleParam = new RuleParam();
|
||||
ruleParam.setWeaponModelDTO(weaponModelDTO);
|
||||
|
||||
ruleParam = ruleChainHandler.findRuleParam(ruleParam);
|
||||
if(ObjectUtil.isEmpty(ruleParam.getWeaponModelVO())){
|
||||
throw new RuntimeException(ExceptionConstants.RESULT_EXCEPTION);
|
||||
}
|
||||
return ruleParam.getWeaponModelVO();
|
||||
|
||||
return ruleParam.getResultWeapons();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.solution.rule.strategy;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.enums.SceneType;
|
||||
import com.solution.rule.handler.RuleChainHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class DefenseStrategy implements SceneStrategy{
|
||||
|
||||
@@ -18,21 +20,21 @@ public class DefenseStrategy implements SceneStrategy{
|
||||
private RuleChainHandler ruleChainHandler;
|
||||
/**
|
||||
* 防御场景处理
|
||||
* @param weaponModelDTO
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public WeaponModelVO execute(WeaponModelDTO weaponModelDTO) {
|
||||
if(ObjectUtil.isEmpty(weaponModelDTO)){
|
||||
public List<PlatformWeaponAggregateVO> execute(RuleParam ruleParam) {
|
||||
if(ObjectUtil.isEmpty(ruleParam) || CollUtil.isEmpty(ruleParam.getWeaponModelDTOList())){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
RuleParam ruleParam = new RuleParam();
|
||||
ruleParam.setWeaponModelDTO(weaponModelDTO);
|
||||
|
||||
ruleParam = ruleChainHandler.findRuleParam(ruleParam);
|
||||
if(ObjectUtil.isEmpty(ruleParam.getWeaponModelVO())){
|
||||
throw new RuntimeException(ExceptionConstants.RESULT_EXCEPTION);
|
||||
}
|
||||
return ruleParam.getWeaponModelVO();
|
||||
|
||||
|
||||
return ruleParam.getResultWeapons();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.solution.rule.strategy;
|
||||
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.enums.SceneType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface SceneStrategy {
|
||||
|
||||
List<PlatformWeaponAggregateVO> execute(RuleParam ruleParam);
|
||||
|
||||
SceneType getSceneType();
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.solution.rule.mapper.RuleMapper">
|
||||
<mapper namespace="com.solution.rule.mapper.FireRuleMapper">
|
||||
|
||||
|
||||
<resultMap id="platformComponentCountMap" type="com.solution.rule.domain.vo.WeaponModelVO">
|
||||
@@ -11,6 +11,13 @@
|
||||
<result property="count" column="count"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PlatformComponentNamesVOResultMap" type="com.solution.rule.domain.vo.PlatformComponentNamesVO">
|
||||
<result property="platformName" column="platformName"/>
|
||||
<collection property="componentNames" ofType="java.lang.String">
|
||||
<result column="componentName"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getWeapon" resultMap="platformComponentCountMap">
|
||||
SELECT
|
||||
p.name AS platform_name,
|
||||
@@ -34,4 +41,26 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getModuleAndCount" resultType="com.solution.rule.domain.vo.ComponentCountVO">
|
||||
SELECT
|
||||
name AS componentName,
|
||||
COUNT(*) AS count
|
||||
FROM platform_component
|
||||
WHERE name IS NOT NULL
|
||||
GROUP BY name
|
||||
ORDER BY count DESC;
|
||||
</select>
|
||||
|
||||
<select id="getCommPlatformComponentNames" resultMap="PlatformComponentNamesVOResultMap"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT
|
||||
p.name AS platformName,
|
||||
pc.name AS componentName
|
||||
FROM platform p
|
||||
INNER JOIN platform_component pc ON p.id = pc.platform_id
|
||||
WHERE pc.type = "comm"
|
||||
AND p.scenario_id = #{scenarioId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.solution.rule.mapper.RuleMapper">
|
||||
|
||||
<resultMap id="RuleResult" type="com.solution.rule.domain.Rule">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sceneType" column="scene_type"/>
|
||||
<result property="conditions" column="conditions"/>
|
||||
<result property="actions" column="actions"/>
|
||||
<result property="priority" column="priority"/>
|
||||
<result property="enabled" column="enabled"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRuleVo">
|
||||
select id, name, scene_type, conditions, actions, priority, enabled, created_time, updated_time
|
||||
from rule
|
||||
</sql>
|
||||
|
||||
<select id="selectRuleById" parameterType="Integer" resultMap="RuleResult">
|
||||
<include refid="selectRuleVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectRuleList" parameterType="com.solution.rule.domain.Rule" resultMap="RuleResult">
|
||||
<include refid="selectRuleVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="sceneType != null">
|
||||
AND scene_type = #{sceneType}
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
AND enabled = #{enabled}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertRule" parameterType="com.solution.rule.domain.Rule" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rule
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="sceneType != null">scene_type,</if>
|
||||
<if test="conditions != null">conditions,</if>
|
||||
<if test="actions != null">actions,</if>
|
||||
<if test="priority != null">priority,</if>
|
||||
<if test="enabled != null">enabled,</if>
|
||||
created_time,
|
||||
updated_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="sceneType != null">#{sceneType},</if>
|
||||
<if test="conditions != null">#{conditions},</if>
|
||||
<if test="actions != null">#{actions},</if>
|
||||
<if test="priority != null">#{priority},</if>
|
||||
<if test="enabled != null">#{enabled},</if>
|
||||
now(),
|
||||
now()
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRule" parameterType="com.solution.rule.domain.Rule">
|
||||
update rule
|
||||
<set>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="sceneType != null">scene_type = #{sceneType},</if>
|
||||
<if test="conditions != null">conditions = #{conditions},</if>
|
||||
<if test="actions != null">actions = #{actions},</if>
|
||||
<if test="priority != null">priority = #{priority},</if>
|
||||
<if test="enabled != null">enabled = #{enabled},</if>
|
||||
updated_time = now()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRuleById" parameterType="Integer">
|
||||
delete from rule where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!--<delete id="deleteRuleByIds" parameterType="String">
|
||||
delete from rule where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>-->
|
||||
<delete id="deleteRuleByIds">
|
||||
delete from rule where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
2
pom.xml
2
pom.xml
@@ -251,7 +251,7 @@
|
||||
<module>auto-solution-quartz</module>
|
||||
<module>auto-solution-generator</module>
|
||||
<module>auto-solution-common</module>
|
||||
<module>solution-rule</module>
|
||||
<module>auto-solution-rule</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class RuleParam {
|
||||
|
||||
private WeaponModelVO weaponModelVO;
|
||||
|
||||
private WeaponModelDTO weaponModelDTO;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.solution.rule.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.common.constant.PlatformAndModuleConstants;
|
||||
import com.solution.rule.domain.PlatformComponent;
|
||||
import com.solution.rule.domain.RuleParam;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 战斗机处理链
|
||||
*/
|
||||
@Component
|
||||
public class WarplaneHandler extends AbstractRuleChainHandler{
|
||||
|
||||
@Override
|
||||
public RuleParam doHandler(RuleParam ruleParam) {
|
||||
if(ObjectUtil.isEmpty(ruleParam) || ObjectUtil.isEmpty(ruleParam.getWeaponModelDTO())){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
WeaponModelDTO weaponModelDTO = ruleParam.getWeaponModelDTO();
|
||||
List<PlatformComponent> platformComponents = weaponModelDTO.getComponents().stream()
|
||||
.filter(component -> PlatformAndModuleConstants.F22.equals(component.getName()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(platformComponents)) {
|
||||
throw new RuntimeException(ExceptionConstants.NOT_FOUND_F22_COMPONENT);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.solution.rule.mapper;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RuleMapper {
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
List<WeaponModelVO> getWeapon();
|
||||
|
||||
List<WeaponModelVO> getPlatformComponentNames();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.solution.rule.strategy;
|
||||
|
||||
import com.solution.rule.domain.dto.RequestDTO;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.enums.SceneType;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface SceneStrategy {
|
||||
|
||||
WeaponModelVO execute(WeaponModelDTO weaponModelDTO);
|
||||
|
||||
SceneType getSceneType();
|
||||
}
|
||||
Reference in New Issue
Block a user