|
@@ -9,11 +9,11 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.eco.als.domain.*;
|
|
|
+import org.eco.als.domain.FaultDiagnosis;
|
|
|
+import org.eco.als.domain.LifePrediction;
|
|
|
+import org.eco.als.domain.PreProcessing;
|
|
|
import org.eco.als.domain.bo.*;
|
|
|
-import org.eco.als.domain.vo.AirConfigurationVo;
|
|
|
-import org.eco.als.domain.vo.ModelHttpVo;
|
|
|
-import org.eco.als.domain.vo.ModelVo;
|
|
|
+import org.eco.als.domain.vo.*;
|
|
|
import org.eco.als.service.*;
|
|
|
import org.eco.als.utils.CsvUtils;
|
|
|
import org.eco.common.core.config.EcoConfig;
|
|
@@ -51,9 +51,6 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
@Resource
|
|
|
private IWarningService warningService;
|
|
|
|
|
|
- @Resource
|
|
|
- private IFalseAlarmService falseAlarmService;
|
|
|
-
|
|
|
@Resource
|
|
|
private IFalseAlarmResultService falseAlarmResultService;
|
|
|
|
|
@@ -70,6 +67,11 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
private ITaskService taskService;
|
|
|
@Resource
|
|
|
private IQaHistoryService qaHistoryService;
|
|
|
+ @Resource
|
|
|
+ private IJudgeFaultLogicService judgeFaultLogicService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IFormulaService formulaService;
|
|
|
|
|
|
@Value("${kgqa.ask-url}")
|
|
|
private String askUrl;
|
|
@@ -140,66 +142,24 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
* executeFalseAlarm 虚警抑制
|
|
|
*
|
|
|
* @param algorithmBo 参数
|
|
|
- * @return java.lang.String
|
|
|
**/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public String executeFalseAlarm(AlgorithmBo algorithmBo) {
|
|
|
- // 虚警抑制校验警告列表
|
|
|
- if (ObjectUtil.isNull(algorithmBo.getWarningIds())) {
|
|
|
- throw new BusinessException("警告信息不能为空,请检查!");
|
|
|
- }
|
|
|
- // 模型相关信息
|
|
|
- ModelBo modelBo = new ModelBo();
|
|
|
- modelBo.setPartId(algorithmBo.getPartId());
|
|
|
- modelBo.setType("4");
|
|
|
- List<ModelVo> list = modelService.selectList(modelBo);
|
|
|
- ModelVo modelVo = list.getFirst();
|
|
|
- if (ObjectUtil.isNull(modelVo)) {
|
|
|
- throw new BusinessException("模型信息为空,请检查!");
|
|
|
- }
|
|
|
- SysOssVo sysOssVo = getSysOssVo(algorithmBo);
|
|
|
- if (sysOssVo == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- FalseAlarmBo falseAlarmBo = FalseAlarmBo.builder()
|
|
|
- .ossId(sysOssVo.getOssId())
|
|
|
- .aircraftId(algorithmBo.getAircraftId())
|
|
|
- .modelType(modelVo.getType())
|
|
|
- .sortieNo(algorithmBo.getSortieNo())
|
|
|
- .param(algorithmBo.getParam())
|
|
|
- .status("0")
|
|
|
- .columnData(Arrays.toString(algorithmBo.getColumnData()))
|
|
|
- .build();
|
|
|
- FalseAlarm falseAlarm = falseAlarmService.insert(falseAlarmBo);
|
|
|
-
|
|
|
+ public void executeFalseAlarm(AlgorithmBo algorithmBo) {
|
|
|
+ WarningBo warningBo = new WarningBo();
|
|
|
+ warningBo.setSortieNo(algorithmBo.getSortieNo());
|
|
|
// 警告列表
|
|
|
- List<Warning> warnings = warningService.listByIds(Arrays.asList(algorithmBo.getWarningIds()));
|
|
|
- Warning warning = warnings.getFirst();
|
|
|
- warnings.forEach(el -> {
|
|
|
- });
|
|
|
- // 参数
|
|
|
- Map<String, Object> map = StrUtil.isBlank(algorithmBo.getParam()) ? new HashMap<>() : new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
- map.put("url", sysOssVo.getUrl());
|
|
|
- map.put("faultCode", warning.getCode());
|
|
|
- // 请求
|
|
|
- ModelHttpVo httpVo = sendHttp(modelVo, map);
|
|
|
- if (httpVo != null && httpVo.getStatus() == 200) {
|
|
|
- falseAlarmBo.setStatus("1");
|
|
|
- falseAlarmBo.setId(falseAlarm.getId());
|
|
|
- falseAlarmBo.setVersion(falseAlarm.getVersion());
|
|
|
- falseAlarmService.update(falseAlarmBo);
|
|
|
- FalseAlarmResultBo falseAlarmResultBo = FalseAlarmResultBo.builder()
|
|
|
- .falseAlarmId(falseAlarmBo.getId())
|
|
|
- .code(warning.getCode())
|
|
|
- .name(warning.getName())
|
|
|
- .aircraftId(warning.getAircraftId())
|
|
|
- .sortieNo(warning.getSortieNo())
|
|
|
- .status(httpVo.getData())
|
|
|
+ List<WarningVo> warningList = warningService.selectList(warningBo);
|
|
|
+ warningList.forEach(el -> {
|
|
|
+ JudgeFaultLogicVo logicVo = judgeFaultLogicService.selectByHmc(el.getCode());
|
|
|
+ ExpressBo expressBo = new ExpressBo();
|
|
|
+ expressBo.setExpression(logicVo.getRemarks());
|
|
|
+ expressBo.setOssId(algorithmBo.getOssId());
|
|
|
+ int result = formulaService.evaluateExpression(expressBo);
|
|
|
+ FalseAlarmResultBo falseAlarmResultBo = FalseAlarmResultBo.builder().code(el.getCode()).name(el.getName()).aircraftId(el.getAircraftId()).sortieNo(el.getSortieNo()).status(String.valueOf(result))
|
|
|
.build();
|
|
|
falseAlarmResultService.insert(falseAlarmResultBo);
|
|
|
- }
|
|
|
- return httpVo != null ? httpVo.getData() : null;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -274,6 +234,9 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
throw new BusinessException("模型信息为空,请检查!");
|
|
|
}
|
|
|
ModelVo modelVo = list.getFirst();
|
|
|
+
|
|
|
+// List<SysOssVo> list = ossService.listSysOssByIds(Arrays.asList(algorithmBo.getOssIds()));
|
|
|
+
|
|
|
List<String> urls = new ArrayList<>();
|
|
|
for (Long ossId : algorithmBo.getOssIds()) {
|
|
|
SysOssVo sysOss = ossService.getById(ossId);
|
|
@@ -331,24 +294,6 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
|
|
|
@Override
|
|
|
public String batchExecute(TaskBo taskBo) {
|
|
|
- // 数据编号
|
|
|
- Long dataId;
|
|
|
- // 预处理编号
|
|
|
- Long preId;
|
|
|
- // 虚警编号
|
|
|
- Long falseAlarmId;
|
|
|
- // 故障诊断编号
|
|
|
- Long faultId;
|
|
|
- // 决策编号
|
|
|
- Long decisionId;
|
|
|
- List<AlgorithmBo> algorithmList = taskBo.getAlgorithmList();
|
|
|
- // 批量执行
|
|
|
- algorithmList.forEach(el -> {
|
|
|
- executePro(el);
|
|
|
- executeFalseAlarm(el);
|
|
|
- executeFault(el);
|
|
|
- });
|
|
|
- taskService.insert(taskBo);
|
|
|
return null;
|
|
|
}
|
|
|
|