Browse Source

#告警方法定义

zhongwei
yang_shj 1 year ago
parent
commit
c560b936d5
  1. 5
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java
  2. 21
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmCountVo.java
  3. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java
  4. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java
  5. 1
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java
  6. 26
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java
  7. 45
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmController.java
  8. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  9. 34
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

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

@ -12,7 +12,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
* @author ysj
*/
@Data
@TableName("hzimsalarmconfigdetail")
@TableName("hzims_alarm_config_detail")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "站点告警配置详情对象", description = "站点告警配置详情对象")
public class AlarmConfigDetailEntity extends TenantEntity {
@ -57,4 +57,5 @@ public class AlarmConfigDetailEntity extends TenantEntity {
@ApiModelProperty(value = "是否微信公众号消息推送 :0-推送 1-不推送")
private Integer isWxMessage;
}
}

21
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmCountVo.java

@ -0,0 +1,21 @@
package com.hnac.hzims.alarm.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AlarmCountVo {
@ApiModelProperty(value = "告警子类")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long type;
@ApiModelProperty(value = "告警条码数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer count;
}

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

@ -55,7 +55,7 @@ public class AlarmConfigController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "分页", notes = "传入em_model_param")
@ApiOperation(value = "分页", notes = "传入AlarmConfigEntity对象")
public R<IPage<AlarmConfigEntity>> list(@ApiIgnore @RequestParam Map<String,Object> params, Query query) {
QueryWrapper<AlarmConfigEntity> queryWrapper = Condition.getQueryWrapper( params, AlarmConfigEntity.class);
IPage<AlarmConfigEntity> pages = alarmConfigService.page(Condition.getPage(query), queryWrapper);
@ -64,10 +64,10 @@ public class AlarmConfigController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "详情", notes = "传入em_model_param")
@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/controller/AlarmConfigDetailController.java

@ -55,7 +55,7 @@ public class AlarmConfigDetailController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "分页", notes = "传入em_model_param")
@ApiOperation(value = "分页", notes = "传入AlarmConfigEntity对象")
public R<IPage<AlarmConfigDetailEntity>> list(@ApiIgnore @RequestParam Map<String,Object> params, Query query) {
QueryWrapper<AlarmConfigDetailEntity> queryWrapper = Condition.getQueryWrapper( params, AlarmConfigDetailEntity.class);
IPage<AlarmConfigDetailEntity> pages = detailService.page(Condition.getPage(query), queryWrapper);
@ -64,7 +64,7 @@ public class AlarmConfigDetailController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "详情", notes = "传入em_model_param")
@ApiOperation(value = "详情", notes = "传入AlarmConfigEntity对象")
public R<AlarmConfigDetailEntity> detail(AlarmConfigDetailEntity entity) {
AlarmConfigDetailEntity detail = detailService.getOne(Condition.getQueryWrapper(entity));
return R.data(detail);

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

@ -8,4 +8,5 @@ import org.springblade.core.mp.base.BaseService;
*/
public interface AlarmConfigService extends BaseService<AlarmConfigEntity> {
boolean isSupport(String code,Integer source,Integer type,Integer operate);
}

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

@ -16,4 +16,30 @@ import org.springframework.stereotype.Service;
@Slf4j
public class AlarmConfigServiceImpl extends BaseServiceImpl<AlarmConfigMapper, AlarmConfigEntity> implements AlarmConfigService {
/**
* 是否支持操作
* @param code : 站点编码
* @param source : 告警来源
* @param type : 告警子类
* @param operate : 操作类型
* @return
*/
@Override
public boolean isSupport(String code, Integer source, Integer type, Integer operate) {
// 查询告警配置
// 站点未进行配置返回默认配置
return this.isDefault(source,type,operate);
}
/**
* 默认操作支持
* @param source : 告警来源
* @param type : 告警子类
* @param operate : 操作类型
* @return
*/
private boolean isDefault(Integer source, Integer type, Integer operate){
return false;
}
}

45
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmController.java

@ -0,0 +1,45 @@
package com.hnac.hzims.alarm.show.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.vo.AlarmCountVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/alarm/show")
@Api(value = "告警配置", tags = "告警配置")
public class AlarmController extends BladeController {
private final AlarmService alarmService;
@PostMapping("/alarms")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "告警列表分页", notes = "传入: AlarmConfigEntity对象,分页参数")
public R<IPage<AlarmEntity>> alarms(@ApiIgnore @RequestParam AlarmEntity alarm, Query query) {
return R.data(alarmService.alarms(alarm,Condition.getPage(query)));
}
@PostMapping("/count")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入告警类型 0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警")
public R<List<AlarmCountVo>> counts(@RequestParam Integer type) {
return R.data(alarmService.counts(type));
}
}

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

@ -1,11 +1,18 @@
package com.hnac.hzims.alarm.show.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.alarm.vo.AlarmCountVo;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
*/
public interface AlarmService extends BaseService<AlarmEntity> {
IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page);
List<AlarmCountVo> counts(Integer type);
}

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

@ -1,13 +1,17 @@
package com.hnac.hzims.alarm.show.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.alarm.show.mapper.AlarmMapper;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.vo.AlarmCountVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author ysj
*/
@ -16,4 +20,34 @@ import org.springframework.stereotype.Service;
@Slf4j
public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> implements AlarmService {
/**
* 查询告警列表
* @param alarm
* @param page
* @return
*/
@Override
public IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page) {
// 参数过滤 :站点、时间、告警来源、告警子类
// 排除站点
// 查询数据
return null;
}
/**
* 查询告警数量
* @param type
* @return
*/
@Override
public List<AlarmCountVo> counts(Integer type) {
// 参数过滤 :站点、时间、告警来源、告警子类
// 排除站点
// 查询数量
return null;
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -802,7 +802,7 @@ public class TargetServiceImpl implements TargetService {
}
return deviceClassify;
}).filter(deviceClass -> StringUtils.isEmpty(stationName) || deviceClass.getStationName().contains(stationName)).collect(Collectors.toList());
List<DeviceClassifyVo> records = new ArrayList<>();
List<DeviceClassifyVo> records;
// 状态过滤
if(ObjectUtil.isEmpty(status)){
records = deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());

Loading…
Cancel
Save