|
|
@ -1,20 +1,30 @@ |
|
|
|
package com.epmet.dataaggre.service.datastats.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.constant.OrgConstant; |
|
|
|
import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
|
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; |
|
|
|
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.*; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.*; |
|
|
|
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; |
|
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; |
|
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; |
|
|
|
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; |
|
|
|
import com.epmet.dataaggre.entity.datastats.DimGridEntity; |
|
|
|
import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; |
|
|
|
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; |
|
|
|
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|
|
|
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.epmet.dataaggre.service.opercrm.CustomerRelation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -42,6 +52,11 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
private DataStatsDao dataStatsDao; |
|
|
|
@Autowired |
|
|
|
private EvaluationIndexService indexService; |
|
|
|
@Autowired |
|
|
|
private CustomerRelation customerRelation; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FactGridMemberStatisticsDailyDao factGridMemberStatisticsDailyDao; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -52,6 +67,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
@Override |
|
|
|
public AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO) { |
|
|
|
AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO(); |
|
|
|
List<String> agencyList = new ArrayList<>(); |
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
@ -63,78 +79,100 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
|
|
|
|
//0.根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
|
|
|
|
agencyList = indexService.getAgencyIdsByAgencyId(formDTO.getAgencyId()); |
|
|
|
agencyList.add(formDTO.getAgencyId()); |
|
|
|
|
|
|
|
//1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
|
|
|
|
AgencyBasicDataResultDTO user = dataStatsDao.getAgnecyRegUser(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
if (null != user) { |
|
|
|
resultDTO.setUserTotal(user.getUserTotal()); |
|
|
|
resultDTO.setResiTotal(user.getResiTotal()); |
|
|
|
resultDTO.setResiRatio(user.getResiTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getResiTotal() / (float) user.getUserTotal()))); |
|
|
|
resultDTO.setPartyMemberTotal(user.getPartyMemberTotal()); |
|
|
|
resultDTO.setPartyMemberRatio(user.getPartyMemberTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getPartyMemberTotal() / (float) user.getUserTotal()))); |
|
|
|
} |
|
|
|
List<AgencyBasicDataResultDTO> userList = dataStatsDao.getAgnecyRegUser(agencyList, formDTO.getDateId()); |
|
|
|
int userTotal = 0; |
|
|
|
int resiTotal = 0; |
|
|
|
int partyMemberTotal = 0; |
|
|
|
for (AgencyBasicDataResultDTO u : userList){ |
|
|
|
userTotal+=u.getUserTotal(); |
|
|
|
resiTotal+=u.getResiTotal(); |
|
|
|
partyMemberTotal+=u.getPartyMemberTotal(); |
|
|
|
} |
|
|
|
resultDTO.setUserTotal(userTotal); |
|
|
|
resultDTO.setResiTotal(resiTotal); |
|
|
|
resultDTO.setResiRatio(resultDTO.getResiTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getResiTotal() / (float) resultDTO.getUserTotal()))); |
|
|
|
resultDTO.setPartyMemberTotal(partyMemberTotal); |
|
|
|
resultDTO.setPartyMemberRatio(resultDTO.getPartyMemberTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPartyMemberTotal() / (float) resultDTO.getUserTotal()))); |
|
|
|
|
|
|
|
//2.查询组织下最新群组日统计数据
|
|
|
|
AgencyBasicDataResultDTO group = dataStatsDao.getAgnecyGroup(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
if (null != group) { |
|
|
|
resultDTO.setGroupTotal(group.getGroupTotal()); |
|
|
|
resultDTO.setOrdinaryTotal(group.getOrdinaryTotal()); |
|
|
|
resultDTO.setOrdinaryRatio(group.getOrdinaryTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getOrdinaryTotal() / (float) group.getGroupTotal()))); |
|
|
|
resultDTO.setBranchTotal(group.getBranchTotal()); |
|
|
|
resultDTO.setBranchRatio(group.getBranchTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getBranchTotal() / (float) group.getGroupTotal()))); |
|
|
|
} |
|
|
|
List<AgencyBasicDataResultDTO> groupList = dataStatsDao.getAgnecyGroup(agencyList, formDTO.getDateId()); |
|
|
|
int groupTotal = 0; |
|
|
|
int ordinaryTotal = 0; |
|
|
|
int branchTotal = 0; |
|
|
|
for (AgencyBasicDataResultDTO g : groupList){ |
|
|
|
groupTotal+=g.getGroupTotal(); |
|
|
|
ordinaryTotal+=g.getOrdinaryTotal(); |
|
|
|
branchTotal+=g.getBranchTotal(); |
|
|
|
} |
|
|
|
resultDTO.setGroupTotal(groupTotal); |
|
|
|
resultDTO.setOrdinaryTotal(ordinaryTotal); |
|
|
|
resultDTO.setOrdinaryRatio(resultDTO.getOrdinaryTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getOrdinaryTotal() / (float) resultDTO.getGroupTotal()))); |
|
|
|
resultDTO.setBranchTotal(branchTotal); |
|
|
|
resultDTO.setBranchRatio(resultDTO.getBranchTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getBranchTotal() / (float) resultDTO.getGroupTotal()))); |
|
|
|
|
|
|
|
//3.查询组织下最新话题日统计数据
|
|
|
|
//状态话题-机关日统计数据表最新日期三种状态数据
|
|
|
|
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念
|
|
|
|
List<AgencyBasicDataResultDTO.Topic> topic = dataStatsDao.getAgencyTopic(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
List<AgencyBasicDataResultDTO.Topic> topic = dataStatsDao.getAgencyTopic(agencyList, formDTO.getDateId()); |
|
|
|
//转议题话题-机关日统计数据表
|
|
|
|
AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
List<AgencyBasicDataResultDTO.Topic> topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(agencyList, formDTO.getDateId()); |
|
|
|
//热议中话题-机关日统计数据
|
|
|
|
AgencyBasicDataResultDTO.Topic hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
AtomicReference<Integer> closedTotal = new AtomicReference<>(0); |
|
|
|
if (topic.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
List<AgencyBasicDataResultDTO.Topic> hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(agencyList, formDTO.getDateId()); |
|
|
|
//话题总数
|
|
|
|
resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); |
|
|
|
int closedTotal = topic.stream().filter(t -> t.getTopicStatus().equals("closed")).mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum(); |
|
|
|
//转议题
|
|
|
|
if (null != topicSHiftIssue) { |
|
|
|
resultDTO.setShiftIssueTotal(topicSHiftIssue.getShiftedIssueTotal()); |
|
|
|
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
} |
|
|
|
int shiftIssueTotal = topicSHiftIssue.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getShiftedIssueTotal).sum(); |
|
|
|
resultDTO.setShiftIssueTotal(shiftIssueTotal); |
|
|
|
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
//热议中
|
|
|
|
if (null != hotdiscuss) { |
|
|
|
resultDTO.setDiscussingTotal(hotdiscuss.getTopicCount()); |
|
|
|
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
} |
|
|
|
int discussingTotal = hotdiscuss.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum(); |
|
|
|
resultDTO.setDiscussingTotal(discussingTotal); |
|
|
|
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
//已处理
|
|
|
|
resultDTO.setClosedTopicTotal(closedTotal.get()); |
|
|
|
resultDTO.setClosedTopicTotal(closedTotal); |
|
|
|
resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
|
|
|
|
//4.查询组织下最新议题日统计数据
|
|
|
|
AgencyBasicDataResultDTO issue = dataStatsDao.getAgencyIssue(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
if (null != issue) { |
|
|
|
resultDTO.setIssueTotal(issue.getIssueTotal()); |
|
|
|
resultDTO.setVotingTotal(issue.getVotingTotal()); |
|
|
|
resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setClosedIssueTotal(issue.getClosedIssueTotal()); |
|
|
|
resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setShiftProjectTotal(issue.getShiftProjectTotal()); |
|
|
|
resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
} |
|
|
|
List<AgencyBasicDataResultDTO> issueList = dataStatsDao.getAgencyIssue(agencyList, formDTO.getDateId()); |
|
|
|
int issueTotal = 0; |
|
|
|
int votingTotal = 0; |
|
|
|
int closedIssueTotal = 0; |
|
|
|
int shiftProjectTotal = 0; |
|
|
|
for (AgencyBasicDataResultDTO i : issueList){ |
|
|
|
issueTotal+=i.getIssueTotal(); |
|
|
|
votingTotal+=i.getVotingTotal(); |
|
|
|
closedIssueTotal+=i.getClosedIssueTotal(); |
|
|
|
shiftProjectTotal+=i.getShiftProjectTotal(); |
|
|
|
} |
|
|
|
resultDTO.setIssueTotal(issueTotal); |
|
|
|
resultDTO.setVotingTotal(votingTotal); |
|
|
|
resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setClosedIssueTotal(closedIssueTotal); |
|
|
|
resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setShiftProjectTotal(shiftProjectTotal); |
|
|
|
resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
|
|
|
|
//5.查询组织下最新项目日统计数据
|
|
|
|
AgencyBasicDataResultDTO project = dataStatsDao.getAgencyProject(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
if (null != project) { |
|
|
|
resultDTO.setProjectTotal(project.getProjectTotal()); |
|
|
|
resultDTO.setPendingTotal(project.getPendingTotal()); |
|
|
|
resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
resultDTO.setClosedProjectTotal(project.getClosedProjectTotal()); |
|
|
|
resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
} |
|
|
|
List<AgencyBasicDataResultDTO> projectList = dataStatsDao.getAgencyProject(agencyList, formDTO.getDateId()); |
|
|
|
int projectTotal = 0; |
|
|
|
int pendingTotal = 0; |
|
|
|
int closedProjectTotal = 0; |
|
|
|
for (AgencyBasicDataResultDTO p : projectList){ |
|
|
|
projectTotal+=p.getProjectTotal(); |
|
|
|
pendingTotal+=p.getPendingTotal(); |
|
|
|
closedProjectTotal+=p.getClosedProjectTotal(); |
|
|
|
} |
|
|
|
resultDTO.setProjectTotal(projectTotal); |
|
|
|
resultDTO.setPendingTotal(pendingTotal); |
|
|
|
resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
resultDTO.setClosedProjectTotal(closedProjectTotal); |
|
|
|
resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
@ -258,23 +296,25 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
|
|
|
|
List<SubAgencyUserResultDTO> list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
for (ScreenCustomerAgencyDTO sub : subAgencyList) { |
|
|
|
SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyId(sub.getAgencyId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); |
|
|
|
dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); |
|
|
|
for (SubAgencyUserResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
if (sub.getAgencyId().equals(u.getAgencyId())) { |
|
|
|
dto.setUserTotal(u.getUserTotal()); |
|
|
|
dto.setPartyMemberTotal(u.getPartyMemberTotal()); |
|
|
|
dto.setResiTotal(u.getResiTotal()); |
|
|
@ -327,23 +367,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
//1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
|
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级注册用户日统计数据,默认按用户总数降序
|
|
|
|
List<SubGridUserResultDTO> list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
for (ScreenCustomerGridDTO gr : gridList) { |
|
|
|
SubGridUserResultDTO dto = new SubGridUserResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridId(gr.getGridId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridUserResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
if (gr.getGridId().equals(re.getGridId())) { |
|
|
|
dto.setUserTotal(re.getUserTotal()); |
|
|
|
dto.setPartyMemberTotal(re.getPartyMemberTotal()); |
|
|
|
dto.setResiTotal(re.getResiTotal()); |
|
|
@ -394,23 +434,25 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织小组日统计数据,默认按群组总数降序
|
|
|
|
List<SubAgencyGroupResultDTO> list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
for (ScreenCustomerAgencyDTO sub : subAgencyList) { |
|
|
|
SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyId(sub.getAgencyId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); |
|
|
|
dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); |
|
|
|
for (SubAgencyGroupResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
if (sub.getAgencyId().equals(u.getAgencyId())) { |
|
|
|
dto.setGroupTotal(u.getGroupTotal()); |
|
|
|
dto.setOrdinaryTotal(u.getOrdinaryTotal()); |
|
|
|
dto.setBranchTotal(u.getBranchTotal()); |
|
|
@ -460,23 +502,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
//1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
|
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级小组日统计数据,默认按群组总数降序
|
|
|
|
List<SubGridGroupResultDTO> list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
for (ScreenCustomerGridDTO gr : gridList) { |
|
|
|
SubGridGroupResultDTO dto = new SubGridGroupResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridId(gr.getGridId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridGroupResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
if (gr.getGridId().equals(re.getGridId())) { |
|
|
|
dto.setGroupTotal(re.getGroupTotal()); |
|
|
|
dto.setOrdinaryTotal(re.getOrdinaryTotal()); |
|
|
|
dto.setBranchTotal(re.getBranchTotal()); |
|
|
@ -527,12 +569,12 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织状态话题-日统计数据
|
|
|
|
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念
|
|
|
@ -548,7 +590,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hotdiscussTotal = new AtomicInteger(0); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
if (t.getAgencyId().equals(sub.getAgencyId())) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
@ -556,18 +598,20 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
if (t.getAgencyId().equals(sub.getAgencyId())) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
hotdiscuss.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
if (t.getAgencyId().equals(sub.getAgencyId())) { |
|
|
|
hotdiscussTotal.addAndGet(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setAgencyId(sub.getId()); |
|
|
|
resultDTO.setAgencyId(sub.getAgencyId()); |
|
|
|
resultDTO.setAgencyName(sub.getAgencyName()); |
|
|
|
resultDTO.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); |
|
|
|
resultDTO.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(hotdiscussTotal.get()); |
|
|
|
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
@ -621,12 +665,12 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
//1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
|
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级话题数据
|
|
|
|
//查询网格层级状态话题-日统计数据 机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数
|
|
|
@ -642,7 +686,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hotdiscussTotal = new AtomicInteger(0); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
if (t.getGridId().equals(gr.getGridId())) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
@ -650,17 +694,17 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
if (t.getGridId().equals(gr.getGridId())) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
hotdiscuss.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
if (t.getGridId().equals(gr.getGridId())) { |
|
|
|
hotdiscussTotal.addAndGet(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setGridId(gr.getId()); |
|
|
|
resultDTO.setGridId(gr.getGridId()); |
|
|
|
resultDTO.setGridName(gr.getGridName()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(hotdiscussTotal.get()); |
|
|
@ -714,23 +758,25 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织议题日统计数据,默认按议题总数降序
|
|
|
|
List<SubAgencyIssueResultDTO> list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
for (ScreenCustomerAgencyDTO sub : subAgencyList) { |
|
|
|
SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyId(sub.getAgencyId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); |
|
|
|
dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); |
|
|
|
for (SubAgencyIssueResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
if (sub.getAgencyId().equals(u.getAgencyId())) { |
|
|
|
dto.setIssueTotal(u.getIssueTotal()); |
|
|
|
dto.setVotingTotal(u.getVotingTotal()); |
|
|
|
dto.setClosedIssueTotal(u.getClosedIssueTotal()); |
|
|
@ -784,23 +830,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
//1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
|
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级议题日统计数据,默认按议题总数降序
|
|
|
|
List<SubGridIssueResultDTO> list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
for (ScreenCustomerGridDTO gr : gridList) { |
|
|
|
SubGridIssueResultDTO dto = new SubGridIssueResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridId(gr.getGridId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridIssueResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
if (gr.getGridId().equals(re.getGridId())) { |
|
|
|
dto.setIssueTotal(re.getIssueTotal()); |
|
|
|
dto.setVotingTotal(re.getVotingTotal()); |
|
|
|
dto.setClosedIssueTotal(re.getClosedIssueTotal()); |
|
|
@ -854,23 +900,25 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织项目日统计数据,默认按项目总数降序
|
|
|
|
List<SubAgencyProjectResultDTO> list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
for (ScreenCustomerAgencyDTO sub : subAgencyList) { |
|
|
|
SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyId(sub.getAgencyId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); |
|
|
|
dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); |
|
|
|
for (SubAgencyProjectResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
if (sub.getAgencyId().equals(u.getAgencyId())) { |
|
|
|
dto.setProjectTotal(u.getProjectTotal()); |
|
|
|
dto.setPendingTotal(u.getPendingTotal()); |
|
|
|
dto.setClosedProjectTotal(u.getClosedProjectTotal()); |
|
|
@ -920,23 +968,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
//1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
|
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级项目日统计数据,默认按项目总数降序
|
|
|
|
List<SubGridProjectResultDTO> list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
for (ScreenCustomerGridDTO gr : gridList) { |
|
|
|
SubGridProjectResultDTO dto = new SubGridProjectResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridId(gr.getGridId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridProjectResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
if (gr.getGridId().equals(re.getGridId())) { |
|
|
|
dto.setProjectTotal(re.getProjectTotal()); |
|
|
|
dto.setPendingTotal(re.getPendingTotal()); |
|
|
|
dto.setClosedProjectTotal(re.getClosedProjectTotal()); |
|
|
@ -1078,6 +1126,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { |
|
|
|
AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); |
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
resultDTO.setLevel(formDTO.getLevel()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
@ -1087,6 +1136,42 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); |
|
|
|
if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { |
|
|
|
if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { |
|
|
|
List<String> subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subAgencyIds)) { |
|
|
|
subAgencyIds = new ArrayList<>(); |
|
|
|
} |
|
|
|
subAgencyIds.add(formDTO.getAgencyId()); |
|
|
|
List<FactAgencyGovernDailyEntity> list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//问题解决总数
|
|
|
|
Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getProblemResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭已解决数
|
|
|
|
Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭无需解决数
|
|
|
|
Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicUnResolvedCount).sum(); |
|
|
|
//未出当前网格的,结案项目数
|
|
|
|
Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity::getGridSelfGovernProjectTotal).sum(); |
|
|
|
//由社区结案的项目总数
|
|
|
|
Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getCommunityClosedCount).sum(); |
|
|
|
//由街道结案的项目总数
|
|
|
|
Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getStreetClosedCount).sum(); |
|
|
|
//由区直部门结案的项目总数
|
|
|
|
Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getDistrictDeptClosedCount).sum(); |
|
|
|
|
|
|
|
resultDTO.setProblemResolvedCount(problemResolvedCount); |
|
|
|
resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); |
|
|
|
resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); |
|
|
|
resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//1.按日期查询当前组织事件治理指数
|
|
|
|
List<String> agencyIds = new ArrayList<>(); |
|
|
|
agencyIds.add(formDTO.getAgencyId()); |
|
|
@ -1125,6 +1210,18 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); |
|
|
|
if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { |
|
|
|
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode()); |
|
|
|
agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
subAgencyList = subAgencies.stream().map(item -> { |
|
|
|
DimAgencyEntity entity = new DimAgencyEntity(); |
|
|
|
entity.setId(item.getAgencyId()); |
|
|
|
entity.setAgencyName(item.getAgencyName()); |
|
|
|
entity.setLevel(item.getLevel()); |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
//2.按日期查询所有下级组织的事件治理指数
|
|
|
|
List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); |
|
|
@ -1223,22 +1320,22 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
List<ScreenCustomerGridDTO> gridList = indexService.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
List<String> gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.按日期查找组织直属网格事件治理指数列表
|
|
|
|
List<GridGovrnResultDTO> list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
for (ScreenCustomerGridDTO gr : gridList) { |
|
|
|
GridGovrnResultDTO dto = new GridGovrnResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridId(gr.getGridId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (GridGovrnResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
if (gr.getGridId().equals(re.getGridId())) { |
|
|
|
dto.setProblemResolvedCount(re.getProblemResolvedCount()); |
|
|
|
dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); |
|
|
|
dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); |
|
|
@ -1290,6 +1387,19 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); |
|
|
|
if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { |
|
|
|
if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { |
|
|
|
ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.getAreaCode(), formDTO.getDateId()); |
|
|
|
resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount())); |
|
|
|
resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount())); |
|
|
|
resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount())); |
|
|
|
resultDTO.setSatisfactionRatio(getPercentage(governData.getSatisfactionCount(), governData.getClosedProjectCount())); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//1.按类型、日期查询治理指数下响应解决满意自治四个统计率
|
|
|
|
GovrnRatioResultDTO dto = indexService.governRatio(formDTO); |
|
|
@ -1302,4 +1412,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GridMemberDataAnalysisResultDTO> listGridMemberDataStats(List<String> gridIds, |
|
|
|
String searchedStaffName, |
|
|
|
String month, |
|
|
|
String sort, |
|
|
|
Integer pageNo, |
|
|
|
Integer pageSize) { |
|
|
|
|
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
return factGridMemberStatisticsDailyDao.listGridMemberDataStats(gridIds, searchedStaffName, month, sort); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId) { |
|
|
|
return factGridMemberStatisticsDailyDao.getGridMemberIssueProjectStats( staffId); |
|
|
|
} |
|
|
|
private String getPercentage(Integer countInt, Integer totalInt) { |
|
|
|
if (NumConstant.ZERO == totalInt) { |
|
|
|
return "0%"; |
|
|
|
} |
|
|
|
BigDecimal count = new BigDecimal(countInt); |
|
|
|
BigDecimal total = new BigDecimal(totalInt); |
|
|
|
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|
|
|
BigDecimal ratio = count.multiply(hundred).divide(total, NumConstant.ONE, RoundingMode.HALF_UP); |
|
|
|
return ratio.toString().concat("%"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|