diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index 2446e96..76cf599 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java @@ -36,4 +36,8 @@ public interface AbnormalAlarmConstant { */ List SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14); + /** + * 告警等级: 0 - 1级告警 1-二级告警 + */ + List LEVEL_LIST = Arrays.asList("0","1"); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java index 0e492ea..9af58de 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java @@ -1,5 +1,6 @@ package com.hnac.hzims.operational.alert.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java index 30d8559..b8a201f 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java @@ -1,5 +1,6 @@ package com.hnac.hzims.operational.alert.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -27,8 +28,17 @@ public class HistoryLevelAlarmEntity extends BaseEntity { @ApiModelProperty("站点名称") private String stationName; + @ApiModelProperty("设备编码") + private String deviceCode; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("告警等级") + private String alarmLevel; + @ApiModelProperty("告警编码") - private Long alarmId; + private String alarmId; @ApiModelProperty("检查点") private String realId; @@ -44,4 +54,8 @@ public class HistoryLevelAlarmEntity extends BaseEntity { @ApiModelProperty("告警原因") private String soeExplain; + + @ApiModelProperty(value = "告警是否处理") + @TableField(exist=false) + private Boolean isHandle; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index 4468b3b..a381b5a 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -12,10 +12,7 @@ import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; import org.springblade.core.mp.support.QueryField; import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tool.utils.DateUtil; @@ -26,6 +23,7 @@ import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; +@EqualsAndHashCode(callSuper = true) @Data @TableName("HZIMS_STATION") @Builder diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java index 674d962..d8097da 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java @@ -41,6 +41,7 @@ import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseService; import org.springblade.core.oss.model.BladeFile; import org.springblade.core.secure.BladeUser; @@ -346,7 +347,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { // 巡检任务ID集合 List taskUsers = this.taskUserService.list(new LambdaQueryWrapper() {{ eq(TaskUserEntity::getUserId, user.getUserId()); - }});; + }}); if(CollectionUtil.isEmpty(taskUsers)){ throw new ServiceException("巡检用户数据不存在!"); } @@ -360,7 +361,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { List users = this.taskUserData(tasks.stream().map(TaskOfflineVO::getId).collect(Collectors.toList())); fileJson.add(JsonUtil.toJson(users)); fileJson.add(JsonUtil.toJson(tasks)); - taskIds = tasks.stream().map(o -> o.getId()).collect(Collectors.toList()); + taskIds = tasks.stream().map(BaseEntity::getId).collect(Collectors.toList()); // 巡检计划 List plans = this.getPlans(tasks.stream().map(TaskOfflineVO::getPlanId).collect(Collectors.toList())); fileJson.add(JsonUtil.toJson(plans)); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java index ea2131c..3f0ed50 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java @@ -92,13 +92,13 @@ public class EventServiceImpl extends BaseServiceImpllambdaQuery() - .eq(TaskUserEntity::getTaskId,eventVO.getTaskId()) - .eq(TaskUserEntity::getUserId,eventVO.getUserId())); + TaskUserEntity taskUserEntity = taskUserService.getOne(Wrappers.lambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).eq(TaskUserEntity::getUserId,user == null ? eventVO.getUserId() : user.getUserId())); if(taskUserEntity==null){ throw new ServiceException("该任务已被别人领取"); } @@ -107,7 +107,7 @@ public class EventServiceImpl extends BaseServiceImpllambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).ne(TaskUserEntity::getUserId,taskUserEntity.getUserId())); + taskUserService.remove(Wrappers.lambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).ne(TaskUserEntity::getId,taskUserEntity.getUserId())); } } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java index c56b802..8d3af89 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java @@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; -import com.hnac.hzims.operational.alert.service.AlarmHandleService; -import com.hnac.hzims.operational.alert.service.AlarmMergeService; -import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService; -import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; +import com.hnac.hzims.operational.alert.service.*; import com.hnac.hzims.operational.alert.vo.AlarmMergeVo; import com.hnac.hzims.operational.config.vo.MessageParamVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; @@ -39,12 +37,12 @@ public class AlertMerageServiceImpl implements AlarmMergeService { private final IStationService stationService; - private final LevelAlarmService levelAlarmService; - private final AlarmHandleService alarmHandleService; private final HistoryAbnormalAlarmService faultAlarmService; + private final HistoryLevelAlarmService levelAlarmService; + /** * 根据用户获取hz3000事故告警、平台一级告警、二级告警 * @param param @@ -95,12 +93,32 @@ public class AlertMerageServiceImpl implements AlarmMergeService { alarm.setDate(fault.getStartTime()); alarm.setRealId(fault.getRealId()); alarm.setAlarmCode(String.valueOf(fault.getAlarmId())); - alarm.setType(AbnormalAlarmConstant.WEBSOCKET_FAULT); + alarm.setType(fault.getType()); return alarm; }).collect(Collectors.toList())); } - // hz3000事故告警 - // faultAlarmService.list(); + // 等级告警 + List levels = levelAlarmService.list(Wrappers.lambdaQuery() + .in(HistoryLevelAlarmEntity::getAlarmLevel,AbnormalAlarmConstant.LEVEL_LIST) + .in(HistoryLevelAlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .in(HistoryLevelAlarmEntity::getType, AbnormalAlarmConstant.TYPE_LIST) + .between(HistoryLevelAlarmEntity::getCreateTime,start,end) + ); + if(CollectionUtil.isNotEmpty(levels)){ + alarms.addAll(levels.stream().filter(l -> CollectionUtil.isEmpty(handles) + || !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(l.getAlarmId())). + map(level->{ + AlarmMergeVo alarm = new AlarmMergeVo(); + alarm.setStationCode(level.getStationId()); + alarm.setStationName(level.getStationName()); + alarm.setContent(level.getSoeExplain()); + alarm.setDate(level.getAlarmTime()); + alarm.setRealId(level.getRealId()); + alarm.setAlarmCode(level.getAlarmId()); + alarm.setType(level.getType()); + return alarm; + }).collect(Collectors.toList())); + } return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmMergeVo::getDate)).collect(Collectors.toList()))); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java index 1367baf..19d238e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java @@ -37,7 +37,7 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl page = super.page(Condition.getPage(query), wrapper); + List records = page.getRecords(); + // 步骤2. 过滤已处理等級告警 + LambdaQueryWrapper handleWarpper = new LambdaQueryWrapper(); + handleWarpper.between(AlarmHandleEntity::getCreateTime, DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00", + DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME)); + handleWarpper.in(AlarmHandleEntity::getStationCode, records.stream().map(HistoryLevelAlarmEntity::getStationId).collect(Collectors.toList())); + handleWarpper.in(AlarmHandleEntity::getAlarmId,records.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList())); + List handles = handleService.list(); + page.setRecords(records.stream().peek(record-> record.setIsHandle(CollectionUtil.isNotEmpty(handles) || handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(record.getAlarmId()))).collect(Collectors.toList())); + return page; } /** @@ -76,7 +86,7 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl handles = handleServicel.list(); + List handles = handleService.list(); // 步骤2.查询告警数据 LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); @@ -93,7 +103,7 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl{ IntelligentAlarmCountVo count = new IntelligentAlarmCountVo(); count.setType(type); - count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.valueOf(type)]); + count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(type)]); if(CollectionUtil.isEmpty(levels)){ count.setCount(0L); }else{ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java index 02bccef..c544bb8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java @@ -2,9 +2,14 @@ package com.hnac.hzims.operational.alert.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; +import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; +import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService; import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.config.vo.LevelAlarmVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationService; import lombok.RequiredArgsConstructor; @@ -14,7 +19,9 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springframework.stereotype.Service; -import java.util.*; +import java.util.Date; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -29,6 +36,9 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { private final IStationService stationService; + private final IMainSystemMonitoringService deviceService; + + private final HistoryLevelAlarmService historyLevelAlarmService; /** * 定时发送消息内容 @@ -45,10 +55,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { Map map = new ConcurrentHashMap<>(); map.put("projectIds",stations.stream().map(StationEntity::getCode).collect(Collectors.joining(","))); map.put("type", AbnormalAlarmConstant.LEVEL_TYPE_LIST); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); - calendar.add(Calendar.SECOND,-30); - map.put("startTime", DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME)); + map.put("startTime", DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"); return JSONObject.toJSONString(map); } @@ -60,10 +67,67 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { @Override public void receiveMessage(String message) { // 对象转换 + List alarms = JSONObject.parseArray(message,LevelAlarmVo.class); + if(CollectionUtil.isEmpty(alarms)){ + return; + } + + // 站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)); + if(CollectionUtil.isEmpty(stations)){ + throw new ServiceException("level send message is null"); + } + + // 设备 + List devices = deviceService.getEmInfoList(); + + // 查询当天已经记录的告警 + List historys = historyLevelAlarmService.list(Wrappers.lambdaQuery() + .ge(HistoryLevelAlarmEntity::getCreateTime,DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00") + ); + + // 数据过滤 + List entitys = alarms.stream().filter(alarm -> CollectionUtil.isEmpty(historys) || !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())).map(item->{ + HistoryLevelAlarmEntity entity = new HistoryLevelAlarmEntity(); + entity.setAlarmId(item.getId()); + entity.setAlarmTime(DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s")); + entity.setType(String.valueOf(item.getType())); + entity.setRealId(item.getSignage()); + entity.setSoeExplain(item.getName()); + entity.setDeviceCode(item.getDevicecode()); + entity.setDeviceName(item.getDevicename()); + entity.setAlarmLevel(String.valueOf(item.getLevel())); + // 根据设备找站点 + if(CollectionUtil.isNotEmpty(devices)){ + // 找到设备 + List alarmDevices = devices.stream().filter(device->device.getEmCode().equals(item.getDevicecode())).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(alarmDevices)){ + // 找到站点 + List alarmStations = stations.stream().filter(station->station.getRefDept().equals(alarmDevices.get(0).getCreateDept())).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(alarmStations)){ + entity.setStationId(alarmStations.get(0).getCode()); + entity.setStationName(alarmStations.get(0).getName()); + } + } + } + return entity; + }).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(entitys)){ + return; + } - // 查询近10分钟记录告警 + // 批量保存 + historyLevelAlarmService.saveBatch(entitys); + // 消息推送 + this.sendAlarmMessage(entitys); + } - // 保存 + /** + * 告警消息推送 + * @param entitys + */ + private void sendAlarmMessage(List entitys) { } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/LevelAlarmVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/LevelAlarmVo.java new file mode 100644 index 0000000..acb2ce9 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/LevelAlarmVo.java @@ -0,0 +1,40 @@ +package com.hnac.hzims.operational.config.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author ysj + * @date 2023/04/26 14:27:33 + * @version 4.0.0 + */ +@Data +public class LevelAlarmVo { + + @ApiModelProperty(value = "主键Id") + private String id; + + @ApiModelProperty(value = "告警时间") + private String ts; + + @ApiModelProperty(value = "设备编码") + private String devicecode; + + @ApiModelProperty(value = "设备名称") + private String devicename; + + @ApiModelProperty(value = "告警内容") + private String name; + + @ApiModelProperty(value = "告警类型") + private Integer type; + + @ApiModelProperty(value = "告警等级") + private Integer level; + + @ApiModelProperty(value = "告警发生时,设备实时数据") + private String context; + + @ApiModelProperty(value = "事件标识") + private String signage; +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java index 3eafc53..e0b4eb7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java @@ -1,9 +1,8 @@ package com.hnac.hzims.operational.config.ws; -import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.operational.alert.service.LevelAlarmService; -import com.hnac.hzims.operational.config.service.StFocusPropertiesService; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.EnableScheduling; @@ -11,7 +10,6 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.net.URI; -import java.net.URISyntaxException; /** * 等级告警获取数据长链接 @@ -34,30 +32,20 @@ public class LevelAlarmRegular{ @Scheduled(cron = "0/30 * * * * ?") private void regular(){ // 检查链接存活状态 - if(this.block()){ + if(ObjectUtil.isNotEmpty(client) && client.isOpen()){ client.send(levelAlarmService.sendMessage()); + }else { + this.createClient(); } - client = this.createClient(); } // 创建websocket链接 - private LevelAlarmWebSocket createClient() { + private void createClient() { try{ - return new LevelAlarmWebSocket(new URI(level_wss_url)); + client = new LevelAlarmWebSocket(new URI(level_wss_url)); + client.connectBlocking(); }catch (Exception e){ log.error("level create error : {}",e.getMessage()); } - return null; } - - // 检查链接存活状态 - private boolean block() { - try{ - return client.connectBlocking(); - } catch (Exception e){ - log.error("level block error : {}",e.getMessage()); - } - return false; - } - } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java index 54a129c..ed224dd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java @@ -1,15 +1,11 @@ package com.hnac.hzims.operational.config.ws; -import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.operational.alert.service.LevelAlarmService; -import com.hnac.hzims.operational.config.service.StAlamRecordService; -import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.scheduling.annotation.EnableScheduling; +import org.springblade.core.tool.utils.StringUtil; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; @@ -48,7 +44,12 @@ public class LevelAlarmWebSocket extends WebSocketClient { // 接收到服务器消息回调接口 @Override public void onMessage(String message) { - levelAlarmService.receiveMessage(message); + if(StringUtil.isEmpty(message)){ + log.error("levl on message is null"); + }else{ + // 等级告警数据处理 + levelAlarmService.receiveMessage(message); + } } // 与服务器链接中断回调接口 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml index b8625fe..1c1efed 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml @@ -333,7 +333,7 @@