|
|
@ -7,11 +7,7 @@ import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.constant.OrgConstant; |
|
|
|
import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
|
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.PartyMemberVanguardFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.GridBasicDataFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.*; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.*; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; |
|
|
|
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; |
|
|
@ -267,18 +263,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); |
|
|
|
List<SubAgencyUserResultDTO> list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); |
|
|
|
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
for (SubAgencyUserResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
dto.setUserTotal(u.getUserTotal()); |
|
|
|
dto.setPartyMemberTotal(u.getPartyMemberTotal()); |
|
|
|
dto.setResiTotal(u.getResiTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); |
|
|
|
dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyUserResultDTO>() { |
|
|
@ -330,18 +332,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级注册用户日统计数据,默认按用户总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); |
|
|
|
List<SubGridUserResultDTO> list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); |
|
|
|
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
SubGridUserResultDTO dto = new SubGridUserResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridUserResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
dto.setUserTotal(re.getUserTotal()); |
|
|
|
dto.setPartyMemberTotal(re.getPartyMemberTotal()); |
|
|
|
dto.setResiTotal(re.getResiTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); |
|
|
|
dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridUserResultDTO>() { |
|
|
@ -391,18 +399,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织小组日统计数据,默认按群组总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); |
|
|
|
List<SubAgencyGroupResultDTO> list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); |
|
|
|
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
for (SubAgencyGroupResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
dto.setGroupTotal(u.getGroupTotal()); |
|
|
|
dto.setOrdinaryTotal(u.getOrdinaryTotal()); |
|
|
|
dto.setBranchTotal(u.getBranchTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); |
|
|
|
dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyGroupResultDTO>() { |
|
|
@ -451,18 +465,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级小组日统计数据,默认按群组总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); |
|
|
|
List<SubGridGroupResultDTO> list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); |
|
|
|
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
SubGridGroupResultDTO dto = new SubGridGroupResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridGroupResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
dto.setGroupTotal(re.getGroupTotal()); |
|
|
|
dto.setOrdinaryTotal(re.getOrdinaryTotal()); |
|
|
|
dto.setBranchTotal(re.getBranchTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setOrdinaryRatio(dto.getOrdinaryTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getOrdinaryTotal() / (float) dto.getGroupTotal()))); |
|
|
|
dto.setBranchRatio(dto.getBranchTotal() == 0 || dto.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getBranchTotal() / (float) dto.getGroupTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridGroupResultDTO>() { |
|
|
@ -518,15 +538,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); |
|
|
|
//查询直属下级组织热议中话题-机关日统计数据
|
|
|
|
List<SubAgencyFormDTO.Topic> hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId()); |
|
|
|
agencyIds.forEach(agencyId -> { |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); |
|
|
|
AtomicInteger topicTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger closedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hotdiscussTotal = new AtomicInteger(0); |
|
|
|
AtomicReference<String> agencyName = new AtomicReference<>(""); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(agencyId)) { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
@ -534,23 +553,18 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(agencyId)) { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
hotdiscuss.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(agencyId)) { |
|
|
|
if (t.getAgencyId().equals(sub.getId())) { |
|
|
|
hotdiscussTotal.addAndGet(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (agencyId.equals(sub.getId())) { |
|
|
|
agencyName.set(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setAgencyId(agencyId); |
|
|
|
resultDTO.setAgencyName(agencyName.get()); |
|
|
|
resultDTO.setAgencyId(sub.getId()); |
|
|
|
resultDTO.setAgencyName(sub.getAgencyName()); |
|
|
|
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()))); |
|
|
@ -618,15 +632,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); |
|
|
|
//查询网格层级热议中话题-日统计数据
|
|
|
|
List<SubGridFormDTO.Topic> hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); |
|
|
|
gridIds.forEach(gridId -> { |
|
|
|
gridList.forEach(gr -> { |
|
|
|
SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); |
|
|
|
AtomicInteger topicTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger closedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hotdiscussTotal = new AtomicInteger(0); |
|
|
|
AtomicReference<String> gridName = new AtomicReference<>(""); |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gridId)) { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
@ -634,23 +647,18 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gridId)) { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
hotdiscuss.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gridId)) { |
|
|
|
if (t.getGridId().equals(gr.getId())) { |
|
|
|
hotdiscussTotal.addAndGet(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (gridId.equals(sub.getId())) { |
|
|
|
gridName.set(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setGridId(gridId); |
|
|
|
resultDTO.setGridName(gridName.get()); |
|
|
|
resultDTO.setGridId(gr.getId()); |
|
|
|
resultDTO.setGridName(gr.getGridName()); |
|
|
|
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()))); |
|
|
@ -711,19 +719,26 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); |
|
|
|
List<SubAgencyIssueResultDTO> list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); |
|
|
|
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); |
|
|
|
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
for (SubAgencyIssueResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
dto.setIssueTotal(u.getIssueTotal()); |
|
|
|
dto.setVotingTotal(u.getVotingTotal()); |
|
|
|
dto.setClosedIssueTotal(u.getClosedIssueTotal()); |
|
|
|
dto.setShiftProjectTotal(u.getShiftProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); |
|
|
|
dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); |
|
|
|
dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyIssueResultDTO>() { |
|
|
@ -774,19 +789,26 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); |
|
|
|
List<SubGridIssueResultDTO> list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); |
|
|
|
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); |
|
|
|
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
SubGridIssueResultDTO dto = new SubGridIssueResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridIssueResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
dto.setIssueTotal(re.getIssueTotal()); |
|
|
|
dto.setVotingTotal(re.getVotingTotal()); |
|
|
|
dto.setClosedIssueTotal(re.getClosedIssueTotal()); |
|
|
|
dto.setShiftProjectTotal(re.getShiftProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setVotingRatio(dto.getVotingTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getVotingTotal() / (float) dto.getIssueTotal()))); |
|
|
|
dto.setClosedIssueRatio(dto.getClosedIssueTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedIssueTotal() / (float) dto.getIssueTotal()))); |
|
|
|
dto.setShiftProjectRatio(dto.getShiftProjectTotal() == 0 || dto.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getShiftProjectTotal() / (float) dto.getIssueTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridIssueResultDTO>() { |
|
|
@ -837,18 +859,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询直属下级组织项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); |
|
|
|
List<SubAgencyProjectResultDTO> list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); |
|
|
|
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
for (SubAgencyProjectResultDTO u : list) { |
|
|
|
if (sub.getId().equals(u.getAgencyId())) { |
|
|
|
dto.setProjectTotal(u.getProjectTotal()); |
|
|
|
dto.setPendingTotal(u.getPendingTotal()); |
|
|
|
dto.setClosedProjectTotal(u.getClosedProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); |
|
|
|
dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyProjectResultDTO>() { |
|
|
@ -897,18 +925,24 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.查询网格层级项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); |
|
|
|
List<SubGridProjectResultDTO> list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
resultList.forEach(re -> { |
|
|
|
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); |
|
|
|
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
SubGridProjectResultDTO dto = new SubGridProjectResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (SubGridProjectResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
dto.setProjectTotal(re.getProjectTotal()); |
|
|
|
dto.setPendingTotal(re.getPendingTotal()); |
|
|
|
dto.setClosedProjectTotal(re.getClosedProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setPendingRatio(dto.getPendingTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPendingTotal() / (float) dto.getProjectTotal()))); |
|
|
|
dto.setClosedProjectRatio(dto.getClosedProjectTotal() == 0 || dto.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getClosedProjectTotal() / (float) dto.getProjectTotal()))); |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridProjectResultDTO>() { |
|
|
@ -1014,4 +1048,199 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 治理实况-当前组织治理指数 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { |
|
|
|
AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); |
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
Date yesterday = DateUtils.addDateDays(new Date(), -1); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//1.按日期查询当前组织事件治理指数
|
|
|
|
List<String> agencyIds = new ArrayList<>(); |
|
|
|
agencyIds.add(formDTO.getAgencyId()); |
|
|
|
List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); |
|
|
|
if (list.size() > NumConstant.ZERO) { |
|
|
|
resultDTO = list.get(NumConstant.ZERO); |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 治理实况-组织直属下级治理指数列表 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<AgencyGovrnResultDTO> subAgencyGovrnList(AgencyGovrnFormDTO formDTO) { |
|
|
|
List<AgencyGovrnResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
Date yesterday = DateUtils.addDateDays(new Date(), -1); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按问题解决总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("problem"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.按日期查询所有下级组织的事件治理指数
|
|
|
|
List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimAgencyEntity sub : subAgencyList) { |
|
|
|
AgencyGovrnResultDTO dto = new AgencyGovrnResultDTO(); |
|
|
|
dto.setAgencyId(sub.getId()); |
|
|
|
dto.setAgencyName(sub.getAgencyName()); |
|
|
|
dto.setLevel(sub.getLevel()); |
|
|
|
for (AgencyGovrnResultDTO re : list) { |
|
|
|
if (sub.getId().equals(re.getAgencyId())) { |
|
|
|
dto.setProblemResolvedCount(re.getProblemResolvedCount()); |
|
|
|
dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); |
|
|
|
dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); |
|
|
|
dto.setCommunityResolvedRatio(re.getCommunityResolvedRatio()); |
|
|
|
dto.setStreetResolvedRatio(re.getStreetResolvedRatio()); |
|
|
|
dto.setDistrictDeptResolvedRatio(re.getDistrictDeptResolvedRatio()); |
|
|
|
} |
|
|
|
} |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<AgencyGovrnResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(AgencyGovrnResultDTO o1, AgencyGovrnResultDTO o2) { |
|
|
|
if ("party".equals(formDTO.getType())) { |
|
|
|
return o2.getGroupSelfGovernRatio().compareTo(o1.getGroupSelfGovernRatio()); |
|
|
|
} else if ("grid".equals(formDTO.getType())) { |
|
|
|
return o2.getGridSelfGovernRatio().compareTo(o1.getGridSelfGovernRatio()); |
|
|
|
} else if ("community".equals(formDTO.getType())) { |
|
|
|
return o2.getCommunityResolvedRatio().compareTo(o1.getCommunityResolvedRatio()); |
|
|
|
} else if ("department".equals(formDTO.getType())) { |
|
|
|
return o2.getDistrictDeptResolvedRatio().compareTo(o1.getDistrictDeptResolvedRatio()); |
|
|
|
} else if ("street".equals(formDTO.getType())) { |
|
|
|
return o2.getStreetResolvedRatio().compareTo(o1.getStreetResolvedRatio()); |
|
|
|
} else { |
|
|
|
return o2.getProblemResolvedCount().compareTo(o1.getProblemResolvedCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 治理实况-当前网格治理指数 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public GridGovrnResultDTO gridGovrn(GridGovrnFormDTO formDTO) { |
|
|
|
GridGovrnResultDTO resultDTO = new GridGovrnResultDTO(); |
|
|
|
resultDTO.setGridId(formDTO.getGridId()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
Date yesterday = DateUtils.addDateDays(new Date(), -1); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
|
|
|
|
//1.按日期查询网格事件治理指数
|
|
|
|
List<String> gridIds = new ArrayList<>(); |
|
|
|
gridIds.add(formDTO.getGridId()); |
|
|
|
List<GridGovrnResultDTO> list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); |
|
|
|
if (list.size() > NumConstant.ZERO) { |
|
|
|
resultDTO = list.get(NumConstant.ZERO); |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 治理实况-组织直属网格治理指数列表 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<GridGovrnResultDTO> subGridGovrnList(GridGovrnFormDTO formDTO) { |
|
|
|
List<GridGovrnResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
Date yesterday = DateUtils.addDateDays(new Date(), -1); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按问题解决总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("problem"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.按日期查找组织直属网格事件治理指数列表
|
|
|
|
List<GridGovrnResultDTO> list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据
|
|
|
|
for (DimGridEntity gr : gridList) { |
|
|
|
GridGovrnResultDTO dto = new GridGovrnResultDTO(); |
|
|
|
dto.setGridId(gr.getId()); |
|
|
|
dto.setGridName(gr.getGridName()); |
|
|
|
for (GridGovrnResultDTO re : list) { |
|
|
|
if (gr.getId().equals(re.getGridId())) { |
|
|
|
dto.setProblemResolvedCount(re.getProblemResolvedCount()); |
|
|
|
dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); |
|
|
|
dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); |
|
|
|
} |
|
|
|
} |
|
|
|
resultList.add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<GridGovrnResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(GridGovrnResultDTO o1, GridGovrnResultDTO o2) { |
|
|
|
if ("party".equals(formDTO.getType())) { |
|
|
|
return o2.getGroupSelfGovernRatio().compareTo(o1.getGroupSelfGovernRatio()); |
|
|
|
} else if ("grid".equals(formDTO.getType())) { |
|
|
|
return o2.getGridSelfGovernRatio().compareTo(o1.getGridSelfGovernRatio()); |
|
|
|
} else { |
|
|
|
return o2.getProblemResolvedCount().compareTo(o1.getProblemResolvedCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|