|
@@ -2,6 +2,7 @@ package org.eco.als.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
@@ -35,6 +36,7 @@ import org.eco.common.core.utils.file.FileUtils;
|
|
|
import org.eco.system.domain.vo.SysOssVo;
|
|
|
import org.eco.system.service.ISysOssService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.InputStream;
|
|
@@ -99,6 +101,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
* @return java.lang.String
|
|
|
**/
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public String executePro(AlgorithmBo algorithmBo) {
|
|
|
// 模型相关信息
|
|
|
ModelVo modelVo = modelService.selectById(algorithmBo.getModelId());
|
|
@@ -122,7 +125,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
.build();
|
|
|
processingService.insert(processingBo);
|
|
|
// 参数
|
|
|
- Map<String, Object> map = new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
+ Map<String, Object> map = StrUtil.isBlank(algorithmBo.getParam())? new HashMap<>() : new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
map.put("url", sysOssVo.getUrl());
|
|
|
// 请求
|
|
|
ModelHttpVo httpVo = sendHttp(modelVo, map);
|
|
@@ -143,6 +146,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
* @return java.lang.String
|
|
|
**/
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public String executeFalseAlarm(AlgorithmBo algorithmBo) {
|
|
|
// 虚警抑制校验警告列表
|
|
|
if (ObjectUtil.isNull(algorithmBo.getWarningIds())) {
|
|
@@ -174,7 +178,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
warnings.forEach(el -> {
|
|
|
});
|
|
|
// 参数
|
|
|
- Map<String, Object> map = new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
+ Map<String, Object> map = StrUtil.isBlank(algorithmBo.getParam())? new HashMap<>() : new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
map.put("url", sysOssVo.getUrl());
|
|
|
// 请求
|
|
|
ModelHttpVo httpVo = sendHttp(modelVo, map);
|
|
@@ -202,6 +206,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
**/
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public String executeFault(AlgorithmBo algorithmBo) {
|
|
|
// 模型相关信息
|
|
|
ModelVo modelVo = modelService.selectById(algorithmBo.getModelId());
|
|
@@ -223,7 +228,7 @@ public class AlgorithmService implements IAlgorithmService {
|
|
|
.build();
|
|
|
faultDiagnosisService.insert(diagnosisBo);
|
|
|
// 参数
|
|
|
- Map<String, Object> map = new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
+ Map<String, Object> map = StrUtil.isBlank(algorithmBo.getParam())? new HashMap<>() : new HashMap<>(JSONUtil.parseObj(algorithmBo.getParam()));
|
|
|
map.put("url", sysOssVo.getUrl());
|
|
|
// 请求
|
|
|
ModelHttpVo httpVo = sendHttp(modelVo, map);
|