@ -2,6 +2,7 @@ package com.xhpc.databigscreen.service.impl;
import com.xhpc.common.constant.ConstantClass ;
import com.xhpc.common.core.domain.R ;
import com.xhpc.common.util.MyDateUtil ;
import com.xhpc.common.util.UserTypeUtil ;
import com.xhpc.databigscreen.domain.CoreParam ;
import com.xhpc.databigscreen.mapper.XhpcAppUserMapper ;
@ -103,19 +104,19 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
tenantIdArray = tenantIdsStr . split ( " , " ) ;
tenantIdList = Arrays . stream ( tenantIdArray ) . collect ( Collectors . toList ( ) ) ;
/ / get user count of c client
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId ( tenantIdList ) ;
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId AndCurrentTime ( tenantIdList , null ) ;
List < Long > chargingStationIdList = xhpcChargingStationMapper . selectChargingStationIds ( tenantIdList ) ;
/ / ( 0 C端用户 1 流量方用户 2社区用户 3B端用户 )
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
/ / get user count of c client
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId ( tenantIdList ) ;
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId AndCurrentTime ( tenantIdList , null ) ;
List < Long > chargingStationIdList = xhpcChargingStationMapper . selectChargingStationIds ( tenantIdList ) ;
/ / ( 0 C端用户 1 流量方用户 2社区用户 3B端用户 )
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
}
/ / query charging station infos of whole area
@ -130,9 +131,9 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId ( tenantIdList ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE ) ;
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId AndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
xhpcChargingStationList = xhpcChargingStationMapper . selectByTenantIdAndAreaCode ( tenantIdList , areaCode ) ;
@ -140,9 +141,9 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId ( tenantIdList ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE ) ;
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId AndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType AndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
}
case 2 :
@ -158,9 +159,95 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantId ( tenantIdList ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserType ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE ) ;
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
return R . fail ( " 传入的参数有误 " ) ;
}
default :
R . fail ( " param type is invalid " ) ;
break ;
}
return null ;
}
@Override
public R < Object > queryUserActivation ( CoreParam coreParam ) {
String tenantIdsStr = null ;
List < Map < String , Object > > xhpcChargingStationList = null ;
List < String > tenantIdList = null ;
String [ ] tenantIdArray = null ;
String currentTime = MyDateUtil . getCurrentDateStrInYyyyMmDdHhMmSsFormat ( ) ;
/ / judge care param function
switch ( coreParam . getParamType ( ) ) {
case 0 :
tenantIdsStr = coreParam . getTenantIds ( ) ;
if ( ! " " . equals ( tenantIdsStr ) & & tenantIdsStr ! = null ) {
tenantIdArray = tenantIdsStr . split ( " , " ) ;
tenantIdList = Arrays . stream ( tenantIdArray ) . collect ( Collectors . toList ( ) ) ;
/ / get user count of c client
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , currentTime ) ;
List < Long > chargingStationIdList = xhpcChargingStationMapper . selectChargingStationIds ( tenantIdList ) ;
/ / ( 0 C端用户 1 流量方用户 2社区用户 3B端用户 )
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , currentTime ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , currentTime ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
/ / get user count of c client
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , currentTime ) ;
List < Long > chargingStationIdList = xhpcChargingStationMapper . selectChargingStationIds ( tenantIdList ) ;
/ / ( 0 C端用户 1 流量方用户 2社区用户 3B端用户 )
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , currentTime ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , currentTime ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
}
/ / query charging station infos of whole area
case 1 :
Integer areaCode = coreParam . getAreaCode ( ) ;
tenantIdsStr = coreParam . getTenantIds ( ) ;
if ( ! " " . equals ( tenantIdsStr ) & & tenantIdsStr ! = null ) {
tenantIdArray = tenantIdsStr . split ( " , " ) ;
tenantIdList = Arrays . stream ( tenantIdArray ) . collect ( Collectors . toList ( ) ) ;
xhpcChargingStationList = xhpcChargingStationMapper . selectByTenantIdAndAreaCode ( tenantIdList , areaCode ) ;
ArrayList < Long > chargingStationIdList = new ArrayList < > ( ) ;
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
xhpcChargingStationList = xhpcChargingStationMapper . selectByTenantIdAndAreaCode ( tenantIdList , areaCode ) ;
ArrayList < Long > chargingStationIdList = new ArrayList < > ( ) ;
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
}
case 2 :
/ / query location info of special charging station of special tenant
tenantIdsStr = coreParam . getTenantIds ( ) ;
if ( ! " " . equals ( tenantIdsStr ) & & tenantIdsStr ! = null ) {
tenantIdArray = tenantIdsStr . split ( " , " ) ;
tenantIdList = Arrays . stream ( tenantIdArray ) . collect ( Collectors . toList ( ) ) ;
String chargingStationIdStr = coreParam . getChargingStationIds ( ) ;
long chargingStationId = Long . parseLong ( chargingStationIdStr ) ;
xhpcChargingStationList = xhpcChargingStationMapper . selectByTenantIdAndChargingStationId ( tenantIdList , chargingStationId ) ;
ArrayList < Long > chargingStationIdList = new ArrayList < > ( ) ;
for ( Map < String , Object > chargingStation : xhpcChargingStationList ) {
chargingStationIdList . add ( ( Long ) chargingStation . get ( ConstantClass . CHARGING_STATION_ID ) ) ;
}
Long appUserCount = xhpcAppUserMapper . selectTotalCountByTenantIdAndCurrentTime ( tenantIdList , null ) ;
Long communityUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . COMMUNIT_TYPE , null ) ;
Long customerUserCount = xhpcHistoryOrderMapper . selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime ( tenantIdList , chargingStationIdList , UserTypeUtil . CUSTOMERS_TYPE , null ) ;
return R . ok ( appUserCount + communityUserCount + customerUserCount ) ;
} else {
return R . fail ( " 传入的参数有误 " ) ;