Browse Source

#告警代码修改

zhongwei
yang_shj 1 year ago
parent
commit
a0a88fc8b2
  1. 2
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java
  2. 5
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java
  3. 1
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigEntity.java
  4. 16
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmConfigVo.java
  5. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java
  6. 26
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java
  7. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java
  8. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java
  9. 64
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java
  10. 35
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java
  11. 29
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/weapper/AlarmConfigWrapper.java
  12. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  13. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/LevelAlarmServiceImpl.java
  14. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/condition/ConditionAlarmRegular.java
  15. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmRegular.java

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

@ -45,7 +45,7 @@ public interface AlarmConstants {
Integer OFFSIDE = 5; Integer OFFSIDE = 5;
Integer INTERRUPT = 13; Integer INTERRUPT = 13;
Integer ABNORMAL = 14; Integer ABNORMAL = 14;
List<Integer> HZ3000_ALARAM = Arrays.asList(WARNING,FAULT,OFFSIDE,INTERRUPT,ABNORMAL); List<Integer> HZ3000_ALARAM_LIST = Arrays.asList(WARNING,FAULT,OFFSIDE,INTERRUPT,ABNORMAL);
Integer ONE_LEVEL = 21; Integer ONE_LEVEL = 21;
Integer TWO_LEVEL = 22; Integer TWO_LEVEL = 22;
Integer THREE_LEVEL = 23; Integer THREE_LEVEL = 23;

5
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
@ -23,10 +24,10 @@ public class AlarmConfigDetailEntity extends TenantEntity {
private Long strategyId; private Long strategyId;
@ApiModelProperty(value = "告警大类") @ApiModelProperty(value = "告警大类")
private String alarmType; private String alarmtype;
@ApiModelProperty(value = "告警子类") @ApiModelProperty(value = "告警子类")
private String alarmChiledType; private Integer alarmChiledType;
@ApiModelProperty(value = "告警内容") @ApiModelProperty(value = "告警内容")
private String alarmContext; private String alarmContext;

1
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigEntity.java

@ -18,6 +18,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
public class AlarmConfigEntity extends TenantEntity { public class AlarmConfigEntity extends TenantEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "站点编号") @ApiModelProperty(value = "站点编号")
private String stationId; private String stationId;

16
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmConfigVo.java

@ -0,0 +1,16 @@
package com.hnac.hzims.alarm.vo;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AlarmConfigVo extends AlarmConfigEntity {
@ApiModelProperty(value = "用户名称")
private String userName;
}

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java

@ -1,6 +1,7 @@
package com.hnac.hzims.alarm; package com.hnac.hzims.alarm;
import com.hnac.hzims.alarm.constants.AlarmConstants; import com.hnac.hzims.alarm.constants.AlarmConstants;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign; import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
@ -15,6 +16,7 @@ import javax.annotation.Resource;
*/ */
@EnableBladeFeign @EnableBladeFeign
@SpringCloudApplication @SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.hzims.alarm.*"}) @ComponentScan(basePackages = {"com.hnac.hzims.alarm.*"})
@Resource @Resource
public class AlarmApplication extends SpringBootServletInitializer { public class AlarmApplication extends SpringBootServletInitializer {

26
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java

@ -1,10 +1,10 @@
package com.hnac.hzims.alarm.config.controller; package com.hnac.hzims.alarm.config.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.vo.AlarmConfigVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Map;
/** /**
* @author ysj * @author ysj
@ -31,11 +30,11 @@ public class AlarmConfigController extends BladeController {
private final AlarmConfigService alarmConfigService; private final AlarmConfigService alarmConfigService;
@PostMapping("/save") @PostMapping("/add")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "新增", notes = "传入AlarmConfigEntity对象") @ApiOperation(value = "新增", notes = "传入AlarmConfigEntity对象")
public R save(@Valid @RequestBody AlarmConfigEntity entity) { public R add(@Valid @RequestBody AlarmConfigEntity entity) {
return R.status(alarmConfigService.save(entity)); return R.status(alarmConfigService.add(entity));
} }
@PostMapping("/update") @PostMapping("/update")
@ -45,7 +44,6 @@ public class AlarmConfigController extends BladeController {
return R.status(alarmConfigService.updateById(entity)); return R.status(alarmConfigService.updateById(entity));
} }
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
@ -56,18 +54,8 @@ public class AlarmConfigController extends BladeController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "分页", notes = "传入AlarmConfigEntity对象") @ApiOperation(value = "分页", notes = "传入AlarmConfigEntity对象")
public R<IPage<AlarmConfigEntity>> list(@ApiIgnore @RequestParam Map<String,Object> params, Query query) { public R<IPage<AlarmConfigVo>> list(@ApiIgnore @RequestParam AlarmConfigEntity params, Query query) {
QueryWrapper<AlarmConfigEntity> queryWrapper = Condition.getQueryWrapper( params, AlarmConfigEntity.class); return R.data(alarmConfigService.pageCondition(Condition.getPage(query), params));
IPage<AlarmConfigEntity> pages = alarmConfigService.page(Condition.getPage(query), queryWrapper);
return R.data(pages);
}
@GetMapping("/detail")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "详情", notes = "传入AlarmConfigEntity对象")
public R<AlarmConfigEntity> detail(AlarmConfigEntity entity) {
AlarmConfigEntity detail = alarmConfigService.getOne(Condition.getQueryWrapper(entity));
return R.data(detail);
} }
} }

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.alarm.config.service; package com.hnac.hzims.alarm.config.service;
import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
/** /**
@ -8,5 +9,8 @@ import org.springblade.core.mp.base.BaseService;
*/ */
public interface AlarmConfigDetailService extends BaseService<AlarmConfigDetailEntity> { public interface AlarmConfigDetailService extends BaseService<AlarmConfigDetailEntity> {
boolean defaults(AlarmConfigEntity entity);
AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type); AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type);
} }

9
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java

@ -1,7 +1,12 @@
package com.hnac.hzims.alarm.config.service; package com.hnac.hzims.alarm.config.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity; import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.vo.AlarmConfigVo;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import java.util.List; import java.util.List;
@ -10,7 +15,11 @@ import java.util.List;
*/ */
public interface AlarmConfigService extends BaseService<AlarmConfigEntity> { public interface AlarmConfigService extends BaseService<AlarmConfigEntity> {
IPage<AlarmConfigVo> pageCondition(IPage<AlarmConfigEntity> page,AlarmConfigEntity entity);
List<String> exclude(Integer operate); List<String> exclude(Integer operate);
boolean isSupport(String code,Integer source,Integer type,Integer operate); boolean isSupport(String code,Integer source,Integer type,Integer operate);
boolean add(AlarmConfigEntity entity);
} }

64
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java

@ -2,12 +2,20 @@ package com.hnac.hzims.alarm.config.service.impl;
import com.hnac.hzims.alarm.config.mapper.AlarmConfigDetailMapper; import com.hnac.hzims.alarm.config.mapper.AlarmConfigDetailMapper;
import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService; import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService;
import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* @author ysj * @author ysj
*/ */
@ -17,6 +25,61 @@ import org.springframework.stereotype.Service;
public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDetailMapper, AlarmConfigDetailEntity> implements AlarmConfigDetailService { public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDetailMapper, AlarmConfigDetailEntity> implements AlarmConfigDetailService {
/** /**
* 保存默认配置
* @param entity
*/
@Override
public boolean defaults(AlarmConfigEntity entity) {
List<AlarmConfigDetailEntity> batchs = new ArrayList<>();
AlarmConstants.ALARAM_SOURCES.forEach(sources->{
// HZ3000告警
if(AlarmConstants.HZ3000_ALARM.equals(sources)){
AlarmConstants.HZ3000_ALARAM_LIST.forEach(type->{
batchs.add(this.superposition(entity,type));
});
// 等级告警
}else if(AlarmConstants.LEVEL_ALARM.equals(sources)){
AlarmConstants.LEVEL_ALARAM.forEach(type->{
batchs.add(this.superposition(entity,type));
});
// 条件告警
}else if(AlarmConstants.CONDITION_ALARM.equals(sources)){
batchs.add(this.superposition(entity,AlarmConstants.CONDITION));
// 智能预警
}else if(AlarmConstants.EARLY_WARNING.equals(sources)){
batchs.add(this.superposition(entity,AlarmConstants.EARLY));
}
});
if(CollectionUtil.isEmpty(batchs)){
return false;
}
return super.saveBatch(batchs);
}
/**
* 叠加配置详情记录
* @param entity
* @param type
* @return
*/
private AlarmConfigDetailEntity superposition(AlarmConfigEntity entity, Integer type) {
AlarmConfigDetailEntity detail = new AlarmConfigDetailEntity();
BeanUtils.copyProperties(entity,detail);
detail.setId(null);
detail.setStrategyId(entity.getId());
detail.setAlarmChiledType(type);
detail.setIsRightTabulation(1);
detail.setIsShowAlert(1);
detail.setIsSmallBell(1);
detail.setIsMask(1);
detail.setIsBroadcast(1);
detail.setIsPlatformMessage(1);
detail.setIsShortMessage(1);
detail.setIsWxMessage(1);
return detail;
}
/**
* 查询告警配置对象 * 查询告警配置对象
* @param code : 站点编码 * @param code : 站点编码
* @param source : 告警来源 * @param source : 告警来源
@ -27,4 +90,5 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDet
public AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type) { public AlarmConfigDetailEntity isSupport(String code, Integer source, Integer type) {
return this.baseMapper.isSupport(code,source,type); return this.baseMapper.isSupport(code,source,type);
} }
} }

35
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java

@ -1,15 +1,23 @@
package com.hnac.hzims.alarm.config.service.impl; package com.hnac.hzims.alarm.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.alarm.config.mapper.AlarmConfigMapper; import com.hnac.hzims.alarm.config.mapper.AlarmConfigMapper;
import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService; import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService;
import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.config.weapper.AlarmConfigWrapper;
import com.hnac.hzims.alarm.constants.AlarmConstants; import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity; import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.vo.AlarmConfigVo;
import com.hnac.hzims.operational.alert.vo.AlarmHandleVo;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -27,6 +35,32 @@ public class AlarmConfigServiceImpl extends BaseServiceImpl<AlarmConfigMapper, A
private final AlarmConfigDetailService detailService; private final AlarmConfigDetailService detailService;
/** /**
* 新增
* @param entity : 告警配置对象
* @return
*/
@Override
public boolean add(AlarmConfigEntity entity) {
// 保存配置
this.save(entity);
// 创建各类型告警配置
return this.detailService.defaults(entity);
}
/**
* 分页查询
* @param page : 分页参数
* @param entity : 查询告警参数
* @return
*/
@Override
public IPage<AlarmConfigVo> pageCondition(IPage<AlarmConfigEntity> page, AlarmConfigEntity entity){
IPage pages = super.page(page, Condition.getQueryWrapper(entity));
pages.setRecords(AlarmConfigWrapper.build().listVO(pages.getRecords()));
return pages;
}
/**
* 排除站点 * 排除站点
* @param operate : 操作类型 * @param operate : 操作类型
* @return * @return
@ -87,6 +121,7 @@ public class AlarmConfigServiceImpl extends BaseServiceImpl<AlarmConfigMapper, A
} }
} }
/** /**
* 默认操作支持 * 默认操作支持
* @param source : 告警来源 * @param source : 告警来源

29
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/weapper/AlarmConfigWrapper.java

@ -0,0 +1,29 @@
package com.hnac.hzims.alarm.config.weapper;
import com.hnac.hzims.alarm.entity.AlarmConfigEntity;
import com.hnac.hzims.alarm.vo.AlarmConfigVo;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import java.util.Optional;
/**
* @author ysj
*/
public class AlarmConfigWrapper extends BaseEntityWrapper<AlarmConfigEntity,AlarmConfigVo> {
public static AlarmConfigWrapper build() {
return new AlarmConfigWrapper();
}
@Override
public AlarmConfigVo entityVO(AlarmConfigEntity entity) {
AlarmConfigVo config = BeanUtil.copy(entity, AlarmConfigVo.class);
User user = UserCache.getUser(entity.getCreateUser());
config.setUserName(Optional.ofNullable(user).map(User::getName).orElse(null));
return config;
}
}

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

@ -100,7 +100,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
private List<ChildAlarmCountVo> childs(Integer source, List<AlarmEntity> collect) { private List<ChildAlarmCountVo> childs(Integer source, List<AlarmEntity> collect) {
// HZ3000告警 // HZ3000告警
if(AlarmConstants.HZ3000_ALARM.equals(source)){ if(AlarmConstants.HZ3000_ALARM.equals(source)){
return AlarmConstants.HZ3000_ALARAM.stream().map(type->{ return AlarmConstants.HZ3000_ALARAM_LIST.stream().map(type->{
ChildAlarmCountVo count = new ChildAlarmCountVo(); ChildAlarmCountVo count = new ChildAlarmCountVo();
count.setType(type); count.setType(type);
if(CollectionUtil.isEmpty(collect)){ if(CollectionUtil.isEmpty(collect)){

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/LevelAlarmServiceImpl.java

@ -64,7 +64,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService {
} }
LevelMessageVo message = new LevelMessageVo(); LevelMessageVo message = new LevelMessageVo();
message.setProjectIds(result.getData().stream().map(StationEntity::getCode).collect(Collectors.joining(","))); message.setProjectIds(result.getData().stream().map(StationEntity::getCode).collect(Collectors.joining(",")));
message.setType(AlarmConstants.HZ3000_ALARAM.stream().map(String::valueOf).collect(Collectors.joining(","))); message.setType(AlarmConstants.HZ3000_ALARAM_LIST.stream().map(String::valueOf).collect(Collectors.joining(",")));
message.setStartTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"); message.setStartTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00");
return JSONObject.toJSONString(message); return JSONObject.toJSONString(message);
} }

7
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/condition/ConditionAlarmRegular.java

@ -1,7 +1,6 @@
package com.hnac.hzims.alarm.ws.condition; package com.hnac.hzims.alarm.ws.condition;
import com.hnac.hzims.alarm.show.service.ConditionAlarmService; import com.hnac.hzims.alarm.show.service.ConditionAlarmService;
import com.hnac.hzims.alarm.show.service.LevelAlarmService;
import com.hnac.hzims.alarm.ws.level.LevelAlarmWebSocket; import com.hnac.hzims.alarm.ws.level.LevelAlarmWebSocket;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -27,8 +26,8 @@ public class ConditionAlarmRegular {
private LevelAlarmWebSocket socket; private LevelAlarmWebSocket socket;
@Value("${hzims.condition.ws-url}") @Value("${hzims.condition.wss-url}")
private String level_wss_url; private String condition_wss_url;
// 两分钟进行一次检查链接是否存活,不存活了重新建立链接 // 两分钟进行一次检查链接是否存活,不存活了重新建立链接
@Scheduled(cron = "0 0/2 * * * ?") @Scheduled(cron = "0 0/2 * * * ?")
@ -52,7 +51,7 @@ public class ConditionAlarmRegular {
// 创建websocket链接 // 创建websocket链接
private void createSocket() { private void createSocket() {
try{ try{
socket = new LevelAlarmWebSocket(new URI(level_wss_url)); socket = new LevelAlarmWebSocket(new URI(condition_wss_url));
socket.connectBlocking(); socket.connectBlocking();
}catch (Exception e){ }catch (Exception e){
log.error("level create error : {}",e.getMessage()); log.error("level create error : {}",e.getMessage());

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmRegular.java

@ -25,7 +25,7 @@ public class LevelAlarmRegular {
private LevelAlarmWebSocket socket; private LevelAlarmWebSocket socket;
@Value("${hzims.level.ws-url}") @Value("${hzims.level.wss-url}")
private String level_wss_url; private String level_wss_url;
// 两分钟进行一次检查链接是否存活,不存活了重新建立链接 // 两分钟进行一次检查链接是否存活,不存活了重新建立链接

Loading…
Cancel
Save