|
|
@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; |
|
|
|
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.result.*; |
|
|
@ -47,7 +48,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO(); |
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -132,6 +133,103 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 网格下五项基础数据汇总 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public GridBasicDataResultDTO gridBasicData(GridBasicDataFormDTO formDTO) { |
|
|
|
GridBasicDataResultDTO resultDTO = new GridBasicDataResultDTO(); |
|
|
|
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<SubGridUserResultDTO> userList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); |
|
|
|
if (userList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setUserTotal(userList.get(0).getUserTotal()); |
|
|
|
resultDTO.setResiTotal(userList.get(0).getResiTotal()); |
|
|
|
resultDTO.setResiRatio(resultDTO.getResiTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getResiTotal() / (float) resultDTO.getUserTotal()))); |
|
|
|
resultDTO.setPartyMemberTotal(userList.get(0).getPartyMemberTotal()); |
|
|
|
resultDTO.setPartyMemberRatio(resultDTO.getPartyMemberTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPartyMemberTotal() / (float) resultDTO.getUserTotal()))); |
|
|
|
} |
|
|
|
|
|
|
|
//2.查询网格下最新群组日统计数据
|
|
|
|
List<SubGridGroupResultDTO> groupList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); |
|
|
|
if (groupList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setGroupTotal(groupList.get(0).getGroupTotal()); |
|
|
|
resultDTO.setOrdinaryTotal(groupList.get(0).getOrdinaryTotal()); |
|
|
|
resultDTO.setOrdinaryRatio(resultDTO.getOrdinaryTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getOrdinaryTotal() / (float) resultDTO.getGroupTotal()))); |
|
|
|
resultDTO.setBranchTotal(groupList.get(0).getBranchTotal()); |
|
|
|
resultDTO.setBranchRatio(resultDTO.getBranchTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getBranchTotal() / (float) resultDTO.getGroupTotal()))); |
|
|
|
} |
|
|
|
|
|
|
|
//3.查询网格下最新话题日统计数据
|
|
|
|
//状态话题-网格日统计数据表最新日期三种状态数据
|
|
|
|
//网格日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念
|
|
|
|
List<SubGridFormDTO.Topic> topicList = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId()); |
|
|
|
//转议题话题-网格日统计数据表
|
|
|
|
List<SubGridFormDTO.Topic> topicShiftIssueList = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); |
|
|
|
//热议中话题-网格日统计数据
|
|
|
|
List<SubGridFormDTO.Topic> hotdiscussList = dataStatsDao.getSubGridTopicHotDiscuss(gridIds, formDTO.getDateId()); |
|
|
|
AtomicReference<Integer> closedTotal = new AtomicReference<>(0); |
|
|
|
if (topicList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setTopicTotal(topicList.stream().collect(Collectors.summingInt(SubGridFormDTO.Topic::getTopicCount))); |
|
|
|
topicList.forEach(t -> { |
|
|
|
if (t.getTopicStatus().equals("closed")) { |
|
|
|
closedTotal.set(t.getTopicCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//转议题
|
|
|
|
if (topicShiftIssueList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setShiftIssueTotal(topicShiftIssueList.get(0).getShiftedIssueTotal()); |
|
|
|
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
} |
|
|
|
//热议中
|
|
|
|
if (hotdiscussList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setDiscussingTotal(hotdiscussList.get(0).getTopicCount()); |
|
|
|
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()))); |
|
|
|
|
|
|
|
//4.查询网格下最新议题日统计数据
|
|
|
|
List<SubGridIssueResultDTO> issueList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); |
|
|
|
if (issueList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setIssueTotal(issueList.get(0).getIssueTotal()); |
|
|
|
resultDTO.setVotingTotal(issueList.get(0).getVotingTotal()); |
|
|
|
resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setClosedIssueTotal(issueList.get(0).getClosedIssueTotal()); |
|
|
|
resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
resultDTO.setShiftProjectTotal(issueList.get(0).getShiftProjectTotal()); |
|
|
|
resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); |
|
|
|
} |
|
|
|
|
|
|
|
//5.查询网格下最新项目日统计数据
|
|
|
|
List<SubGridProjectResultDTO> projectList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); |
|
|
|
if (projectList.size() > NumConstant.ZERO) { |
|
|
|
resultDTO.setProjectTotal(projectList.get(0).getProjectTotal()); |
|
|
|
resultDTO.setPendingTotal(projectList.get(0).getPendingTotal()); |
|
|
|
resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
resultDTO.setClosedProjectTotal(projectList.get(0).getClosedProjectTotal()); |
|
|
|
resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织用户数据 |
|
|
@ -141,7 +239,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyUserResultDTO> subAgencyUser(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyUserResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -204,7 +302,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridUserResultDTO> subGridUser(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridUserResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -265,7 +363,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyGroupResultDTO> subAgencyGroup(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyGroupResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -325,7 +423,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridGroupResultDTO> subGridGroup(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridGroupResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -386,7 +484,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyTopicResultDTO> subAgencyTopic(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyTopicResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -486,7 +584,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridTopicResultDTO> subGridTopic(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridTopicResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -585,7 +683,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyIssueResultDTO> subAgencyIssue(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyIssueResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -648,7 +746,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridIssueResultDTO> subGridIssue(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridIssueResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -711,7 +809,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyProjectResultDTO> subAgencyProject(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyProjectResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
@ -771,7 +869,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridProjectResultDTO> subGridProject(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridProjectResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.THREE); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|