Browse Source

治理指数数据查询接口修改

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
5b956fc712
  1. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java
  2. 8
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java
  4. 161
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java
  5. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
  6. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
  7. 174
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java
  8. 72
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  9. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
  10. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
  11. 25
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  12. 19
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml
  13. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java

@ -7,4 +7,8 @@ package com.epmet.dataaggre.constant;
public interface OrgConstant { public interface OrgConstant {
String AGENCY = "agency"; String AGENCY = "agency";
String GRID = "grid"; String GRID = "grid";
String PROVINCE = "province";
String CITY = "city";
String DISTRICT = "district";
} }

8
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java

@ -33,6 +33,14 @@ public class AgencyGovrnFormDTO implements Serializable {
* 街道解决占比:street * 街道解决占比:street
*/ */
private String type; private String type;
/**
* 组织级别
*/
private String level;
/**
* 组织地区码
*/
private String areaCode;
public interface Agency extends CustomerClientShowGroup {} public interface Agency extends CustomerClientShowGroup {}
} }

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java

@ -28,6 +28,8 @@ public class GovrnRatioFormDTO implements Serializable {
* 日维度Id[日期不传值默认查前一天的格式20210101] * 日维度Id[日期不传值默认查前一天的格式20210101]
*/ */
private String dateId; private String dateId;
private String areaCode;
private String level;
public interface AgencyGrid extends CustomerClientShowGroup {} public interface AgencyGrid extends CustomerClientShowGroup {}
} }

161
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java

@ -0,0 +1,161 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.dto.evaluationindex;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 基层治理-治理能力排行数据(按月统计)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-24
*/
@Data
public class ScreenGovernRankDataDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 年Id
*/
private String yearId;
/**
* 月份Id
*/
private String monthId;
/**
* 数据更新至yyyyMMdd
*/
private String dateId;
/**
* 组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
* 组织Id 可以为网格机关id
*/
private String orgId;
/**
* 上级组织Id
*/
private String parentId;
/**
* 组织名称
*/
private String orgName;
/**
* 响应率
*/
private BigDecimal responseRatio;
/**
* 解决率
*/
private BigDecimal resolvedRatio;
/**
* 自治率
*/
private BigDecimal governRatio;
/**
* 满意率
*/
private BigDecimal satisfactionRatio;
/**
* 响应数
*/
private Integer responseCount;
/**
* 项目转入次数
*/
private Integer transferCount;
/**
* 解决项目数
*/
private Integer resolvedCount;
/**
* 已关闭项目数
*/
private Integer closedCount;
/**
* 自治项目数
*/
private Integer governCount;
/**
* 满意项目数
*/
private Integer satisfactionCount;
/**
* 已关闭项目由议题转的项目
*/
private Integer closedProjectCount;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java

@ -25,6 +25,7 @@ import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.entity.datastats.DimGridEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -242,4 +243,14 @@ public interface DataStatsDao {
* @author sun * @author sun
*/ */
List<GridGovrnResultDTO> getGridGovern(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId); List<GridGovrnResultDTO> getGridGovern(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* 根据组织Id查询事件治理指数
* @author zhaoqifeng
* @date 2021/6/25 15:08
* @param agencyIds
* @param dateId
* @return com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity
*/
List<FactAgencyGovernDailyEntity> getAgencyGovernDaily(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
} }

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java

@ -20,6 +20,7 @@ package com.epmet.dataaggre.dao.evaluationindex;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -56,4 +57,14 @@ public interface EvaluationIndexDao {
* @author sun * @author sun
*/ */
List<ScreenCustomerGridDTO> getSubGridList(@Param("agencyId") String agencyId); List<ScreenCustomerGridDTO> getSubGridList(@Param("agencyId") String agencyId);
/**
* 根据组织Id查询治理指数
* @author zhaoqifeng
* @date 2021/6/25 16:36
* @param agencyIds
* @param dateId
* @return java.util.List<com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO>
*/
ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
} }

174
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java

@ -0,0 +1,174 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.entity.datastats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 组织的治理指数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_agency_govern_daily")
public class FactAgencyGovernDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 数据更新至yyyyMMdd;
*/
private String dateId;
/**
* 组织id
*/
private String agencyId;
/**
* agency_id所属的机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String level;
/**
* 组织i所属的组织id
*/
private String pid;
/**
* 组织i所有上级id
*/
private String pids;
/**
* 界面展示问题解决总数=1+2+3+4+5+6+7+8
*/
private Integer problemResolvedCount;
/**
* 界面展示党群自治占比=9+10/PROBLEM_RESOLVED_COUNT; 此列存储的是小数
*/
private BigDecimal groupSelfGovernRatio;
/**
* 界面展示网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT此列存储的是小数
*/
private BigDecimal gridSelfGovernRatio;
/**
* 界面展示社区解决占比=COMMUNITY_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT此列存储的是小数
*/
private BigDecimal communityClosedRatio;
/**
* 界面展示街道解决占比=STREET_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT此列存储的是小数
*/
private BigDecimal streetClosedRatio;
/**
* 界面展示区直部门解决占比=DISTRICT_DEPT_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT此列存储的是小数
*/
private BigDecimal districtDeptClosedRatio;
/**
* 1当前组织内话题关闭已解决数
*/
private Integer topicResolvedCount;
/**
* 2当前组织内话题关闭无需解决数
*/
private Integer topicUnResolvedCount;
/**
* 3当前组织内议题关闭已解决数
*/
private Integer issueResolvedCount;
/**
* 4当前组织内议题关闭无需解决数
*/
private Integer issueUnResolvedCount;
/**
* 5当前组织内来源于议题的项目结案已解决数
*/
private Integer issueProjectResolvedCount;
/**
* 6当前组织内来源于议题的项目结案无需解决数
*/
private Integer issueProjectUnResolvedCount;
/**
* 7当前组织内项目立项结案已解决数默认为0
*/
private Integer approvalProjectResolvedCount;
/**
* 8当前组织内项目立项结案无需解决数默认为0
*/
private Integer approvalProjectUnResolvedCount;
/**
* 9当前组织内未出小组即未转议题的话题关闭已解决数
*/
private Integer inGroupTopicResolvedCount;
/**
* 10当前组织内未出小组即未转议题的话题关闭无需解决数
*/
private Integer inGroupTopicUnResolvedCount;
/**
* 未出当前网格的结案项目数
*/
private Integer gridSelfGovernProjectTotal;
/**
* 当前组织内结案的项目中由社区结案的项目总数
*/
private Integer communityClosedCount;
/**
* 当前组织内结案的项目中由街道结案的项目总数
*/
private Integer streetClosedCount;
/**
* 当前组织内结案的项目中由区直部门结案的项目总数
*/
private Integer districtDeptClosedCount;
}

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

@ -11,10 +11,12 @@ import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.entity.datastats.DimGridEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -1105,6 +1107,7 @@ public class DataStatsServiceImpl implements DataStatsService {
public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) {
AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO();
resultDTO.setAgencyId(formDTO.getAgencyId()); resultDTO.setAgencyId(formDTO.getAgencyId());
resultDTO.setLevel(formDTO.getLevel());
NumberFormat numberFormat = NumberFormat.getInstance(); NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE); numberFormat.setMaximumFractionDigits(NumConstant.THREE);
@ -1114,6 +1117,42 @@ public class DataStatsServiceImpl implements DataStatsService {
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday)); formDTO.setDateId(format.format(yesterday));
} }
if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) {
if (StringUtils.isNotBlank(formDTO.getAreaCode())) {
List<String> subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.getAreaCode());
if (CollectionUtils.isEmpty(subAgencyIds)) {
subAgencyIds = new ArrayList<>();
}
subAgencyIds.add(formDTO.getAgencyId());
List<FactAgencyGovernDailyEntity> list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId());
if (CollectionUtils.isNotEmpty(list)) {
//问题解决总数
Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getProblemResolvedCount).sum();
//未出小组即未转议题的:话题关闭已解决数
Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicResolvedCount).sum();
//未出小组即未转议题的:话题关闭无需解决数
Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicUnResolvedCount).sum();
//未出当前网格的,结案项目数
Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getGridSelfGovernProjectTotal).sum();
//由社区结案的项目总数
Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getCommunityClosedCount).sum();
//由街道结案的项目总数
Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getStreetClosedCount).sum();
//由区直部门结案的项目总数
Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getDistrictDeptClosedCount).sum();
resultDTO.setProblemResolvedCount(problemResolvedCount);
resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount));
resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount));
resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount));
resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount));
resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount));
return resultDTO;
}
}
}
//1.按日期查询当前组织事件治理指数 //1.按日期查询当前组织事件治理指数
List<String> agencyIds = new ArrayList<>(); List<String> agencyIds = new ArrayList<>();
agencyIds.add(formDTO.getAgencyId()); agencyIds.add(formDTO.getAgencyId());
@ -1152,6 +1191,17 @@ public class DataStatsServiceImpl implements DataStatsService {
return resultList; return resultList;
} }
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
if (StringUtils.isNotBlank(formDTO.getAreaCode())) {
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode());
agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
subAgencyList = subAgencies.stream().map(item -> {
DimAgencyEntity entity = new DimAgencyEntity();
entity.setId(item.getAgencyId());
entity.setAgencyName(item.getAgencyName());
entity.setLevel(item.getLevel());
return entity;
}).collect(Collectors.toList());
}
//2.按日期查询所有下级组织的事件治理指数 //2.按日期查询所有下级组织的事件治理指数
List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId());
@ -1318,6 +1368,17 @@ public class DataStatsServiceImpl implements DataStatsService {
formDTO.setDateId(format.format(yesterday)); formDTO.setDateId(format.format(yesterday));
} }
if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) {
if (StringUtils.isNotBlank(formDTO.getAreaCode())) {
ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), formDTO.getAreaCode(), formDTO.getDateId());
resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount()));
resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount()));
resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount()));
resultDTO.setSatisfactionRatio(getPercentage(governData.getSatisfactionCount(), governData.getClosedProjectCount()));
return resultDTO;
}
}
//1.按类型、日期查询治理指数下响应解决满意自治四个统计率 //1.按类型、日期查询治理指数下响应解决满意自治四个统计率
GovrnRatioResultDTO dto = indexService.governRatio(formDTO); GovrnRatioResultDTO dto = indexService.governRatio(formDTO);
if (null != dto) { if (null != dto) {
@ -1329,4 +1390,15 @@ public class DataStatsServiceImpl implements DataStatsService {
return resultDTO; return resultDTO;
} }
private String getPercentage(Integer countInt, Integer totalInt) {
if (NumConstant.ZERO == totalInt) {
return "0%";
}
BigDecimal count = new BigDecimal(countInt);
BigDecimal total = new BigDecimal(totalInt);
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal ratio = count.multiply(hundred).divide(total, NumConstant.ONE, RoundingMode.HALF_UP);
return ratio.toString().concat("%");
}
} }

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java

@ -4,6 +4,7 @@ import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import java.util.List; import java.util.List;
@ -37,4 +38,15 @@ public interface EvaluationIndexService {
* @author sun * @author sun
*/ */
List<ScreenCustomerGridDTO> getSubGridList(String agencyId); List<ScreenCustomerGridDTO> getSubGridList(String agencyId);
/**
* 根据组织ID获取治理指数
* @author zhaoqifeng
* @date 2021/6/25 16:33
* @param agencyId
* @param areaCode
* @param dateId
* @return java.util.List<com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO>
*/
ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId);
} }

23
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java

@ -9,13 +9,16 @@ import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO;
import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -67,4 +70,24 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
return evaluationIndexDao.getSubGridList(agencyId); return evaluationIndexDao.getSubGridList(agencyId);
} }
/**
* 根据组织ID获取治理指数
*
* @param agencyId
* @param areaCode
* @param dateId
* @return java.util.List<com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO>
* @author zhaoqifeng
* @date 2021/6/25 16:33
*/
@Override
public ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId) {
List<String> agencyIdList = getAgencyByAreaCodeAgencyId(agencyId, areaCode);
if (CollectionUtils.isEmpty(agencyIdList)) {
agencyIdList = new ArrayList<>();
}
agencyIdList.add(agencyId);
return evaluationIndexDao.getGovernRankList(agencyIdList, dateId);
}
} }

25
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -660,5 +660,30 @@
</foreach> </foreach>
ORDER BY problem_resolved_count DESC ORDER BY problem_resolved_count DESC
</select> </select>
<select id="getAgencyGovernDaily" resultType="com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity">
SELECT
AGENCY_ID,
`LEVEL`,
PROBLEM_RESOLVED_COUNT,
GROUP_SELF_GOVERN_RATIO,
GRID_SELF_GOVERN_RATIO,
COMMUNITY_CLOSED_RATIO,
STREET_CLOSED_RATIO,
DISTRICT_DEPT_CLOSED_RATIO,
IN_GROUP_TOPIC_RESOLVED_COUNT,
IN_GROUP_TOPIC_UN_RESOLVED_COUNT,
GRID_SELF_GOVERN_PROJECT_TOTAL,
COMMUNITY_CLOSED_COUNT,
STREET_CLOSED_COUNT,
DISTRICT_DEPT_CLOSED_COUNT
FROM
fact_grid_govern_daily
WHERE
DEL_FLAG = '0'
AND DATE_ID = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
AGENCY_ID = #{agencyId}
</foreach>
</select>
</mapper> </mapper>

19
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

@ -77,5 +77,24 @@
del_flag = '0' del_flag = '0'
AND parent_agency_id = #{agencyId} AND parent_agency_id = #{agencyId}
</select> </select>
<select id="getGovernRankList" resultType="com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO">
SELECT
SUM(RESPONSE_COUNT) AS responseCount,
SUM(TRANSFER_COUNT) AS transferCount,
SUM(RESOLVED_COUNT) AS resolvedCount,
SUM(CLOSED_COUNT) AS closedCount,
SUM(GOVERN_COUNT) AS governCount,
SUM(SATISFACTION_PROJECT_COUNT) AS satisfactionProjectCount,
SUM(CLOSED_PROJECT_COUNT) AS closedProjectCount
FROM
screen_govern_rank_data_daily
WHERE
DEL_FLAG = '0'
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
ORG_ID = #{agencyId}
</foreach>
AND ORG_TYPE = 'agency'
AND DATE_ID = #{dateId}
</select>
</mapper> </mapper>

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java

@ -349,6 +349,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setSatisfactionCount(dto.getCount());
entity.setClosedProjectCount(dto.getSum());
} }
})); }));
} }
@ -360,6 +362,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal selfCount = new BigDecimal(grid.getCount()); BigDecimal selfCount = new BigDecimal(grid.getCount());
if (grid.getSum() != NumConstant.ZERO) { if (grid.getSum() != NumConstant.ZERO) {
entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setGovernCount(grid.getCount());
entity.setClosedCount(grid.getSum());
} }
})); }));
} }
@ -372,6 +376,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResponseCount(dto.getCount());
entity.setTransferCount(dto.getSum());
} }
})); }));
} }
@ -384,6 +390,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResolvedCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -423,6 +431,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setSatisfactionCount(dto.getCount());
entity.setClosedProjectCount(dto.getSum());
} }
})); }));
} }
@ -435,6 +445,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResponseCount(dto.getCount());
entity.setTransferCount(dto.getSum());
} }
})); }));
} }
@ -446,6 +458,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setGovernCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -458,6 +472,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResolvedCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -496,6 +512,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setSatisfactionCount(dto.getCount());
entity.setClosedProjectCount(dto.getSum());
} }
})); }));
} }
@ -508,6 +526,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResponseCount(dto.getCount());
entity.setTransferCount(dto.getSum());
} }
})); }));
} }
@ -519,6 +539,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setGovernCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -531,6 +553,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResolvedCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -569,6 +593,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setSatisfactionCount(dto.getCount());
entity.setClosedProjectCount(dto.getSum());
} }
})); }));
} }
@ -581,6 +607,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResponseCount(dto.getCount());
entity.setTransferCount(dto.getSum());
} }
})); }));
} }
@ -592,6 +620,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setGovernCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }
@ -604,6 +634,8 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe
BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount()); BigDecimal count = new BigDecimal(dto.getCount());
entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setResolvedCount(dto.getCount());
entity.setClosedCount(dto.getSum());
} }
})); }));
} }

Loading…
Cancel
Save