|
|
|
@ -1,6 +1,14 @@
|
|
|
|
|
package com.ruoyi.web.controller.iot;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
|
|
|
|
import com.ruoyi.system.domain.BaseMonitorunitInfo;
|
|
|
|
|
import com.ruoyi.system.domain.BaseMonitorunitType;
|
|
|
|
|
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
|
|
|
|
import com.ruoyi.system.domain.dto.ScrollTableDto;
|
|
|
|
|
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
|
|
|
|
|
import com.ruoyi.system.service.IBaseMonitorunitTypeService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
@ -8,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author WenJY
|
|
|
|
@ -17,6 +26,10 @@ import java.util.List;
|
|
|
|
|
@RequestMapping("/iot/index")
|
|
|
|
|
public class IndexController {
|
|
|
|
|
|
|
|
|
|
@Autowired private IBaseMonitorunitTypeService baseMonitorunitTypeService;
|
|
|
|
|
|
|
|
|
|
@Autowired private IBaseMonitorunitInfoService baseMonitorunitInfoService;
|
|
|
|
|
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String index() {
|
|
|
|
|
return "iot-ui/index";
|
|
|
|
@ -24,43 +37,67 @@ public class IndexController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 监控单元统计
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 14:26
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMonitorUnitCharts")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getMonitorUnitCharts(){
|
|
|
|
|
return "[\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 32,\n" +
|
|
|
|
|
" \"name\": \"隔离开关\"\n" +
|
|
|
|
|
" },\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 14,\n" +
|
|
|
|
|
" \"name\": \"电流互感器\"\n" +
|
|
|
|
|
" },\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 26,\n" +
|
|
|
|
|
" \"name\": \"电压互感器\"\n" +
|
|
|
|
|
" },\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 20,\n" +
|
|
|
|
|
" \"name\": \"变压器\"\n" +
|
|
|
|
|
" },\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 10,\n" +
|
|
|
|
|
" \"name\": \"电容电抗器\"\n" +
|
|
|
|
|
" },\n" +
|
|
|
|
|
" {\n" +
|
|
|
|
|
" \"value\": 10,\n" +
|
|
|
|
|
" \"name\": \"避雷器\"\n" +
|
|
|
|
|
" }\n" +
|
|
|
|
|
" ]";
|
|
|
|
|
public String getMonitorUnitCharts() {
|
|
|
|
|
try {
|
|
|
|
|
List<BaseMonitorunitInfoDto> result = new ArrayList<BaseMonitorunitInfoDto>();
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitType> baseMonitorunitTypes =
|
|
|
|
|
baseMonitorunitTypeService.selectBaseMonitorunitTypeList(new BaseMonitorunitType());
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
|
|
|
|
|
|
|
|
|
|
baseMonitorunitTypes.forEach(
|
|
|
|
|
x -> {
|
|
|
|
|
List<BaseMonitorunitInfoDto> collect =
|
|
|
|
|
baseMonitorunitInfoDtos.stream()
|
|
|
|
|
.filter(y -> y.getMonitorunitType().equals(x.getMonitorunittypeId()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
BaseMonitorunitInfoDto info = new BaseMonitorunitInfoDto();
|
|
|
|
|
info.setName(x.getMonitorunittypeName());
|
|
|
|
|
info.setValue(collect.size());
|
|
|
|
|
result.add(info);
|
|
|
|
|
});
|
|
|
|
|
return JSONArray.toJSONString(result);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return "[\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 32,\n"
|
|
|
|
|
+ " \"name\": \"隔离开关\"\n"
|
|
|
|
|
+ " },\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 14,\n"
|
|
|
|
|
+ " \"name\": \"电流互感器\"\n"
|
|
|
|
|
+ " },\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 26,\n"
|
|
|
|
|
+ " \"name\": \"电压互感器\"\n"
|
|
|
|
|
+ " },\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 20,\n"
|
|
|
|
|
+ " \"name\": \"变压器\"\n"
|
|
|
|
|
+ " },\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 10,\n"
|
|
|
|
|
+ " \"name\": \"电容电抗器\"\n"
|
|
|
|
|
+ " },\n"
|
|
|
|
|
+ " {\n"
|
|
|
|
|
+ " \"value\": 10,\n"
|
|
|
|
|
+ " \"name\": \"避雷器\"\n"
|
|
|
|
|
+ " }\n"
|
|
|
|
|
+ " ]";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 监控单元统计
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 13:55
|
|
|
|
|
* @return java.lang.String
|
|
|
|
@ -68,6 +105,42 @@ public class IndexController {
|
|
|
|
|
@GetMapping("/getMonitorUnitInfo")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getMonitorUnitInfo() {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<List<String>> data = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<String> header =
|
|
|
|
|
new ArrayList<String>() {
|
|
|
|
|
{
|
|
|
|
|
this.add("名称");
|
|
|
|
|
this.add("监控数量");
|
|
|
|
|
this.add("告警数量");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitType> baseMonitorunitTypes =
|
|
|
|
|
baseMonitorunitTypeService.selectBaseMonitorunitTypeList(new BaseMonitorunitType());
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
|
|
|
|
|
|
|
|
|
|
baseMonitorunitTypes.forEach(
|
|
|
|
|
x -> {
|
|
|
|
|
List<BaseMonitorunitInfoDto> collect =
|
|
|
|
|
baseMonitorunitInfoDtos.stream()
|
|
|
|
|
.filter(y -> y.getMonitorunitType().equals(x.getMonitorunittypeId()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
data.add(
|
|
|
|
|
new ArrayList<String>() {
|
|
|
|
|
{
|
|
|
|
|
this.add(x.getMonitorunittypeName());
|
|
|
|
|
this.add(collect.size() + "");
|
|
|
|
|
this.add(collect.size() + "");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return JSONArray.toJSONString(new ScrollTableDto(header, data));
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return "{\n"
|
|
|
|
|
+ " \"header\": [\"名称\", \"监控数量\", \"告警数量\"],\n"
|
|
|
|
|
+ " \"data\": [\n"
|
|
|
|
@ -80,24 +153,27 @@ public class IndexController {
|
|
|
|
|
+ " ]\n"
|
|
|
|
|
+ "}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 传感器状态统计
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 13:54
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getSensorStateCharts")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getSensorStateCharts(){
|
|
|
|
|
return "{\n" +
|
|
|
|
|
" \"yAxis\": [\"在线\", \"离线\", \"告警\"],\n" +
|
|
|
|
|
" \"data\": [60, 132, 89]\n" +
|
|
|
|
|
"}";
|
|
|
|
|
public String getSensorStateCharts() {
|
|
|
|
|
return "{\n"
|
|
|
|
|
+ " \"yAxis\": [\"在线\", \"离线\", \"告警\"],\n"
|
|
|
|
|
+ " \"data\": [60, 132, 89]\n"
|
|
|
|
|
+ "}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 传感器状态统计
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 13:55
|
|
|
|
|
* @return java.lang.String
|
|
|
|
@ -120,13 +196,14 @@ public class IndexController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 告警数量统计
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 13:54
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getAlarmAmount")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getAlarmAmount(){
|
|
|
|
|
public String getAlarmAmount() {
|
|
|
|
|
return "{\n"
|
|
|
|
|
+ " \"yAxis\": [\"设备高温\", \"设备振动\", \"烟雾火情\", \"环境大风\", \"测试一\", \"测试二\", \"测试三\", \"测试四\", \"测试五\", \"测试六\"],\n"
|
|
|
|
|
+ " \"data\": [60, 132, 89, 10,15,23,22,60, 132, 89]\n"
|
|
|
|
@ -135,17 +212,17 @@ public class IndexController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 告警趋势
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2022/2/23 14:23
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getAlarmTrend")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getAlarmTrend(){
|
|
|
|
|
return "{\n" +
|
|
|
|
|
" \"xAxis\": [\"06-21\", \"06-22\", \"06-23\", \"06-24\", \"06-25\", \"06-26\", \"06-27\"],\n" +
|
|
|
|
|
" \"data\": [18, 5, 4, 2, 1, 7, 6]\n" +
|
|
|
|
|
"}";
|
|
|
|
|
public String getAlarmTrend() {
|
|
|
|
|
return "{\n"
|
|
|
|
|
+ " \"xAxis\": [\"06-21\", \"06-22\", \"06-23\", \"06-24\", \"06-25\", \"06-26\", \"06-27\"],\n"
|
|
|
|
|
+ " \"data\": [18, 5, 4, 2, 1, 7, 6]\n"
|
|
|
|
|
+ "}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|