Browse Source

漏洞修复 程序调整

master
sunyuchao 4 years ago
parent
commit
eba81f6624
  1. 234
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

234
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -263,18 +263,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序 //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); List<SubAgencyUserResultDTO> list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimAgencyEntity sub : subAgencyList) {
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO();
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); dto.setAgencyId(sub.getId());
subAgencyList.forEach(sub -> { dto.setAgencyName(sub.getAgencyName());
if (re.getAgencyId().equals(sub.getId())) { for (SubAgencyUserResultDTO u : list) {
re.setAgencyName(sub.getAgencyName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubAgencyUserResultDTO>() { Collections.sort(resultList, new Comparator<SubAgencyUserResultDTO>() {
@ -326,18 +332,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级注册用户日统计数据,默认按用户总数降序 //2.查询网格层级注册用户日统计数据,默认按用户总数降序
resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); List<SubGridUserResultDTO> list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimGridEntity gr : gridList) {
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal()))); SubGridUserResultDTO dto = new SubGridUserResultDTO();
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal()))); dto.setGridId(gr.getId());
gridList.forEach(sub -> { dto.setGridName(gr.getGridName());
if (re.getGridId().equals(sub.getId())) { for (SubGridUserResultDTO re : list) {
re.setGridName(sub.getGridName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubGridUserResultDTO>() { Collections.sort(resultList, new Comparator<SubGridUserResultDTO>() {
@ -387,18 +399,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织小组日统计数据,默认按群组总数降序 //2.查询直属下级组织小组日统计数据,默认按群组总数降序
resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); List<SubAgencyGroupResultDTO> list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimAgencyEntity sub : subAgencyList) {
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO();
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); dto.setAgencyId(sub.getId());
subAgencyList.forEach(sub -> { dto.setAgencyName(sub.getAgencyName());
if (re.getAgencyId().equals(sub.getId())) { for (SubAgencyGroupResultDTO u : list) {
re.setAgencyName(sub.getAgencyName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubAgencyGroupResultDTO>() { Collections.sort(resultList, new Comparator<SubAgencyGroupResultDTO>() {
@ -447,18 +465,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级小组日统计数据,默认按群组总数降序 //2.查询网格层级小组日统计数据,默认按群组总数降序
resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); List<SubGridGroupResultDTO> list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId());
//3.封装数据并返回 //3.封装数据并返回
resultList.forEach(re -> { for (DimGridEntity gr : gridList) {
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal()))); SubGridGroupResultDTO dto = new SubGridGroupResultDTO();
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal()))); dto.setGridId(gr.getId());
gridList.forEach(sub -> { dto.setGridName(gr.getGridName());
if (re.getGridId().equals(sub.getId())) { for (SubGridGroupResultDTO re : list) {
re.setGridName(sub.getGridName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubGridGroupResultDTO>() { Collections.sort(resultList, new Comparator<SubGridGroupResultDTO>() {
@ -514,15 +538,14 @@ public class DataStatsServiceImpl implements DataStatsService {
List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId());
//查询直属下级组织热议中话题-机关日统计数据 //查询直属下级组织热议中话题-机关日统计数据
List<SubAgencyFormDTO.Topic> hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId()); List<SubAgencyFormDTO.Topic> hotdiscuss = dataStatsDao.getSubAgencyTopicHotDiscuss(agencyIds, formDTO.getDateId());
agencyIds.forEach(agencyId -> { subAgencyList.forEach(sub -> {
SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO();
AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger topicTotal = new AtomicInteger(0);
AtomicInteger closedTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0);
AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicInteger hotdiscussTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0);
AtomicReference<String> agencyName = new AtomicReference<>("");
topic.forEach(t -> { topic.forEach(t -> {
if (t.getAgencyId().equals(agencyId)) { if (t.getAgencyId().equals(sub.getId())) {
topicTotal.addAndGet(t.getTopicCount()); topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")) { if (t.getTopicStatus().equals("closed")) {
closedTotal.set(t.getTopicCount()); closedTotal.set(t.getTopicCount());
@ -530,23 +553,18 @@ public class DataStatsServiceImpl implements DataStatsService {
} }
}); });
topicShiftIssue.forEach(t -> { topicShiftIssue.forEach(t -> {
if (t.getAgencyId().equals(agencyId)) { if (t.getAgencyId().equals(sub.getId())) {
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
} }
}); });
hotdiscuss.forEach(t -> { hotdiscuss.forEach(t -> {
if (t.getAgencyId().equals(agencyId)) { if (t.getAgencyId().equals(sub.getId())) {
hotdiscussTotal.addAndGet(t.getTopicCount()); hotdiscussTotal.addAndGet(t.getTopicCount());
} }
}); });
subAgencyList.forEach(sub -> {
if (agencyId.equals(sub.getId())) {
agencyName.set(sub.getAgencyName());
}
});
resultDTO.setAgencyId(agencyId); resultDTO.setAgencyId(sub.getId());
resultDTO.setAgencyName(agencyName.get()); resultDTO.setAgencyName(sub.getAgencyName());
resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(hotdiscussTotal.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()))); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
@ -614,15 +632,14 @@ public class DataStatsServiceImpl implements DataStatsService {
List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId());
//查询网格层级热议中话题-日统计数据 //查询网格层级热议中话题-日统计数据
List<SubGridFormDTO.Topic> hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); List<SubGridFormDTO.Topic> hotdiscuss = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId());
gridIds.forEach(gridId -> { gridList.forEach(gr -> {
SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO();
AtomicInteger topicTotal = new AtomicInteger(0); AtomicInteger topicTotal = new AtomicInteger(0);
AtomicInteger closedTotal = new AtomicInteger(0); AtomicInteger closedTotal = new AtomicInteger(0);
AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicInteger hotdiscussTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0);
AtomicReference<String> gridName = new AtomicReference<>("");
topic.forEach(t -> { topic.forEach(t -> {
if (t.getGridId().equals(gridId)) { if (t.getGridId().equals(gr.getId())) {
topicTotal.addAndGet(t.getTopicCount()); topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")) { if (t.getTopicStatus().equals("closed")) {
closedTotal.set(t.getTopicCount()); closedTotal.set(t.getTopicCount());
@ -630,23 +647,18 @@ public class DataStatsServiceImpl implements DataStatsService {
} }
}); });
topicShiftIssue.forEach(t -> { topicShiftIssue.forEach(t -> {
if (t.getGridId().equals(gridId)) { if (t.getGridId().equals(gr.getId())) {
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
} }
}); });
hotdiscuss.forEach(t -> { hotdiscuss.forEach(t -> {
if (t.getGridId().equals(gridId)) { if (t.getGridId().equals(gr.getId())) {
hotdiscussTotal.addAndGet(t.getTopicCount()); hotdiscussTotal.addAndGet(t.getTopicCount());
} }
}); });
gridList.forEach(sub -> {
if (gridId.equals(sub.getId())) {
gridName.set(sub.getGridName());
}
});
resultDTO.setGridId(gridId); resultDTO.setGridId(gr.getId());
resultDTO.setGridName(gridName.get()); resultDTO.setGridName(gr.getGridName());
resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(hotdiscussTotal.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()))); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
@ -707,19 +719,26 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织议题日统计数据,默认按议题总数降序 //2.查询直属下级组织议题日统计数据,默认按议题总数降序
resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); List<SubAgencyIssueResultDTO> list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimAgencyEntity sub : subAgencyList) {
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO();
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); dto.setAgencyId(sub.getId());
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); dto.setAgencyName(sub.getAgencyName());
subAgencyList.forEach(sub -> { for (SubAgencyIssueResultDTO u : list) {
if (re.getAgencyId().equals(sub.getId())) { if (sub.getId().equals(u.getAgencyId())) {
re.setAgencyName(sub.getAgencyName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubAgencyIssueResultDTO>() { Collections.sort(resultList, new Comparator<SubAgencyIssueResultDTO>() {
@ -770,19 +789,26 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级议题日统计数据,默认按议题总数降序 //2.查询网格层级议题日统计数据,默认按议题总数降序
resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); List<SubGridIssueResultDTO> list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimGridEntity gr : gridList) {
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal()))); SubGridIssueResultDTO dto = new SubGridIssueResultDTO();
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal()))); dto.setGridId(gr.getId());
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal()))); dto.setGridName(gr.getGridName());
gridList.forEach(sub -> { for (SubGridIssueResultDTO re : list) {
if (re.getGridId().equals(sub.getId())) { if (gr.getId().equals(re.getGridId())) {
re.setGridName(sub.getGridName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubGridIssueResultDTO>() { Collections.sort(resultList, new Comparator<SubGridIssueResultDTO>() {
@ -833,18 +859,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织项目日统计数据,默认按项目总数降序 //2.查询直属下级组织项目日统计数据,默认按项目总数降序
resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); List<SubAgencyProjectResultDTO> list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimAgencyEntity sub : subAgencyList) {
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO();
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); dto.setAgencyId(sub.getId());
subAgencyList.forEach(sub -> { dto.setAgencyName(sub.getAgencyName());
if (re.getAgencyId().equals(sub.getId())) { for (SubAgencyProjectResultDTO u : list) {
re.setAgencyName(sub.getAgencyName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubAgencyProjectResultDTO>() { Collections.sort(resultList, new Comparator<SubAgencyProjectResultDTO>() {
@ -893,18 +925,24 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级项目日统计数据,默认按项目总数降序 //2.查询网格层级项目日统计数据,默认按项目总数降序
resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); List<SubGridProjectResultDTO> list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId());
//3.封装数据 //3.封装数据
resultList.forEach(re -> { for (DimGridEntity gr : gridList) {
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal()))); SubGridProjectResultDTO dto = new SubGridProjectResultDTO();
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal()))); dto.setGridId(gr.getId());
gridList.forEach(sub -> { dto.setGridName(gr.getGridName());
if (re.getGridId().equals(sub.getId())) { for (SubGridProjectResultDTO re : list) {
re.setGridName(sub.getGridName()); 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.按要求排序并返回 //4.按要求排序并返回
Collections.sort(resultList, new Comparator<SubGridProjectResultDTO>() { Collections.sort(resultList, new Comparator<SubGridProjectResultDTO>() {

Loading…
Cancel
Save