Browse Source

#发电量计算最后值减最初值方式

zhongwei
yang_shj 6 months ago
parent
commit
8c12033877
  1. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java
  2. 16
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java

@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.DroolsAlarmService;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzinfo.subscribe.SubscribeCallBack;
import lombok.extern.slf4j.Slf4j;
import oracle.sql.DATE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;

16
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/DroolsAlarmServiceImpl.java

@ -3,7 +3,6 @@ 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.ConditionAlarmVo;
import com.hnac.hzims.alarm.config.vo.DroolsAlarmVo;
import com.hnac.hzims.alarm.show.service.AlarmService;
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.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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -52,15 +49,8 @@ public class DroolsAlarmServiceImpl implements DroolsAlarmService {
public List<AlarmEntity> receiveMessage(String message) {
// 对象转换
DroolsAlarmVo parseObject= JSONObject.parseObject(message, DroolsAlarmVo.class);
List<DroolsAlarmVo> alarms = Arrays.asList(parseObject);
if (CollectionUtil.isEmpty(alarms)) {
return new ArrayList<>();
}
List<AlarmEntity> res = alarms.stream().map(s -> {
AlarmEntity entity = getAlarmEntity(s);
return entity;
}).collect(Collectors.toList());
return res;
List<DroolsAlarmVo> alarms = Collections.singletonList(parseObject);
return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList());
}
private AlarmEntity getAlarmEntity(DroolsAlarmVo item) {

Loading…
Cancel
Save