Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
ty 11 months ago
parent
commit
379c360a38
  1. 11
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java
  2. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  3. 35
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  4. 70
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java
  5. 63
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java
  6. 33
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java
  7. 13
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketPool.java
  8. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  9. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  10. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  11. 111
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  12. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationServiceImpl.java

11
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java

@ -1,5 +1,7 @@
package com.hnac.hzims.alarm.constants; package com.hnac.hzims.alarm.constants;
import io.swagger.models.auth.In;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -28,19 +30,21 @@ public interface AlarmConstants {
Integer IS_WX_MESSAGE = 8; Integer IS_WX_MESSAGE = 8;
// 告警来源 : 0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警 // 告警来源 : 0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警 5-开关机告警
Integer HZ3000_ALARM = 0; Integer HZ3000_ALARM = 0;
Integer LEVEL_ALARM = 1; Integer LEVEL_ALARM = 1;
Integer CONDITION_ALARM = 2; Integer CONDITION_ALARM = 2;
Integer EARLY_WARNING = 3; Integer EARLY_WARNING = 3;
Integer VIDEO_WARNING = 4; Integer VIDEO_WARNING = 4;
List<Integer> ALARAM_SOURCE = Arrays.asList(HZ3000_ALARM,LEVEL_ALARM,CONDITION_ALARM,EARLY_WARNING); Integer START_STOP_WARNING = 5;
List<Integer> ALARAM_SOURCE = Arrays.asList(HZ3000_ALARM,LEVEL_ALARM,CONDITION_ALARM,EARLY_WARNING,START_STOP_WARNING);
// 子类告警 // 子类告警
// HZ3000告警 : 2-告警 3-故障 5-遥测越限 13-通讯中断 14-数据异常 // HZ3000告警 : 2-告警 3-故障 5-遥测越限 13-通讯中断 14-数据异常
// 等级告警 : 21-一级告警 22-二级告警 23-三级告警 // 等级告警 : 21-一级告警 22-二级告警 23-三级告警
// 智能预警 : 30-智能预警 // 智能预警 : 30-智能预警
// 条件告警 : 40-条件告警 // 条件告警 : 40-条件告警
// 开关机告警 : 50-开机告警 51-关机告警
Integer WARNING = 2; Integer WARNING = 2;
Integer FAULT = 3; Integer FAULT = 3;
Integer OFFSIDE = 5; Integer OFFSIDE = 5;
@ -53,5 +57,8 @@ public interface AlarmConstants {
List<Integer> LEVEL_ALARAM = Arrays.asList(ONE_LEVEL,TWO_LEVEL,THREE_LEVEL); List<Integer> LEVEL_ALARAM = Arrays.asList(ONE_LEVEL,TWO_LEVEL,THREE_LEVEL);
Integer EARLY = 30; Integer EARLY = 30;
Integer CONDITION = 40; Integer CONDITION = 40;
Integer START = 50;
Integer STOP = 51;
List<Integer> START_STOP_ALARAM = Arrays.asList(START,STOP);
String VIDEO_SCHEDULED_TASK= "VideoScheduledTask"; String VIDEO_SCHEDULED_TASK= "VideoScheduledTask";
} }

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.entity.AlarmEntity; import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.alarm.vo.AlarmCountVo; import com.hnac.hzims.alarm.vo.AlarmCountVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springframework.web.socket.TextMessage;
import java.util.List; import java.util.List;
@ -17,4 +18,6 @@ public interface AlarmService extends BaseService<AlarmEntity> {
List<AlarmCountVo> counts(AlarmEntity alarm); List<AlarmCountVo> counts(AlarmEntity alarm);
List<AlarmEntity> broadcast(String startTime, String endTime); List<AlarmEntity> broadcast(String startTime, String endTime);
TextMessage majorAlarm(List<Long> depts);
} }

35
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -1,7 +1,9 @@
package com.hnac.hzims.alarm.show.service.impl; package com.hnac.hzims.alarm.show.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.constants.AlarmConstants; import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmEntity; import com.hnac.hzims.alarm.entity.AlarmEntity;
@ -23,10 +25,9 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.socket.TextMessage;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -165,7 +166,33 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
return this.list(wrapper); return this.list(wrapper);
} }
/**
* 弹框告警
* @param depts
* @return
*/
@Override
public TextMessage majorAlarm(List<Long> depts) {
// 站点查询
List<StationEntity> stations = this.stations();
if(CollectionUtil.isEmpty(stations)){
return null;
}
List<String> effectives = stations.stream().filter(station->depts.contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(effectives)){
return null;
}
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>lambdaQuery()
.in(AlarmEntity::getStationId,effectives)
.in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.FAULT,AlarmConstants.EARLY))
.eq(AlarmEntity::getIsShowAlert,0)
//.ge(AlarmEntity::getAlarmType, DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00")
);
if(CollectionUtil.isEmpty(alarms)){
return null;
}
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
}
/** /**

70
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java

@ -0,0 +1,70 @@
package com.hnac.hzims.alarm.ws.alart;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.show.service.AlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
import java.util.List;
/**
* @author ysj
*/
@Slf4j
public class AlarmHandler extends TextWebSocketHandler {
@Autowired
private AlarmService alarmService;
@Override
public void afterConnectionEstablished(WebSocketSession session) {
String[] split = session.getUri().toString().split("/");
String uid = split[split.length - 1];
AlarmSessionManager.add(uid, session);
session.getAttributes().put("userId", uid);
log.info("sessionId: " + session.getId());
log.info("session connection successful!");
AlarmSocketPool.pool.put(session.getId(), this);
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
log.info("sessionId: " + session.getId());
log.info("uri: " + session.getUri());
log.info("session closed successful!");
}
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage textMessage) throws IOException {
String userId = (String) session.getAttributes().get("userId");
String message = textMessage.getPayload();
if(StringUtil.isBlank(message)){
return;
}
List<Long> depts = JSONObject.parseArray(message,Long.class);
if(CollectionUtil.isEmpty(depts)){
return;
}
TextMessage sendMessage = alarmService.majorAlarm(depts);
if(ObjectUtil.isEmpty(sendMessage)){
return;
}
session.sendMessage(sendMessage);
}
}

63
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java

@ -0,0 +1,63 @@
package com.hnac.hzims.alarm.ws.alart;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author ysj
*/
@Slf4j
public class AlarmSessionManager {
/**
* ws会话池
*/
public static ConcurrentHashMap<String, WebSocketSession> SESSION_POOL = new ConcurrentHashMap<>();
/**
* 添加会话
*
* @param uid 标记
* @param session 会话对象
*/
public static void add(String uid, WebSocketSession session) {
if (SESSION_POOL.containsKey(uid)) {
AlarmSessionManager.removeAndClose(uid);
}
SESSION_POOL.put(uid, session);
log.info("添加 WebSocketSession 会话成功,uid=" + uid);
}
/**
* 获取 ws 会话
*
* @param uid
*/
public static WebSocketSession get(String uid) {
return SESSION_POOL.get(uid);
}
/**
* 移除 ws 会话并关闭会话
*
* @param uid
*/
public static void removeAndClose(String uid) {
WebSocketSession session = SESSION_POOL.get(uid);
if (session != null) {
try {
//关闭连接
session.close();
} catch (IOException ex) {
throw new RuntimeException("关闭ws会话失败!", ex);
}
}
SESSION_POOL.remove(uid);
}
}

33
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java

@ -0,0 +1,33 @@
package com.hnac.hzims.alarm.ws.alart;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* @author ysj
*/
@Configuration
@EnableWebSocket
public class AlarmSocketConfig implements WebSocketConfigurer{
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 集中监控弹框处理器
registry.addHandler(monitorHandler(), "/alarm/alart/{uid}").setAllowedOrigins("*");
}
@Bean
public WebSocketHandler monitorHandler() {
return new AlarmHandler();
}
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

13
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketPool.java

@ -0,0 +1,13 @@
package com.hnac.hzims.alarm.ws.alart;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author ysj
*/
public class AlarmSocketPool {
public static Map<String, AlarmHandler> pool = new ConcurrentHashMap<>();
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -2,17 +2,15 @@ package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.START_STOP_ALARM;
/** /**
* 告警定时任务 * 告警定时任务
@ -29,9 +27,10 @@ public class AlarmScheduledTask {
* 开停机告警 * 开停机告警
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(START_STOP_ALARM) //@XxlJob(START_STOP_ALARM)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> startStopAlarm(String param) { public ReturnT<String> startStopAlarm() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -42,8 +42,10 @@ public class MonitorScheduledTask {
* 实时数据刷新 * 实时数据刷新
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(REAL_TIME_DATA) //@XxlJob(REAL_TIME_DATA)
public ReturnT<String> loadRealData(String param) { @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
@ -45,8 +46,10 @@ public class RealTargetScheduledTask {
/** /**
* 水电站-机组实时加载 * 水电站-机组实时加载
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) //@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
public ReturnT<String> loadHydropowerReal(String param) { @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

111
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java

@ -1,17 +1,25 @@
package com.hnac.hzims.scheduled.service.alarm.impl; package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.constants.AlarmConstants; import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmEntity; import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.alarm.AlarmQueryMapper; import com.hnac.hzims.scheduled.mapper.alarm.AlarmQueryMapper;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
@ -26,13 +34,116 @@ import java.util.stream.Collectors;
@DS("alarm") @DS("alarm")
public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService { public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService {
private final StationService stationService;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/** /**
* 开停机告警 * 开停机告警
* @param param * @param param
*/ */
@Override @Override
public void startStopAlarm(String param) { public void startStopAlarm(String param) {
// 获取站点开关机状态
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);;
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.save(alarm);
} }
/** /**

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.scheduled.service.operation.station.impl; package com.hnac.hzims.scheduled.service.operation.station.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationMapper; import com.hnac.hzims.scheduled.mapper.operation.StationMapper;
import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.station.StationService;
@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@DS("master")
public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEntity> implements StationService { public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEntity> implements StationService {
} }
Loading…
Cancel
Save