|
|
@ -5,8 +5,6 @@ import com.alibaba.fastjson2.JSONArray; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.alibaba.fastjson2.TypeReference; |
|
|
import com.alibaba.fastjson2.TypeReference; |
|
|
import com.baidu.fsg.uid.UidGenerator; |
|
|
import com.baidu.fsg.uid.UidGenerator; |
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonMappingException; |
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.google.gson.Gson; |
|
|
import com.google.gson.Gson; |
|
|
@ -25,6 +23,7 @@ import com.techsor.datacenter.sender.dao.*; |
|
|
import com.techsor.datacenter.sender.disruptor.AccumulateService; |
|
|
import com.techsor.datacenter.sender.disruptor.AccumulateService; |
|
|
import com.techsor.datacenter.sender.disruptor.AlertService; |
|
|
import com.techsor.datacenter.sender.disruptor.AlertService; |
|
|
import com.techsor.datacenter.sender.disruptor.MeasureService; |
|
|
import com.techsor.datacenter.sender.disruptor.MeasureService; |
|
|
|
|
|
import com.techsor.datacenter.sender.dto.BlockConfigDTO; |
|
|
import com.techsor.datacenter.sender.dto.DeviceAlertInfo; |
|
|
import com.techsor.datacenter.sender.dto.DeviceAlertInfo; |
|
|
import com.techsor.datacenter.sender.dto.DeviceInfoVO; |
|
|
import com.techsor.datacenter.sender.dto.DeviceInfoVO; |
|
|
import com.techsor.datacenter.sender.entitiy.*; |
|
|
import com.techsor.datacenter.sender.entitiy.*; |
|
|
@ -34,11 +33,7 @@ import com.techsor.datacenter.sender.entitiy.bastatus.BaStatusThirdReqEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.bastatus.LatestValueBO; |
|
|
import com.techsor.datacenter.sender.entitiy.bastatus.LatestValueBO; |
|
|
import com.techsor.datacenter.sender.entitiy.company.CompanyEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.company.CompanyEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.delta.DeltaNumEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.delta.DeltaNumEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.kingio.KingIODataItemEntity; |
|
|
|
|
|
import com.techsor.datacenter.sender.entitiy.kingio.KingIODbmEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.kingio.KingIODbmEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.kingio.TrendLog1RawEntity; |
|
|
|
|
|
import com.techsor.datacenter.sender.entitiy.kingio.TrendLog1RawEntity.LogBuffer; |
|
|
|
|
|
import com.techsor.datacenter.sender.entitiy.st150.St150DataItem; |
|
|
|
|
|
import com.techsor.datacenter.sender.entitiy.st150.St150DbmEntity; |
|
|
import com.techsor.datacenter.sender.entitiy.st150.St150DbmEntity; |
|
|
import com.techsor.datacenter.sender.service.AlarmDataPushLambda; |
|
|
import com.techsor.datacenter.sender.service.AlarmDataPushLambda; |
|
|
import com.techsor.datacenter.sender.service.DispatchService; |
|
|
import com.techsor.datacenter.sender.service.DispatchService; |
|
|
@ -53,30 +48,20 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.eclipse.paho.client.mqttv3.MqttClient; |
|
|
|
|
|
import org.eclipse.paho.client.mqttv3.MqttException; |
|
|
|
|
|
import org.eclipse.paho.client.mqttv3.MqttMessage; |
|
|
|
|
|
import org.eclipse.paho.client.mqttv3.MqttPersistenceException; |
|
|
|
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; |
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
import jakarta.annotation.PostConstruct; |
|
|
import jakarta.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import lombok.val; |
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Type; |
|
|
import java.lang.reflect.Type; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.text.DecimalFormat; |
|
|
|
|
|
import java.text.MessageFormat; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.TimeUnit; |
|
|
import java.util.concurrent.TimeUnit; |
|
|
@ -201,6 +186,9 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
@Resource |
|
|
@Resource |
|
|
private DeviceForwardConfigDao deviceForwardConfigDao; |
|
|
private DeviceForwardConfigDao deviceForwardConfigDao; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private DashboardBlockConfigDao dashboardBlockConfigDao; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private RedisTemplate redisTemplate; |
|
|
private RedisTemplate redisTemplate; |
|
|
@ -642,6 +630,11 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
|
|
|
|
|
|
//设备信息
|
|
|
//设备信息
|
|
|
DeviceInfoVO deviceInfoVO = alarmDataPushLambda.queryDeviceInfoByDeviceId(deviceId); |
|
|
DeviceInfoVO deviceInfoVO = alarmDataPushLambda.queryDeviceInfoByDeviceId(deviceId); |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否在告警屏蔽时段
|
|
|
|
|
|
setAlertBlock(deviceInfoVO); |
|
|
|
|
|
baseTransDataEntity.setAlertBlock(deviceInfoVO.getAlertBlock()); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
log.debug("triggerAlertConditions:{} {} {}", content, JSON.toJSON(baseTransDataEntity), JSON.toJSON(currentDeviceAlertInfoBindTemplateLists)); |
|
|
log.debug("triggerAlertConditions:{} {} {}", content, JSON.toJSON(baseTransDataEntity), JSON.toJSON(currentDeviceAlertInfoBindTemplateLists)); |
|
|
triggerAlertConditions(companyId, content, currentDeviceAlertInfoBindTemplateLists, baseTransDataEntity,waitingTargetKeySets,currentDevice.getDeviceSN(), deviceInfoVO); |
|
|
triggerAlertConditions(companyId, content, currentDeviceAlertInfoBindTemplateLists, baseTransDataEntity,waitingTargetKeySets,currentDevice.getDeviceSN(), deviceInfoVO); |
|
|
@ -702,6 +695,24 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
//更新
|
|
|
//更新
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setAlertBlock(DeviceInfoVO deviceInfoVO) { |
|
|
|
|
|
if (deviceInfoVO != null && deviceInfoVO.getBuildingId() != null) { |
|
|
|
|
|
List<BlockConfigDTO> blockConfigs = dashboardBlockConfigDao |
|
|
|
|
|
.queryActiveBlockConfigsByBuildingId(deviceInfoVO.getBuildingId()); |
|
|
|
|
|
long now = System.currentTimeMillis(); |
|
|
|
|
|
boolean inBlockPeriod = blockConfigs.stream().anyMatch( |
|
|
|
|
|
config -> config.getStartTime() != null |
|
|
|
|
|
&& config.getEndTime() != null |
|
|
|
|
|
&& now >= config.getStartTime() |
|
|
|
|
|
&& now <= config.getEndTime() |
|
|
|
|
|
); |
|
|
|
|
|
deviceInfoVO.setAlertBlock(inBlockPeriod ? 1 : 0); |
|
|
|
|
|
if (inBlockPeriod) { |
|
|
|
|
|
log.debug("device {} building {} in alert block period", deviceInfoVO.getDeviceId(), deviceInfoVO.getBuildingId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private void sysAlarmNotify(DynamodbEntity baseTransDataEntity, DeviceInfoVO deviceInfoVO) throws Exception {
|
|
|
// private void sysAlarmNotify(DynamodbEntity baseTransDataEntity, DeviceInfoVO deviceInfoVO) throws Exception {
|
|
|
// String temp = "建物「{0}」の監視ポイント「{1}」でアラームが発生しました";
|
|
|
// String temp = "建物「{0}」の監視ポイント「{1}」でアラームが発生しました";
|
|
|
|