|
|
@ -48,7 +48,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
@Override |
|
|
|
public UserStatisticalData traverseAgencyUser(List<AgencySubTreeDto> agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) { |
|
|
|
if(null == agencies || agencies.size() == NumConstant.ZERO){ |
|
|
|
logger.warn("没有相应的机关集合"); |
|
|
|
logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
@ -90,7 +90,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
@Override |
|
|
|
public UserStatisticalData traverseGridUser(List<AgencySubTreeDto> agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) { |
|
|
|
if(null == agencies || agencies.size() == NumConstant.ZERO){ |
|
|
|
logger.warn("没有相应的机关集合"); |
|
|
|
logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
@ -184,15 +184,15 @@ public class UserServiceImpl implements UserService { |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.SIX); |
|
|
|
|
|
|
|
Boolean isMonthEnd = false; |
|
|
|
Boolean isMonthBeginning = true; |
|
|
|
Calendar calendar =Calendar.getInstance(); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.add(Calendar.DATE, NumConstant.ONE_NEG); |
|
|
|
Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate; |
|
|
|
|
|
|
|
calendar.setTime(targetDateCheck); |
|
|
|
//如果目标日期是当月的最后一天
|
|
|
|
if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){ |
|
|
|
//如果目标日期不是是当月的第一天
|
|
|
|
if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){ |
|
|
|
//求出这个月的第一天
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE); |
|
|
@ -200,7 +200,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
calendar.set(Calendar.MINUTE, NumConstant.ZERO); |
|
|
|
calendar.set(Calendar.SECOND, NumConstant.ZERO); |
|
|
|
|
|
|
|
isMonthEnd = true; |
|
|
|
isMonthBeginning = false; |
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){ |
|
|
@ -297,10 +297,68 @@ public class UserServiceImpl implements UserService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//月末处理
|
|
|
|
if(isMonthEnd){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO(); |
|
|
|
regAgencyM.setCustomerId(customerId); |
|
|
|
regAgencyM.setAgencyId(agencyId); |
|
|
|
regAgencyM.setMonthId(timeDimension.getMonthId()); |
|
|
|
regAgencyM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
regAgencyM.setYearId(timeDimension.getYearId()); |
|
|
|
regAgencyM.setRegTotal(regData.getTotal()); |
|
|
|
regAgencyM.setResiTotal(regData.getTotal()); |
|
|
|
regAgencyM.setWarmHeartedTotal(warmRegData.getTotal()); |
|
|
|
regAgencyM.setPartymemberTotal(partyRegData.getTotal()); |
|
|
|
regAgencyM.setRegIncr(regData.getIncr()); |
|
|
|
regAgencyM.setWarmIncr(warmRegData.getIncr()); |
|
|
|
regAgencyM.setPartymemberIncr(partiData.getIncr()); |
|
|
|
regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion()); |
|
|
|
regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion()); |
|
|
|
regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO(); |
|
|
|
partiAgencyM.setCustomerId(customerId); |
|
|
|
partiAgencyM.setAgencyId(agencyId); |
|
|
|
partiAgencyM.setMonthId(timeDimension.getMonthId()); |
|
|
|
partiAgencyM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
partiAgencyM.setYearId(timeDimension.getYearId()); |
|
|
|
partiAgencyM.setRegTotal(partiData.getTotal()); |
|
|
|
partiAgencyM.setResiTotal(partiData.getTotal()); |
|
|
|
partiAgencyM.setWarmHeartedTotal(warmPartiData.getTotal()); |
|
|
|
partiAgencyM.setPartymemberTotal(partyPartiData.getTotal()); |
|
|
|
partiAgencyM.setRegIncr(partiData.getIncr()); |
|
|
|
partiAgencyM.setWarmIncr(warmPartiData.getIncr()); |
|
|
|
partiAgencyM.setPartymemberIncr(partyPartiData.getIncr()); |
|
|
|
partiAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion()); |
|
|
|
partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); |
|
|
|
partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果是月初第一天,不再做日期区间查询
|
|
|
|
if(isMonthBeginning) { |
|
|
|
if (null == dataPacket.getRegAgencyMonthlyList()) { |
|
|
|
List<FactRegUserAgencyMonthlyDTO> list = new LinkedList<>(); |
|
|
|
list.add(regAgencyM); |
|
|
|
dataPacket.setRegAgencyMonthlyList(list); |
|
|
|
} else { |
|
|
|
dataPacket.getRegAgencyMonthlyList().add(regAgencyM); |
|
|
|
} |
|
|
|
if (null == dataPacket.getPartiAgencyMonthlyList()) { |
|
|
|
List<FactParticipationUserAgencyMonthlyDTO> list = new LinkedList<>(); |
|
|
|
list.add(partiAgencyM); |
|
|
|
dataPacket.setPartiAgencyMonthlyList(list); |
|
|
|
} else { |
|
|
|
dataPacket.getPartiAgencyMonthlyList().add(partiAgencyM); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//如果不是月初第一天
|
|
|
|
|
|
|
|
//本月注册用户增长数
|
|
|
|
Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); |
|
|
|
//本月新增注册用户Id集合
|
|
|
@ -321,23 +379,10 @@ public class UserServiceImpl implements UserService { |
|
|
|
Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,gridIds,calendar.getTime(),targetDateCheck); |
|
|
|
|
|
|
|
|
|
|
|
FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO(); |
|
|
|
regAgencyM.setCustomerId(customerId); |
|
|
|
regAgencyM.setAgencyId(agencyId); |
|
|
|
regAgencyM.setMonthId(timeDimension.getMonthId()); |
|
|
|
regAgencyM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
regAgencyM.setYearId(timeDimension.getYearId()); |
|
|
|
regAgencyM.setRegTotal(regData.getTotal()); |
|
|
|
regAgencyM.setResiTotal(regData.getTotal()); |
|
|
|
regAgencyM.setWarmHeartedTotal(warmRegData.getTotal()); |
|
|
|
regAgencyM.setPartymemberTotal(partyRegData.getTotal()); |
|
|
|
|
|
|
|
regAgencyM.setRegIncr(regIncrMonthly); |
|
|
|
regAgencyM.setWarmIncr(incrWarmOfRegMonthly); |
|
|
|
regAgencyM.setPartymemberIncr(incrPartyOfRegMonthly); |
|
|
|
regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion()); |
|
|
|
regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion()); |
|
|
|
regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
if(null == dataPacket.getRegAgencyMonthlyList()){ |
|
|
|
List<FactRegUserAgencyMonthlyDTO> list = new LinkedList<>(); |
|
|
|
list.add(regAgencyM); |
|
|
@ -347,23 +392,10 @@ public class UserServiceImpl implements UserService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO(); |
|
|
|
partiAgencyM.setCustomerId(customerId); |
|
|
|
partiAgencyM.setAgencyId(agencyId); |
|
|
|
partiAgencyM.setMonthId(timeDimension.getMonthId()); |
|
|
|
partiAgencyM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
partiAgencyM.setYearId(timeDimension.getYearId()); |
|
|
|
partiAgencyM.setRegTotal(partiData.getTotal()); |
|
|
|
partiAgencyM.setResiTotal(partiData.getTotal()); |
|
|
|
partiAgencyM.setWarmHeartedTotal(warmPartiData.getTotal()); |
|
|
|
partiAgencyM.setPartymemberTotal(partyPartiData.getTotal()); |
|
|
|
|
|
|
|
partiAgencyM.setRegIncr(partiIncrMonthly); |
|
|
|
partiAgencyM.setWarmIncr(incrWarmOfPartiMonthly); |
|
|
|
partiAgencyM.setPartymemberIncr(incrPartyOfPartiMonthly); |
|
|
|
partiAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion()); |
|
|
|
partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); |
|
|
|
partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
if(null == dataPacket.getPartiAgencyMonthlyList()){ |
|
|
|
List<FactParticipationUserAgencyMonthlyDTO> list = new LinkedList<>(); |
|
|
|
list.add(partiAgencyM); |
|
|
@ -381,7 +413,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
|
|
|
|
Set<String> singleGridIdSet = new HashSet<>(); |
|
|
|
final boolean monthEndFlag = isMonthEnd; |
|
|
|
final boolean monthBeginningFlag = isMonthBeginning; |
|
|
|
//grid
|
|
|
|
gridIds.forEach(gridId -> { |
|
|
|
|
|
|
@ -486,7 +518,68 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(monthEndFlag){ |
|
|
|
FactRegUserGridMonthlyDTO regGridM = new FactRegUserGridMonthlyDTO(); |
|
|
|
regGridM.setCustomerId(customerId); |
|
|
|
regGridM.setAgencyId(agencyId); |
|
|
|
regGridM.setGridId(gridId); |
|
|
|
regGridM.setMonthId(timeDimension.getMonthId()); |
|
|
|
regGridM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
regGridM.setYearId(timeDimension.getYearId()); |
|
|
|
regGridM.setRegTotal(regData.getTotal()); |
|
|
|
regGridM.setResiTotal(regData.getTotal()); |
|
|
|
regGridM.setWarmHeartedTotal(warmRegData.getTotal()); |
|
|
|
regGridM.setPartymemberTotal(partyRegData.getTotal()); |
|
|
|
regGridM.setRegIncr(regData.getIncr()); |
|
|
|
regGridM.setWarmIncr(warmRegData.getIncr()); |
|
|
|
regGridM.setPartymemberIncr(partyRegData.getIncr()); |
|
|
|
regGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
regGridM.setPartymemberProportion(regGridD.getPartymemberProportion()); |
|
|
|
regGridM.setWarmHeartedProportion(regGridD.getWarmHeartedProportion()); |
|
|
|
regGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
|
|
|
|
FactParticipationUserGridMonthlyDTO partiGridM = new FactParticipationUserGridMonthlyDTO(); |
|
|
|
partiGridM.setCustomerId(customerId); |
|
|
|
partiGridM.setAgencyId(agencyId); |
|
|
|
partiGridM.setGridId(gridId); |
|
|
|
partiGridM.setMonthId(timeDimension.getMonthId()); |
|
|
|
partiGridM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
partiGridM.setYearId(timeDimension.getYearId()); |
|
|
|
partiGridM.setRegTotal(partiData.getTotal()); |
|
|
|
partiGridM.setResiTotal(partiData.getTotal()); |
|
|
|
partiGridM.setWarmHeartedTotal(warmPartiData.getTotal()); |
|
|
|
partiGridM.setPartymemberTotal(partyPartiData.getTotal()); |
|
|
|
partiGridM.setRegIncr(partiData.getIncr()); |
|
|
|
partiGridM.setWarmIncr(warmPartiData.getIncr()); |
|
|
|
partiGridM.setPartymemberIncr(partyPartiData.getIncr()); |
|
|
|
partiGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
partiGridM.setPartymemberProportion(partiGridD.getPartymemberProportion()); |
|
|
|
partiGridM.setWarmHeartedProportion(partiGridD.getWarmHeartedProportion()); |
|
|
|
partiGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果是月初第一天,不再做日期区间查询
|
|
|
|
if(monthBeginningFlag){ |
|
|
|
if(null != dataPacket.getRegGridMonthlyList()){ |
|
|
|
dataPacket.getRegGridMonthlyList().add(regGridM); |
|
|
|
}else{ |
|
|
|
List<FactRegUserGridMonthlyDTO> list = new ArrayList<>(); |
|
|
|
list.add(regGridM); |
|
|
|
dataPacket.setRegGridMonthlyList(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(null != dataPacket.getPartiGridMonthlyList()){ |
|
|
|
dataPacket.getPartiGridMonthlyList().add(partiGridM); |
|
|
|
}else{ |
|
|
|
List<FactParticipationUserGridMonthlyDTO> list = new ArrayList<>(); |
|
|
|
list.add(partiGridM); |
|
|
|
dataPacket.setPartiGridMonthlyList(list); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
//本月注册用户增长数
|
|
|
|
Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,calendar.getTime(),targetDateCheck); |
|
|
|
//本月新增注册用户Id集合
|
|
|
@ -506,24 +599,11 @@ public class UserServiceImpl implements UserService { |
|
|
|
//本月新增热心居民数(参与用户)
|
|
|
|
Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,singleGridIdSet,calendar.getTime(),targetDateCheck); |
|
|
|
|
|
|
|
FactRegUserGridMonthlyDTO regGridM = new FactRegUserGridMonthlyDTO(); |
|
|
|
regGridM.setCustomerId(customerId); |
|
|
|
regGridM.setAgencyId(agencyId); |
|
|
|
regGridM.setGridId(gridId); |
|
|
|
regGridM.setMonthId(timeDimension.getMonthId()); |
|
|
|
regGridM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
regGridM.setYearId(timeDimension.getYearId()); |
|
|
|
regGridM.setRegTotal(regData.getTotal()); |
|
|
|
regGridM.setResiTotal(regData.getTotal()); |
|
|
|
regGridM.setWarmHeartedTotal(warmRegData.getTotal()); |
|
|
|
regGridM.setPartymemberTotal(partyRegData.getTotal()); |
|
|
|
|
|
|
|
regGridM.setRegIncr(regIncrMonthly); |
|
|
|
regGridM.setWarmIncr(incrWarmOfRegMonthly); |
|
|
|
regGridM.setPartymemberIncr(incrPartyOfRegMonthly); |
|
|
|
regGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
regGridM.setPartymemberProportion(regGridD.getPartymemberProportion()); |
|
|
|
regGridM.setWarmHeartedProportion(regGridD.getWarmHeartedProportion()); |
|
|
|
regGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
if(null != dataPacket.getRegGridMonthlyList()){ |
|
|
|
dataPacket.getRegGridMonthlyList().add(regGridM); |
|
|
|
}else{ |
|
|
@ -532,24 +612,11 @@ public class UserServiceImpl implements UserService { |
|
|
|
dataPacket.setRegGridMonthlyList(list); |
|
|
|
} |
|
|
|
|
|
|
|
FactParticipationUserGridMonthlyDTO partiGridM = new FactParticipationUserGridMonthlyDTO(); |
|
|
|
partiGridM.setCustomerId(customerId); |
|
|
|
partiGridM.setAgencyId(agencyId); |
|
|
|
partiGridM.setGridId(gridId); |
|
|
|
partiGridM.setMonthId(timeDimension.getMonthId()); |
|
|
|
partiGridM.setQuarterId(timeDimension.getQuarterId()); |
|
|
|
partiGridM.setYearId(timeDimension.getYearId()); |
|
|
|
partiGridM.setRegTotal(partiData.getTotal()); |
|
|
|
partiGridM.setResiTotal(partiData.getTotal()); |
|
|
|
partiGridM.setWarmHeartedTotal(warmPartiData.getTotal()); |
|
|
|
partiGridM.setPartymemberTotal(partyPartiData.getTotal()); |
|
|
|
|
|
|
|
partiGridM.setRegIncr(partiIncrMonthly); |
|
|
|
partiGridM.setWarmIncr(incrWarmOfPartiMonthly); |
|
|
|
partiGridM.setPartymemberIncr(incrPartyOfPartiMonthly); |
|
|
|
partiGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); |
|
|
|
partiGridM.setPartymemberProportion(partiGridD.getPartymemberProportion()); |
|
|
|
partiGridM.setWarmHeartedProportion(partiGridD.getWarmHeartedProportion()); |
|
|
|
partiGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); |
|
|
|
|
|
|
|
if(null != dataPacket.getPartiGridMonthlyList()){ |
|
|
|
dataPacket.getPartiGridMonthlyList().add(partiGridM); |
|
|
|
}else{ |
|
|
@ -568,7 +635,6 @@ public class UserServiceImpl implements UserService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -592,12 +658,4 @@ public class UserServiceImpl implements UserService { |
|
|
|
System.out.println(format.format(calendar.getTime())); |
|
|
|
System.out.println(format2.format(calendar.getTime())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 先查出所有的用户单位时间内新增的注册居民、党员、热心居民(跟随网格),然后查出单位时间内,每一个网格下的参与用户Id集合和注册用户Id集合 |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.23 00:32 |
|
|
|
**/ |
|
|
|
} |
|
|
|