火力规则:返回平台以及组件

This commit is contained in:
MHW
2026-03-12 16:01:04 +08:00
parent 8b3fe9b548
commit 956d3f69ea
30 changed files with 817 additions and 4 deletions

View File

@@ -0,0 +1,42 @@
package com.solution.rule.strategy;
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.enums.SceneType;
import com.solution.rule.handler.RuleChainHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DefenseStrategy implements SceneStrategy{
@Autowired
private RuleChainHandler ruleChainHandler;
/**
* 防御场景处理
* @param weaponModelDTO
* @return
*/
@Override
public WeaponModelVO execute(WeaponModelDTO weaponModelDTO) {
if(ObjectUtil.isEmpty(weaponModelDTO)){
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();
}
@Override
public SceneType getSceneType() {
return SceneType.DEFENSE;
}
}