| 
						
						
							
								
							
						
						
					 | 
					@ -20,6 +20,7 @@ import com.epmet.service.project.ProjectService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.*; | 
					 | 
					 | 
					import com.epmet.service.stats.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import oracle.sql.DATE; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.scheduling.annotation.Async; | 
					 | 
					 | 
					import org.springframework.scheduling.annotation.Async; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -66,6 +67,28 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								//获取当前日期前一天
 | 
					 | 
					 | 
								//获取当前日期前一天
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								Date date = DateUtils.getBeforeDay(new Date()); | 
					 | 
					 | 
								Date date = DateUtils.getBeforeDay(new Date()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); | 
					 | 
					 | 
								customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								if (!CollectionUtils.isEmpty(customerIdList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
									for (String customerId : customerIdList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										//遍历统计每一个客户数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
											customerStats(customerId, date); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										} catch(Exception e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
											log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", customerId, DateUtils.format(date), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
													e.getMessage())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
									} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						@Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						public void agencyGridIssueStatsOfDate(Date date) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							int pageNo = 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							int pageSize = 100; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							List<String> customerIdList = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							do { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								//获取当前日期前一天
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								if (!CollectionUtils.isEmpty(customerIdList)) { | 
					 | 
					 | 
								if (!CollectionUtils.isEmpty(customerIdList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									for (String customerId : customerIdList) { | 
					 | 
					 | 
									for (String customerId : customerIdList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										//遍历统计每一个客户数据
 | 
					 | 
					 | 
										//遍历统计每一个客户数据
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -109,7 +132,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取当前客户下所有机关
 | 
					 | 
					 | 
							//获取当前客户下所有机关
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); | 
					 | 
					 | 
							List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取机关下议题各种状态的数目统计
 | 
					 | 
					 | 
							//获取机关下议题各种状态的数目统计
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); | 
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							//获取机关下议题各种状态的数目增量
 | 
					 | 
					 | 
							//获取机关下议题各种状态的数目增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); | 
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取机关下已关闭议题统计
 | 
					 | 
					 | 
							//获取机关下已关闭议题统计
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -129,10 +152,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								entity.setPid(agency.getPid()); | 
					 | 
					 | 
								entity.setPid(agency.getPid()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								String pIds; | 
					 | 
					 | 
								String pIds; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
								if (null == agency.getPids() || agency.getPids().isEmpty()) { | 
					 | 
					 | 
								if (NumConstant.ZERO_STR.equals(agency.getPid())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
									pIds = agency.getPid().concat(":").concat(agency.getId()); | 
					 | 
					 | 
									pIds = agency.getPid(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								} else { | 
					 | 
					 | 
								} else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
									pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); | 
					 | 
					 | 
									pIds = agency.getPids().concat(":").concat(agency.getId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								} | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								//总量统计
 | 
					 | 
					 | 
								//总量统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								saveTotal(issueAgencyTotalList, agency, entity, pIds); | 
					 | 
					 | 
								saveTotal(issueAgencyTotalList, agency, entity, pIds); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -172,7 +195,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取当前客户下所有机关
 | 
					 | 
					 | 
							//获取当前客户下所有机关
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); | 
					 | 
					 | 
							List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取机关下议题各种状态的数目统计
 | 
					 | 
					 | 
							//获取机关下议题各种状态的数目统计
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); | 
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							//获取机关下已关闭议题统计
 | 
					 | 
					 | 
							//获取机关下已关闭议题统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); | 
					 | 
					 | 
							List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//已结案项目统计
 | 
					 | 
					 | 
							//已结案项目统计
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -185,10 +208,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); | 
					 | 
					 | 
								FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								String pIds; | 
					 | 
					 | 
								String pIds; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
								if (null == agency.getPids() || agency.getPids().isEmpty()) { | 
					 | 
					 | 
								if (NumConstant.ZERO_STR.equals(agency.getPid())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
									pIds = agency.getPid().concat(":").concat(agency.getId()); | 
					 | 
					 | 
									pIds = agency.getPid(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								} else { | 
					 | 
					 | 
								} else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
									pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); | 
					 | 
					 | 
									pIds = agency.getPids().concat(":").concat(agency.getId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								} | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								//总量统计
 | 
					 | 
					 | 
								//总量统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								saveTotal(issueAgencyTotalList, agency, daily, pIds); | 
					 | 
					 | 
								saveTotal(issueAgencyTotalList, agency, daily, pIds); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -550,6 +573,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							int shiftInc = NumConstant.ZERO; | 
					 | 
					 | 
							int shiftInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//已关闭增量
 | 
					 | 
					 | 
							//已关闭增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							int closedInc = NumConstant.ZERO; | 
					 | 
					 | 
							int closedInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							//议题增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							int issueInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							for (IssueGridDTO dto : list) { | 
					 | 
					 | 
							for (IssueGridDTO dto : list) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								if (grid.getId().equals(dto.getGridId())) { | 
					 | 
					 | 
								if (grid.getId().equals(dto.getGridId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									if (IssueConstant.VOTING.equals(dto.getStatus())) { | 
					 | 
					 | 
									if (IssueConstant.VOTING.equals(dto.getStatus())) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -558,13 +583,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									} else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { | 
					 | 
					 | 
									} else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										//已转项目议题数量
 | 
					 | 
					 | 
										//已转项目议题数量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										shiftInc = dto.getCount(); | 
					 | 
					 | 
										shiftInc = dto.getCount(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
									} else { | 
					 | 
					 | 
									} else if(IssueConstant.CLOSED.equals(dto.getStatus())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
										//已关闭议题数量
 | 
					 | 
					 | 
										//已关闭议题数量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										closedInc = dto.getCount(); | 
					 | 
					 | 
										closedInc = dto.getCount(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
									} else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										issueInc = dto.getCount(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									} | 
					 | 
					 | 
									} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								} | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							int issueInc = votingInc + shiftInc + closedInc; | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							entity.setVotingIncr(votingInc); | 
					 | 
					 | 
							entity.setVotingIncr(votingInc); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							entity.setShiftProjectIncr(shiftInc); | 
					 | 
					 | 
							entity.setShiftProjectIncr(shiftInc); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							entity.setClosedIncr(closedInc); | 
					 | 
					 | 
							entity.setClosedIncr(closedInc); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -712,6 +739,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							int shiftInc = NumConstant.ZERO; | 
					 | 
					 | 
							int shiftInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//已关闭增量
 | 
					 | 
					 | 
							//已关闭增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							int closedInc = NumConstant.ZERO; | 
					 | 
					 | 
							int closedInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							//议题增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							int issueInc = NumConstant.ZERO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							for (IssueAgencyDTO issueAgency : list) { | 
					 | 
					 | 
							for (IssueAgencyDTO issueAgency : list) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { | 
					 | 
					 | 
								if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { | 
					 | 
					 | 
									if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -720,13 +749,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									} else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { | 
					 | 
					 | 
									} else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										//已转项目议题数量
 | 
					 | 
					 | 
										//已转项目议题数量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										shiftInc = shiftInc + issueAgency.getCount(); | 
					 | 
					 | 
										shiftInc = shiftInc + issueAgency.getCount(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
									} else { | 
					 | 
					 | 
									} else if(IssueConstant.CLOSED.equals(issueAgency.getStatus())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
										//已关闭议题数量
 | 
					 | 
					 | 
										//已关闭议题数量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
										closedInc = closedInc + issueAgency.getCount(); | 
					 | 
					 | 
										closedInc = closedInc + issueAgency.getCount(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
									} else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										//议题增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
										issueInc = issueInc + issueAgency.getCount(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									} | 
					 | 
					 | 
									} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								} | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							int issueInc = votingInc + shiftInc + closedInc; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							entity.setVotingIncr(votingInc); | 
					 | 
					 | 
							entity.setVotingIncr(votingInc); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							entity.setShiftProjectIncr(shiftInc); | 
					 | 
					 | 
							entity.setShiftProjectIncr(shiftInc); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							entity.setClosedIncr(closedInc); | 
					 | 
					 | 
							entity.setClosedIncr(closedInc); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |