|
|
@ -3,6 +3,9 @@ package com.ruoyi.web.controller.iot;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
import com.ruoyi.system.domain.*;
|
|
|
|
import com.ruoyi.system.domain.*;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
|
|
@ -41,6 +44,9 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private IRecordAlarmService recordAlarmService;
|
|
|
|
@Autowired private IRecordAlarmService recordAlarmService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysRoleService iSysRoleService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 数量统计:传感器数量、监控单元数量
|
|
|
|
* 数量统计:传感器数量、监控单元数量
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -53,8 +59,26 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public String quantityStatistics(String monitorUnitType) {
|
|
|
|
public String quantityStatistics(String monitorUnitType) {
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos =
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfos1 =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
|
|
|
|
|
|
|
|
baseMonitorunitInfos.addAll(baseMonitorunitInfos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos1 =
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo());
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo());
|
|
|
|
|
|
|
|
baseMonitorunitInfos.addAll(baseMonitorunitInfos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfo> collect =
|
|
|
|
List<BaseMonitorunitInfo> collect =
|
|
|
|
baseMonitorunitInfos.stream()
|
|
|
|
baseMonitorunitInfos.stream()
|
|
|
|
.filter(
|
|
|
|
.filter(
|
|
|
@ -65,10 +89,26 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
int sensorAmount = 0;
|
|
|
|
int sensorAmount = 0;
|
|
|
|
for (BaseMonitorunitInfo x : collect) {
|
|
|
|
for (BaseMonitorunitInfo x : collect) {
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos =
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = new ArrayList<>();
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(
|
|
|
|
|
|
|
|
new BaseSensorInfo(null, null, null, x.getMonitorunitId()));
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
BaseSensorInfo baseSensorInfo = new BaseSensorInfo();
|
|
|
|
|
|
|
|
baseSensorInfo.setMonitorunitId(x.getMonitorunitId());
|
|
|
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos1 =
|
|
|
|
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
|
|
|
|
|
|
|
|
baseSensorInfoDtos.addAll(baseSensorInfoDtos1);
|
|
|
|
sensorAmount = sensorAmount + baseSensorInfoDtos.size();
|
|
|
|
sensorAmount = sensorAmount + baseSensorInfoDtos.size();
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseSensorInfo baseSensorInfo = new BaseSensorInfo();
|
|
|
|
|
|
|
|
baseSensorInfo.setMonitorunitId(x.getMonitorunitId());
|
|
|
|
|
|
|
|
baseSensorInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos1 =
|
|
|
|
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
|
|
|
|
|
|
|
|
baseSensorInfoDtos.addAll(baseSensorInfoDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sensorAmount = sensorAmount + baseSensorInfoDtos.size();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int finalSensorAmount = sensorAmount;
|
|
|
|
int finalSensorAmount = sensorAmount;
|
|
|
@ -93,8 +133,27 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
@GetMapping("/getMonitorUnitModule")
|
|
|
|
@GetMapping("/getMonitorUnitModule")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public String getMonitorUnitModule(String monitorUnitType) {
|
|
|
|
public String getMonitorUnitModule(String monitorUnitType) {
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfos1 =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
|
|
|
|
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfos1 =
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
|
|
|
|
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());*/
|
|
|
|
List<BaseMonitorunitInfoDto> collect =
|
|
|
|
List<BaseMonitorunitInfoDto> collect =
|
|
|
|
baseMonitorunitInfoDtos.stream()
|
|
|
|
baseMonitorunitInfoDtos.stream()
|
|
|
|
.filter(
|
|
|
|
.filter(
|
|
|
@ -122,9 +181,26 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
@GetMapping("/getAlarmModule")
|
|
|
|
@GetMapping("/getAlarmModule")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public String getAlarmModule(String monitorUnitId) {
|
|
|
|
public String getAlarmModule(String monitorUnitId) {
|
|
|
|
|
|
|
|
List<BaseAlarmModuleDto> baseAlarmModuleDtos = new ArrayList();
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseAlarmModule baseAlarmModule = new BaseAlarmModule();
|
|
|
|
|
|
|
|
baseAlarmModule.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
baseAlarmModule.setMonitorunitId(monitorUnitId);
|
|
|
|
|
|
|
|
List<BaseAlarmModuleDto> baseAlarmModuleDtos1 = baseAlarmModuleService.selectAlarmModuleAmountList(baseAlarmModule);
|
|
|
|
|
|
|
|
baseAlarmModuleDtos.addAll(baseAlarmModuleDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
List<BaseAlarmModuleDto> baseAlarmModuleDtos1 = baseAlarmModuleService.selectAlarmModuleAmountList(new BaseAlarmModule(monitorUnitId));
|
|
|
|
|
|
|
|
baseAlarmModuleDtos.addAll(baseAlarmModuleDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseAlarmModuleDto> baseAlarmModuleDtos =
|
|
|
|
//List<BaseAlarmModuleDto> baseAlarmModuleDtos =baseAlarmModuleService.selectAlarmModuleAmountList(new BaseAlarmModule(monitorUnitId));
|
|
|
|
baseAlarmModuleService.selectAlarmModuleAmountList(new BaseAlarmModule(monitorUnitId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (baseAlarmModuleDtos.size() < 6) {
|
|
|
|
if (baseAlarmModuleDtos.size() < 6) {
|
|
|
|
List<BaseAlarmModuleDto> info = new ArrayList<>();
|
|
|
|
List<BaseAlarmModuleDto> info = new ArrayList<>();
|
|
|
@ -161,11 +237,32 @@ public class WisdomScenarioContorller extends BaseController {
|
|
|
|
public String getAlarmInfo(String monitorUnitId) {
|
|
|
|
public String getAlarmInfo(String monitorUnitId) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!monitorUnitId.isEmpty()) {
|
|
|
|
if (!monitorUnitId.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
List<RecordAlarmDto> recordAlarmDtos = recordAlarmService.selectAlarmInfoList(monitorUnitId);
|
|
|
|
List<RecordAlarmDto> recordAlarmDtos = recordAlarmService.selectAlarmInfoList(monitorUnitId);
|
|
|
|
|
|
|
|
|
|
|
|
String s = JSONArray.toJSONString(recordAlarmDtos);
|
|
|
|
String s = JSONArray.toJSONString(recordAlarmDtos);
|
|
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
List<RecordAlarmDto> recordAlarmDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
RecordAlarm recordAlarm = new RecordAlarm();
|
|
|
|
|
|
|
|
recordAlarm.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
recordAlarm.setMonitorUnitTypeId(monitorUnitId);
|
|
|
|
|
|
|
|
List<RecordAlarmDto> recordAlarmDtos1 = recordAlarmService.selectAlarmInfoListByRoleId(recordAlarm);
|
|
|
|
|
|
|
|
recordAlarmDtos.addAll(recordAlarmDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String s = JSONArray.toJSONString(recordAlarmDtos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|