Browse Source

#设备实例告警修改

zhongwei
yang_shj 5 months ago
parent
commit
475f03f5c9
  1. 20
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java

20
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SoeAlarmServiceImpl.java

@ -9,6 +9,8 @@ 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;
@ -21,10 +23,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static com.hnac.hzims.alarm.config.constants.AlarmConstants.*;
@ -55,15 +54,8 @@ public class SoeAlarmServiceImpl implements SoeAlarmService {
public List<AlarmEntity> receiveMessage(String message) {
// 对象转换
SoeAlarmVo parseObject = JSONObject.parseObject(message, SoeAlarmVo.class);
List<SoeAlarmVo> 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<SoeAlarmVo> alarms = Collections.singletonList(parseObject);
return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList());
}
private AlarmEntity getAlarmEntity(SoeAlarmVo item) {
@ -81,7 +73,7 @@ public class SoeAlarmServiceImpl implements SoeAlarmService {
entity.setAlarmLevel(Integer.valueOf(item.getLevel()));
entity.setAlarmStatus(1);
entity.setDeviceCode(item.getDeviceCode());
entity.setTenantId("200000");
entity.setTenantId(CommonConstant.TENANT_ID);
entity.setStationId(item.getProjectId());
R<StationEntity> stationByCode = stationClient.getStationByCode(item.getProjectId());
if (stationByCode.isSuccess()&& ObjectUtils.isNotEmpty(stationByCode.getData())){

Loading…
Cancel
Save