@ -58,10 +58,12 @@ public class HouseInformationServiceImpl implements HouseInformationService {
* /
@Override
public CommunityCountResultDTO getCommunityCount ( HouseInformationFormDTO formDTO ) {
//获取工作人员所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis . getStaffInfo ( formDTO . getCustomerId ( ) , formDTO . getStaffId ( ) ) ;
if ( StringUtils . isEmpty ( formDTO . getCommunityId ( ) ) ) {
//获取工作人员所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis . getStaffInfo ( formDTO . getCustomerId ( ) , formDTO . getStaffId ( ) ) ;
if ( null = = staffInfo ) {
// CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if ( null = = staffInfo ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "获取用户信息失败" , "获取用户信息失败" ) ;
}
formDTO . setCommunityId ( staffInfo . getAgencyId ( ) ) ;
@ -69,7 +71,12 @@ public class HouseInformationServiceImpl implements HouseInformationService {
String orgName ;
CustomerAgencyEntity agency = customerAgencyDao . selectById ( formDTO . getCommunityId ( ) ) ;
if ( null = = agency ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "社区不存在" , "社区不存在" ) ;
agency = customerAgencyDao . selectById ( staffInfo . getAgencyId ( ) ) ;
if ( null = = agency ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "社区不存在" , "社区不存在" ) ;
} else {
formDTO . setCommunityId ( staffInfo . getAgencyId ( ) ) ;
}
}
CustomerAgencyEntity parentAgency = customerAgencyDao . selectById ( agency . getPid ( ) ) ;
if ( null = = parentAgency ) {
@ -122,6 +129,34 @@ public class HouseInformationServiceImpl implements HouseInformationService {
item . setDifferPersonCount ( item . getPersonRealCount ( ) - item . getPersonCount ( ) ) ;
} ) ;
} else {
return deleteAfetrEmergency ( formDTO ) ;
}
return new PageData < > ( list , pageInfo . getTotal ( ) ) ;
}
private PageData < GridCountListResultDTO > deleteAfetrEmergency ( HouseInformationFormDTO formDTO ) {
//获取工作人员所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis . getStaffInfo ( formDTO . getCustomerId ( ) , formDTO . getStaffId ( ) ) ;
formDTO . setCommunityId ( staffInfo . getAgencyId ( ) ) ;
PageHelper . startPage ( formDTO . getPageNo ( ) , formDTO . getPageSize ( ) ) ;
List < GridCountListResultDTO > list = icNeighborHoodDao . getGridList ( formDTO ) ;
PageInfo < GridCountListResultDTO > pageInfo = new PageInfo < > ( list ) ;
if ( CollectionUtils . isNotEmpty ( list ) ) {
//获取录入人口数
IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO ( ) ;
countFormDTO . setOrgType ( NumConstant . ZERO_STR ) ;
countFormDTO . setOrgId ( formDTO . getCommunityId ( ) ) ;
countFormDTO . setType ( NumConstant . ONE_STR ) ;
Map < String , Integer > map = getMapResult ( countFormDTO ) ;
list . forEach ( item - > {
if ( map . containsKey ( item . getId ( ) ) ) {
item . setPersonCount ( map . get ( item . getId ( ) ) ) ;
}
item . setDifferPersonCount ( item . getPersonRealCount ( ) - item . getPersonCount ( ) ) ;
} ) ;
}
return new PageData < > ( list , pageInfo . getTotal ( ) ) ;
}
@ -254,7 +289,7 @@ public class HouseInformationServiceImpl implements HouseInformationService {
//排序
list = list . stream ( ) . sorted ( Comparator . comparing ( BuildingListResultDTO : : getDifferPersonCount ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
//分页
list = list . stream ( ) . skip ( ( long ) ( formDTO . getPageNo ( ) - 1 ) * formDTO . getPageSize ( ) ) . limit ( formDTO . getPageSize ( ) ) . collect ( Collectors . toList ( ) ) ;
list = list . stream ( ) . skip ( ( long ) ( formDTO . getPageNo ( ) - 1 ) * formDTO . getPageSize ( ) ) . limit ( formDTO . getPageSize ( ) ) . collect ( Collectors . toList ( ) ) ;
}
}
@ -387,7 +422,7 @@ public class HouseInformationServiceImpl implements HouseInformationService {
//排序
list = list . stream ( ) . sorted ( Comparator . comparing ( HomeListResultDTO : : getPersonCount ) . reversed ( ) ) . collect ( Collectors . toList ( ) ) ;
//分页
list = list . stream ( ) . skip ( ( long ) ( formDTO . getPageNo ( ) - 1 ) * formDTO . getPageSize ( ) ) . limit ( formDTO . getPageSize ( ) ) . collect ( Collectors . toList ( ) ) ;
list = list . stream ( ) . skip ( ( long ) ( formDTO . getPageNo ( ) - 1 ) * formDTO . getPageSize ( ) ) . limit ( formDTO . getPageSize ( ) ) . collect ( Collectors . toList ( ) ) ;
}
}