@ -52,7 +52,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
private IcResiUserDao icResiUserDao ;
@Override
public List < IcStatsResiWarnBuildingResultDTO > buildingwWarnList ( String agencyID ) {
public List < IcStatsResiWarnBuildingResultDTO > buildingwWarnList ( String customerId , String agencyID ) {
List < IcStatsResiWarnBuildingResultDTO > result = new ArrayList < > ( ) ;
//feign获取当前需要预警的配置信息以及阈值
Result < List < IcResiCategoryWarnConfigDTO > > warnResult = operCustomizeOpenFeignClient . resiCategoryWarnList ( ) ;
@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
return resiWarnBuildingResultDTO ;
} ) . collect ( Collectors . toList ( ) ) ;
//统计数量
List < IcStatsResiWarnEntity > icStatsResiWarnEntityList = icStatsResiWarnDao . selectResiWarnByAgencyId ( agencyID ) ;
List < IcStatsResiWarnEntity > icStatsResiWarnEntityList = icStatsResiWarnDao . selectResiWarnByAgencyId ( customerId , agencyID ) ;
if ( CollectionUtils . isEmpty ( icStatsResiWarnEntityList ) ) {
return result ;
}
@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
}
@Override
public List < IcStatsResiWarnUserResultDTO > userWarnList ( String configId , List < String > buildingIdList ) {
public List < IcStatsResiWarnUserResultDTO > userWarnList ( String customerId , String c onfigId , List < String > buildingIdList ) {
//feign根据buildingIdList 获取网格,小区,楼宇 信息
Result < List < BuildingResultDTO > > buildingList = govOrgOpenFeignClient . buildingListByIds ( buildingIdList ) ;
if ( ! buildingList . success ( ) | | null = = buildingList . getData ( ) ) {
@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult . getData ( ) ;
//根据buildingID,tableName he columnName获取名字
List < Map < String , String > > maps = icStatsResiWarnDao . userWarnList ( buildingIdList , icResiCategoryWarnConfigDTO . getTableName ( ) , icResiCategoryWarnConfigDTO . getColumnName ( ) ) ;
List < Map < String , String > > maps = icStatsResiWarnDao . userWarnList ( customerId , buildingIdList , icResiCategoryWarnConfigDTO . getTableName ( ) , icResiCategoryWarnConfigDTO . getColumnName ( ) ) ;
result . forEach ( item - > {
item . setConfigId ( configId ) ;
List < Map < String , String > > buildingIds = maps . stream ( ) . filter ( map - > item . getBuildingId ( ) . equals ( map . get ( "buildingId" ) ) ) . collect ( Collectors . toList ( ) ) ;
@ -147,7 +147,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
}
@Override
public List < IcStatsResiResultDTO > list ( String id , String level ) {
public List < IcStatsResiResultDTO > list ( String customerId , String id , String level ) {
//获取所有配置类项 getshow
Result < List < IcResiCategoryStatsConfigDTO > > statsResult = operCustomizeOpenFeignClient . resiCategoryStatsListShowd ( ) ;
if ( ! statsResult . success ( ) | | null = = statsResult . getData ( ) ) {
@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
resultDTO . setHouseShowIcon ( item . getHouseShowIcon ( ) ) ;
resultDTO . setManagementIcon ( item . getManagementIcon ( ) ) ;
//根据id ,level 获取count
Integer count = icStatsResiWarnDao . countListByLevelAndCol ( item . getTableName ( ) , item . getColumnName ( ) , id , level ) ;
Integer count = icStatsResiWarnDao . countListByLevelAndCol ( customerId , item . getTableName ( ) , item . getColumnName ( ) , id , level ) ;
resultDTO . setCount ( count ) ;
result . add ( resultDTO ) ;
} ) ;
@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
//保存数据
List < IcStatsResiWarnEntity > icStatsResiWarnEntities = new ArrayList < > ( ) ;
for ( IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList ) {
icStatsResiWarnDao . delete ( new QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( ) . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) ) ) ;
List < IcStatsResiWarnEntity > maps = icStatsResiWarnDao . resiWarn ( item . getTableName ( ) , item . getColumnName ( ) ) ;
icStatsResiWarnDao . delete ( new QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( ) . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) ) . eq ( IcStatsResiWarnEntity : : getCustomerId , customerId ) ) ;
List < IcStatsResiWarnEntity > maps = icStatsResiWarnDao . resiWarn ( customerId , item . getTableName ( ) , item . getColumnName ( ) ) ;
if ( CollectionUtils . isEmpty ( maps ) ) {
continue ;
}
@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
if ( null = = icResiUserEntity ) {
return ;
}
IcStatsResiWarnEntity query = new IcStatsResiWarnEntity ( ) ;
query . setAgencyId ( icResiUserEntity . getAgencyId ( ) ) ;
query . setGridId ( icResiUserEntity . getGridId ( ) ) ;
query . setNeighborHoodId ( icResiUserEntity . getVillageId ( ) ) ;
query . setBuildingId ( icResiUserEntity . getBuildId ( ) ) ;
//保存数据
for ( IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList ) {
@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao . selectOne ( new QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( )
. eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) )
. eq ( IcStatsResiWarnEntity : : getCustomerId , customerId )
. eq ( IcStatsResiWarnEntity : : getAgencyId , icResiUserEntity . getAgencyId ( ) )
. eq ( IcStatsResiWarnEntity : : getGridId , icResiUserEntity . getGridId ( ) )
. eq ( IcStatsResiWarnEntity : : getNeighborHoodId , icResiUserEntity . getVillageId ( ) )
. eq ( IcStatsResiWarnEntity : : getBuildingId , icResiUserEntity . getBuildId ( ) ) ) ;
//统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao . resiWarnById ( customerId , item . getTableName ( ) , item . getColumnName ( ) , query ) ;
if ( null = = icStatsResiWarn ) {
//如果不存在,新增统计数量
icStatsResiWarn = new IcStatsResiWarnEntity ( ) ;
@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
icStatsResiWarn . setBuildingId ( icResiUserEntity . getBuildId ( ) ) ;
icStatsResiWarn . setConfigId ( item . getId ( ) ) ;
icStatsResiWarn . setCustomerId ( customerId ) ;
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao . resiWarnById ( item . getTableName ( ) , item . getColumnName ( ) , icStatsResiWarn ) ;
if ( null = = resiWarnEntity ) {
continue ;
icStatsResiWarn . setCount ( 0 ) ;
} else {
icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;
}
icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;
icStatsResiWarnDao . insert ( icStatsResiWarn ) ;
} else {
//如果存在,更新统计数量
IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao . resiWarnById ( item . getTableName ( ) , item . getColumnName ( ) , icStatsResiWarn ) ;
icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;
if ( null = = resiWarnEntity ) {
icStatsResiWarn . setCount ( 0 ) ;
} else {
icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;
}
icStatsResiWarn . setCustomerId ( customerId ) ;
icStatsResiWarnDao . updateById ( icStatsResiWarn ) ;
}