|
@@ -5,14 +5,17 @@ import cn.hutool.core.util.StrUtil;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.eco.als.domain.bo.AlgorithmBo;
|
|
import org.eco.als.domain.bo.AlgorithmBo;
|
|
|
|
+import org.eco.als.domain.bo.ExpressBo;
|
|
import org.eco.als.domain.bo.QaBo;
|
|
import org.eco.als.domain.bo.QaBo;
|
|
import org.eco.als.domain.bo.TaskBo;
|
|
import org.eco.als.domain.bo.TaskBo;
|
|
import org.eco.als.service.IAlgorithmService;
|
|
import org.eco.als.service.IAlgorithmService;
|
|
|
|
+import org.eco.als.service.IFormulaService;
|
|
import org.eco.common.core.core.domain.CommonResult;
|
|
import org.eco.common.core.core.domain.CommonResult;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 算法相关控制
|
|
* 算法相关控制
|
|
@@ -27,6 +30,8 @@ import java.util.List;
|
|
public class AlgorithmController {
|
|
public class AlgorithmController {
|
|
@Resource
|
|
@Resource
|
|
private IAlgorithmService algorithmService;
|
|
private IAlgorithmService algorithmService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IFormulaService formulaService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 执行预处理
|
|
* 执行预处理
|
|
@@ -133,4 +138,19 @@ public class AlgorithmController {
|
|
public CommonResult<String> executeQa(@Validated @RequestBody QaBo QaBo) {
|
|
public CommonResult<String> executeQa(@Validated @RequestBody QaBo QaBo) {
|
|
return CommonResult.success(algorithmService.executeQa(QaBo), "");
|
|
return CommonResult.success(algorithmService.executeQa(QaBo), "");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 执行公式-规则引擎
|
|
|
|
+ *
|
|
|
|
+ * @param expressBo 入参
|
|
|
|
+ * @return org.eco.common.core.core.domain.CommonResult<java.lang.String> 结果
|
|
|
|
+ **/
|
|
|
|
+ @PostMapping("/execute/express")
|
|
|
|
+ public CommonResult<String> executeExpress(@RequestBody ExpressBo expressBo) throws Exception {
|
|
|
|
+ String express = expressBo.getExpression();
|
|
|
|
+ Map<String, Object> variables = expressBo.getVariables();
|
|
|
|
+ // 执行表达式求值
|
|
|
|
+ Object result = formulaService.evaluateExpression(express, variables);
|
|
|
|
+ return CommonResult.success(result.toString(), "");
|
|
|
|
+ }
|
|
}
|
|
}
|