From b3ec70c789ff1a64d230b96158d33148afcfc442 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 10 Nov 2023 10:08:43 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/controller/AlarmTestController.java | 36 ++++++++++++++++++++++ .../alarm/monitor/listener/AlarmListener.java | 2 +- .../monitor/service/impl/AlarmSaveServiceImpl.java | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/controller/AlarmTestController.java diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/controller/AlarmTestController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/controller/AlarmTestController.java new file mode 100644 index 0000000..4a79188 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/controller/AlarmTestController.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.alarm.monitor.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.alarm.entity.AlarmEntity; +import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author ysj + */ +@RestController +@AllArgsConstructor +@RequestMapping("/alarm/test") +@Api(value = "告警配置", tags = "告警配置") +public class AlarmTestController extends BladeController { + + private final AlarmSaveService alarmSaveService; + + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增告警", notes = "传入AlarmConfigEntity对象") + public R save(@RequestBody List entitys) { + return R.status(alarmSaveService.save(entitys)); + } + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java index 24c9fb8..2e553a7 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/listener/AlarmListener.java @@ -20,7 +20,7 @@ public class AlarmListener implements MessageListener { private AlarmMessageSendService alarmMessageSendService; @Autowired - private RedisTemplate redisTemplate; + private RedisTemplate redisTemplate; @Override public void onMessage(Message message, byte[] pattern) { diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 2725a9b..bb22640 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -35,7 +35,7 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { private final IStationClient stationClient; - private final RedisTemplate redisTemplate; + private final RedisTemplate redisTemplate; @GetMapping(value = "pub/{msg}") public String pubMsg(@PathVariable String msg){