|
|
@ -9,6 +9,8 @@ import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
|
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.evaluationindex.ScreenCustomerAgencyDTO; |
|
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; |
|
|
|
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; |
|
|
@ -52,6 +54,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 +66,102 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
|
|
|
|
//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()))); |
|
|
|
//0.判断level是否有值,有值判断areaCode是否有值,没值直接用agencyId查数据,有值查询不是当前agencyId对应客户的areaCode的下级组织列表
|
|
|
|
if(StringUtils.isNotBlank(formDTO.getLevel())&&!"community".equals(formDTO.getLevel())&&StringUtils.isNotBlank(formDTO.getAreaCode())){ |
|
|
|
agencyList = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
} |
|
|
|
agencyList.add(formDTO.getAgencyId()); |
|
|
|
|
|
|
|
//1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
|
|
|
|
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) { |
|
|
|
List<AgencyBasicDataResultDTO.Topic> hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(agencyList, formDTO.getDateId()); |
|
|
|
//话题总数
|
|
|
|
resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
int closedTotal = topic.stream().filter(t -> t.getTopicStatus().equals("closed")).mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum(); |
|
|
|
//转议题
|
|
|
|
if (null != topicSHiftIssue) { |
|
|
|
resultDTO.setShiftIssueTotal(topicSHiftIssue.getShiftedIssueTotal()); |
|
|
|
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()); |
|
|
|
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()); |
|
|
|
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(issue.getClosedIssueTotal()); |
|
|
|
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(issue.getShiftProjectTotal()); |
|
|
|
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()); |
|
|
|
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(project.getClosedProjectTotal()); |
|
|
|
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 +285,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
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()); |
|
|
|
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 +354,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 +421,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
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()); |
|
|
|
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 +487,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 +554,12 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
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 +575,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,17 +583,17 @@ 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.setTopicTotal(topicTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(hotdiscussTotal.get()); |
|
|
@ -621,12 +648,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 +669,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 +677,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 +741,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
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()); |
|
|
|
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 +811,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 +881,23 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
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()); |
|
|
|
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 +947,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()); |
|
|
|