From f1cb7ec004323b02c85e3d205ba21ffceec8df65 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 10 十月 2023 09:58:34 +0800
Subject: [PATCH] 报警优化
---
ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMoveMapper.xml | 4 +-
ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java | 62 ++++++++++++++++++++++++------
ard-work/src/main/java/com/ruoyi/statistical/vo/TenVo.java | 2
3 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java b/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
index 7d9a463..09168d6 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
@@ -3,6 +3,7 @@
import com.ruoyi.statistical.param.ESParam;
import com.ruoyi.statistical.service.StatisticalService;
import com.ruoyi.statistical.vo.NumVo;
+import com.ruoyi.statistical.vo.TenVo;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -10,7 +11,9 @@
import javax.annotation.Resource;
import java.time.LocalDate;
+import java.util.ArrayList;
import java.util.Calendar;
+import java.util.List;
import java.util.Map;
/**
@@ -177,19 +180,52 @@
@ApiOperation("鎶ヨ鏁伴噺")
@GetMapping("alarm/num")
public Results num(){
- NumVo numVo = new NumVo();
- numVo.setStealelec(statisticalService.stealelecNum());
- numVo.setCamera(statisticalService.cameraNum());
- numVo.setMove(statisticalService.moveNum());
- numVo.setFire(statisticalService.fireNum());
- numVo.setExternal(statisticalService.externalNum());
- numVo.setAccess(statisticalService.accessNum());
- numVo.setApponekey(statisticalService.apponekeyNum());
- numVo.setPump(statisticalService.pumpNum());
- numVo.setWall(statisticalService.wallNum());
- numVo.setDigitization(statisticalService.digitizationNum());
- numVo.setTube(statisticalService.tubeNum());
- return Results.succeed(numVo);
+ List<TenVo> tenVo = new ArrayList<>();
+ TenVo stealelec = new TenVo();
+ stealelec.setName("鐩楃數鎶ヨ");
+ stealelec.setValue(statisticalService.stealelecNum());
+ tenVo.add(stealelec);
+ TenVo camera = new TenVo();
+ camera.setName("閫氱敤鍏夌數");
+ camera.setValue(statisticalService.cameraNum());
+ tenVo.add(camera);
+ TenVo move = new TenVo();
+ move.setName("闆疯揪绉诲姩");
+ move.setValue(statisticalService.moveNum());
+ tenVo.add(move);
+ TenVo fire = new TenVo();
+ fire.setName("闆疯揪闃茬伀");
+ fire.setValue(statisticalService.fireNum());
+ tenVo.add(fire);
+ TenVo external = new TenVo();
+ external.setName("澶栬仈鎶ヨ");
+ external.setValue(statisticalService.externalNum());
+ tenVo.add(external);
+ TenVo access = new TenVo();
+ access.setName("闂ㄧ鎶ヨ");
+ access.setValue(statisticalService.accessNum());
+ tenVo.add(access);
+ TenVo apponekey = new TenVo();
+ apponekey.setName("绉诲姩缁堢");
+ apponekey.setValue(statisticalService.apponekeyNum());
+ tenVo.add(apponekey);
+ TenVo pump = new TenVo();
+ pump.setName("闆疯揪鍋滄満");
+ pump.setValue(statisticalService.pumpNum());
+ tenVo.add(pump);
+ TenVo wall = new TenVo();
+ wall.setName("鐢靛瓙鍥存爮");
+ wall.setValue(statisticalService.wallNum());
+ tenVo.add(wall);
+ TenVo digitization = new TenVo();
+ digitization.setName("棰勮鎶ヨ");
+ digitization.setValue(statisticalService.digitizationNum());
+ tenVo.add(digitization);
+ TenVo tube = new TenVo();
+ tube.setName("绠$嚎娉勯湶");
+ tube.setValue(statisticalService.tubeNum());
+ tenVo.add(tube);
+ return Results.succeed(tenVo);
}
/**
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/vo/TenVo.java b/ard-work/src/main/java/com/ruoyi/statistical/vo/TenVo.java
index 6f92ba9..124556a 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/vo/TenVo.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/vo/TenVo.java
@@ -5,5 +5,5 @@
@Data
public class TenVo {
private String name;
- private String num;
+ private Integer value;
}
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMoveMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMoveMapper.xml
index 53eb25c..3ec6951 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMoveMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMoveMapper.xml
@@ -179,7 +179,7 @@
where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date
</select>
<select id="ten" resultType="com.ruoyi.statistical.vo.TenVo">
- SELECT name,count(name) num from ard_alarm_radar_move
- where (current_timestamp - interval '1024 hour') <= alarm_time GROUP BY name ORDER BY num desc LIMIT 10
+ SELECT name,count(name) as "value" from ard_alarm_radar_move
+ where (current_timestamp - interval '1024 hour') <= alarm_time GROUP BY name ORDER BY "value" desc LIMIT 10
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3