|
@@ -5,6 +5,7 @@ import static com.zksy.common.utils.CollectionSideEffects.requireSaved;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.zksy.api.domain.EarlyWarning;
|
|
import com.zksy.api.domain.EarlyWarning;
|
|
|
import com.zksy.api.domain.EquipmentBase;
|
|
import com.zksy.api.domain.EquipmentBase;
|
|
|
|
|
+import com.zksy.api.mapper.AutoWarningClosureMapper;
|
|
|
import com.zksy.api.mapper.EarlyWarningApiMapper;
|
|
import com.zksy.api.mapper.EarlyWarningApiMapper;
|
|
|
import com.zksy.api.mapper.EquipmentBaseApiMapper;
|
|
import com.zksy.api.mapper.EquipmentBaseApiMapper;
|
|
|
import com.zksy.api.mapper.WarningTypeApiMapper;
|
|
import com.zksy.api.mapper.WarningTypeApiMapper;
|
|
@@ -22,6 +23,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 采集数据接近阈值时自动写入 early_warning
|
|
* 采集数据接近阈值时自动写入 early_warning
|
|
@@ -45,6 +47,7 @@ public class EarlyWarningAutoServiceImpl implements EarlyWarningAutoService {
|
|
|
private com.zksy.api.mapper.WarningItemBindingMapper warningItemBindingMapper;
|
|
private com.zksy.api.mapper.WarningItemBindingMapper warningItemBindingMapper;
|
|
|
|
|
|
|
|
@Autowired private com.zksy.api.service.AutoWarningClosureService closureService;
|
|
@Autowired private com.zksy.api.service.AutoWarningClosureService closureService;
|
|
|
|
|
+ @Autowired private AutoWarningClosureMapper closureMapper;
|
|
|
@Autowired private WarningTypeApiMapper warningTypeApiMapper;
|
|
@Autowired private WarningTypeApiMapper warningTypeApiMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -205,6 +208,11 @@ public class EarlyWarningAutoServiceImpl implements EarlyWarningAutoService {
|
|
|
|
|
|
|
|
bindConfiguredItem(warning, warningCode);
|
|
bindConfiguredItem(warning, warningCode);
|
|
|
requireSaved(earlyWarningApiMapper.insert(warning) > 0);
|
|
requireSaved(earlyWarningApiMapper.insert(warning) > 0);
|
|
|
|
|
+ try {
|
|
|
|
|
+ closureMapper.insertTrigger(UUID.randomUUID().toString().replace("-", ""), warning.getWarningId(), now);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("预警触发日志写入失败: warningNo={}", warning.getWarningNo(), e);
|
|
|
|
|
+ }
|
|
|
log.info("自动生成预警成功: warningNo={}, deviceCode={}, warningCode={}, level={}级, actual={}, min={}, max={}",
|
|
log.info("自动生成预警成功: warningNo={}, deviceCode={}, warningCode={}, level={}级, actual={}, min={}, max={}",
|
|
|
warning.getWarningNo(), deviceCode, warningCode, result.getLevel(),
|
|
warning.getWarningNo(), deviceCode, warningCode, result.getLevel(),
|
|
|
actualValue, minValue, maxValue);
|
|
actualValue, minValue, maxValue);
|