From 05bde067a5a874c0a1dbbf57af7b6a09ab8ee0eb Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期日, 08 十月 2023 14:54:57 +0800
Subject: [PATCH] 在线设备数
---
ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java | 3 +
ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java | 4 +
ard-work/src/main/java/com/ruoyi/statistical/param/Para.java | 25 ++++++++++++
ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java | 10 ++++
ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCamerasMapper.java | 3 +
ard-work/src/main/java/com/ruoyi/statistical/vo/UnitVo.java | 9 ++++
ard-work/src/main/java/com/ruoyi/device/radar/domain/ArdEquipRadar.java | 2 +
ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java | 55 ++++++++++++++++++++++++++-
8 files changed, 105 insertions(+), 6 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCamerasMapper.java b/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCamerasMapper.java
index beac34a..4f931ff 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCamerasMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCamerasMapper.java
@@ -2,6 +2,7 @@
import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.device.camera.domain.ArdCameras;
@@ -12,7 +13,7 @@
* @author 鍒樿嫃涔�
* @date 2023-02-11
*/
-public interface ArdCamerasMapper
+public interface ArdCamerasMapper extends BaseMapper<ArdCameras>
{
/**
* 鏌ヨ鐩告満璁惧
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/domain/ArdEquipRadar.java b/ard-work/src/main/java/com/ruoyi/device/radar/domain/ArdEquipRadar.java
index f823752..997f410 100644
--- a/ard-work/src/main/java/com/ruoyi/device/radar/domain/ArdEquipRadar.java
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/domain/ArdEquipRadar.java
@@ -2,6 +2,7 @@
import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -84,6 +85,7 @@
*/
@Excel(name = "濉攊d")
private String towerId;
+ @TableField(exist = false)
private String towerName;
/**
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java b/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
index 5697afc..0ef2b09 100644
--- a/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
@@ -1,6 +1,8 @@
package com.ruoyi.device.radar.mapper;
import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.device.radar.domain.ArdEquipRadar;
/**
@@ -9,7 +11,7 @@
* @author zj
* @date 2023-03-11
*/
-public interface ArdEquipRadarMapper
+public interface ArdEquipRadarMapper extends BaseMapper<ArdEquipRadar>
{
/**
* 鏌ヨradar
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 66a5d7c..389646a 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
@@ -1,7 +1,6 @@
package com.ruoyi.statistical.controller;
import com.ruoyi.statistical.param.ESParam;
-import com.ruoyi.statistical.param.MonthParam;
import com.ruoyi.statistical.service.StatisticalService;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
@@ -162,4 +161,13 @@
}
}
+ /**
+ * 鍦ㄧ嚎璁惧鏁�
+ */
+ @ApiOperation("鍦ㄧ嚎璁惧鏁�")
+ @GetMapping("unit")
+ public Results unit(){
+ return Results.succeed(statisticalService.unit());
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/param/Para.java b/ard-work/src/main/java/com/ruoyi/statistical/param/Para.java
new file mode 100644
index 0000000..7ca83be
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/statistical/param/Para.java
@@ -0,0 +1,25 @@
+package com.ruoyi.statistical.param;
+
+public class Para {
+
+ private static int i = 0;
+
+ private static int j = 0;
+
+ public static int getI() {
+ return i;
+ }
+
+ public static void setI(int i) {
+ Para.i = i;
+ }
+
+ public static int getJ() {
+ return j;
+ }
+
+ public static void setJ(int j) {
+ Para.j = j;
+ }
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java b/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
index 0520c43..03b884c 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson2.JSONArray;
import com.ruoyi.statistical.param.ESParam;
import com.ruoyi.statistical.vo.CountVo;
+import com.ruoyi.statistical.vo.UnitVo;
import com.ruoyi.utils.result.Results;
import org.springframework.stereotype.Service;
@@ -41,4 +42,6 @@
List<CountVo> wallMonth(ESParam esParam);
List<CountVo> digitizationMonth(ESParam esParam);
List<CountVo> tubeMonth(ESParam esParam);
+
+ UnitVo unit();
}
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java b/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
index c65b702..0f1532c 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
@@ -17,17 +17,22 @@
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.common.core.domain.entity.SysConfig;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.camera.domain.ArdCameras;
+import com.ruoyi.device.camera.mapper.ArdCamerasMapper;
+import com.ruoyi.device.radar.domain.ArdEquipRadar;
+import com.ruoyi.device.radar.mapper.ArdEquipRadarMapper;
import com.ruoyi.statistical.param.ESParam;
+import com.ruoyi.statistical.param.Para;
import com.ruoyi.statistical.service.StatisticalService;
import com.ruoyi.statistical.vo.CountVo;
+import com.ruoyi.statistical.vo.UnitVo;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.utils.result.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
+import java.net.Socket;
+import java.util.*;
/**
* @author Administrator
@@ -61,6 +66,10 @@
private ArdAlarmDigitization3Mapper digitization3Mapper;
@Autowired
private ArdAlarmTubeMapper tubeMapper;
+ @Autowired
+ private ArdEquipRadarMapper radarMapper;
+ @Autowired
+ private ArdCamerasMapper camerasMapper;
@Override
@@ -261,6 +270,46 @@
return esMonth(list,esParam.getEnd());
}
+ @Override
+ public UnitVo unit() {
+ UnitVo unitVo = new UnitVo();
+ //闆疯揪鍦ㄧ嚎鏁伴噺
+ List<ArdEquipRadar> radarList = radarMapper.selectList(null);
+ Timer timer = new Timer();
+ TimerTask timerTask =new TimerTask(){
+ @Override
+ public void run(){
+ Para.setI(0);
+ for(Object o : radarList){
+ Thread thread = new Thread(){
+ @Override
+ public void run(){
+ try {
+ Socket socket = new Socket("192.168.5.226",1200);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ int i = Para.getI();
+ i++;
+ }
+ }
+ };
+ thread.start();
+ }
+ Para.setJ(radarList.size() - Para.getI());
+ }
+ };
+ Date date = new Date();
+ timer.scheduleAtFixedRate(timerTask,date,5000);
+ unitVo.setRadar(Para.getJ());
+ //鍏夌數鏁伴噺
+ QueryWrapper<ArdCameras> queryWrapper = new QueryWrapper<>();
+ queryWrapper.select("id").eq("gdtype","0").eq("state","1");
+ List<ArdCameras> ardCameras = camerasMapper.selectList(queryWrapper);
+ unitVo.setCamera(ardCameras.size());
+ return unitVo;
+ }
+
public List<CountVo> es(List<CountVo> list){
for (int i = 1; i <= 12 ; i++) {
String month;
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/vo/UnitVo.java b/ard-work/src/main/java/com/ruoyi/statistical/vo/UnitVo.java
new file mode 100644
index 0000000..daffe75
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/statistical/vo/UnitVo.java
@@ -0,0 +1,9 @@
+package com.ruoyi.statistical.vo;
+
+import lombok.Data;
+
+@Data
+public class UnitVo {
+ private Integer radar;
+ private Integer camera;
+}
--
Gitblit v1.9.3