|
|
@ -3,7 +3,6 @@ package com.hnac.hzims.alarm.source.service.impl; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.hnac.hzims.alarm.config.entity.AlarmEntity; |
|
|
|
import com.hnac.hzims.alarm.config.entity.AlarmEntity; |
|
|
|
import com.hnac.hzims.alarm.config.vo.ConditionAlarmVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo; |
|
|
|
import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
import com.hnac.hzims.alarm.source.service.DroolsAlarmService; |
|
|
|
import com.hnac.hzims.alarm.source.service.DroolsAlarmService; |
|
|
@ -14,12 +13,10 @@ import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -52,15 +49,8 @@ public class DroolsAlarmServiceImpl implements DroolsAlarmService { |
|
|
|
public List<AlarmEntity> receiveMessage(String message) { |
|
|
|
public List<AlarmEntity> receiveMessage(String message) { |
|
|
|
// 对象转换
|
|
|
|
// 对象转换
|
|
|
|
DroolsAlarmVo parseObject= JSONObject.parseObject(message, DroolsAlarmVo.class); |
|
|
|
DroolsAlarmVo parseObject= JSONObject.parseObject(message, DroolsAlarmVo.class); |
|
|
|
List<DroolsAlarmVo> alarms = Arrays.asList(parseObject); |
|
|
|
List<DroolsAlarmVo> alarms = Collections.singletonList(parseObject); |
|
|
|
if (CollectionUtil.isEmpty(alarms)) { |
|
|
|
return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList()); |
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<AlarmEntity> res = alarms.stream().map(s -> { |
|
|
|
|
|
|
|
AlarmEntity entity = getAlarmEntity(s); |
|
|
|
|
|
|
|
return entity; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AlarmEntity getAlarmEntity(DroolsAlarmVo item) { |
|
|
|
private AlarmEntity getAlarmEntity(DroolsAlarmVo item) { |
|
|
|