|
|
|
@ -3,27 +3,24 @@ package com.hnac.hzims.alarm.source.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.hnac.hzims.alarm.config.entity.AlarmEntity; |
|
|
|
|
import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo; |
|
|
|
|
import com.hnac.hzims.alarm.config.vo.SoeAlarmVo; |
|
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
|
import com.hnac.hzims.alarm.source.service.DroolsAlarmService; |
|
|
|
|
import com.hnac.hzims.alarm.source.service.MessageService; |
|
|
|
|
import com.hnac.hzims.alarm.source.service.SoeAlarmService; |
|
|
|
|
import com.hnac.hzims.common.constant.CommonConstant; |
|
|
|
|
import com.hnac.hzims.common.utils.CommonUtil; |
|
|
|
|
import com.hnac.hzims.common.utils.DateUtil; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.hnac.hzims.alarm.config.constants.AlarmConstants.*; |
|
|
|
@ -60,10 +57,9 @@ public class SoeAlarmServiceImpl implements SoeAlarmService {
|
|
|
|
|
|
|
|
|
|
private AlarmEntity getAlarmEntity(SoeAlarmVo item) { |
|
|
|
|
AlarmEntity entity = new AlarmEntity(); |
|
|
|
|
String format = DateUtil.format(item.getTs(), org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME_MINI); |
|
|
|
|
entity.setAlarmId(format+"-"+item.getDeviceCode()); |
|
|
|
|
String format = DateUtil.format(item.getTs(),DateUtil.PATTERN_DATETIME_MINI); |
|
|
|
|
entity.setAlarmId(format); |
|
|
|
|
entity.setAlarmSource(LEVEL_ALARM); |
|
|
|
|
entity.setAlarmType(ONE_LEVEL); |
|
|
|
|
entity.setAlarmContext(item.getName()); |
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
|
LocalDateTime localDateTime = LocalDateTime.ofInstant(item.getTs().toInstant(), zoneId); |
|
|
|
@ -71,6 +67,13 @@ public class SoeAlarmServiceImpl implements SoeAlarmService {
|
|
|
|
|
entity.setAlarmValue(item.getCurrentValue()); |
|
|
|
|
entity.setAlarmSignage(item.getSignage()); |
|
|
|
|
entity.setAlarmLevel(Integer.valueOf(item.getLevel())); |
|
|
|
|
if(entity.getAlarmLevel() == 0){ |
|
|
|
|
entity.setAlarmType(ONE_LEVEL); |
|
|
|
|
}else if (entity.getAlarmLevel() == 1){ |
|
|
|
|
entity.setAlarmType(TWO_LEVEL); |
|
|
|
|
}else { |
|
|
|
|
entity.setAlarmType(THREE_LEVEL); |
|
|
|
|
} |
|
|
|
|
entity.setAlarmStatus(1); |
|
|
|
|
entity.setDeviceCode(item.getDeviceCode()); |
|
|
|
|
entity.setTenantId(CommonConstant.TENANT_ID); |
|
|
|
|