|
|
@ -98,13 +98,14 @@ public class StatsProjectServiceImpl implements StatsProjectService { |
|
|
|
//1:查询各维度表Id,方便使用
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); |
|
|
|
|
|
|
|
//2:根据客户Id查询项目业务表数据(查询当前日期之前的数据不包含当天的)
|
|
|
|
//2:根据客户Id查询项目业务表已结案数据(查询当前日期之前的数据不包含当天的)
|
|
|
|
ProjectEntity projectEntity = new ProjectEntity(); |
|
|
|
projectEntity.setCustomerId(customerId); |
|
|
|
projectEntity.setCreatedTime(yesterDay()); |
|
|
|
projectEntity.setStatus(ProjectConstant.CLOSED); |
|
|
|
List<ProjectEntity> projectList = projectService.getProjectList(projectEntity); |
|
|
|
|
|
|
|
//3:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询当前日期之前的数据不包含当天的)
|
|
|
|
//3:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询当前日期之前的数据不包含当天的)
|
|
|
|
List<ProjectProcessEntity> processList = projectProcessService.getProcessList(projectEntity); |
|
|
|
|
|
|
|
//4:遍历统计每个机关各项指标数
|
|
|
@ -126,56 +127,69 @@ public class StatsProjectServiceImpl implements StatsProjectService { |
|
|
|
}); |
|
|
|
//机关下截止当前日期的项目总数、处理中总数、已结案总数、已结案已解决总数、已结案未解决总数
|
|
|
|
AtomicInteger projectTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger pendingTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger closedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger resolvedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger unResolvedTotal = new AtomicInteger(0); |
|
|
|
//存放当前机关及下级已结案切已解决的项目信息
|
|
|
|
Map resolvedMap = new HashMap<>(); |
|
|
|
//存放当前机关及下级已结案切未解决的项目信息
|
|
|
|
Map unResolvedMap = new HashMap<>(); |
|
|
|
//遍历项目数据,统计不同数据值
|
|
|
|
projectList.forEach(project -> { |
|
|
|
if (map.containsKey(project.getAgencyId())) { |
|
|
|
projectTotal.addAndGet(1); |
|
|
|
if (ProjectConstant.PENDING.equals(project.getStatus())) { |
|
|
|
pendingTotal.addAndGet(1); |
|
|
|
} |
|
|
|
if (ProjectConstant.CLOSED.equals(project.getStatus())) { |
|
|
|
closedTotal.addAndGet(1); |
|
|
|
if (ProjectConstant.RESOLVED.equals(project.getClosedStatus())) { |
|
|
|
resolvedTotal.addAndGet(1); |
|
|
|
resolvedMap.put(project.getAgencyId(), project.getClosedStatus()); |
|
|
|
} |
|
|
|
if (ProjectConstant.UNRESOLVED.equals(project.getClosedStatus())) { |
|
|
|
unResolvedTotal.addAndGet(1); |
|
|
|
unResolvedMap.put(project.getAgencyId(), project.getClosedStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
//日增量中项目总数、处理中总数、已结案总数、已结案已解决总数、已结案未解决总数
|
|
|
|
AtomicInteger pendingIncr = new AtomicInteger(0); |
|
|
|
AtomicInteger projectIncr = new AtomicInteger(0); |
|
|
|
AtomicInteger closedIncr = new AtomicInteger(0); |
|
|
|
AtomicInteger resolvedIncr = new AtomicInteger(0); |
|
|
|
AtomicInteger unResolvedIncr = new AtomicInteger(0); |
|
|
|
//遍历项目进展列表数据,统计日增量数据
|
|
|
|
//存放已结案项目Id,用于统计已结案中已解决未解决数
|
|
|
|
Map<String, String> closeMap = new HashMap<>(); |
|
|
|
//存放前一日已结案项目Id,用于统计日增量中已结案项目的已解决、未解决数量
|
|
|
|
Map<String, String> closeDateMap = new HashMap<>(); |
|
|
|
//遍历进展数据,统计截止当日的项目总量、处理中总量、已结案总量以及日增量中的项目总量、处理中总量、已结案总量
|
|
|
|
processList.forEach(process -> { |
|
|
|
if (map.containsKey(process.getAgencyId()) && date.equals(process.getCreatedTime())) { |
|
|
|
//当前机关及下级
|
|
|
|
if (map.containsKey(process.getAgencyId())) { |
|
|
|
//进展表中是创建项目状态的数据总数即为客户该机关下项目总数
|
|
|
|
if (ProjectConstant.CREATED.equals(process.getOperation())) { |
|
|
|
pendingIncr.addAndGet(1); |
|
|
|
projectTotal.addAndGet(1); |
|
|
|
if (date.equals(process.getCreatedTime())) { |
|
|
|
//日增量总数
|
|
|
|
projectIncr.addAndGet(1); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ProjectConstant.CLOSE.equals(process.getOperation())) { |
|
|
|
closedIncr.addAndGet(1); |
|
|
|
} |
|
|
|
if (resolvedMap.containsKey(process.getAgencyId())) { |
|
|
|
resolvedIncr.addAndGet(1); |
|
|
|
//截止当前日期的结案总数
|
|
|
|
closedTotal.addAndGet(1); |
|
|
|
closeMap.put(process.getProjectId(), process.getProjectId()); |
|
|
|
if (date.equals(process.getCreatedTime())) { |
|
|
|
//日增量已结案总数
|
|
|
|
closedIncr.addAndGet(1); |
|
|
|
closeDateMap.put(process.getProjectId(), process.getProjectId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (unResolvedMap.containsKey(process.getAgencyId())) { |
|
|
|
unResolvedIncr.addAndGet(1); |
|
|
|
} |
|
|
|
}); |
|
|
|
//遍历项目业务数据,统计截止当日的已结案已解决总量、已结案未解决总量以及日增量中的已结案已解决总量、已结案未解决总量
|
|
|
|
projectList.forEach(project -> { |
|
|
|
//当前机关及下级
|
|
|
|
if (map.containsKey(project.getAgencyId())) { |
|
|
|
if (closeMap.containsKey(project.getId())) { |
|
|
|
//已结案已解决
|
|
|
|
if (ProjectConstant.RESOLVED.equals(project.getClosedStatus())) { |
|
|
|
//截止当日的已结案已解决总量
|
|
|
|
resolvedTotal.addAndGet(1); |
|
|
|
if (closeDateMap.containsKey(project.getId())) { |
|
|
|
//日增量中的已结案已解决总量
|
|
|
|
resolvedIncr.addAndGet(1); |
|
|
|
} |
|
|
|
} |
|
|
|
//已结案未解决
|
|
|
|
if (ProjectConstant.UNRESOLVED.equals(project.getClosedStatus())) { |
|
|
|
//截止当日的已结案未解决总量
|
|
|
|
unResolvedTotal.addAndGet(1); |
|
|
|
if (closeDateMap.containsKey(project.getId())) { |
|
|
|
//日增量中的已结案未解决总量
|
|
|
|
unResolvedIncr.addAndGet(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//封装日数据对象
|
|
|
|
FactAgencyProjectDailyEntity agencyDailyEntity = new FactAgencyProjectDailyEntity(); |
|
|
|
agencyDailyEntity.setCustomerId(customerId); |
|
|
@ -186,20 +200,20 @@ public class StatsProjectServiceImpl implements StatsProjectService { |
|
|
|
agencyDailyEntity.setMonthId(dimId.getMonthId()); |
|
|
|
agencyDailyEntity.setYearId(dimId.getYearId()); |
|
|
|
agencyDailyEntity.setProjectTotal(projectTotal.intValue()); |
|
|
|
agencyDailyEntity.setPendingTotal(pendingTotal.intValue()); |
|
|
|
agencyDailyEntity.setPendingTotal(projectTotal.intValue() - closedTotal.intValue()); |
|
|
|
agencyDailyEntity.setClosedTotal(closedTotal.intValue()); |
|
|
|
agencyDailyEntity.setResolvedTotal(resolvedTotal.intValue()); |
|
|
|
agencyDailyEntity.setUnresolvedTotal(unResolvedTotal.intValue()); |
|
|
|
if (projectTotal.intValue() > NumConstant.ZERO) { |
|
|
|
agencyDailyEntity.setPendingRatio(new BigDecimal(numberFormat.format((float) pendingTotal.intValue() / (float) projectTotal.intValue() * 100))); |
|
|
|
agencyDailyEntity.setPendingRatio(new BigDecimal(numberFormat.format((float) agencyDailyEntity.getPendingTotal() / (float) projectTotal.intValue() * 100))); |
|
|
|
agencyDailyEntity.setClosedRatio(new BigDecimal(numberFormat.format((float) closedTotal.intValue() / (float) projectTotal.intValue() * 100))); |
|
|
|
} |
|
|
|
if (closedTotal.intValue() > NumConstant.ZERO) { |
|
|
|
agencyDailyEntity.setResolvedRatio(new BigDecimal(numberFormat.format((float) resolvedTotal.intValue() / (float) closedTotal.intValue() * 100))); |
|
|
|
agencyDailyEntity.setUnresolvedRatio(new BigDecimal(numberFormat.format((float) unResolvedTotal.intValue() / (float) closedTotal.intValue() * 100))); |
|
|
|
} |
|
|
|
agencyDailyEntity.setProjectIncr(pendingIncr.intValue() + closedIncr.intValue()); |
|
|
|
agencyDailyEntity.setPendingIncr(pendingIncr.intValue()); |
|
|
|
agencyDailyEntity.setProjectIncr(projectIncr.intValue()); |
|
|
|
agencyDailyEntity.setPendingIncr(projectIncr.intValue() - closedIncr.intValue()); |
|
|
|
agencyDailyEntity.setClosedIncr(closedIncr.intValue()); |
|
|
|
agencyDailyEntity.setResolvedIncr(resolvedIncr.intValue()); |
|
|
|
agencyDailyEntity.setUnresolvedIncr(unResolvedIncr.intValue()); |
|
|
@ -330,7 +344,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { |
|
|
|
//1:查询各维度表Id,方便使用
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); |
|
|
|
|
|
|
|
//2:根据客户Id查询项目业务表数据(查询当前日期之前的数据不包含当天的)
|
|
|
|
//2:根据客户Id查询项目业务表已结案数据(查询当前日期之前的数据不包含当天的)
|
|
|
|
ProjectEntity projectEntity = new ProjectEntity(); |
|
|
|
projectEntity.setCustomerId(customerId); |
|
|
|
projectEntity.setCreatedTime(yesterDay()); |
|
|
|