From c560b936d5d9a3b93103f2306b27c54ec940154b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 13 Sep 2023 10:19:58 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E6=96=B9=E6=B3=95=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/entity/AlarmConfigDetailEntity.java | 5 ++- .../java/com/hnac/hzims/alarm/vo/AlarmCountVo.java | 21 ++++++++++ .../config/controller/AlarmConfigController.java | 6 +-- .../controller/AlarmConfigDetailController.java | 4 +- .../alarm/config/service/AlarmConfigService.java | 1 + .../service/impl/AlarmConfigServiceImpl.java | 26 +++++++++++++ .../alarm/show/controller/AlarmController.java | 45 ++++++++++++++++++++++ .../hzims/alarm/show/service/AlarmService.java | 7 ++++ .../alarm/show/service/impl/AlarmServiceImpl.java | 34 ++++++++++++++++ .../census/service/impl/TargetServiceImpl.java | 2 +- 10 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmCountVo.java create mode 100644 hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmController.java diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java index f3106bf..8554ba9 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java +++ b/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; -} \ No newline at end of file +} + diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmCountVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/vo/AlarmCountVo.java new file mode 100644 index 0000000..2645d1d --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java index cf60b69..a4009be 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java +++ b/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> list(@ApiIgnore @RequestParam Map params, Query query) { QueryWrapper queryWrapper = Condition.getQueryWrapper( params, AlarmConfigEntity.class); IPage 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 detail(AlarmConfigEntity entity) { AlarmConfigEntity detail = alarmConfigService.getOne(Condition.getQueryWrapper(entity)); return R.data(detail); } -} +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java index 959a73d..c8d82ab 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java +++ b/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> list(@ApiIgnore @RequestParam Map params, Query query) { QueryWrapper queryWrapper = Condition.getQueryWrapper( params, AlarmConfigDetailEntity.class); IPage 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 detail(AlarmConfigDetailEntity entity) { AlarmConfigDetailEntity detail = detailService.getOne(Condition.getQueryWrapper(entity)); return R.data(detail); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java index e752cee..bee58ab 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java +++ b/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 { + boolean isSupport(String code,Integer source,Integer type,Integer operate); } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java index 5943ecb..d1ed03f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java +++ b/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 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; + } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmController.java new file mode 100644 index 0000000..50897ea --- /dev/null +++ b/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> 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> counts(@RequestParam Integer type) { + return R.data(alarmService.counts(type)); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java index 79c04e2..ae4e5dc 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java +++ b/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 { + IPage alarms(AlarmEntity alarm, IPage page); + + List counts(Integer type); } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 3d87951..791b43a 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/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 implements AlarmService { + /** + * 查询告警列表 + * @param alarm + * @param page + * @return + */ + @Override + public IPage alarms(AlarmEntity alarm, IPage page) { + // 参数过滤 :站点、时间、告警来源、告警子类 + + // 排除站点 + + // 查询数据 + return null; + } + + /** + * 查询告警数量 + * @param type + * @return + */ + @Override + public List counts(Integer type) { + // 参数过滤 :站点、时间、告警来源、告警子类 + + // 排除站点 + + // 查询数量 + return null; + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 022e1eb..4da2a15 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/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 records = new ArrayList<>(); + List records; // 状态过滤 if(ObjectUtil.isEmpty(status)){ records = deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());