|
|
@ -1,27 +1,30 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.IssueConstant; |
|
|
|
import com.epmet.dto.issue.IssueAgencyDTO; |
|
|
|
import com.epmet.dto.issue.IssueGridDTO; |
|
|
|
import com.epmet.dto.issue.IssueProjectDTO; |
|
|
|
import com.epmet.dto.project.ProjectAgencyDTO; |
|
|
|
import com.epmet.dto.project.ProjectGridDTO; |
|
|
|
import com.epmet.dto.stats.DimAgencyDTO; |
|
|
|
import com.epmet.entity.stats.FactIssueAgencyDailyEntity; |
|
|
|
import com.epmet.entity.stats.FactIssueAgencyMonthlyEntity; |
|
|
|
import com.epmet.dto.stats.FactIssueAgencyMonthlyDTO; |
|
|
|
import com.epmet.dto.stats.FactIssueGridMonthlyDTO; |
|
|
|
import com.epmet.entity.stats.*; |
|
|
|
import com.epmet.service.Issue.IssueService; |
|
|
|
import com.epmet.service.StatsIssueService; |
|
|
|
import com.epmet.service.project.ProjectService; |
|
|
|
import com.epmet.service.stats.DimAgencyService; |
|
|
|
import com.epmet.service.stats.FactIssueAgencyDailyService; |
|
|
|
import com.epmet.service.stats.*; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author zhaoqifeng |
|
|
@ -35,9 +38,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
@Autowired |
|
|
|
private DimAgencyService dimAgencyService; |
|
|
|
@Autowired |
|
|
|
private DimGridService dimGridService; |
|
|
|
@Autowired |
|
|
|
private ProjectService projectService; |
|
|
|
@Autowired |
|
|
|
private FactIssueAgencyDailyService factIssueAgencyDailyService; |
|
|
|
@Autowired |
|
|
|
private FactIssueAgencyMonthlyService factIssueAgencyMonthlyService; |
|
|
|
@Autowired |
|
|
|
private FactIssueGridMonthlyService factIssueGridMonthlyService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveIssueAgencyDaily(String customerId, Date date) { |
|
|
@ -51,9 +60,9 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
//获取机关下议题各种状态的数目增量
|
|
|
|
List<IssueAgencyDTO> issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); |
|
|
|
//获取机关下已关闭议题统计
|
|
|
|
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyIssueInc(customerId, dateString); |
|
|
|
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); |
|
|
|
//获取机关下已关闭议题增量
|
|
|
|
List<IssueAgencyDTO> issueAgencyClosedIncList = issueService.getAgencyIssueInc(customerId, dateString); |
|
|
|
List<IssueAgencyDTO> issueAgencyClosedIncList = issueService.getAgencyClosedIssueInc(customerId, dateString); |
|
|
|
//已结案项目统计
|
|
|
|
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); |
|
|
|
//已结案项目增量
|
|
|
@ -95,20 +104,460 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
} |
|
|
|
} |
|
|
|
list.add(entity); |
|
|
|
|
|
|
|
} |
|
|
|
//批量插入
|
|
|
|
factIssueAgencyDailyService.insertBatch(list); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveIssueAgencyMonthly(String customerId, Date date) { |
|
|
|
String dateString = DateUtils.format(date); |
|
|
|
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); |
|
|
|
dimAgencyDTO.setCustomerId(customerId); |
|
|
|
//获取当前客户下所有机关
|
|
|
|
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); |
|
|
|
//获取机关下议题各种状态的数目统计
|
|
|
|
List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); |
|
|
|
//获取机关下已关闭议题统计
|
|
|
|
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); |
|
|
|
//已结案项目统计
|
|
|
|
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); |
|
|
|
//统计机关下议题各个指标月度增量
|
|
|
|
List<FactIssueAgencyMonthlyDTO> issueAgencyMonthlyIncList = factIssueAgencyMonthlyService.getAgencyMonthlyInc(customerId, dimId.getMonthId()); |
|
|
|
|
|
|
|
List<FactIssueAgencyMonthlyEntity> list = new ArrayList<>(); |
|
|
|
for (DimAgencyDTO agency : agencyList) { |
|
|
|
FactIssueAgencyDailyEntity daily = initIssueAgencyDaily(dimId); |
|
|
|
FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); |
|
|
|
|
|
|
|
String pIds; |
|
|
|
if (null == agency.getPids() || agency.getPids().isEmpty()) { |
|
|
|
pIds = agency.getPid().concat(":").concat(agency.getId()); |
|
|
|
} else { |
|
|
|
pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); |
|
|
|
} |
|
|
|
//总量统计
|
|
|
|
saveTotal(issueAgencyTotalList, agency, daily, pIds); |
|
|
|
//已关闭议题已解决未解决统计
|
|
|
|
if (daily.getClosedTotal() > NumConstant.ZERO) { |
|
|
|
saveClosedTotal(issueAgencyClosedTotalList, agency, daily, pIds); |
|
|
|
} |
|
|
|
//已关闭项目已解决未解决统计
|
|
|
|
if (daily.getShiftProjectTotal() > NumConstant.ZERO) { |
|
|
|
saveClosedProjectTotal(projectAgencyClosedTotalList, agency, daily, pIds); |
|
|
|
} |
|
|
|
monthly = ConvertUtils.sourceToTarget(daily, FactIssueAgencyMonthlyEntity.class); |
|
|
|
//各指标增量统计
|
|
|
|
for (int i = 0; i < issueAgencyMonthlyIncList.size(); i++) { |
|
|
|
FactIssueAgencyMonthlyDTO dto = issueAgencyMonthlyIncList.get(i); |
|
|
|
if (agency.getId().equals(dto.getAgencyId())) { |
|
|
|
monthly.setIssueIncr(dto.getIssueIncr()); |
|
|
|
monthly.setShiftProjectIncr(dto.getShiftProjectIncr()); |
|
|
|
monthly.setClosedIncr(dto.getClosedIncr()); |
|
|
|
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr()); |
|
|
|
monthly.setClosedUnresolvedIncr(dto.getClosedUnresolvedIncr()); |
|
|
|
monthly.setClosedCaseIncr(dto.getClosedCaseIncr()); |
|
|
|
monthly.setClosedCaseResolvedIncr(dto.getClosedCaseResolvedIncr()); |
|
|
|
monthly.setClosedCaseUnresolvedIncr(dto.getClosedCaseUnresolvedIncr()); |
|
|
|
issueAgencyMonthlyIncList.remove(i); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
monthly.setCustomerId(agency.getCustomerId()); |
|
|
|
monthly.setAgencyId(agency.getId()); |
|
|
|
monthly.setPid(agency.getPid()); |
|
|
|
|
|
|
|
list.add(monthly); |
|
|
|
} |
|
|
|
//批量插入
|
|
|
|
factIssueAgencyMonthlyService.insertBatch(list); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveIssueGridDaily(String customerId, Date date) { |
|
|
|
String dateString = DateUtils.format(date); |
|
|
|
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); |
|
|
|
dimAgencyDTO.setCustomerId(customerId); |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); |
|
|
|
//获取客户下所有网格数据
|
|
|
|
List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId); |
|
|
|
//获取网格下议题各种状态的数目统计
|
|
|
|
List<IssueGridDTO> gridTotalList = issueService.getGridIssueTotal(customerId, dateString); |
|
|
|
//获取网格下议题各种状态的增量统计
|
|
|
|
List<IssueGridDTO> gridIncList = issueService.getGridIssueInc(customerId, dateString); |
|
|
|
//获取网格下已关闭议题各种状态的数目统计
|
|
|
|
List<IssueGridDTO> gridClosedTotalList = issueService.getGridClosedIssueTotal(customerId, dateString); |
|
|
|
//获取网格下已关闭议题各种状态的增量统计
|
|
|
|
List<IssueGridDTO> gridClosedIncList = issueService.getGridClosedIssueInc(customerId, dateString); |
|
|
|
//项目议题关系
|
|
|
|
List<IssueProjectDTO> issueProjectList = issueService.getIssueProjectList(customerId); |
|
|
|
//已结案项目统计
|
|
|
|
List<ProjectGridDTO> closedProjectTotalList = projectService.getGridClosedProjectTotal(customerId, dateString); |
|
|
|
//已结案项目增量
|
|
|
|
List<ProjectGridDTO> closedProjectIncList = projectService.getGridClosedProjectTotal(customerId, dateString); |
|
|
|
Map<String, Long> resolveMap= new HashMap<>(); |
|
|
|
Map<String, Long> unResolveMap = new HashMap<>(); |
|
|
|
Map<String, Long> resolveIncMap = new HashMap<>(); |
|
|
|
Map<String, Long> unResolveIncMap = new HashMap<>(); |
|
|
|
if (null != issueProjectList) { |
|
|
|
List<IssueProjectDTO> totalList = issueProjectList.stream().flatMap(ip -> |
|
|
|
closedProjectTotalList.stream().filter(closed -> ip.getIssueId().equals(closed.getIssueId())).map(project -> { |
|
|
|
IssueProjectDTO dto = new IssueProjectDTO(); |
|
|
|
dto.setIssueId(ip.getIssueId()); |
|
|
|
dto.setGridId(ip.getGridId()); |
|
|
|
dto.setProjectId(ip.getProjectId()); |
|
|
|
dto.setStatus(project.getStatus()); |
|
|
|
return dto; |
|
|
|
})).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); |
|
|
|
resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
unResolveMap = unResolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, |
|
|
|
Collectors.counting())); |
|
|
|
List<IssueProjectDTO> incList = issueProjectList.stream().flatMap(ip -> |
|
|
|
closedProjectIncList.stream().filter(closed -> ip.getIssueId().equals(closed.getIssueId())).map(project -> { |
|
|
|
IssueProjectDTO dto = new IssueProjectDTO(); |
|
|
|
dto.setIssueId(ip.getIssueId()); |
|
|
|
dto.setGridId(ip.getGridId()); |
|
|
|
dto.setProjectId(ip.getProjectId()); |
|
|
|
dto.setStatus(project.getStatus()); |
|
|
|
return dto; |
|
|
|
})).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); |
|
|
|
resolveIncMap = resolveIncList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
unResolveIncMap = unResolveIncList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, |
|
|
|
Collectors.counting())); |
|
|
|
} |
|
|
|
|
|
|
|
List<FactIssueGridDailyEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (DimGridEntity grid : gridList) { |
|
|
|
FactIssueGridDailyEntity entity = initIssueGridDaily(dimId); |
|
|
|
entity.setCustomerId(grid.getCustomerId()); |
|
|
|
entity.setAgencyId(grid.getId()); |
|
|
|
//总量统计
|
|
|
|
saveGridTotal(gridTotalList, grid, entity); |
|
|
|
//增量统计
|
|
|
|
saveGridInc(gridIncList, grid, entity); |
|
|
|
|
|
|
|
if (entity.getClosedTotal() > NumConstant.ZERO) { |
|
|
|
//已关闭议题已解决未解决数量统计
|
|
|
|
saveGridClosedTotal(gridClosedTotalList, grid, entity); |
|
|
|
|
|
|
|
if (entity.getClosedIncr() > NumConstant.ZERO) { |
|
|
|
//已关闭议题已解决未解决增量统计
|
|
|
|
saveGridClosedInc(gridClosedIncList, grid, entity); |
|
|
|
} |
|
|
|
} |
|
|
|
//已关闭项目已解决未解决统计
|
|
|
|
saveClosedProject(resolveMap, unResolveMap, resolveIncMap, unResolveIncMap, grid, entity); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveIssueGridMonthly(String customerId, Date date) { |
|
|
|
String dateString = DateUtils.format(date); |
|
|
|
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); |
|
|
|
dimAgencyDTO.setCustomerId(customerId); |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); |
|
|
|
//获取客户下所有网格数据
|
|
|
|
List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId); |
|
|
|
//获取网格下议题各种状态的数目统计
|
|
|
|
List<IssueGridDTO> gridTotalList = issueService.getGridIssueTotal(customerId, dateString); |
|
|
|
//获取网格下已关闭议题各种状态的数目统计
|
|
|
|
List<IssueGridDTO> gridClosedTotalList = issueService.getGridClosedIssueTotal(customerId, dateString); |
|
|
|
//增量统计
|
|
|
|
List<FactIssueGridMonthlyDTO> gridMonthlyIncListList = factIssueGridMonthlyService.getGridMonthlyInc(customerId, dimId.getMonthId()); |
|
|
|
//项目议题关系
|
|
|
|
List<IssueProjectDTO> issueProjectList = issueService.getIssueProjectList(customerId); |
|
|
|
//已结案项目统计
|
|
|
|
List<ProjectGridDTO> closedProjectTotalList = projectService.getGridClosedProjectTotal(customerId, dateString); |
|
|
|
Map<String, Long> resolveMap= new HashMap<>(); |
|
|
|
Map<String, Long> unResolveMap = new HashMap<>(); |
|
|
|
if (null != issueProjectList) { |
|
|
|
List<IssueProjectDTO> totalList = issueProjectList.stream().flatMap(ip -> |
|
|
|
closedProjectTotalList.stream().filter(closed -> ip.getIssueId().equals(closed.getIssueId())).map(project -> { |
|
|
|
IssueProjectDTO dto = new IssueProjectDTO(); |
|
|
|
dto.setIssueId(ip.getIssueId()); |
|
|
|
dto.setGridId(ip.getGridId()); |
|
|
|
dto.setProjectId(ip.getProjectId()); |
|
|
|
dto.setStatus(project.getStatus()); |
|
|
|
return dto; |
|
|
|
})).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); |
|
|
|
resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); |
|
|
|
unResolveMap = unResolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, |
|
|
|
Collectors.counting())); |
|
|
|
} |
|
|
|
|
|
|
|
List<FactIssueGridMonthlyEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (DimGridEntity grid : gridList) { |
|
|
|
FactIssueGridDailyEntity daily = initIssueGridDaily(dimId); |
|
|
|
FactIssueGridMonthlyEntity monthly = initIssueGridMonthly(dimId); |
|
|
|
|
|
|
|
//总量统计
|
|
|
|
saveGridTotal(gridTotalList, grid, daily); |
|
|
|
|
|
|
|
if (daily.getClosedTotal() > NumConstant.ZERO) { |
|
|
|
//已关闭议题已解决未解决数量统计
|
|
|
|
saveGridClosedTotal(gridClosedTotalList, grid, daily); |
|
|
|
} |
|
|
|
monthly = ConvertUtils.sourceToTarget(daily, FactIssueGridMonthlyEntity.class); |
|
|
|
|
|
|
|
//已关闭项目已解决未解决统计
|
|
|
|
int resolve = null == resolveMap.get(grid.getId())?0:resolveMap.get(grid.getId()).intValue(); |
|
|
|
int unResolve = null == unResolveMap.get(grid.getId())?0:unResolveMap.get(grid.getId()).intValue(); |
|
|
|
int total = resolve + unResolve; |
|
|
|
monthly.setClosedCaseTotal(total); |
|
|
|
monthly.setClosedCaseResolvedTotal(resolve); |
|
|
|
monthly.setClosedCaseUnresolvedTotal(unResolve); |
|
|
|
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|
|
|
BigDecimal resolved = new BigDecimal(resolve); |
|
|
|
BigDecimal unresolved = new BigDecimal(unResolve); |
|
|
|
BigDecimal closed = new BigDecimal(total); |
|
|
|
monthly.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
monthly.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
//各指标增量统计
|
|
|
|
for (int i = 0; i < gridMonthlyIncListList.size(); i++) { |
|
|
|
FactIssueGridMonthlyDTO dto = gridMonthlyIncListList.get(i); |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
monthly.setIssueIncr(dto.getIssueIncr()); |
|
|
|
monthly.setShiftProjectIncr(dto.getShiftProjectIncr()); |
|
|
|
monthly.setClosedIncr(dto.getClosedIncr()); |
|
|
|
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr()); |
|
|
|
monthly.setClosedUnresolvedIncr(dto.getClosedUnresolvedIncr()); |
|
|
|
monthly.setClosedCaseIncr(dto.getClosedCaseIncr()); |
|
|
|
monthly.setClosedCaseResolvedIncr(dto.getClosedCaseResolvedIncr()); |
|
|
|
monthly.setClosedCaseUnresolvedIncr(dto.getClosedCaseUnresolvedIncr()); |
|
|
|
gridMonthlyIncListList.remove(i); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
monthly.setCustomerId(grid.getCustomerId()); |
|
|
|
monthly.setAgencyId(grid.getId()); |
|
|
|
monthly.setGridId(grid.getId()); |
|
|
|
list.add(monthly); |
|
|
|
} |
|
|
|
factIssueGridMonthlyService.insertBatch(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已关闭项目已解决未解决增量统计 |
|
|
|
* 已关闭项目已解决未解决统计 |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/18 17:23 |
|
|
|
* @date 2020/6/22 10:35 |
|
|
|
* @param resolveMap |
|
|
|
* @param unResolveMap |
|
|
|
* @param resolveIncMap |
|
|
|
* @param unResolveIncMap |
|
|
|
* @param grid |
|
|
|
* @param entity |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
private void saveClosedProject(Map<String, Long> resolveMap, Map<String, Long> unResolveMap, Map<String, Long> resolveIncMap, |
|
|
|
Map<String, Long> unResolveIncMap, DimGridEntity grid, FactIssueGridDailyEntity entity) { |
|
|
|
int resolve = null == resolveMap.get(grid.getId())?0:resolveMap.get(grid.getId()).intValue(); |
|
|
|
int unResolve = null == unResolveMap.get(grid.getId())?0:unResolveMap.get(grid.getId()).intValue(); |
|
|
|
int resolveInc = null == resolveIncMap.get(grid.getId())?0:resolveIncMap.get(grid.getId()).intValue(); |
|
|
|
int unResolveInc = null == unResolveIncMap.get(grid.getId())?0:unResolveIncMap.get(grid.getId()).intValue(); |
|
|
|
int total = resolve + unResolve; |
|
|
|
int inc = resolveInc + unResolveInc; |
|
|
|
entity.setClosedCaseTotal(total); |
|
|
|
entity.setClosedCaseResolvedTotal(resolve); |
|
|
|
entity.setClosedCaseUnresolvedTotal(unResolve); |
|
|
|
entity.setClosedCaseIncr(inc); |
|
|
|
entity.setClosedCaseResolvedIncr(resolveInc); |
|
|
|
entity.setClosedCaseUnresolvedIncr(unResolveInc); |
|
|
|
|
|
|
|
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|
|
|
BigDecimal resolved = new BigDecimal(resolve); |
|
|
|
BigDecimal unresolved = new BigDecimal(unResolve); |
|
|
|
BigDecimal closed = new BigDecimal(total); |
|
|
|
entity.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
entity.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已关闭议题已解决未解决增量统计 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param grid |
|
|
|
* @param entity |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/19 15:56 |
|
|
|
*/ |
|
|
|
private void saveGridClosedInc(List<IssueGridDTO> list, DimGridEntity grid, FactIssueGridDailyEntity entity) { |
|
|
|
//已解决数
|
|
|
|
int resolvedInc = NumConstant.ZERO; |
|
|
|
//未解决数
|
|
|
|
int unresolvedInc = NumConstant.ZERO; |
|
|
|
|
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.RESLOVED.equals(dto.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedInc = dto.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedInc = dto.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setClosedResolvedIncr(resolvedInc); |
|
|
|
entity.setClosedUnresolvedIncr(unresolvedInc); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已关闭议题已解决未解决总量级占比统计 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param grid |
|
|
|
* @param entity |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/19 15:56 |
|
|
|
*/ |
|
|
|
private void saveGridClosedTotal(List<IssueGridDTO> list, DimGridEntity grid, FactIssueGridDailyEntity entity) { |
|
|
|
//已解决数
|
|
|
|
int resolvedCount = NumConstant.ZERO; |
|
|
|
//未解决数
|
|
|
|
int unresolvedCount = NumConstant.ZERO; |
|
|
|
|
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.RESLOVED.equals(dto.getStatus())) { |
|
|
|
//已解决议题数量
|
|
|
|
resolvedCount = dto.getCount(); |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { |
|
|
|
//未解决议题数量
|
|
|
|
unresolvedCount = dto.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setClosedResolvedTotal(resolvedCount); |
|
|
|
entity.setClosedUnresolvedTotal(unresolvedCount); |
|
|
|
|
|
|
|
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|
|
|
BigDecimal resolved = new BigDecimal(resolvedCount); |
|
|
|
BigDecimal unresolved = new BigDecimal(unresolvedCount); |
|
|
|
BigDecimal closed = new BigDecimal(entity.getClosedTotal()); |
|
|
|
entity.setClosedResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
entity.setClosedUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 网格议题增量统计 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param grid |
|
|
|
* @param entity |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/19 15:57 |
|
|
|
*/ |
|
|
|
private void saveGridInc(List<IssueGridDTO> list, DimGridEntity grid, FactIssueGridDailyEntity entity) { |
|
|
|
//表决中增量
|
|
|
|
int votingInc = NumConstant.ZERO; |
|
|
|
//已转项目增量
|
|
|
|
int shiftInc = NumConstant.ZERO; |
|
|
|
//已关闭增量
|
|
|
|
int closedInc = NumConstant.ZERO; |
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (grid.getId().equals(dto.getGridId())) { |
|
|
|
if (IssueConstant.VOTING.equals(dto.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
votingInc = dto.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
shiftInc = dto.getCount(); |
|
|
|
} else { |
|
|
|
//已关闭议题数量
|
|
|
|
closedInc = dto.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int issueInc = votingInc + shiftInc + closedInc; |
|
|
|
entity.setVotingIncr(votingInc); |
|
|
|
entity.setShiftProjectIncr(shiftInc); |
|
|
|
entity.setClosedIncr(closedInc); |
|
|
|
entity.setIssueIncr(issueInc); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 网格议题总量统计 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param grid |
|
|
|
* @param entity |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/19 15:57 |
|
|
|
*/ |
|
|
|
private void saveGridTotal(List<IssueGridDTO> list, DimGridEntity grid, FactIssueGridDailyEntity entity) { |
|
|
|
//表决中数量
|
|
|
|
Integer votingCount = NumConstant.ZERO; |
|
|
|
//已转项目数量
|
|
|
|
Integer shiftCount = NumConstant.ZERO; |
|
|
|
//已关闭数量
|
|
|
|
Integer closedCount = NumConstant.ZERO; |
|
|
|
for (IssueGridDTO dto : list) { |
|
|
|
if (dto.getGridId().equals(grid.getId())) { |
|
|
|
if (IssueConstant.VOTING.equals(dto.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
votingCount = dto.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
shiftCount = dto.getCount(); |
|
|
|
} else { |
|
|
|
//已关闭议题数量
|
|
|
|
closedCount = dto.getCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int issueTotal = votingCount + shiftCount + closedCount; |
|
|
|
entity.setVotingTotal(votingCount); |
|
|
|
entity.setShiftProjectTotal(shiftCount); |
|
|
|
entity.setClosedTotal(closedCount); |
|
|
|
entity.setIssueTotal(issueTotal); |
|
|
|
if (NumConstant.ZERO != issueTotal) { |
|
|
|
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|
|
|
BigDecimal voting = new BigDecimal(votingCount); |
|
|
|
BigDecimal shift = new BigDecimal(shiftCount); |
|
|
|
BigDecimal closed = new BigDecimal(closedCount); |
|
|
|
BigDecimal total = new BigDecimal(issueTotal); |
|
|
|
entity.setVotingPercent(voting.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
entity.setShiftProjectPercent(shift.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
entity.setClosedPercent(closed.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已关闭项目已解决未解决增量统计 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param agency |
|
|
|
* @param entity |
|
|
|
* @param pIds |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/18 17:23 |
|
|
|
*/ |
|
|
|
private void saveClosedProjectInc(List<ProjectAgencyDTO> list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { |
|
|
|
//已解决数
|
|
|
@ -135,13 +584,14 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 已关闭项目已解决未解决统计 |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/18 17:23 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param agency |
|
|
|
* @param entity |
|
|
|
* @param pIds |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/18 17:23 |
|
|
|
*/ |
|
|
|
private void saveClosedProjectTotal(List<ProjectAgencyDTO> list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { |
|
|
|
//已解决数
|
|
|
@ -286,7 +736,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedCount = resolvedCount + issueAgency.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedCount = unresolvedCount + issueAgency.getCount(); |
|
|
|
} |
|
|
@ -325,7 +775,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
//表决中议题数量
|
|
|
|
resolvedInc = resolvedInc + issueAgency.getCount(); |
|
|
|
} else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { |
|
|
|
} else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { |
|
|
|
//已转项目议题数量
|
|
|
|
unresolvedInc = unresolvedInc + issueAgency.getCount(); |
|
|
|
} |
|
|
@ -419,4 +869,72 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
entity.setClosedCaseUnresolvedPercent(BigDecimal.ZERO); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
|
|
|
|
private FactIssueGridDailyEntity initIssueGridDaily(DimIdGenerator.DimIdBean dimIdBean) { |
|
|
|
FactIssueGridDailyEntity entity = new FactIssueGridDailyEntity(); |
|
|
|
entity.setYearId(dimIdBean.getYearId()); |
|
|
|
entity.setQuarterId(dimIdBean.getQuarterId()); |
|
|
|
entity.setMonthId(dimIdBean.getMonthId()); |
|
|
|
entity.setWeekId(dimIdBean.getWeekId()); |
|
|
|
entity.setDateId(dimIdBean.getDateId()); |
|
|
|
entity.setIssueTotal(NumConstant.ZERO); |
|
|
|
entity.setIssueIncr(NumConstant.ZERO); |
|
|
|
entity.setVotingTotal(NumConstant.ZERO); |
|
|
|
entity.setVotingIncr(NumConstant.ZERO); |
|
|
|
entity.setVotingPercent(BigDecimal.ZERO); |
|
|
|
entity.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectIncr(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedResolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedUnresolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedResolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedUnresolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedResolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedUnresolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedCaseIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedPercent(BigDecimal.ZERO); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
|
|
|
|
private FactIssueGridMonthlyEntity initIssueGridMonthly(DimIdGenerator.DimIdBean dimIdBean) { |
|
|
|
FactIssueGridMonthlyEntity entity = new FactIssueGridMonthlyEntity(); |
|
|
|
entity.setYearId(dimIdBean.getYearId()); |
|
|
|
entity.setQuarterId(dimIdBean.getQuarterId()); |
|
|
|
entity.setMonthId(dimIdBean.getMonthId()); |
|
|
|
entity.setIssueTotal(NumConstant.ZERO); |
|
|
|
entity.setIssueIncr(NumConstant.ZERO); |
|
|
|
entity.setVotingTotal(NumConstant.ZERO); |
|
|
|
entity.setVotingIncr(NumConstant.ZERO); |
|
|
|
entity.setVotingPercent(BigDecimal.ZERO); |
|
|
|
entity.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectIncr(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedResolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedUnresolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedResolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedUnresolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedResolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedUnresolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedCaseIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedIncr(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedTotal(NumConstant.ZERO); |
|
|
|
entity.setClosedCaseResolvedPercent(BigDecimal.ZERO); |
|
|
|
entity.setClosedCaseUnresolvedPercent(BigDecimal.ZERO); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
} |
|
|
|