Browse Source

#告警处理

zhongwei
yang_shj 2 years ago
parent
commit
8cf809cc38
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleDetailEntity.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java
  4. 51
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java
  5. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/RainfallEntity.java
  6. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java
  8. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
  9. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -14,4 +14,6 @@ public interface AbnormalAlarmConstant {
String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**处理、延后、误报*/
List<Long> HANDLE_WAY = Arrays.asList(0L,1L,2L);
} }

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleDetailEntity.java

@ -7,12 +7,17 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
@Data @Data
@TableName("hzims_alarm_handle_detail") @TableName("hzims_alarm_handle_detail")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "告警处理详情对象") @ApiModel(value = "告警处理详情对象")
public class AlarmHandleDetailEntity extends BaseEntity { public class AlarmHandleDetailEntity extends BaseEntity {
@ApiModelProperty("通知处理人")
private Long handleUser;
@ApiModelProperty("现象ID") @ApiModelProperty("现象ID")
private Long phenomenonId; private Long phenomenonId;
@ -20,13 +25,13 @@ public class AlarmHandleDetailEntity extends BaseEntity {
private Long accessId; private Long accessId;
@ApiModelProperty("延后时间") @ApiModelProperty("延后时间")
private Long delayTime; private Date delayTime;
@ApiModelProperty("延后原因") @ApiModelProperty("延后原因")
private Long delayCause; private String delayCause;
@ApiModelProperty("误报描述") @ApiModelProperty("误报描述")
private Long falseAlarmDesc; private String falseAlarmDesc;
@ApiModelProperty("附件路径") @ApiModelProperty("附件路径")
private Long filePath; private Long filePath;

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java

@ -31,5 +31,5 @@ public class AlarmHandleEntity extends BaseEntity {
private String handleWay; private String handleWay;
@ApiModelProperty("处理详情ID") @ApiModelProperty("处理详情ID")
private String detailId; private Long detailId;
} }

51
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java

@ -0,0 +1,51 @@
package com.hnac.hzims.operational.alert.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author ysj
* @date 2023/03/17 10:02:33
* @version 4.0.0
*/
@Data
public class AlarmHandleVo{
@ApiModelProperty("站点编码")
private String stationCode;
@ApiModelProperty("告警类型")
private Long alarmType;
@ApiModelProperty("告警内容")
private String alarmContent;
@ApiModelProperty("告警时间")
private Date alarmTime;
@ApiModelProperty("处理方式:0-处理 1-延后 2-误报")
private Long handleWay;
@ApiModelProperty("延后处理时间")
private Date delayTime;
@ApiModelProperty("延后处理时间")
private String delayCause;
@ApiModelProperty("误报描述")
private String falseAlarmDesc;
@ApiModelProperty("附件路径")
private String filePath;
@ApiModelProperty("通知处理人")
private String handleUser;
@ApiModelProperty("现象Id")
private Long phenomenonId;
@ApiModelProperty("检修ID")
private Long accessId;
}

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/RainfallEntity.java

@ -25,9 +25,9 @@ public class RainfallEntity extends TenantEntity implements Serializable {
@ApiModelProperty("站点名称") @ApiModelProperty("站点名称")
private String stationName; private String stationName;
@ApiModelProperty("发电量") @ApiModelProperty("降雨量")
private BigDecimal rain; private BigDecimal rain;
@ApiModelProperty("填报日期") @ApiModelProperty("填报月份")
private Date fillDate; private String fillDate;
} }

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java

@ -5,6 +5,7 @@ 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.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.service.AlarmHandleService; import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.vo.AlarmHandleVo;
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;
@ -55,13 +56,13 @@ public class AlarmHandleController extends BladeController {
} }
/** /**
* 新增或修改 * 告警处理:处理延后误报
*/ */
@PostMapping("/submit") @PostMapping("/execute")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "新增或修改", notes = "传入AlarmHandleEntity") @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity")
public R submit(@Valid @RequestBody AlarmHandleEntity entity) { public R execute(@RequestBody AlarmHandleVo param) {
return R.status(service.saveOrUpdate(entity)); return R.status(service.execute(param));
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.alert.service; package com.hnac.hzims.operational.alert.service;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.vo.AlarmHandleVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
/** /**
@ -10,4 +11,5 @@ import org.springblade.core.mp.base.BaseService;
*/ */
public interface AlarmHandleService extends BaseService<AlarmHandleEntity> { public interface AlarmHandleService extends BaseService<AlarmHandleEntity> {
boolean execute(AlarmHandleVo param);
} }

30
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

@ -1,21 +1,49 @@
package com.hnac.hzims.operational.alert.service.impl; package com.hnac.hzims.operational.alert.service.impl;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.mapper.AlarmHandleMapper; import com.hnac.hzims.operational.alert.mapper.AlarmHandleMapper;
import com.hnac.hzims.operational.alert.service.AlarmHandleDetailService;
import com.hnac.hzims.operational.alert.service.AlarmHandleService; import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.vo.AlarmHandleVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* @author ysj * @author ysj
* @date 2023/03/09 09:29:34
* @version 4.0.0 * @version 4.0.0
* @date 2023/03/09 09:29:34
*/ */
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, AlarmHandleEntity> implements AlarmHandleService { public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, AlarmHandleEntity> implements AlarmHandleService {
private final AlarmHandleDetailService detailService;
/**
* 告警处理
*
* @param param
* @return
*/
@Override
public boolean execute(AlarmHandleVo param) {
Long way = param.getHandleWay();
if (!AbnormalAlarmConstant.HANDLE_WAY.contains(way)) {
throw new ServiceException("无效处理!");
}
AlarmHandleDetailEntity detail = new AlarmHandleDetailEntity();
BeanUtils.copyProperties(param,detail);
detailService.save(detail);
AlarmHandleEntity entity = new AlarmHandleEntity();
entity.setDetailId(detail.getId());
BeanUtils.copyProperties(param,entity);
return this.save(entity);
}
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -453,12 +453,14 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
R<List<String>> fdpRealIds = fdpMonitorClient.getRealIds(); R<List<String>> fdpRealIds = fdpMonitorClient.getRealIds();
SoeQueryConditionByStation soeQueryConditionByStation = new SoeQueryConditionByStation(); SoeQueryConditionByStation soeQueryConditionByStation = new SoeQueryConditionByStation();
if (Func.isNotBlank(date)) { /*if (Func.isNotBlank(date)) {
soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(date, df)); soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(date, df));
} else { } else {
soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00", df)); soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00", df));
} }
soeQueryConditionByStation.setEndTime(LocalDateTime.now()); soeQueryConditionByStation.setEndTime(LocalDateTime.now());*/
soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(/*DateUtil.format(new Date(), DateUtil.PATTERN_DATE) +*/ "2022-12-01 00:00:00", df));
soeQueryConditionByStation.setEndTime(LocalDateTime.parse(/*DateUtil.format(new Date(), DateUtil.PATTERN_DATE) +*/ "2022-12-28 00:00:00", df));
soeQueryConditionByStation.setNeedPage(true); soeQueryConditionByStation.setNeedPage(true);
soeQueryConditionByStation.setPage(current); soeQueryConditionByStation.setPage(current);
soeQueryConditionByStation.setLimit(size); soeQueryConditionByStation.setLimit(size);

Loading…
Cancel
Save