|
|
@ -20,6 +20,7 @@ import com.epmet.service.project.ProjectService; |
|
|
|
import com.epmet.service.stats.*; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import oracle.sql.DATE; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -66,6 +67,28 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
//获取当前日期前一天
|
|
|
|
Date date = DateUtils.getBeforeDay(new Date()); |
|
|
|
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)) { |
|
|
|
for (String customerId : customerIdList) { |
|
|
|
//遍历统计每一个客户数据
|
|
|
@ -109,7 +132,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
//获取当前客户下所有机关
|
|
|
|
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); |
|
|
|
//获取机关下已关闭议题统计
|
|
|
@ -129,10 +152,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
entity.setPid(agency.getPid()); |
|
|
|
|
|
|
|
String pIds; |
|
|
|
if (null == agency.getPids() || agency.getPids().isEmpty()) { |
|
|
|
pIds = agency.getPid().concat(":").concat(agency.getId()); |
|
|
|
if (NumConstant.ZERO_STR.equals(agency.getPid())) { |
|
|
|
pIds = agency.getPid(); |
|
|
|
} else { |
|
|
|
pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); |
|
|
|
pIds = agency.getPids().concat(":").concat(agency.getId()); |
|
|
|
} |
|
|
|
//总量统计
|
|
|
|
saveTotal(issueAgencyTotalList, agency, entity, pIds); |
|
|
@ -172,7 +195,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
//获取当前客户下所有机关
|
|
|
|
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); |
|
|
|
//已结案项目统计
|
|
|
@ -185,10 +208,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); |
|
|
|
|
|
|
|
String pIds; |
|
|
|
if (null == agency.getPids() || agency.getPids().isEmpty()) { |
|
|
|
pIds = agency.getPid().concat(":").concat(agency.getId()); |
|
|
|
if (NumConstant.ZERO_STR.equals(agency.getPid())) { |
|
|
|
pIds = agency.getPid(); |
|
|
|
} else { |
|
|
|
pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); |
|
|
|
pIds = agency.getPids().concat(":").concat(agency.getId()); |
|
|
|
} |
|
|
|
//总量统计
|
|
|
|
saveTotal(issueAgencyTotalList, agency, daily, pIds); |
|
|
@ -269,8 +292,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
Map<String, List<IssueProjectDTO>> totalMap = |
|
|
|
totalList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); |
|
|
|
List<IssueProjectDTO> resolveList = totalMap.get(IssueConstant.RESLOVED); |
|
|
|
List<IssueProjectDTO> unResolveList = totalMap.get(IssueConstant.UNRESLOVED); |
|
|
|
List<IssueProjectDTO> resolveList = totalMap.get(IssueConstant.RESOLVED); |
|
|
|
List<IssueProjectDTO> unResolveList = totalMap.get(IssueConstant.UNRESOLVED); |
|
|
|
if (null != resolveList) { |
|
|
|
resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
} |
|
|
@ -289,8 +312,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
Map<String, List<IssueProjectDTO>> incMap = |
|
|
|
incList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); |
|
|
|
List<IssueProjectDTO> resolveIncList = incMap.get(IssueConstant.RESLOVED); |
|
|
|
List<IssueProjectDTO> unResolveIncList = incMap.get(IssueConstant.UNRESLOVED); |
|
|
|
List<IssueProjectDTO> resolveIncList = incMap.get(IssueConstant.RESOLVED); |
|
|
|
List<IssueProjectDTO> unResolveIncList = incMap.get(IssueConstant.UNRESOLVED); |
|
|
|
if (null != resolveIncList) { |
|
|
|
resolveIncMap = resolveIncList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
} |
|
|
@ -363,8 +386,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
Map<String, List<IssueProjectDTO>> totalMap = |
|
|
|
totalList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); |
|
|
|
List<IssueProjectDTO> resolveList = totalMap.get(IssueConstant.RESLOVED); |
|
|
|
List<IssueProjectDTO> unResolveList = totalMap.get(IssueConstant.UNRESLOVED); |
|
|
|
List<IssueProjectDTO> resolveList = totalMap.get(IssueConstant.RESOLVED); |
|
|
|
List<IssueProjectDTO> unResolveList = totalMap.get(IssueConstant.UNRESOLVED); |
|
|
|
if (null != resolveList) { |
|
|
|
resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
} |
|
|
@ -482,10 +505,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.RESLOVED.equals(dto.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(dto.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedInc = dto.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(dto.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedInc = dto.getCount(); |
|
|
|
} |
|
|
@ -513,10 +536,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.RESLOVED.equals(dto.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(dto.getStatus())) { |
|
|
|
//已解决议题数量
|
|
|
|
resolvedCount = dto.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(dto.getStatus())) { |
|
|
|
//未解决议题数量
|
|
|
|
unresolvedCount = dto.getCount(); |
|
|
|
} |
|
|
@ -550,6 +573,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
int shiftInc = NumConstant.ZERO; |
|
|
|
//已关闭增量
|
|
|
|
int closedInc = NumConstant.ZERO; |
|
|
|
//议题增量
|
|
|
|
int issueInc = NumConstant.ZERO; |
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.VOTING.equals(dto.getStatus())) { |
|
|
@ -558,17 +583,16 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
shiftInc = dto.getCount(); |
|
|
|
} else { |
|
|
|
} else if(IssueConstant.CLOSED.equals(dto.getStatus())) { |
|
|
|
//已关闭议题数量
|
|
|
|
closedInc = dto.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int issueInc = votingInc + shiftInc + closedInc; |
|
|
|
entity.setVotingIncr(votingInc); |
|
|
|
entity.setShiftProjectIncr(shiftInc); |
|
|
|
entity.setClosedIncr(closedInc); |
|
|
|
entity.setIssueIncr(issueInc); |
|
|
|
entity.setIssueIncr(votingInc); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -638,10 +662,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (ProjectAgencyDTO project : list) { |
|
|
|
if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { |
|
|
|
if (IssueConstant.RESLOVED.equals(project.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(project.getStatus())) { |
|
|
|
//已解决数量
|
|
|
|
resolvedCount = resolvedCount + project.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(project.getStatus())) { |
|
|
|
//未解决数量
|
|
|
|
unresolvedCount = unresolvedCount + project.getCount(); |
|
|
|
} |
|
|
@ -672,10 +696,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (ProjectAgencyDTO project : list) { |
|
|
|
if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { |
|
|
|
if (IssueConstant.RESLOVED.equals(project.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(project.getStatus())) { |
|
|
|
//已解决数量
|
|
|
|
resolvedCount = resolvedCount + project.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(project.getStatus())) { |
|
|
|
//未解决数量
|
|
|
|
unresolvedCount = unresolvedCount + project.getCount(); |
|
|
|
} |
|
|
@ -712,6 +736,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
int shiftInc = NumConstant.ZERO; |
|
|
|
//已关闭增量
|
|
|
|
int closedInc = NumConstant.ZERO; |
|
|
|
//议题增量
|
|
|
|
int issueInc = NumConstant.ZERO; |
|
|
|
for (IssueAgencyDTO issueAgency : list) { |
|
|
|
if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { |
|
|
|
if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { |
|
|
@ -720,17 +746,16 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
shiftInc = shiftInc + issueAgency.getCount(); |
|
|
|
} else { |
|
|
|
} else if(IssueConstant.CLOSED.equals(issueAgency.getStatus())) { |
|
|
|
//已关闭议题数量
|
|
|
|
closedInc = closedInc + issueAgency.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int issueInc = votingInc + shiftInc + closedInc; |
|
|
|
entity.setVotingIncr(votingInc); |
|
|
|
entity.setShiftProjectIncr(shiftInc); |
|
|
|
entity.setClosedIncr(closedInc); |
|
|
|
entity.setIssueIncr(issueInc); |
|
|
|
entity.setIssueIncr(votingInc); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -802,10 +827,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (IssueAgencyDTO issueAgency : list) { |
|
|
|
if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { |
|
|
|
if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(issueAgency.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedCount = resolvedCount + issueAgency.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(issueAgency.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedCount = unresolvedCount + issueAgency.getCount(); |
|
|
|
} |
|
|
@ -841,10 +866,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
for (IssueAgencyDTO issueAgency : list) { |
|
|
|
if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { |
|
|
|
if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
if (IssueConstant.RESOLVED.equals(issueAgency.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedInc = resolvedInc + issueAgency.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESOLVED.equals(issueAgency.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedInc = unresolvedInc + issueAgency.getCount(); |
|
|
|
} |
|
|
@ -854,7 +879,6 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
entity.setClosedUnresolvedIncr(unresolvedInc); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 初始化数据 |
|
|
|
* |
|
|
|