|
|
|
@ -1,7 +1,6 @@ |
|
|
|
package com.epmet.dataaggre.service.datastats.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
@ -9,9 +8,7 @@ import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.SubAgencyUserResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.SubGridUserResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.datastats.result.*; |
|
|
|
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; |
|
|
|
import com.epmet.dataaggre.entity.datastats.DimGridEntity; |
|
|
|
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|
|
|
@ -23,9 +20,8 @@ import org.springframework.stereotype.Service; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -51,7 +47,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO(); |
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.SIX); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
@ -72,7 +68,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
|
|
|
|
//2.查询组织下最新群组日统计数据
|
|
|
|
AgencyBasicDataResultDTO group = dataStatsDao.getAgnecyGroup(formDTO.getAgencyId(), formDTO.getDateId()); |
|
|
|
if (null != user) { |
|
|
|
if (null != group) { |
|
|
|
resultDTO.setGroupTotal(group.getGroupTotal()); |
|
|
|
resultDTO.setOrdinaryTotal(group.getOrdinaryTotal()); |
|
|
|
resultDTO.setOrdinaryRatio(group.getOrdinaryTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getOrdinaryTotal() / (float) group.getGroupTotal()))); |
|
|
|
@ -138,7 +134,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubAgencyUserResultDTO> subAgencyUser(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyUserResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.SIX); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
@ -180,7 +176,7 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
public List<SubGridUserResultDTO> subGridUser(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridUserResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.SIX); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
if (StringUtils.isBlank(formDTO.getDateId())) { |
|
|
|
@ -213,4 +209,424 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织群组数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyGroupResultDTO> subAgencyGroup(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyGroupResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询直属下级组织小组日统计数据,默认按群组总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织下直属网格列表群组数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubGridGroupResultDTO> subGridGroup(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridGroupResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询网格层级小组日统计数据,默认按群组总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织话题数据 |
|
|
|
* @author sun |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyTopicResultDTO> subAgencyTopic(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyTopicResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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<SubAgencyFormDTO.Topic> topic = dataStatsDao.getSubAgencyTopic(agencyIds, formDTO.getDateId()); |
|
|
|
//查询直属下级组织转议题话题-日统计数据表
|
|
|
|
List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId()); |
|
|
|
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)){ |
|
|
|
topicTotal.addAndGet(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)){ |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
subAgencyList.forEach(sub->{ |
|
|
|
if(agencyId.equals(sub.getId())){ |
|
|
|
agencyName.set(sub.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setAgencyId(agencyId); |
|
|
|
resultDTO.setAgencyName(agencyName.get()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.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()))); |
|
|
|
resultDTO.setShiftIssueTotal(shiftIssueTotal.get()); |
|
|
|
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
|
|
|
|
resultList.add(resultDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
//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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织下直属网格列表话题数据 |
|
|
|
* @author sun |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubGridTopicResultDTO> subGridTopic(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridTopicResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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<SubGridFormDTO.Topic> topic = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId()); |
|
|
|
//查询网格层级转议题话题-日统计数据表
|
|
|
|
List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId()); |
|
|
|
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)){ |
|
|
|
topicTotal.addAndGet(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)){ |
|
|
|
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
gridList.forEach(sub->{ |
|
|
|
if(gridId.equals(sub.getId())){ |
|
|
|
gridName.set(sub.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
resultDTO.setGridId(gridId); |
|
|
|
resultDTO.setGridName(gridName.get()); |
|
|
|
resultDTO.setTopicTotal(topicTotal.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()))); |
|
|
|
resultDTO.setShiftIssueTotal(shiftIssueTotal.get()); |
|
|
|
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); |
|
|
|
|
|
|
|
resultList.add(resultDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
//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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织议题数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyIssueResultDTO> subAgencyIssue(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyIssueResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询直属下级组织议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织下直属网格列表议题数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubGridIssueResultDTO> subGridIssue(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridIssueResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询网格层级议题日统计数据,默认按议题总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织的直属下级组织项目数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyProjectResultDTO> subAgencyProject(SubAgencyFormDTO formDTO) { |
|
|
|
List<SubAgencyProjectResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询直属下级组织项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Param formDTO |
|
|
|
* @Description 查询当前组织下直属网格列表项目数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubGridProjectResultDTO> subGridProject(SubGridFormDTO formDTO) { |
|
|
|
List<SubGridProjectResultDTO> resultList = new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.FOUR); |
|
|
|
|
|
|
|
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
|
|
|
|
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<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.查询网格层级项目日统计数据,默认按项目总数降序
|
|
|
|
resultList = 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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|