+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.evaluationindex;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 网格(党支部)信息
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-26
+ */
+@Data
+public class ScreenCustomerGridDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键ID 主键ID
+ */
+ private String id;
+
+ /**
+ * 客户id
+ */
+ private String customerId;
+
+ /**
+ * 网格id
+ */
+ private String gridId;
+
+ /**
+ * 组织名称
+ */
+ private String gridName;
+
+ /**
+ * 网格所属组织id
+ */
+ private String parentAgencyId;
+
+ /**
+ * 坐标区域
+ */
+ private String areaMarks;
+
+ /**
+ * 中心点位
+ */
+ private String centerMark;
+
+ /**
+ * 党支部(=网格)的位置
+ */
+ private String partyMark;
+
+ /**
+ * 删除标识 0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+ /**
+ * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
+ */
+ private String dataEndTime;
+
+ /**
+ * 所有上级ID,用英文逗号分开
+ */
+ private String allParentIds;
+ private String pid;
+ private String pids;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
index b49b16fc0c..5b6ba190ef 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
@@ -41,43 +41,43 @@ public interface DataStatsDao {
* @Description 查询组织下注册用户最新日统计数据
* @author sun
*/
- AgencyBasicDataResultDTO getAgnecyRegUser(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgnecyRegUser(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新群组日统计数据
* @author sun
*/
- AgencyBasicDataResultDTO getAgnecyGroup(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgnecyGroup(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新状态话题-机关日统计数据表
* @author sun
*/
- List getAgencyTopic(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgencyTopic(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新转议题话题-机关日统计数据表
* @author sun
*/
- AgencyBasicDataResultDTO.Topic getAgencyTopicShiftIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgencyTopicShiftIssue(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 热议中话题-机关日统计数据
* @author sun
*/
- AgencyBasicDataResultDTO.Topic getAgencyTopicHotDiscuss(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgencyTopicHotDiscuss(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新议题日统计数据
* @author sun
*/
- AgencyBasicDataResultDTO getAgencyIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgencyIssue(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新项目日统计数据
* @author sun
*/
- AgencyBasicDataResultDTO getAgencyProject(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
+ List getAgencyProject(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询当前组织的直属下级组织信息
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
index c9084a0b4b..3391ee5fee 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
@@ -18,9 +18,13 @@
package com.epmet.dataaggre.dao.evaluationindex;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
/**
* @Author sun
* @Description 指标统计服务
@@ -34,4 +38,22 @@ public interface EvaluationIndexDao {
* @author sun
*/
GovrnRatioResultDTO getAgnecyOrGridGoverRatio(@Param("orgId") String orgId, @Param("orgType") String orgType, @Param("dateId") String dateId);
+
+ /**
+ * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表
+ * @author sun
+ */
+ List getAgencyByAreaCodeAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode);
+
+ /**
+ * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ * @author sun
+ */
+ List getSubAgencyList(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode);
+
+ /**
+ * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ * @author sun
+ */
+ List getSubGridList(@Param("agencyId") String agencyId);
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
index b61338b163..9f2d0ca357 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
@@ -9,6 +9,8 @@ import com.epmet.dataaggre.dao.datastats.DataStatsDao;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO;
import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
@@ -52,6 +54,7 @@ public class DataStatsServiceImpl implements DataStatsService {
@Override
public AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO) {
AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO();
+ List agencyList = new ArrayList<>();
resultDTO.setAgencyId(formDTO.getAgencyId());
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE);
@@ -63,78 +66,102 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setDateId(format.format(yesterday));
}
- //1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
- AgencyBasicDataResultDTO user = dataStatsDao.getAgnecyRegUser(formDTO.getAgencyId(), formDTO.getDateId());
- if (null != user) {
- resultDTO.setUserTotal(user.getUserTotal());
- resultDTO.setResiTotal(user.getResiTotal());
- resultDTO.setResiRatio(user.getResiTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getResiTotal() / (float) user.getUserTotal())));
- resultDTO.setPartyMemberTotal(user.getPartyMemberTotal());
- resultDTO.setPartyMemberRatio(user.getPartyMemberTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getPartyMemberTotal() / (float) user.getUserTotal())));
+ //0.判断level是否有值,有值判断areaCode是否有值,没值直接用agencyId查数据,有值查询不是当前agencyId对应客户的areaCode的下级组织列表
+ if(StringUtils.isNotBlank(formDTO.getLevel())&&!"community".equals(formDTO.getLevel())&&StringUtils.isNotBlank(formDTO.getAreaCode())){
+ agencyList = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.getAreaCode());
}
+ agencyList.add(formDTO.getAgencyId());
+
+ //1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
+ List userList = dataStatsDao.getAgnecyRegUser(agencyList, formDTO.getDateId());
+ int userTotal = 0;
+ int resiTotal = 0;
+ int partyMemberTotal = 0;
+ for (AgencyBasicDataResultDTO u : userList){
+ userTotal+=u.getUserTotal();
+ resiTotal+=u.getResiTotal();
+ partyMemberTotal+=u.getPartyMemberTotal();
+ }
+ resultDTO.setUserTotal(userTotal);
+ resultDTO.setResiTotal(resiTotal);
+ resultDTO.setResiRatio(resultDTO.getResiTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getResiTotal() / (float) resultDTO.getUserTotal())));
+ resultDTO.setPartyMemberTotal(partyMemberTotal);
+ resultDTO.setPartyMemberRatio(resultDTO.getPartyMemberTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPartyMemberTotal() / (float) resultDTO.getUserTotal())));
//2.查询组织下最新群组日统计数据
- AgencyBasicDataResultDTO group = dataStatsDao.getAgnecyGroup(formDTO.getAgencyId(), formDTO.getDateId());
- 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())));
- resultDTO.setBranchTotal(group.getBranchTotal());
- resultDTO.setBranchRatio(group.getBranchTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getBranchTotal() / (float) group.getGroupTotal())));
- }
+ List groupList = dataStatsDao.getAgnecyGroup(agencyList, formDTO.getDateId());
+ int groupTotal = 0;
+ int ordinaryTotal = 0;
+ int branchTotal = 0;
+ for (AgencyBasicDataResultDTO g : groupList){
+ groupTotal+=g.getGroupTotal();
+ ordinaryTotal+=g.getOrdinaryTotal();
+ branchTotal+=g.getBranchTotal();
+ }
+ resultDTO.setGroupTotal(groupTotal);
+ resultDTO.setOrdinaryTotal(ordinaryTotal);
+ resultDTO.setOrdinaryRatio(resultDTO.getOrdinaryTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getOrdinaryTotal() / (float) resultDTO.getGroupTotal())));
+ resultDTO.setBranchTotal(branchTotal);
+ resultDTO.setBranchRatio(resultDTO.getBranchTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getBranchTotal() / (float) resultDTO.getGroupTotal())));
//3.查询组织下最新话题日统计数据
//状态话题-机关日统计数据表最新日期三种状态数据
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念
- List topic = dataStatsDao.getAgencyTopic(formDTO.getAgencyId(), formDTO.getDateId());
+ List topic = dataStatsDao.getAgencyTopic(agencyList, formDTO.getDateId());
//转议题话题-机关日统计数据表
- AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId());
+ List topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(agencyList, formDTO.getDateId());
//热议中话题-机关日统计数据
- AgencyBasicDataResultDTO.Topic hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(formDTO.getAgencyId(), formDTO.getDateId());
- AtomicReference closedTotal = new AtomicReference<>(0);
- 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());
- }
- });
- }
+ List hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(agencyList, formDTO.getDateId());
+ //话题总数
+ resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount)));
+ int closedTotal = topic.stream().filter(t -> t.getTopicStatus().equals("closed")).mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum();
//转议题
- 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())));
- }
+ int shiftIssueTotal = topicSHiftIssue.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getShiftedIssueTotal).sum();
+ resultDTO.setShiftIssueTotal(shiftIssueTotal);
+ resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal())));
//热议中
- if (null != hotdiscuss) {
- resultDTO.setDiscussingTotal(hotdiscuss.getTopicCount());
- resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
- }
+ int discussingTotal = hotdiscuss.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum();
+ resultDTO.setDiscussingTotal(discussingTotal);
+ 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.setClosedTopicTotal(closedTotal);
resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal())));
//4.查询组织下最新议题日统计数据
- AgencyBasicDataResultDTO issue = dataStatsDao.getAgencyIssue(formDTO.getAgencyId(), formDTO.getDateId());
- if (null != issue) {
- resultDTO.setIssueTotal(issue.getIssueTotal());
- resultDTO.setVotingTotal(issue.getVotingTotal());
- resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal())));
- resultDTO.setClosedIssueTotal(issue.getClosedIssueTotal());
- resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal())));
- resultDTO.setShiftProjectTotal(issue.getShiftProjectTotal());
- resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal())));
- }
+ List issueList = dataStatsDao.getAgencyIssue(agencyList, formDTO.getDateId());
+ int issueTotal = 0;
+ int votingTotal = 0;
+ int closedIssueTotal = 0;
+ int shiftProjectTotal = 0;
+ for (AgencyBasicDataResultDTO i : issueList){
+ issueTotal+=i.getIssueTotal();
+ votingTotal+=i.getVotingTotal();
+ closedIssueTotal+=i.getClosedIssueTotal();
+ shiftProjectTotal+=i.getShiftProjectTotal();
+ }
+ resultDTO.setIssueTotal(issueTotal);
+ resultDTO.setVotingTotal(votingTotal);
+ resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal())));
+ resultDTO.setClosedIssueTotal(closedIssueTotal);
+ resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal())));
+ resultDTO.setShiftProjectTotal(shiftProjectTotal);
+ resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal())));
//5.查询组织下最新项目日统计数据
- AgencyBasicDataResultDTO project = dataStatsDao.getAgencyProject(formDTO.getAgencyId(), formDTO.getDateId());
- if (null != project) {
- resultDTO.setProjectTotal(project.getProjectTotal());
- resultDTO.setPendingTotal(project.getPendingTotal());
- resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal())));
- resultDTO.setClosedProjectTotal(project.getClosedProjectTotal());
- resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal())));
- }
+ List projectList = dataStatsDao.getAgencyProject(agencyList, formDTO.getDateId());
+ int projectTotal = 0;
+ int pendingTotal = 0;
+ int closedProjectTotal = 0;
+ for (AgencyBasicDataResultDTO p : projectList){
+ projectTotal+=p.getProjectTotal();
+ pendingTotal+=p.getPendingTotal();
+ closedProjectTotal+=p.getClosedProjectTotal();
+ }
+ resultDTO.setProjectTotal(projectTotal);
+ resultDTO.setPendingTotal(pendingTotal);
+ resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal())));
+ resultDTO.setClosedProjectTotal(closedProjectTotal);
+ resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal())));
return resultDTO;
}
@@ -258,23 +285,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("user");
}
- //1.查询当前组织的直属下级组织信息【机关维度】
- List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
+ //1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ List subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
- List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
+ List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
List list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId());
//3.封装数据
- for (DimAgencyEntity sub : subAgencyList) {
+ for (ScreenCustomerAgencyDTO sub : subAgencyList) {
SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO();
- dto.setAgencyId(sub.getId());
+ dto.setAgencyId(sub.getAgencyId());
dto.setAgencyName(sub.getAgencyName());
for (SubAgencyUserResultDTO u : list) {
- if (sub.getId().equals(u.getAgencyId())) {
+ if (sub.getAgencyId().equals(u.getAgencyId())) {
dto.setUserTotal(u.getUserTotal());
dto.setPartyMemberTotal(u.getPartyMemberTotal());
dto.setResiTotal(u.getResiTotal());
@@ -327,23 +354,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("user");
}
- //1.查询组织直属网格列表【网格维度】
- List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
+ //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ List gridList = indexService.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
- List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
+ List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList());
//2.查询网格层级注册用户日统计数据,默认按用户总数降序
List list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId());
//3.封装数据
- for (DimGridEntity gr : gridList) {
+ for (ScreenCustomerGridDTO gr : gridList) {
SubGridUserResultDTO dto = new SubGridUserResultDTO();
- dto.setGridId(gr.getId());
+ dto.setGridId(gr.getGridId());
dto.setGridName(gr.getGridName());
for (SubGridUserResultDTO re : list) {
- if (gr.getId().equals(re.getGridId())) {
+ if (gr.getGridId().equals(re.getGridId())) {
dto.setUserTotal(re.getUserTotal());
dto.setPartyMemberTotal(re.getPartyMemberTotal());
dto.setResiTotal(re.getResiTotal());
@@ -394,23 +421,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("group");
}
- //1.查询当前组织的直属下级组织信息【机关维度】
- List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
+ //1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ List subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
- List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
+ List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
//2.查询直属下级组织小组日统计数据,默认按群组总数降序
List list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId());
//3.封装数据
- for (DimAgencyEntity sub : subAgencyList) {
+ for (ScreenCustomerAgencyDTO sub : subAgencyList) {
SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO();
- dto.setAgencyId(sub.getId());
+ dto.setAgencyId(sub.getAgencyId());
dto.setAgencyName(sub.getAgencyName());
for (SubAgencyGroupResultDTO u : list) {
- if (sub.getId().equals(u.getAgencyId())) {
+ if (sub.getAgencyId().equals(u.getAgencyId())) {
dto.setGroupTotal(u.getGroupTotal());
dto.setOrdinaryTotal(u.getOrdinaryTotal());
dto.setBranchTotal(u.getBranchTotal());
@@ -460,23 +487,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("group");
}
- //1.查询组织直属网格列表【网格维度】
- List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
+ //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ List gridList = indexService.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
- List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
+ List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList());
//2.查询网格层级小组日统计数据,默认按群组总数降序
List list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId());
//3.封装数据并返回
- for (DimGridEntity gr : gridList) {
+ for (ScreenCustomerGridDTO gr : gridList) {
SubGridGroupResultDTO dto = new SubGridGroupResultDTO();
- dto.setGridId(gr.getId());
+ dto.setGridId(gr.getGridId());
dto.setGridName(gr.getGridName());
for (SubGridGroupResultDTO re : list) {
- if (gr.getId().equals(re.getGridId())) {
+ if (gr.getGridId().equals(re.getGridId())) {
dto.setGroupTotal(re.getGroupTotal());
dto.setOrdinaryTotal(re.getOrdinaryTotal());
dto.setBranchTotal(re.getBranchTotal());
@@ -527,12 +554,12 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("topic");
}
- //1.查询当前组织的直属下级组织信息【机关维度】
- List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
+ //1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ List subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
- List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
+ List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
//2.查询直属下级组织状态话题-日统计数据
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念
@@ -548,7 +575,7 @@ public class DataStatsServiceImpl implements DataStatsService {
AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicInteger hotdiscussTotal = new AtomicInteger(0);
topic.forEach(t -> {
- if (t.getAgencyId().equals(sub.getId())) {
+ if (t.getAgencyId().equals(sub.getAgencyId())) {
topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")) {
closedTotal.set(t.getTopicCount());
@@ -556,17 +583,17 @@ public class DataStatsServiceImpl implements DataStatsService {
}
});
topicShiftIssue.forEach(t -> {
- if (t.getAgencyId().equals(sub.getId())) {
+ if (t.getAgencyId().equals(sub.getAgencyId())) {
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
}
});
hotdiscuss.forEach(t -> {
- if (t.getAgencyId().equals(sub.getId())) {
+ if (t.getAgencyId().equals(sub.getAgencyId())) {
hotdiscussTotal.addAndGet(t.getTopicCount());
}
});
- resultDTO.setAgencyId(sub.getId());
+ resultDTO.setAgencyId(sub.getAgencyId());
resultDTO.setAgencyName(sub.getAgencyName());
resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(hotdiscussTotal.get());
@@ -621,12 +648,12 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("topic");
}
- //1.查询组织直属网格列表【网格维度】
- List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
+ //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ List gridList = indexService.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
- List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
+ List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList());
//2.查询网格层级话题数据
//查询网格层级状态话题-日统计数据 机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数
@@ -642,7 +669,7 @@ public class DataStatsServiceImpl implements DataStatsService {
AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicInteger hotdiscussTotal = new AtomicInteger(0);
topic.forEach(t -> {
- if (t.getGridId().equals(gr.getId())) {
+ if (t.getGridId().equals(gr.getGridId())) {
topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")) {
closedTotal.set(t.getTopicCount());
@@ -650,17 +677,17 @@ public class DataStatsServiceImpl implements DataStatsService {
}
});
topicShiftIssue.forEach(t -> {
- if (t.getGridId().equals(gr.getId())) {
+ if (t.getGridId().equals(gr.getGridId())) {
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
}
});
hotdiscuss.forEach(t -> {
- if (t.getGridId().equals(gr.getId())) {
+ if (t.getGridId().equals(gr.getGridId())) {
hotdiscussTotal.addAndGet(t.getTopicCount());
}
});
- resultDTO.setGridId(gr.getId());
+ resultDTO.setGridId(gr.getGridId());
resultDTO.setGridName(gr.getGridName());
resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(hotdiscussTotal.get());
@@ -714,23 +741,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("issue");
}
- //1.查询当前组织的直属下级组织信息【机关维度】
- List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
+ //1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ List subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
- List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
+ List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
//2.查询直属下级组织议题日统计数据,默认按议题总数降序
List list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId());
//3.封装数据
- for (DimAgencyEntity sub : subAgencyList) {
+ for (ScreenCustomerAgencyDTO sub : subAgencyList) {
SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO();
- dto.setAgencyId(sub.getId());
+ dto.setAgencyId(sub.getAgencyId());
dto.setAgencyName(sub.getAgencyName());
for (SubAgencyIssueResultDTO u : list) {
- if (sub.getId().equals(u.getAgencyId())) {
+ if (sub.getAgencyId().equals(u.getAgencyId())) {
dto.setIssueTotal(u.getIssueTotal());
dto.setVotingTotal(u.getVotingTotal());
dto.setClosedIssueTotal(u.getClosedIssueTotal());
@@ -784,23 +811,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("issue");
}
- //1.查询组织直属网格列表【网格维度】
- List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
+ //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ List gridList = indexService.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
- List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
+ List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList());
//2.查询网格层级议题日统计数据,默认按议题总数降序
List list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId());
//3.封装数据
- for (DimGridEntity gr : gridList) {
+ for (ScreenCustomerGridDTO gr : gridList) {
SubGridIssueResultDTO dto = new SubGridIssueResultDTO();
- dto.setGridId(gr.getId());
+ dto.setGridId(gr.getGridId());
dto.setGridName(gr.getGridName());
for (SubGridIssueResultDTO re : list) {
- if (gr.getId().equals(re.getGridId())) {
+ if (gr.getGridId().equals(re.getGridId())) {
dto.setIssueTotal(re.getIssueTotal());
dto.setVotingTotal(re.getVotingTotal());
dto.setClosedIssueTotal(re.getClosedIssueTotal());
@@ -854,23 +881,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("project");
}
- //1.查询当前组织的直属下级组织信息【机关维度】
- List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
+ //1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ List subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
- List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
+ List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
//2.查询直属下级组织项目日统计数据,默认按项目总数降序
List list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId());
//3.封装数据
- for (DimAgencyEntity sub : subAgencyList) {
+ for (ScreenCustomerAgencyDTO sub : subAgencyList) {
SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO();
- dto.setAgencyId(sub.getId());
+ dto.setAgencyId(sub.getAgencyId());
dto.setAgencyName(sub.getAgencyName());
for (SubAgencyProjectResultDTO u : list) {
- if (sub.getId().equals(u.getAgencyId())) {
+ if (sub.getAgencyId().equals(u.getAgencyId())) {
dto.setProjectTotal(u.getProjectTotal());
dto.setPendingTotal(u.getPendingTotal());
dto.setClosedProjectTotal(u.getClosedProjectTotal());
@@ -920,23 +947,23 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setType("project");
}
- //1.查询组织直属网格列表【网格维度】
- List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
+ //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ List gridList = indexService.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
- List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
+ List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList());
//2.查询网格层级项目日统计数据,默认按项目总数降序
List list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId());
//3.封装数据
- for (DimGridEntity gr : gridList) {
+ for (ScreenCustomerGridDTO gr : gridList) {
SubGridProjectResultDTO dto = new SubGridProjectResultDTO();
- dto.setGridId(gr.getId());
+ dto.setGridId(gr.getGridId());
dto.setGridName(gr.getGridName());
for (SubGridProjectResultDTO re : list) {
- if (gr.getId().equals(re.getGridId())) {
+ if (gr.getGridId().equals(re.getGridId())) {
dto.setProjectTotal(re.getProjectTotal());
dto.setPendingTotal(re.getPendingTotal());
dto.setClosedProjectTotal(re.getClosedProjectTotal());
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
index 909a3dc208..cb5e1fb553 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
@@ -2,6 +2,10 @@ package com.epmet.dataaggre.service.evaluationindex;
import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
+
+import java.util.List;
/**
* @Author sun
@@ -15,4 +19,22 @@ public interface EvaluationIndexService {
* @author sun
*/
GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO);
+
+ /**
+ * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表
+ * @author sun
+ */
+ List getAgencyByAreaCodeAgencyId(String agencyId, String areaCode);
+
+ /**
+ * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ * @author sun
+ */
+ List getSubAgencyList(String agencyId, String areaCode);
+
+ /**
+ * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ * @author sun
+ */
+ List getSubGridList(String agencyId);
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
index bec7bafd90..cfe929ee26 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
@@ -7,6 +7,8 @@ import com.epmet.dataaggre.dao.datastats.DataStatsDao;
import com.epmet.dataaggre.dao.evaluationindex.EvaluationIndexDao;
import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
+import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.List;
/**
* @Author sun
@@ -37,4 +40,31 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
return evaluationIndexDao.getAgnecyOrGridGoverRatio(formDTO.getOrgId(),formDTO.getOrgType(),formDTO.getDateId());
}
+ /**
+ * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表
+ * @author sun
+ */
+ @Override
+ public List getAgencyByAreaCodeAgencyId(String agencyId, String areaCode) {
+ return evaluationIndexDao.getAgencyByAreaCodeAgencyId(agencyId,areaCode);
+ }
+
+ /**
+ * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
+ * @author sun
+ */
+ @Override
+ public List getSubAgencyList(String agencyId, String areaCode) {
+ return evaluationIndexDao.getSubAgencyList(agencyId,areaCode);
+ }
+
+ /**
+ * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】
+ * @author sun
+ */
+ @Override
+ public List getSubGridList(String agencyId) {
+ return evaluationIndexDao.getSubGridList(agencyId);
+ }
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
index fb5757da88..1178ae153b 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
@@ -12,9 +12,10 @@
fact_reg_user_agency_daily
WHERE
del_flag = '0'
- AND agency_id = #{agencyId}
AND date_id = #{dateId}
- LIMIT 1
+
+ agency_id = #{agencyId}
+
+
+
+
+
+
+
\ No newline at end of file