|
|
@ -84,18 +84,22 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
AtomicReference<Integer> closedTotal = new AtomicReference<>(0); |
|
|
|
AtomicReference<Integer> hiddenTotal = new AtomicReference<>(0); |
|
|
|
if (topic.size()>NumConstant.ZERO) { |
|
|
|
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()); } |
|
|
|
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); } |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
if (t.getTopicStatus().equals("hidden")) { |
|
|
|
hiddenTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
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()))); |
|
|
|
} |
|
|
|
resultDTO.setDiscussingTotal(resultDTO.getTopicTotal()-closedTotal.get()-hiddenTotal.get()-resultDTO.getShiftIssueTotal()); |
|
|
|
resultDTO.setDiscussingTotal(resultDTO.getTopicTotal() - closedTotal.get() - hiddenTotal.get() - resultDTO.getShiftIssueTotal()); |
|
|
|
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.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
@ -142,10 +146,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if(subAgencyList.size()<NumConstant.ONE){ |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
@ -153,17 +161,34 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyUserResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubAgencyUserResultDTO o1, SubAgencyUserResultDTO o2) { |
|
|
|
if ("party".equals(formDTO.getType())) { |
|
|
|
//升序
|
|
|
|
//return o1.getPartyMemberTotal().compareTo(o2.getPartyMemberTotal());
|
|
|
|
//降序
|
|
|
|
return o2.getPartyMemberTotal().compareTo(o1.getPartyMemberTotal()); |
|
|
|
} else if ("resi".equals(formDTO.getType())) { |
|
|
|
return o2.getResiTotal().compareTo(o1.getResiTotal()); |
|
|
|
} else { |
|
|
|
return o2.getUserTotal().compareTo(o1.getUserTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -184,10 +209,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if(gridList.size()<NumConstant.ONE){ |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
@ -195,17 +224,32 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询网格层级注册用户日统计数据,默认按用户总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridUserResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubGridUserResultDTO o1, SubGridUserResultDTO o2) { |
|
|
|
if ("party".equals(formDTO.getType())) { |
|
|
|
//降序
|
|
|
|
return o2.getPartyMemberTotal().compareTo(o1.getPartyMemberTotal()); |
|
|
|
} else if ("resi".equals(formDTO.getType())) { |
|
|
|
return o2.getResiTotal().compareTo(o1.getResiTotal()); |
|
|
|
} else { |
|
|
|
return o2.getUserTotal().compareTo(o1.getUserTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -226,10 +270,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if(subAgencyList.size()<NumConstant.ONE){ |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
@ -237,17 +285,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询直属下级组织小组日统计数据,默认按群组总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyGroupResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubAgencyGroupResultDTO o1, SubAgencyGroupResultDTO o2) { |
|
|
|
if ("ordinary".equals(formDTO.getType())) { |
|
|
|
return o2.getOrdinaryTotal().compareTo(o1.getOrdinaryTotal()); |
|
|
|
} else if ("branch".equals(formDTO.getType())) { |
|
|
|
return o2.getBranchTotal().compareTo(o1.getBranchTotal()); |
|
|
|
} else { |
|
|
|
return o2.getGroupTotal().compareTo(o1.getGroupTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -268,10 +330,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if(gridList.size()<NumConstant.ONE){ |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
@ -280,24 +346,38 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
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())){ |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridGroupResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubGridGroupResultDTO o1, SubGridGroupResultDTO o2) { |
|
|
|
if ("ordinary".equals(formDTO.getType())) { |
|
|
|
return o2.getOrdinaryTotal().compareTo(o1.getOrdinaryTotal()); |
|
|
|
} else if ("branch".equals(formDTO.getType())) { |
|
|
|
return o2.getBranchTotal().compareTo(o1.getBranchTotal()); |
|
|
|
} else { |
|
|
|
return o2.getGroupTotal().compareTo(o1.getGroupTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织话题数据 |
|
|
|
* @author sun |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyTopicResultDTO> subAgencyTopic(SubAgencyFormDTO formDTO) { |
|
|
@ -311,10 +391,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if(subAgencyList.size()<NumConstant.ONE){ |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
@ -324,27 +408,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<SubAgencyFormDTO.Topic> topic = dataStatsDao.getSubAgencyTopic(agencyIds, formDTO.getDateId()); |
|
|
|
//查询直属下级组织转议题话题-日统计数据表
|
|
|
|
List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); |
|
|
|
agencyIds.forEach(agencyId->{ |
|
|
|
agencyIds.forEach(agencyId -> { |
|
|
|
SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO(); |
|
|
|
AtomicInteger topicTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger closedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hiddenTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicReference<String> agencyName = new AtomicReference<>(""); |
|
|
|
topic.forEach(t->{ |
|
|
|
if(t.getAgencyId().equals(agencyId)){ |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(agencyId)) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")){ closedTotal.set(t.getTopicCount()); } |
|
|
|
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); } |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
if (t.getTopicStatus().equals("hidden")) { |
|
|
|
hiddenTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t->{ |
|
|
|
if(t.getAgencyId().equals(agencyId)){ |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getAgencyId().equals(agencyId)) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
subAgencyList.forEach(sub->{ |
|
|
|
if(agencyId.equals(sub.getId())){ |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (agencyId.equals(sub.getId())) { |
|
|
|
agencyName.set(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
@ -352,7 +440,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
resultDTO.setAgencyId(agencyId); |
|
|
|
resultDTO.setAgencyName(agencyName.get()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(topicTotal.get()-closedTotal.get()-hiddenTotal.get()-shiftIssueTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(topicTotal.get() - closedTotal.get() - hiddenTotal.get() - shiftIssueTotal.get()); |
|
|
|
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.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
@ -362,14 +450,19 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
resultList.add(resultDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
//3.默认按话题总数降序
|
|
|
|
//3.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyTopicResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubAgencyTopicResultDTO o1, SubAgencyTopicResultDTO o2) { |
|
|
|
//升序
|
|
|
|
//return o1.getTopicTotal().compareTo(o2.getTopicTotal());
|
|
|
|
//降序
|
|
|
|
return o2.getTopicTotal().compareTo(o1.getTopicTotal()); |
|
|
|
if ("discussing".equals(formDTO.getType())) { |
|
|
|
return o2.getDiscussingTotal().compareTo(o1.getDiscussingTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedTopicTotal().compareTo(o1.getClosedTopicTotal()); |
|
|
|
} else if ("shiftIssue".equals(formDTO.getType())) { |
|
|
|
return o2.getShiftIssueTotal().compareTo(o1.getShiftIssueTotal()); |
|
|
|
} else { |
|
|
|
return o2.getTopicTotal().compareTo(o1.getTopicTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -377,10 +470,10 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织下直属网格列表话题数据 |
|
|
|
* @author sun |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubGridTopicResultDTO> subGridTopic(SubGridFormDTO formDTO) { |
|
|
@ -394,10 +487,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if(gridList.size()<NumConstant.ONE){ |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
@ -407,27 +504,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
List<SubGridFormDTO.Topic> topic = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId()); |
|
|
|
//查询网格层级转议题话题-日统计数据表
|
|
|
|
List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); |
|
|
|
gridIds.forEach(gridId->{ |
|
|
|
gridIds.forEach(gridId -> { |
|
|
|
SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO(); |
|
|
|
AtomicInteger topicTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger closedTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger hiddenTotal = new AtomicInteger(0); |
|
|
|
AtomicInteger shiftIssueTotal = new AtomicInteger(0); |
|
|
|
AtomicReference<String> gridName = new AtomicReference<>(""); |
|
|
|
topic.forEach(t->{ |
|
|
|
if(t.getGridId().equals(gridId)){ |
|
|
|
topic.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gridId)) { |
|
|
|
topicTotal.addAndGet(t.getTopicCount()); |
|
|
|
if (t.getTopicStatus().equals("closed")){ closedTotal.set(t.getTopicCount()); } |
|
|
|
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); } |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
if (t.getTopicStatus().equals("hidden")) { |
|
|
|
hiddenTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
topicShiftIssue.forEach(t->{ |
|
|
|
if(t.getGridId().equals(gridId)){ |
|
|
|
topicShiftIssue.forEach(t -> { |
|
|
|
if (t.getGridId().equals(gridId)) { |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
gridList.forEach(sub->{ |
|
|
|
if(gridId.equals(sub.getId())){ |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (gridId.equals(sub.getId())) { |
|
|
|
gridName.set(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
@ -435,7 +536,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
resultDTO.setGridId(gridId); |
|
|
|
resultDTO.setGridName(gridName.get()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(topicTotal.get()-closedTotal.get()-hiddenTotal.get()-shiftIssueTotal.get()); |
|
|
|
resultDTO.setDiscussingTotal(topicTotal.get() - closedTotal.get() - hiddenTotal.get() - shiftIssueTotal.get()); |
|
|
|
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.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
@ -445,14 +546,19 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
resultList.add(resultDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
//3.默认按话题总数降序
|
|
|
|
//3.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridTopicResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubGridTopicResultDTO o1, SubGridTopicResultDTO o2) { |
|
|
|
//升序
|
|
|
|
//return o1.getTopicTotal().compareTo(o2.getTopicTotal());
|
|
|
|
//降序
|
|
|
|
return o2.getTopicTotal().compareTo(o1.getTopicTotal()); |
|
|
|
if ("discussing".equals(formDTO.getType())) { |
|
|
|
return o2.getDiscussingTotal().compareTo(o1.getDiscussingTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedTopicTotal().compareTo(o1.getClosedTopicTotal()); |
|
|
|
} else if ("shiftIssue".equals(formDTO.getType())) { |
|
|
|
return o2.getShiftIssueTotal().compareTo(o1.getShiftIssueTotal()); |
|
|
|
} else { |
|
|
|
return o2.getTopicTotal().compareTo(o1.getTopicTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -476,10 +582,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if(subAgencyList.size()<NumConstant.ONE){ |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
@ -487,18 +597,34 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询直属下级组织议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyIssueResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubAgencyIssueResultDTO o1, SubAgencyIssueResultDTO o2) { |
|
|
|
if ("voting".equals(formDTO.getType())) { |
|
|
|
return o2.getVotingTotal().compareTo(o1.getVotingTotal()); |
|
|
|
} else if ("shiftProject".equals(formDTO.getType())) { |
|
|
|
return o2.getShiftProjectTotal().compareTo(o1.getShiftProjectTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedIssueTotal().compareTo(o1.getClosedIssueTotal()); |
|
|
|
} else { |
|
|
|
return o2.getIssueTotal().compareTo(o1.getIssueTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -519,10 +645,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if(gridList.size()<NumConstant.ONE){ |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
@ -530,18 +660,34 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询网格层级议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridIssueResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubGridIssueResultDTO o1, SubGridIssueResultDTO o2) { |
|
|
|
if ("voting".equals(formDTO.getType())) { |
|
|
|
return o2.getVotingTotal().compareTo(o1.getVotingTotal()); |
|
|
|
} else if ("shiftProject".equals(formDTO.getType())) { |
|
|
|
return o2.getShiftProjectTotal().compareTo(o1.getShiftProjectTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedIssueTotal().compareTo(o1.getClosedIssueTotal()); |
|
|
|
} else { |
|
|
|
return o2.getIssueTotal().compareTo(o1.getIssueTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -562,10 +708,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询当前组织的直属下级组织信息【机关维度】
|
|
|
|
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); |
|
|
|
if(subAgencyList.size()<NumConstant.ONE){ |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
@ -573,17 +723,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询直属下级组织项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
if (re.getAgencyId().equals(sub.getId())) { |
|
|
|
re.setAgencyName(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubAgencyProjectResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubAgencyProjectResultDTO o1, SubAgencyProjectResultDTO o2) { |
|
|
|
if ("pending".equals(formDTO.getType())) { |
|
|
|
return o2.getPendingTotal().compareTo(o1.getPendingTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedProjectTotal().compareTo(o1.getClosedProjectTotal()); |
|
|
|
} else { |
|
|
|
return o2.getProjectTotal().compareTo(o1.getProjectTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
@ -604,10 +768,14 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
//排序类型,默认按用户总数降序
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询组织直属网格列表【网格维度】
|
|
|
|
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); |
|
|
|
if(gridList.size()<NumConstant.ONE){ |
|
|
|
if (gridList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); |
|
|
@ -615,17 +783,31 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
//2.查询网格层级项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re->{ |
|
|
|
//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())){ |
|
|
|
gridList.forEach(sub -> { |
|
|
|
if (re.getGridId().equals(sub.getId())) { |
|
|
|
re.setGridName(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//4.按要求排序并返回
|
|
|
|
Collections.sort(resultList, new Comparator<SubGridProjectResultDTO>() { |
|
|
|
@Override |
|
|
|
public int compare(SubGridProjectResultDTO o1, SubGridProjectResultDTO o2) { |
|
|
|
if ("pending".equals(formDTO.getType())) { |
|
|
|
return o2.getPendingTotal().compareTo(o1.getPendingTotal()); |
|
|
|
} else if ("closed".equals(formDTO.getType())) { |
|
|
|
return o2.getClosedProjectTotal().compareTo(o1.getClosedProjectTotal()); |
|
|
|
} else { |
|
|
|
return o2.getProjectTotal().compareTo(o1.getProjectTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|