@ -149,13 +149,23 @@ public class IndexController {
List < BaseMonitorunitType > baseMonitorunitTypes =
List < BaseMonitorunitType > baseMonitorunitTypes =
baseMonitorunitTypeService . selectBaseMonitorunitTypeList ( new BaseMonitorunitType ( ) ) ;
baseMonitorunitTypeService . selectBaseMonitorunitTypeList ( new BaseMonitorunitType ( ) ) ;
List < BaseMonitorunitInfoDto > baseMonitorunitInfoDtos =
baseMonitorunitInfoService . selectBaseMonitorunitInfoDtoList ( new BaseMonitorunitInfo ( ) ) ;
List < BaseMonitorunitInfoDto > baseMonitorunitInfoDtoList = new ArrayList < BaseMonitorunitInfoDto > ( ) ;
SysUser sysUser = ShiroUtils . getSysUser ( ) ;
List < SysRole > sysRoles = iSysRoleService . selectRolesByUserId ( sysUser . getUserId ( ) ) ;
for ( SysRole sysRole : sysRoles ) {
//
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo ( ) ;
baseMonitorunitInfo . setRoleId ( sysRole . getRoleId ( ) ) ;
List < BaseMonitorunitInfoDto > baseMonitorunitInfoDtos =
baseMonitorunitInfoService . selectBaseMonitorunitInfoDtoList ( baseMonitorunitInfo ) ;
baseMonitorunitInfoDtoList . addAll ( baseMonitorunitInfoDtos ) ;
}
baseMonitorunitTypes . forEach (
baseMonitorunitTypes . forEach (
x - > {
x - > {
List < BaseMonitorunitInfoDto > collect =
List < BaseMonitorunitInfoDto > collect =
baseMonitorunitInfoDtos . stream ( )
baseMonitorunitInfoDto Li st . stream ( )
. filter (
. filter (
y - >
y - >
! y . getParentId ( ) . isEmpty ( )
! y . getParentId ( ) . isEmpty ( )
@ -202,8 +212,22 @@ public class IndexController {
@ResponseBody
@ResponseBody
public String getSensorStateCharts ( ) {
public String getSensorStateCharts ( ) {
try {
try {
List < BaseSensorInfoDto > baseSensorInfoDtos =
baseSensorInfoService . selectBaseSensorInfoList ( new BaseSensorInfo ( ) ) ;
SysUser sysUser = ShiroUtils . getSysUser ( ) ;
List < SysRole > sysRoles = iSysRoleService . selectRolesByUserId ( sysUser . getUserId ( ) ) ;
List < BaseSensorInfoDto > baseSensorInfoDtos = new ArrayList < > ( ) ;
for ( SysRole sysRole : sysRoles ) {
BaseSensorInfo baseSensorInfo = new BaseSensorInfo ( ) ;
baseSensorInfo . setEnableFlag ( 0 L ) ;
baseSensorInfo . setRoleId ( sysRole . getRoleId ( ) ) ;
List < BaseSensorInfoDto > baseSensorInfoDtos1 = baseSensorInfoService . selectBaseSensorInfoList ( baseSensorInfo ) ;
baseSensorInfoDtos . addAll ( baseSensorInfoDtos1 ) ;
}
/ * List < BaseSensorInfoDto > baseSensorInfoDtos =
baseSensorInfoService . selectBaseSensorInfoList ( new BaseSensorInfo ( ) ) ; * /
List < String > yAxis =
List < String > yAxis =
new ArrayList < String > ( ) {
new ArrayList < String > ( ) {
{
{
@ -216,7 +240,7 @@ public class IndexController {
List < Integer > data =
List < Integer > data =
new ArrayList < Integer > ( ) {
new ArrayList < Integer > ( ) {
{
{
this . add (
/ * this . add (
baseSensorInfoDtos . stream ( )
baseSensorInfoDtos . stream ( )
. filter ( x - > x . getSensorStatus ( ) = = 0 )
. filter ( x - > x . getSensorStatus ( ) = = 0 )
. collect ( Collectors . toList ( ) )
. collect ( Collectors . toList ( ) )
@ -230,7 +254,10 @@ public class IndexController {
baseSensorInfoDtos . stream ( )
baseSensorInfoDtos . stream ( )
. filter ( x - > x . getSensorStatus ( ) = = 2 )
. filter ( x - > x . getSensorStatus ( ) = = 2 )
. collect ( Collectors . toList ( ) )
. collect ( Collectors . toList ( ) )
. size ( ) ) ; // 告警
. size ( ) ) ; // 告警*/
this . add ( 0 ) ;
this . add ( baseSensorInfoDtos . size ( ) ) ;
this . add ( 0 ) ;
}
}
} ;
} ;
@ -254,6 +281,7 @@ public class IndexController {
@ResponseBody
@ResponseBody
public String getSensorStateInfo ( ) {
public String getSensorStateInfo ( ) {
try {
try {
List < List < String > > data = new ArrayList < > ( ) ;
List < List < String > > data = new ArrayList < > ( ) ;
List < String > header =
List < String > header =
@ -266,24 +294,49 @@ public class IndexController {
} ;
} ;
List < BaseSensorType > baseSensorTypeList =
List < BaseSensorType > baseSensorTypeList =
baseSensorTypeService . selectBaseSensorTypeList ( new BaseSensorType ( ) ) ;
baseSensorTypeService . selectBaseSensorTypeList ( new BaseSensorType ( ) ) ;
SysUser sysUser = ShiroUtils . getSysUser ( ) ;
List < SysRole > sysRoles = iSysRoleService . selectRolesByUserId ( sysUser . getUserId ( ) ) ;
baseSensorTypeList . forEach (
baseSensorTypeList . forEach (
x - > {
x - > {
List < BaseSensorInfoDto > baseSensorInfoDtos =
List < BaseSensorInfoDto > baseSensorInfoDtos = new ArrayList < > ( ) ;
baseSensorInfoService . selectBaseSensorInfoList (
for ( SysRole sysRole : sysRoles ) {
new BaseSensorInfo ( x . getSensortypeId ( ) , 0 L ) ) ;
//
BaseSensorInfo baseSensorInfo = new BaseSensorInfo ( ) ;
baseSensorInfo . setEnableFlag ( 0 L ) ;
baseSensorInfo . setRoleId ( sysRole . getRoleId ( ) ) ;
baseSensorInfo . setSensorType ( x . getSensortypeId ( ) ) ;
List < BaseSensorInfoDto > baseSensorInfoDtos1 = baseSensorInfoService . selectBaseSensorInfoList ( baseSensorInfo ) ;
baseSensorInfoDtos . addAll ( baseSensorInfoDtos1 ) ;
}
data . add (
data . add (
new ArrayList < String > ( ) {
new ArrayList < String > ( ) {
{
{
this . add ( x . getSensortypeName ( ) ) ;
this . add ( x . getSensortypeName ( ) ) ;
this . add ( baseSensorInfoDtos . size ( ) + "" ) ;
if ( baseSensorInfoDtos ! = null ) {
this . add (
this . add ( baseSensorInfoDtos . size ( ) + "" ) ;
baseSensorInfoDtos . stream ( )
if ( baseSensorInfoDtos . size ( ) > 0 ) {
. filter ( z - > z . getSensorStatus ( ) = = 1 )
/ * this . add (
. collect ( Collectors . toList ( ) )
baseSensorInfoDtos . stream ( )
. size ( )
. filter ( z - > z . getSensorStatus ( ) = = 1 )
+ "" ) ;
. collect ( Collectors . toList ( ) )
}
. size ( )
} ) ;
+ "" ) ; * /
this . add ( 0 + "" ) ;
} else {
this . add ( 0 + "" ) ;
}
} else {
this . add ( 0 + "" ) ;
this . add ( 0 + "" ) ;
}
}
} ) ;
} ) ;
} ) ;
return JSONArray . toJSONString ( new ScrollTableDto ( header , data ) ) ;
return JSONArray . toJSONString ( new ScrollTableDto ( header , data ) ) ;
} catch ( Exception ex ) {
} catch ( Exception ex ) {
@ -311,16 +364,33 @@ public class IndexController {
@GetMapping ( "/quantityStatistics" )
@GetMapping ( "/quantityStatistics" )
@ResponseBody
@ResponseBody
public String quantityStatistics ( ) {
public String quantityStatistics ( ) {
List < BaseSensorInfoDto > baseSensorInfoDtos =
List < BaseSensorInfoDto > baseSensorInfoDtos = new ArrayList < > ( ) ;
baseSensorInfoService . selectBaseSensorInfoList ( new BaseSensorInfo ( "" , 0 L ) ) ;
List < BaseMonitorunitInfo > baseMonitorunitInfos =
List < BaseMonitorunitInfoDto > baseMonitorunitInfoDtoList = new ArrayList < BaseMonitorunitInfoDto > ( ) ;
baseMonitorunitInfoService . selectBaseMonitorunitInfoList ( new BaseMonitorunitInfo ( ) ) ;
SysUser sysUser = ShiroUtils . getSysUser ( ) ;
List < SysRole > sysRoles = iSysRoleService . selectRolesByUserId ( sysUser . getUserId ( ) ) ;
for ( SysRole sysRole : sysRoles ) {
//
BaseSensorInfo baseSensorInfo = new BaseSensorInfo ( ) ;
baseSensorInfo . setEnableFlag ( 0 L ) ;
baseSensorInfo . setRoleId ( sysRole . getRoleId ( ) ) ;
List < BaseSensorInfoDto > baseSensorInfoDtos1 = baseSensorInfoService . selectBaseSensorInfoList ( baseSensorInfo ) ;
baseSensorInfoDtos . addAll ( baseSensorInfoDtos1 ) ;
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo ( ) ;
baseMonitorunitInfo . setRoleId ( sysRole . getRoleId ( ) ) ;
List < BaseMonitorunitInfoDto > baseMonitorunitInfoDtos =
baseMonitorunitInfoService . selectBaseMonitorunitInfoDtoList ( baseMonitorunitInfo ) ;
baseMonitorunitInfoDtoList . addAll ( baseMonitorunitInfoDtos ) ;
}
List < Integer > result =
List < Integer > result =
new ArrayList < Integer > ( ) {
new ArrayList < Integer > ( ) {
{
{
this . add ( baseSensorInfoDtos . size ( ) ) ;
this . add ( baseSensorInfoDtos . size ( ) ) ;
this . add (
this . add (
baseMonitorunitInfos . stream ( )
baseMonitorunitInfo DtoLi st . stream ( )
. filter ( x - > ! x . getParentId ( ) . isEmpty ( ) & & x . getEnableFlag ( ) = = 0 L )
. filter ( x - > ! x . getParentId ( ) . isEmpty ( ) & & x . getEnableFlag ( ) = = 0 L )
. collect ( Collectors . toList ( ) )
. collect ( Collectors . toList ( ) )
. size ( ) ) ;
. size ( ) ) ;
@ -340,7 +410,16 @@ public class IndexController {
@ResponseBody
@ResponseBody
public String getAlarmAmount ( ) {
public String getAlarmAmount ( ) {
List < String > info = new ArrayList < > ( ) ;
List < String > info = new ArrayList < > ( ) ;
List < RecordAlarm > recordAlarms = recordAlarmService . selectRecordAlarmList ( new RecordAlarm ( ) ) ;
List < RecordAlarm > recordAlarms = 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 ( ) ) ;
List < RecordAlarm > recordAlarms1 = recordAlarmService . selectRecordAlarmList ( recordAlarm ) ;
recordAlarms . addAll ( recordAlarms1 ) ;
}
if ( recordAlarms . size ( ) > 0 ) {
if ( recordAlarms . size ( ) > 0 ) {
int size =
int size =
@ -409,7 +488,21 @@ public class IndexController {
List < String > dayByMonth = getSevenDate ( ) ;
List < String > dayByMonth = getSevenDate ( ) ;
List < RecordAlarmDto > recordAlarmDtos = recordAlarmService . selectAlarmTrendList ( "" ) ;
List < RecordAlarmDto > recordAlarmDtos = new ArrayList < > ( ) ;
SysUser sysUser = ShiroUtils . getSysUser ( ) ;
if ( ShiroUtils . getLoginName ( ) . equals ( "admin" ) ) {
List < RecordAlarmDto > recordAlarmDtos1 = recordAlarmService . selectAlarmTrendList ( "" ) ;
recordAlarmDtos . addAll ( recordAlarmDtos1 ) ;
} else {
List < SysRole > sysRoles = iSysRoleService . selectRolesByUserId ( sysUser . getUserId ( ) ) ;
for ( SysRole sysRole : sysRoles ) {
RecordAlarm recordAlarm = new RecordAlarm ( ) ;
recordAlarm . setRoleId ( sysRole . getRoleId ( ) ) ;
List < RecordAlarmDto > recordAlarmDtos1 = recordAlarmService . selectAlarmTrendListByRoleId ( sysRole . getRoleId ( ) ) ;
recordAlarmDtos . addAll ( recordAlarmDtos1 ) ;
}
}
dayByMonth . forEach (
dayByMonth . forEach (
x - > {
x - > {