From 8cf809cc38b7afef34dd691e65399b5e4d06028c Mon Sep 17 00:00:00 2001 From: yang_shj Date: Fri, 17 Mar 2023 10:57:53 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alert/constants/AbnormalAlarmConstant.java | 2 + .../alert/entity/AlarmHandleDetailEntity.java | 11 +++-- .../alert/entity/AlarmHandleEntity.java | 2 +- .../hzims/operational/alert/vo/AlarmHandleVo.java | 51 ++++++++++++++++++++++ .../operational/fill/entity/RainfallEntity.java | 6 +-- .../alert/controller/AlarmHandleController.java | 11 ++--- .../alert/service/AlarmHandleService.java | 2 + .../alert/service/impl/AlarmHandleServiceImpl.java | 30 ++++++++++++- .../service/impl/StAlamRecordServiceImpl.java | 6 ++- 9 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java 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 5d8c294..de34866 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 @@ -14,4 +14,6 @@ public interface AbnormalAlarmConstant { String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; + /**处理、延后、误报*/ + List HANDLE_WAY = Arrays.asList(0L,1L,2L); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleDetailEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleDetailEntity.java index be52a81..c435e08 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleDetailEntity.java +++ b/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 org.springblade.core.mp.base.BaseEntity; +import java.util.Date; + @Data @TableName("hzims_alarm_handle_detail") @EqualsAndHashCode(callSuper = true) @ApiModel(value = "告警处理详情对象") public class AlarmHandleDetailEntity extends BaseEntity { + @ApiModelProperty("通知处理人") + private Long handleUser; + @ApiModelProperty("现象ID") private Long phenomenonId; @@ -20,13 +25,13 @@ public class AlarmHandleDetailEntity extends BaseEntity { private Long accessId; @ApiModelProperty("延后时间") - private Long delayTime; + private Date delayTime; @ApiModelProperty("延后原因") - private Long delayCause; + private String delayCause; @ApiModelProperty("误报描述") - private Long falseAlarmDesc; + private String falseAlarmDesc; @ApiModelProperty("附件路径") private Long filePath; 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 fb37ade..0b4cc1c 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 @@ -31,5 +31,5 @@ public class AlarmHandleEntity extends BaseEntity { private String handleWay; @ApiModelProperty("处理详情ID") - private String detailId; + private Long detailId; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java new file mode 100644 index 0000000..6db5ac2 --- /dev/null +++ b/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; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/RainfallEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/RainfallEntity.java index 6fee245..ba28a68 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/RainfallEntity.java +++ b/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("站点名称") private String stationName; - @ApiModelProperty("发电量") + @ApiModelProperty("降雨量") private BigDecimal rain; - @ApiModelProperty("填报日期") - private Date fillDate; + @ApiModelProperty("填报月份") + private String fillDate; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java index 1ff7ff8..7d1764e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AlarmHandleController.java +++ b/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.hnac.hzims.operational.alert.entity.AlarmHandleEntity; 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.ApiOperation; import io.swagger.annotations.ApiParam; @@ -55,13 +56,13 @@ public class AlarmHandleController extends BladeController { } /** - * 新增或修改 + * 告警处理:处理、延后、误报 */ - @PostMapping("/submit") + @PostMapping("/execute") @ApiOperationSupport(order = 3) - @ApiOperation(value = "新增或修改", notes = "传入AlarmHandleEntity") - public R submit(@Valid @RequestBody AlarmHandleEntity entity) { - return R.status(service.saveOrUpdate(entity)); + @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity") + public R execute(@RequestBody AlarmHandleVo param) { + return R.status(service.execute(param)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java index 5c8dcf0..3e892dd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AlarmHandleService.java +++ b/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; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; +import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; import org.springblade.core.mp.base.BaseService; /** @@ -10,4 +11,5 @@ import org.springblade.core.mp.base.BaseService; */ public interface AlarmHandleService extends BaseService { + boolean execute(AlarmHandleVo param); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index d706f34..db0f2d7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/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; +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.mapper.AlarmHandleMapper; +import com.hnac.hzims.operational.alert.service.AlarmHandleDetailService; import com.hnac.hzims.operational.alert.service.AlarmHandleService; +import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; /** * @author ysj - * @date 2023/03/09 09:29:34 * @version 4.0.0 + * @date 2023/03/09 09:29:34 */ @Slf4j @Service @RequiredArgsConstructor public class AlarmHandleServiceImpl extends BaseServiceImpl 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); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index e256659..0a4f280 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -453,12 +453,14 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl> fdpRealIds = fdpMonitorClient.getRealIds(); SoeQueryConditionByStation soeQueryConditionByStation = new SoeQueryConditionByStation(); - if (Func.isNotBlank(date)) { + /*if (Func.isNotBlank(date)) { soeQueryConditionByStation.setBeginTime(LocalDateTime.parse(date, df)); } else { 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.setPage(current); soeQueryConditionByStation.setLimit(size);