diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 9ff138efe7..49681043e0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -136,4 +136,13 @@ public interface Constant { String CREATED_TIME = "created_time"; String DEFAULT_CUSTOMER = "default"; + + /** + * 省级:province; 市级: city; 区县级: district ;乡(镇、街道)级:street ;社区级:community + */ + String PROVINCE = "province"; + String CITY = "city"; + String DISTRICT = "district"; + String STREET = "street"; + String COMMUNITY = "community"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 68c417c580..6f5e7bf1f3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -469,4 +469,8 @@ public class RedisKeys { public static String getCorsConfigKey() { return rootPrefix.concat("sys:cors"); } + + public static String getProjectChangedMsgDistinceKey(String customerId) { + return rootPrefix.concat("project_changed:consume:").concat(customerId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index b47d56574c..c2988b67f9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -446,6 +446,22 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMM); } + /** + * @Description 获取指定 月份的前n月 返回yyyyMM + * @Param beforeMonth + * @Param monthId + * @author zxc + * @date 2021/7/9 2:44 下午 + */ + public static String getBeforeNMonthByMonth(int beforeMonth, String monthId){ + StringBuilder builder = new StringBuilder(monthId); + builder.insert(NumConstant.FOUR,"-"); + builder.insert(builder.length(),"-01"); + LocalDate parse = LocalDate.parse(builder.toString()); + LocalDate localDate = parse.minusMonths(beforeMonth); + return localDate.toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); + } + /** * @return java.util.List 返回yyyyMMdd * @param startTime yyyyMMdd diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java index a7da3d564b..b3083d658e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java +++ b/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 { String AGENCY = "agency"; String GRID = "grid"; + String PROVINCE = "province"; + String CITY = "city"; + String DISTRICT = "district"; + } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java index 82315c125f..14bfa2c51b 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java +++ b/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 */ private String type; + /** + * 组织级别 + */ + private String level; + /** + * 组织地区码 + */ + private String areaCode; public interface Agency extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java index 7e5407a8ef..d760cd834f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java +++ b/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】] */ private String dateId; + private String areaCode; + private String level; public interface AgencyGrid extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java index 144368c26e..8b0f229204 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyGroupResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //党群小组总数 private Integer groupTotal = 0; //楼院小组总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java index 5bece9dab4..a13f9d158b 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyIssueResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //议题总数 private Integer issueTotal = 0; //表决中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java index 33aa889ad4..63b0c512ca 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyProjectResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //项目总数 private Integer projectTotal = 0; //处理中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java index bad0896389..3712128526 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyTopicResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //话题总数 private Integer topicTotal = 0; //热议中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java index a60c3ad76b..d1cc92cd8f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyUserResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //用户总数 private Integer userTotal = 0; //党员总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java new file mode 100644 index 0000000000..3b2c818967 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dataaggre.dto.evaluationindex; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 组织机构信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-21 + */ +@Data +public class ScreenCustomerAgencyDTO implements Serializable { + private static final long serialVersionUID = 6328123559936824470L; + /** + * 客户id + */ + private String customerId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织名称 + */ + private String agencyName; + + /** + * 机关级别(社区级:community, + 乡(镇、街道)级:street, + 区县级: district, + 市级: city + 省级:province) + */ + private String level; + + /** + * 行政地区编码 + */ + private String areaCode; + + /** + * 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 + */ + private String parentAreaCode; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java new file mode 100644 index 0000000000..e57fd42ac5 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java new file mode 100644 index 0000000000..6542b8eb1c --- /dev/null +++ b/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 + *

+ * 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.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; + +} \ 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..d157058b2e 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 @@ -25,6 +25,7 @@ import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; 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.Param; @@ -41,43 +42,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 查询当前组织的直属下级组织信息 @@ -242,4 +243,14 @@ public interface DataStatsDao { * @author sun */ List getGridGovern(@Param("gridIds") List 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 getAgencyGovernDaily(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); } \ No newline at end of file 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..197b4e05e6 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,14 @@ 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 com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * @Author sun * @Description 指标统计服务 @@ -34,4 +39,60 @@ 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); + + /** + * 根据组织Id查询治理指数 + * @author zhaoqifeng + * @date 2021/6/25 16:36 + * @param agencyIds + * @param dateId + * @return java.util.List + */ + ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:58 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId); + + /** + * @Description 查询agencyId对应组织信息 + * @author sun + */ + ScreenCustomerAgencyDTO getByAgencyId(@Param("agencyId") String agencyId); + + /** + * @Description 存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + * @author sun + */ + List getAgencyIdsByAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查且是在当前客户和子客户范围内查询 + * @author sun + */ + List getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java index ed7aef852a..4cca334ea8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java @@ -13,4 +13,13 @@ import java.util.List; @Mapper public interface CustomerRelationDao { List selectUsedAreaCodeList(String areaCode); + + /** + * 根据customerId查询其所有下级子客户id + * @author zhaoqifeng + * @date 2021/6/29 11:04 + * @param customerId + * @return java.util.List + */ + List selectAllSubCustomerIds(String customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java new file mode 100644 index 0000000000..d709731f77 --- /dev/null +++ b/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 + *

+ * 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.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; + +} 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 e290386e71..bfa9a29710 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 @@ -12,14 +12,19 @@ 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.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +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.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity; import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; +import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import com.github.pagehelper.PageHelper; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -47,6 +52,8 @@ public class DataStatsServiceImpl implements DataStatsService { private DataStatsDao dataStatsDao; @Autowired private EvaluationIndexService indexService; + @Autowired + private CustomerRelation customerRelation; @Autowired private FactGridMemberStatisticsDailyDao factGridMemberStatisticsDailyDao; @@ -60,6 +67,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); @@ -71,78 +79,100 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setDateId(format.format(yesterday)); } + //0.根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + agencyList = indexService.getAgencyIdsByAgencyId(formDTO.getAgencyId()); + agencyList.add(formDTO.getAgencyId()); + //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()))); - } + 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; } @@ -266,23 +296,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("user"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); 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()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); 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()); @@ -335,23 +367,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()); @@ -402,23 +434,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("group"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); 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()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); 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()); @@ -468,23 +502,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()); @@ -535,12 +569,12 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("topic"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); 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.查询直属下级组织状态话题-日统计数据 //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 @@ -556,7 +590,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()); @@ -564,18 +598,20 @@ 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.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + resultDTO.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); @@ -629,12 +665,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.查询网格层级话题数据 //查询网格层级状态话题-日统计数据 机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数 @@ -650,7 +686,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()); @@ -658,17 +694,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()); @@ -722,23 +758,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("issue"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); 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()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); 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()); @@ -792,23 +830,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()); @@ -862,23 +900,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("project"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); 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()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); 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()); @@ -928,23 +968,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()); @@ -1086,6 +1126,7 @@ public class DataStatsServiceImpl implements DataStatsService { public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); resultDTO.setAgencyId(formDTO.getAgencyId()); + resultDTO.setLevel(formDTO.getLevel()); NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(NumConstant.THREE); @@ -1095,6 +1136,42 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); + if (CollectionUtils.isEmpty(subAgencyIds)) { + subAgencyIds = new ArrayList<>(); + } + subAgencyIds.add(formDTO.getAgencyId()); + List 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.按日期查询当前组织事件治理指数 List agencyIds = new ArrayList<>(); agencyIds.add(formDTO.getAgencyId()); @@ -1133,6 +1210,18 @@ public class DataStatsServiceImpl implements DataStatsService { return resultList; } List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + List subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.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.按日期查询所有下级组织的事件治理指数 List list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); @@ -1231,22 +1320,22 @@ public class DataStatsServiceImpl implements DataStatsService { } //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + 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.getGridGovern(gridIds, formDTO.getDateId()); //3.封装数据 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { GridGovrnResultDTO dto = new GridGovrnResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (GridGovrnResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setProblemResolvedCount(re.getProblemResolvedCount()); dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); @@ -1298,6 +1387,19 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } + if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.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.按类型、日期查询治理指数下响应解决满意自治四个统计率 GovrnRatioResultDTO dto = indexService.governRatio(formDTO); @@ -1326,4 +1428,15 @@ public class DataStatsServiceImpl implements DataStatsService { public GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId) { return factGridMemberStatisticsDailyDao.getGridMemberIssueProjectStats( staffId); } + 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("%"); + } + } 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..43be38a84f 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,11 @@ 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 com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; + +import java.util.List; /** * @Author sun @@ -15,4 +20,55 @@ 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); + + /** + * 根据组织ID获取治理指数 + * @author zhaoqifeng + * @date 2021/6/25 16:33 + * @param agencyId + * @param areaCode + * @param dateId + * @return java.util.List + */ + ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:57 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(String agencyId); + + /** + * @Description 根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + * @author sun + */ + List getAgencyIdsByAgencyId(String agencyId); + + /** + * @Description 查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + * @author sun + */ + List getSubAgencyListByAgency(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..fc9e6b8ba6 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,14 +7,21 @@ 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.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * @Author sun @@ -26,6 +33,8 @@ import java.util.Date; public class EvaluationIndexServiceImpl implements EvaluationIndexService { @Autowired private EvaluationIndexDao evaluationIndexDao; + @Autowired + private CustomerRelation customerRelation; /** * @Param formDTO @@ -37,4 +46,99 @@ 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); + } + + /** + * 根据组织ID获取治理指数 + * + * @param agencyId + * @param areaCode + * @param dateId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/25 16:33 + */ + @Override + public ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId) { + List agencyIdList = getAgencyByAreaCodeAgencyId(agencyId, areaCode); + if (CollectionUtils.isEmpty(agencyIdList)) { + agencyIdList = new ArrayList<>(); + } + agencyIdList.add(agencyId); + return evaluationIndexDao.getGovernRankList(agencyIdList, dateId); + } + + /** + * 获取组织信息 + * + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + * @author zhaoqifeng + * @date 2021/6/29 13:57 + */ + @Override + public ScreenCustomerAgencyDTO getAgencyInfo(String agencyId) { + return evaluationIndexDao.getAgencyInfo(agencyId); + } + + /** + * @Description 根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + * @author sun + */ + @Override + public List getAgencyIdsByAgencyId(String agencyId) { + //1.查询agencyId对应组织信息 + ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); + //2.判断客户是否存在子客户 + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { + return new ArrayList<>(); + } + //3.存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + return evaluationIndexDao.getAgencyIdsByAgencyId(agencyId, dto.getAreaCode(), list); + } + + /** + * @Description 查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查且是在当前客户和子客户范围内查询 + * @author sun + */ + @Override + public List getSubAgencyListByAgency(String agencyId) { + //1.查询agencyId对应组织信息 + ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); + //2.判断客户是否存在子客户 + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { + return evaluationIndexDao.getSubAgencyListByAgency(agencyId, null, null); + } else { + list.add(dto.getCustomerId()); + return evaluationIndexDao.getSubAgencyListByAgency(null, dto.getAreaCode(), list); + } + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java index af0dc94e88..71d96fe17b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java @@ -10,4 +10,13 @@ import java.util.List; */ public interface CustomerRelation { List selectUsedAreaCodeList(String areaCode); + + /** + * 是否有子客户 + * @author zhaoqifeng + * @date 2021/6/29 11:06 + * @param customerId + * @return List + */ + List haveSubCustomer(String customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java index 045232e1a7..af5f40e53f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java @@ -5,6 +5,7 @@ import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.opercrm.CustomerRelationDao; import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,4 +28,17 @@ public class CustomerRelationImpl implements CustomerRelation { public List selectUsedAreaCodeList(String areaCode) { return customerRelationDao.selectUsedAreaCodeList(areaCode); } + + /** + * 是否有子客户 + * + * @param customerId + * @return boolean + * @author zhaoqifeng + * @date 2021/6/29 11:06 + */ + @Override + public List haveSubCustomer(String customerId) { + return customerRelationDao.selectAllSubCustomerIds(customerId); + } } 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..7b4361e463 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} + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml index a0c2e0c245..d248aa13df 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml @@ -20,4 +20,158 @@ AND date_id = #{dateId} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml index 169a44070f..439efdb207 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml @@ -14,4 +14,13 @@ AND cr.AREA_CODE LIKE concat(#{areaCode}, '%') AND cr.AREA_CODE != #{areaCode} + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java new file mode 100644 index 0000000000..10c2a503c3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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.dto; + +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; + private String areaCode; +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java new file mode 100644 index 0000000000..003e925379 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 15:26 + */ +@Data +public class AgencyDetailMulticFormDTO implements Serializable { + private static final long serialVersionUID = 6603177626712295270L; + /** + * 内部错误分组 + * */ + public interface AddUserInternalGroup{} + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空" , groups = {AddUserInternalGroup.class}) + private String agencyId; + + + /** + * 当前登录用户所属的客户id + */ + private String customerId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java new file mode 100644 index 0000000000..55df09cdfe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.form.project; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 群众不满列表查询入参DTO,从指标库取值 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 10:55 + */ +@Data +public class MassesDiscontentFormV2DTO implements Serializable { + public interface MassesDiscontentFormV2 { + } + + /** + * 时间区间,三个月:threeMonth;半年:sixMonth;一年:twelveMonth + * 一个月按照30天,三个月90天,半年180天,一年365天 + */ + @NotBlank(message = "timeSection不能为空,取值:三个月:threeMonth;半年:sixMonth;一年:twelveMonth", groups = MassesDiscontentFormV2.class) + private String timeSection; + + /** + * asc:分数由低到高 + * desc:分数由高到低 + */ + @NotBlank(message = "sortType不能为空,取值:asc:分数由低到高;desc:分数由高到低", groups = MassesDiscontentFormV2.class) + private String sortType; + + /** + * 组织ID + */ + @NotBlank(message = "agencyId不能为空", groups = MassesDiscontentFormV2.class) + private String agencyId; + + @NotNull(message = "pageNo不能为空", groups = MassesDiscontentFormV2.class) + private Integer pageNo; + + @NotNull(message = "pageSize不能为空", groups = MassesDiscontentFormV2.class) + private Integer pageSize; + + /** + * 当前agency对应的区域编码,由前端传入,前端从/data/report/screen/agency/agencydetail这取值 + */ + private String areaCode; + + + + + //以下属性无需前端传入 + private String startDate; + private String endDate; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java new file mode 100644 index 0000000000..7b34abcec9 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java @@ -0,0 +1,104 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 15:31 + */ +@Data +public class AgencyDetailMulticResultDTO implements Serializable { + /** + * 机关组织Id + */ + private String agencyId = ""; + + /** + * 组织名称 + */ + private String agencyName = ""; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level = ""; + + /** + * 地区编码 + */ + private String areaCode = ""; + + /** + * 【省份】名称 + */ + private String province = ""; + + /** + * 【城市】名称 + */ + private String city = ""; + + /** + * 【区县】名称 + */ + private String district = ""; + + /** + * 本机关的所有上级机关 + */ + private List parentList; + + /** + * 街道 + */ + private String street=""; + + /** + * 社区 + */ + private String community=""; + + /** + * open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参 + */ + private String areaCodeSwitch; + + /** + * 组织区划的名称 + */ + private String areaName; + + /** + * 当前组织对应客户根组织级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String rootlevel; + + + //以下参数是06.24新增 + private String rootAgencyId; + private String parentAreaCode; + /** + * 是否有字客户 + */ + private Boolean haveSubCustomer; + + /** + * 子客户列表 + */ + private List subCustomerIds; + + // @JsonIgnore + /** + * 当前agencyId所属的客户id + */ + private String customerId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java new file mode 100644 index 0000000000..60683bf779 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口-本机关的所有上级机关信息 + * + * @author sun + */ +@Data +public class ParentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String id = ""; + /** + * 机关组织名称 + */ + private String name = ""; + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java index 5ceeca49a7..a07fa65053 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java @@ -46,4 +46,14 @@ public class ScreenCustomerAgencyDTO implements Serializable { * 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 */ private String parentAreaCode; + + /** + * 父级id ,顶级,此列为0 + */ + private String pid; + + /** + * 所有上级ID,用逗号(英文)分开 + */ + private String pids; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java new file mode 100644 index 0000000000..627edc6daa --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java @@ -0,0 +1,69 @@ +package com.epmet.dto.result.project; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * 群众不满列表查询返参DTO,从指标库取值 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 11:02 + */ +@Data +public class MassesDiscontentResultV2DTO implements Serializable { + private static final long serialVersionUID = 403953150174574960L; + /** + * 项目ID + */ + private String projectId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 话题所在网格 + */ + private String gridName; + + /** + * 话题图片 + */ + private List photos; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 项目分类标签 + */ + private String projectCategory; + + /** + * 项目评价分数 + * 直接取整数位展示 + */ + private BigDecimal score; + + @JsonIgnore + private String customerId; + @JsonIgnore + private String parentAgencyId; + @JsonIgnore + private String areaCode; + + public MassesDiscontentResultV2DTO() { + this.gridName = ""; + this.photos = new ArrayList<>(); + this.topicContent = ""; + this.projectCategory = ""; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java index 166c9c2aa9..fcba02911c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java @@ -21,4 +21,9 @@ public class AgencyFormDTO implements Serializable { @NotBlank(message = "机关Id不能为空" , groups = CommonAgencyIdGroup.class) private String agencyId; + + /** + * 平阴县默认穿370124,跟随8个街道点击事件,传入街道的areaCode + * */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java index 42a67c936f..ce778cf651 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java @@ -21,4 +21,9 @@ public class RootAgencyFormDTO implements Serializable { @NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class}) private String agencyId; + /** + * token中客户Id + */ + private String customerId; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java index 1c7391dd93..ece032ba4d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Set; @@ -24,6 +25,11 @@ public class ScreenProjectDetailResultDTO implements Serializable { * 项目id */ private String projectId; + /** + * 项目标题,06.25新增,工作端小程序难点赌点+群众不满详情用 + */ + private String projectTitle; + /** * 议题内容,其实就是项目内容 */ @@ -66,6 +72,11 @@ public class ScreenProjectDetailResultDTO implements Serializable { */ private List processList; + /** + * 满意度得分 06.25新增,这个返参目前大屏和工作端小程序都没有用到,工作端小程序详情的得分是取得列表返回去的值 + */ + private BigDecimal score; + @Data public static class processDTO{ private String processId; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java index 94e4f20546..3e02aa4e96 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; /** * @Description 用户参与各项指标以及增长查询结果dto * @ClassName UserJoinIndicatorGrowthRateResultDTO - * @Auth wangc + * @author wangc * @Date 2020-08-21 16:07 */ @Data @@ -16,25 +16,33 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { private static final long serialVersionUID = -8830240350298414599L; private String id; - + /** + * 总参与数 + * */ private Integer total; + /** + * 总参与数:月增长 + * */ private BigDecimal monthIncr; /** - * incr上升, decr下降 + * 总参与数:incr上升, decr下降 * */ private String monthTrend; + /** + * 人均议题 + * */ private BigDecimal averageIssue; /** - * 较上月百分比 + * 人均议题:较上月百分比 * */ private BigDecimal issueCompareLatestMonth; /** - * 较上月趋势:incr上升,decr下降 + * 人均议题:较上月趋势:incr上升,decr下降 * */ private String issueCompareLatestTrend; @@ -43,7 +51,13 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { */ private BigDecimal averageJoin; + /** + * 平均参与度: 较上月百分比 + */ private BigDecimal joinCompareLatestMonth; + /** + * 平均参与度:较上月趋势:incr上升,decr下降 + */ private String joinCompareLatestTrend; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java index 7b07db5c72..ac850effbe 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java @@ -22,4 +22,11 @@ public interface ProjectConstant { String PROCESS_FAILURE = "查询项目进展失败......"; + /** + * 三个月,六个月,12个月 + */ + String THREE_MONTH = "threeMonth"; + String SIX_MONTH = "sixMonth"; + String TWELVE_MONTH = "twelveMonth"; + String YESTERDAY = "yesterday"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java index 5a3936db6a..8f62ab848e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java @@ -40,4 +40,15 @@ public class DifficultyRankFormDTO implements Serializable { * 组织类型: 网格:grid ; 组织:agency */ private String orgType; + + /** + * 当前agency对应的区域编码,由前端传入,前端从/data/report/screen/agency/agencydetail这取值 + */ + private String areaCode; + + //以下属性无需前端赋值 + /** + * 当前登录用户所属客户id + */ + private String customerId; } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java index f781d62d15..f3d1967599 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java @@ -3,7 +3,6 @@ package com.epmet.project.dto.result; import lombok.Data; import java.io.Serializable; -import java.util.ArrayList; import java.util.List; /** @@ -25,11 +24,17 @@ public class ProjectDifficultRankResultDTO implements Serializable { * 项目标题 * */ private String title; - + // 3个街道和产品这边状态码不一样.. /** * 状态: 待处理: pending; 结案closed * */ private String statusCode; + // pending 处理中 + // closed 已结案 + // 10 已结案 + // 5 已关闭 + // 0 处理中 + private String statusDesc; /** * 社区-网格名 diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java index 2c867a6398..9aaf0b6050 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java @@ -1,9 +1,9 @@ package com.epmet.project.dto.result; +import com.epmet.commons.tools.constant.StrConstant; import lombok.Data; import java.io.Serializable; -import java.util.List; /** * @Description 难点赌点-当前登录人员本级一级下一级组织机构/网格 返参DTO @@ -30,5 +30,15 @@ public class ProjectNextAgencyResultDTO implements Serializable { * */ private String orgType; + /** + * orgId对应的areaCode。 只有当前客户有子客户时,才会返回指,否则返回null或者空字符串 + * */ + private String areaCode; + public ProjectNextAgencyResultDTO(){ + this.orgId= StrConstant.EPMETY_STR; + this.orgName= StrConstant.EPMETY_STR; + this.orgType= StrConstant.EPMETY_STR; + this.areaCode= StrConstant.EPMETY_STR; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java index 3a2f5cfebb..29d8cb939b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java @@ -1,5 +1,7 @@ package com.epmet.datareport.controller.fact; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.fact.FactIndexService; @@ -98,8 +100,9 @@ public class FactIndexController { * @author sun */ @PostMapping("index/rootagency") - public Result rootAgency(@RequestBody RootAgencyFormDTO formDTO) { + public Result rootAgency(@LoginUser TokenDto tokenDto, @RequestBody RootAgencyFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(factIndexService.rootAgency(formDTO)); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java index 2f704b6b16..6f485e507e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java @@ -11,6 +11,8 @@ import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantity import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.datareport.service.project.ProjectService; import com.epmet.dto.form.ProcessListFormDTO; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.constant.ProjectConstant; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; @@ -114,6 +116,21 @@ public class ProjectController { return new Result>().ok(projectService.getDifficultyRank(param)); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 难点赌点-耗时最长|涉及部门最多|处理次数 返回该组织下所有的难点堵点的 数据 + * 2021.06.21新增次API,多客户版本,eg:平阴县的工作人员可以看到8个街道的难点赌点 + * @Date 2021/6/23 13:09 + **/ + @PostMapping("difficultyrank-multic") + public Result> difficultyRankMultic(@RequestHeader("CustomerId") String customerId,@RequestBody DifficultyRankFormDTO formDTO){ + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, DifficultyRankFormDTO.DifficultyRankInternalGroup.class); + return new Result>().ok(projectService.difficultyRankMultic(formDTO)); + } + /** * @Description 难点赌点-耗时最长|涉及部门最多|处理次数 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321614 @@ -127,6 +144,20 @@ public class ProjectController { return new Result>().ok(projectService.getMyNextAgency(tokenDto)); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param tokenDto + * @author yinzuomei + * @description 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * @Date 2021/6/22 14:20 + **/ + @PostMapping("mynextagency-multic") + public Result> myNextAgencyMultic(@LoginUser TokenDto tokenDto){ + return new Result>().ok(projectService.myNextAgencyMultic(tokenDto.getUserId(),tokenDto.getCustomerId())); + } + /** * 002、项目分类字典查询 * 查询当前客户的父客户下,项目分类字典 @@ -140,4 +171,18 @@ public class ProjectController { public Result> categoryDict(@RequestHeader("CustomerId") String customerId) { return new Result>().ok(projectService.getCategoryDict(customerId)); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 群众不满列表,改为从指标库的screen_project_data取值 + * sql里面写死<75分的展示 + * @Date 2021/6/24 11:13 + **/ + @PostMapping("massesdiscontent-multic") + public Result> queryMassesDiscontentMultic(@RequestBody MassesDiscontentFormV2DTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MassesDiscontentFormV2DTO.MassesDiscontentFormV2.class); + return new Result>().ok(projectService.queryMassesDiscontentMultic(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java index 1eba0b727c..6c71a15009 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java @@ -1,10 +1,14 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; @@ -110,4 +114,19 @@ public class AgencyController { } return new Result<>(); } + + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 工作端小程序-数据上面的 当前组织调用此接口 + * @Date 2021/6/24 15:29 + **/ + @PostMapping("agencydetail-multic") + public Result queryAgencyDetailMultiC(@LoginUser TokenDto tokenDto, @RequestBody AgencyDetailMulticFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AgencyDetailMulticFormDTO.AddUserInternalGroup.class); + return new Result().ok(agencyService.queryAgencyDetailMultiC(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 986a880aac..a951b18406 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -17,6 +17,8 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.dto.result.plugins.DeptNodeDTO; @@ -98,7 +100,7 @@ public interface ScreenCustomerAgencyDao { * @Description 根据组织ID判断是否根组织 * @author sun */ - int selectRootAgency(@Param("agencyId") String agencyId); + int selectRootAgency(@Param("agencyId") String agencyId, @Param("customerId") String customerId); /** * desc: 根据orgId获取组织信息 @@ -170,4 +172,35 @@ public interface ScreenCustomerAgencyDao { * @date 2021/6/8 1:27 下午 */ List selectGrid(@Param("agencyId")String agencyId,@Param("areaCode")String areaCode); + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @return java.util.List + */ + List selectNextAgencyList(@Param("areaCode") String areaCode, @Param("pid") String pid, @Param("allCustomerIds") List allCustomerIds); + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @return java.util.List + */ + List selectGridDTOList(@Param("areaCode") String areaCode, @Param("parentAgencyId") String parentAgencyId,@Param("allCustomerIds") List allCustomerIds); + + List selectPAgencyById(@Param("listStr")List pidList); + + /** + * @return com.epmet.dto.result.ScreenCustomerAgencyDTO + * @param customerId + * @author yinzuomei + * @description 根据客户id,返回当前客户下的跟组织信息 + * @Date 2021/6/24 17:43 + **/ + ScreenCustomerAgencyDTO selectCustomerRootAgency(String customerId); + + ScreenCustomerAgencyDTO selectByAreaCode(String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java index 870c25a6d2..d323c244c8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java @@ -1,5 +1,6 @@ package com.epmet.datareport.dao.project; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.result.*; @@ -66,6 +67,14 @@ public interface ProjectDao { **/ List difficultyRank(DifficultyRankFormDTO difficultyRankFormDTO); + /** + * 工作端-数据:难点赌点列表查询V2,多客户版本 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + List difficultyRankV2(DifficultyRankFormDTO formDTO); + /** * @Description 查询难点堵点的图片list * @param @@ -74,4 +83,21 @@ public interface ProjectDao { * @date 2020.10.20 10:13 **/ List getDifficultyImgList(String eventId); + + /** + * @return java.util.List + * @param agencyId + * @param areaCode + * @param startDate + * @param endDate + * @param sortType + * @author yinzuomei + * @description 群众不满列表,改为从指标库的screen_project_data取值 sql里面写死<75分的展示 + * @Date 2021/6/24 13:16 + **/ + List selectMassesDiscontentMultic(@Param("agencyId") String agencyId, + @Param("areaCode") String areaCode, + @Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("sortType") String sortType); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java new file mode 100644 index 0000000000..f9bdc24a1e --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java @@ -0,0 +1,39 @@ +package com.epmet.datareport.redis; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/29 15:46 + */ +@Component +public class DataReportRedis { + @Autowired + private RedisUtils redisUtils; + private String agencyDetailKeyPrefix="epmet:screen:"; + + public AgencyDetailMulticResultDTO queryAgencyDetailMulticResultDTO(String customerId, String agencyId) { + String agencyDetailKey=agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); + Map map = redisUtils.hGetAll(agencyDetailKey); + if (MapUtil.isEmpty(map)) { + return null; + } + AgencyDetailMulticResultDTO dto = BeanUtil.mapToBean(map, AgencyDetailMulticResultDTO.class, true); + return dto; + } + + public void setAgencyDetailMulticResultDTO(String customerId, String agencyId, AgencyDetailMulticResultDTO agencysResultDTO) { + String agencyDetailKey = agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); + Map map = BeanUtil.beanToMap(agencysResultDTO); + redisUtils.hMSet(agencyDetailKey, map, RedisUtils.DEFAULT_EXPIRE); + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java index 4f11f160ab..aa142bed95 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java @@ -1,11 +1,14 @@ package com.epmet.datareport.service.evaluationindex.screen; import com.epmet.dto.AgencyInfoDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; -import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; +import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; @@ -73,4 +76,32 @@ public interface AgencyService { List getNextAgencyIds(String areaCode,String agencyId); AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId); + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + List queryNextAgencyList(String areaCode, String pid,List allSubCustomerIds); + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + List queryGridList(String areaCode, String parentAgencyId,List allSubCustomerIds); + + /** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @param formDTO + * @return com.epmet.dto.result.AgencyDetailMulticResultDTO + */ + AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 535362f3ea..538df72f10 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -2,20 +2,28 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.AgencyTreeUtils; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.datareport.redis.DataReportRedis; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.dto.AgencyInfoDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; -import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; +import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; @@ -25,6 +33,8 @@ import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.exceptions.TooManyResultsException; @@ -33,6 +43,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -52,6 +64,12 @@ public class AgencyServiceImpl implements AgencyService { private ScreenCustomerGridDao screenCustomerGridDao; @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private DataReportRedis dataReportRedis; /** * @Description 1、组织机构树 @@ -322,4 +340,171 @@ public class AgencyServiceImpl implements AgencyService { agencyInfoDTO.setSubGridIds(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); return agencyInfoDTO; } + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + @Override + public List queryNextAgencyList(String areaCode, String pid,List allSubCustomerIds) { + return screenCustomerAgencyDao.selectNextAgencyList(areaCode,pid,allSubCustomerIds); + } + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + @Override + public List queryGridList(String areaCode, String parentAgencyId,List allSubCustomerIds) { + return screenCustomerAgencyDao.selectGridDTOList(areaCode,parentAgencyId,allSubCustomerIds); + } + + /** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @param formDTO + * @return com.epmet.dto.result.AgencyDetailMulticResultDTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO) { + AgencyDetailMulticResultDTO agencysResultDTO =dataReportRedis.queryAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId()); + if (null != agencysResultDTO) { + log.info("queryAgencyDetailMultiC从redis取值入参:"+ JSON.toJSONString(formDTO)); + return agencysResultDTO; + } + agencysResultDTO = new AgencyDetailMulticResultDTO(); + List parentList = new ArrayList<>(); + agencysResultDTO.setParentList(parentList); + + //1:查询本机关详细信息 + ScreenCustomerAgencyDTO customerAgencyDTO = screenCustomerAgencyDao.selectByAgencyId(formDTO.getAgencyId()); + if (null == customerAgencyDTO) { + return agencysResultDTO; + } + agencysResultDTO = ConvertUtils.sourceToTarget(customerAgencyDTO, AgencyDetailMulticResultDTO.class); + //当前组织的客户id。 + agencysResultDTO.setCustomerId(customerAgencyDTO.getCustomerId()); + + //2、当前登录用户所属客户,的跟级组织 + ScreenCustomerAgencyDTO rootAgency=screenCustomerAgencyDao.selectCustomerRootAgency(formDTO.getCustomerId()); + agencysResultDTO.setRootlevel(rootAgency.getLevel()); + agencysResultDTO.setRootAgencyId(rootAgency.getAgencyId()); + + //3、当前登录用户所属客户,是否开启了area_code开关 + // 这个接口返回areaCodeSwitch应该没有啥用...先注释吧 + /*Result govOrgRes=govOrgOpenFeignClient.getAreaCodeSwitch(formDTO.getCustomerId()); + log.info("当前登录用户所属客户,是否开启了area_code开关,返参:"+ JSON.toJSONString(govOrgRes)); + if(govOrgRes.success()&&StringUtils.isNotBlank(govOrgRes.getData())){ + agencysResultDTO.setAreaCodeSwitch(govOrgRes.getData()); + }else{ + agencysResultDTO.setAreaCodeSwitch("closed"); + }*/ + agencysResultDTO.setAreaCodeSwitch("closed"); + + + //4、如果当前客户不存在子客户则areaCode置为空 + Result> crmRes=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); + if (crmRes.success() &&CollectionUtils.isEmpty(crmRes.getData())) { + //不存在子客户,则areaCode相关返参都默认为空字符串 + agencysResultDTO.setAreaCode(StrConstant.EPMETY_STR); + agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); + agencysResultDTO.setParentAreaCode(StrConstant.EPMETY_STR); + agencysResultDTO.setHaveSubCustomer(false); + agencysResultDTO.setSubCustomerIds(new ArrayList<>()); + }else{ + agencysResultDTO.setAreaName(agencysResultDTO.getAgencyName()); + agencysResultDTO.setHaveSubCustomer(true); + agencysResultDTO.setSubCustomerIds(crmRes.getData()); + } + + log.info("当前组织的客户id="+agencysResultDTO.getCustomerId()+";当前登录用户所属的客户id="+formDTO.getCustomerId()); + if(agencysResultDTO.getHaveSubCustomer()){ + if (formDTO.getCustomerId().equals(agencysResultDTO.getCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { + log.info(String.format("1)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); + agencysResultDTO.setParentList(parentList); + }else{ + // 5、多客户时根据area_code查询上级,自下向上,查询到当前客户的跟组织即可stop + log.info("多客户版本parentList、level要重新赋值;agencysResultDTO.getParentAreaCode()="+agencysResultDTO.getParentAreaCode()); + ScreenCustomerAgencyDTO parentAgency=screenCustomerAgencyDao.selectByAreaCode(agencysResultDTO.getParentAreaCode()); + if (null != parentAgency) { + agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency)); + List temp = getParentListMultic(parentList, parentAgency, formDTO.getCustomerId(), agencysResultDTO.getRootAgencyId()); + agencysResultDTO.setParentList(temp); + } + } + }else{ + //单客户 + //6:查询当前组织的所有上级组织,按自上而下层级顺序 + if (formDTO.getCustomerId().equals(agencysResultDTO.getCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { + log.info(String.format("2)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); + agencysResultDTO.setParentList(parentList); + }else{ + List pidList =new ArrayList<>(); + if(customerAgencyDTO.getPids().contains(StrConstant.COLON)){ + pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COLON)); + }else if(customerAgencyDTO.getPids().contains(StrConstant.COMMA)){ + pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COMMA)); + } + if(!CollectionUtils.isEmpty(pidList)){ + //单客户,存在上级时查询... + agencysResultDTO.setParentList(screenCustomerAgencyDao.selectPAgencyById(pidList)); + } + } + } + dataReportRedis.setAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId(),agencysResultDTO); + return agencysResultDTO; + } + + private List getParentListMultic(List resList, ScreenCustomerAgencyDTO firstParent, String currentUserCustomerId, String rootAgencyId) { + ParentListResultDTO resultDTO = new ParentListResultDTO(); + resultDTO.setId(firstParent.getAgencyId()); + resultDTO.setName(firstParent.getAgencyName()); + resultDTO.setLevel(firstParent.getLevel()); + resultDTO.setAreaCode(firstParent.getAreaCode()); + resList.add(resultDTO); + if (firstParent.getCustomerId().equals(currentUserCustomerId) && firstParent.getAgencyId().equals(rootAgencyId)) { + Collections.reverse(resList); + return resList; + } else { + String parentAgencyAreaCode = firstParent.getParentAreaCode(); + if (StringUtils.isNotBlank(parentAgencyAreaCode)) { + parentAgencyAreaCode = parentAgencyAreaCode.replaceAll("(0)+$", ""); + } + ScreenCustomerAgencyDTO parentAgency = screenCustomerAgencyDao.selectByAreaCode(parentAgencyAreaCode); + if (null != parentAgency) { + return getParentListMultic(resList, parentAgency, currentUserCustomerId, rootAgencyId); + } else { + return resList; + } + } + } + + private String getAgencyLevelMultiC(ScreenCustomerAgencyDTO parentAgency) { + String level=StrConstant.EPMETY_STR; + if(null!=parentAgency){ + if(Constant.PROVINCE.equals(parentAgency.getLevel())){ + return Constant.CITY; + }else if(Constant.CITY.equals(parentAgency.getLevel())){ + return Constant.DISTRICT; + }else if(Constant.DISTRICT.equals(parentAgency.getLevel())){ + return Constant.STREET; + }else if(Constant.STREET.equals(parentAgency.getLevel())){ + return Constant.COMMUNITY; + } + } + return level; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index 0cdb93a9c7..45eeb51736 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -133,30 +134,58 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { * @author wangc * @date 2020.08.20 14:37 **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { - ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); - Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); - List subCustomers; - if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;} - else {subCustomers = crmResp.getData();} + String monthId = dateUtils.getPreviousMonthId(NumConstant.ONE); + UserJoinIndicatorGrowthRateResultDTO latest = new UserJoinIndicatorGrowthRateResultDTO(); + if (StringUtils.isNotBlank(param.getAreaCode()) && "370124".equals(param.getAreaCode())) { + latest= screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), monthId); + if (null == latest) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s", monthId)); + return new PublicPartiProfileResultDTO(); + } + UserJoinIndicatorGrowthRateResultDTO beforeTwoMonth = screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), dateUtils.getPreviousMonthId(NumConstant.TWO)); + if (null == beforeTwoMonth) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s",dateUtils.getPreviousMonthId(NumConstant.TWO))); + return new PublicPartiProfileResultDTO(); + }else{ + //举例,today is 20210707 , latest是06月份的数据,beforeTwoMonth是05月份的数据 - String monthId = dateUtils.getCurrentMonthId(); - UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - //保证获取公众参与概率数据的最大可能性 - int time = NumConstant.TWELVE; - while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { - time--; - monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); - latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - } + // 总参与数6月份比5月份增加了? + int incrTotal = latest.getTotal() - beforeTwoMonth.getTotal(); + // 总参与数月增长:增加的占5月份的占比??? + BigDecimal monthIncr = NumConstant.ZERO == beforeTwoMonth.getTotal() ? BigDecimal.ZERO : BigDecimal.valueOf(incrTotal / beforeTwoMonth.getTotal()); + latest.setMonthIncr(monthIncr); + latest.setMonthTrend(monthIncr.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + + //人均议题数6月份比五月份增加了? + BigDecimal issueIncrTotal = latest.getAverageIssue().subtract(beforeTwoMonth.getAverageIssue()); + //人均议题数月增长:增加的占5月份的占比??? + BigDecimal issueCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getAverageIssue()) == 0 ? BigDecimal.ZERO : issueIncrTotal.divide(beforeTwoMonth.getAverageIssue(), 2, RoundingMode.HALF_UP); + latest.setIssueCompareLatestMonth(issueCompareLatestMonth); + latest.setIssueCompareLatestTrend(issueCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); - if (null == latest) return new PublicPartiProfileResultDTO(); + // 平均参与度6月份比5月份增加了? + BigDecimal incrJoinCompareLatestMonth=latest.getJoinCompareLatestMonth().subtract(beforeTwoMonth.getJoinCompareLatestMonth()); + //平均参与度月增长:增加的占5月份的占比??? + BigDecimal joinCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getJoinCompareLatestMonth()) == 0 ? BigDecimal.ZERO : incrJoinCompareLatestMonth.divide(beforeTwoMonth.getJoinCompareLatestMonth(), 2, RoundingMode.HALF_UP); + latest.setJoinCompareLatestMonth(joinCompareLatestMonth); + latest.setJoinCompareLatestTrend(joinCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + } + } else { + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + //保证获取公众参与概率数据的最大可能性 + int time = NumConstant.TWELVE; + while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + } + } + if (null == latest) { + return new PublicPartiProfileResultDTO(); + } PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class); result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO)); result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO)); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 7a5eeee0d1..80d2161ebb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -486,7 +486,7 @@ public class FactIndexServiceImpl implements FactIndexService { public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) { RootAgencyResultDTO resultDTO = new RootAgencyResultDTO(); //1.根据agencyId查询是否为根级组织 - int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId()); + int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId(), formDTO.getCustomerId()); if (num < NumConstant.ONE) { resultDTO.setIsRoot(false); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java index 917113fe12..e2d1a06654 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java @@ -1,6 +1,8 @@ package com.epmet.datareport.service.project; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; @@ -62,6 +64,14 @@ public interface ProjectService { **/ List getDifficultyRank(DifficultyRankFormDTO param); + /** + * 难点赌点-耗时最长|涉及部门最多|处理次数 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + List difficultyRankMultic(DifficultyRankFormDTO formDTO); + /** * @Description 难点赌点-获取组织下拉框 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321614 @@ -80,4 +90,23 @@ public interface ProjectService { * @Date 14:26 2021-03-22 **/ List getCategoryDict(String customerId); + + /** + * 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * + * @param staffId 当前登录用户id + * @param currentCustomerId 当前客户id + * @return com.epmet.project.dto.result.ProjectNextAgencyResultDTO + */ + List myNextAgencyMultic(String staffId,String currentCustomerId); + + /** + * 群众不满列表,改为从指标库的screen_project_data取值,sql里面写死<75分的展示 + * + * @param formDTO + * @return com.epmet.dto.result.project.MassesDiscontentResultV2DTO + */ + List queryMassesDiscontentMultic(MassesDiscontentFormV2DTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index 4d2df70470..33fd65dd1b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -4,20 +4,25 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.datareport.dao.project.ProjectDao; -import com.epmet.datareport.service.evaluationindex.screen.ScreenDifficultyDataService; +import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.project.ProjectService; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.SubAgencyFormDTO; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.evaluationindex.screen.dto.result.DepartmentNameListResultDTO; import com.epmet.feign.*; import com.epmet.project.constant.ProjectConstant; @@ -25,12 +30,13 @@ import com.epmet.project.dto.CustomerCategoryDTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; -import com.epmet.project.dto.result.*; import com.epmet.project.dto.result.ProjectDetailResultDTO; +import com.epmet.project.dto.result.*; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -59,9 +65,6 @@ public class ProjectServiceImpl implements ProjectService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private GovProjectOpenFeignClient govProjectOpenFeignClient; - @Autowired - private ScreenDifficultyDataService screenDifficultyDataService; - @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; @Autowired @@ -70,6 +73,10 @@ public class ProjectServiceImpl implements ProjectService { private GovIssueOpenFeignClient govIssueOpenFeignClient; @Autowired private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private AgencyService screenAgencyService; + @Autowired + private ScreenProjectDataDao screenProjectDataDao; /** * @Author sun @@ -357,6 +364,48 @@ public class ProjectServiceImpl implements ProjectService { return result; } + /** + * 难点赌点-耗时最长|涉及部门最多|处理次数 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + @Override + public List difficultyRankMultic(DifficultyRankFormDTO formDTO) { + //1、查询当前客户是否包含子客户 + //多客户测试写死值,别忘了注释掉呀 + // formDTO.setCustomerId("613cc61a6b8ce4c70d21bd413dac72cc"); + // formDTO.setAgencyId("30705f91f1295ae77d372b868596a5e7"); + + //06.24决定areaCode让前端传入, 前端从前端从/data/report/screen/agency/agencydetail这取值取值 + /*Result> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + log.warn("❤当前客户存在子客户❤"); + //2、查询组织信息 + Result agencyResult = govOrgOpenFeignClient.getAgencyById(formDTO.getAgencyId()); + if (!agencyResult.success() || null == agencyResult.getData()) { + throw new RenException(String.format("查询组织信息异常,agencyId:%s", formDTO.getAgencyId())); + } + formDTO.setAreaCode(agencyResult.getData().getAreaCode()); + }*/ + // 只有平阴根据areaCode查询,其余的还是按照agencyId查询 + if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !"370124".equals(formDTO.getAreaCode())) { + formDTO.setAreaCode(StrConstant.EPMETY_STR); + } + // 3、升级原来的列表查询接口 + PageHelper.startPage(null == formDTO.getPageNo() ? NumConstant.ONE : formDTO.getPageNo(), formDTO.getTopNum()); + List result = projectDao.difficultyRankV2(formDTO); + for (int i = 0; i < result.size(); i++) { + List imgUrlList = projectDao.getDifficultyImgList(result.get(i).getProjectId()); + result.get(i).setImgUrlList(imgUrlList); + } + if (CollectionUtils.isEmpty(result)) { + return new ArrayList<>(); + } + return result; + } + @Override public List getCategoryDict(String customerId) { List result = new ArrayList<>(); @@ -394,4 +443,132 @@ public class ProjectServiceImpl implements ProjectService { } return result; } + + /** + * 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * + * @param staffId 当前登录用户id + * @param currentCustomerId 当前客户id + * @return com.epmet.project.dto.result.ProjectNextAgencyResultDTO + */ + @Override + public List myNextAgencyMultic(String staffId,String currentCustomerId) { + //多客户测试写死值,别忘了注释掉呀 + // staffId="3f04e397cc226e4e2f2531ac4363e3f9"; + // currentCustomerId="613cc61a6b8ce4c70d21bd413dac72cc"; + //1、当前工作人员所属组织信息 + Result staffResult = govOrgOpenFeignClient.getAgencyByStaff(staffId); + if (!staffResult.success() || null == staffResult.getData()) { + throw new RenException(String.format("查询当前工作人员所属组织信息异常,staffId:%s", staffId)); + } + List resultList = new ArrayList<>(); + ProjectNextAgencyResultDTO staffAgency = new ProjectNextAgencyResultDTO(); + staffAgency.setOrgId(staffResult.getData().getId()); + staffAgency.setOrgName(staffResult.getData().getOrganizationName()); + staffAgency.setOrgType("agency"); + staffAgency.setAreaCode(staffResult.getData().getAreaCode()); + resultList.add(staffAgency); + //2、查询指标库当前组织的下级组织 + List agencyDTOList =new ArrayList<>(); + Result> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(currentCustomerId); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + log.warn("❤当前客户存在子客户❤"); + crmRes.getData().add(currentCustomerId); + //如果包含子客户,则根据areaCode查询下一级 + agencyDTOList = screenAgencyService.queryNextAgencyList(staffResult.getData().getAreaCode(), StrConstant.EPMETY_STR,crmRes.getData()); + } else { + //当前客户没有子客户,根据agencyId查询下一级组织 + agencyDTOList = screenAgencyService.queryNextAgencyList(StrConstant.EPMETY_STR, staffResult.getData().getId(),null); + } + if (CollectionUtils.isNotEmpty(agencyDTOList)) { + agencyDTOList.forEach(agencyDTO -> { + ProjectNextAgencyResultDTO nextAgency = new ProjectNextAgencyResultDTO(); + nextAgency.setOrgId(agencyDTO.getAgencyId()); + nextAgency.setOrgName(agencyDTO.getAgencyName()); + nextAgency.setOrgType("agency"); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //只有当前客户存在子客户时,才返回areaCode + nextAgency.setAreaCode(agencyDTO.getAreaCode()); + } + resultList.add(nextAgency); + }); + } + //3、查询指标库当前组织的下级网格 + List gridList = new ArrayList<>(); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //如果包含子客户,则根据areaCode查询下一级网格 + crmRes.getData().add(currentCustomerId); + gridList=screenAgencyService.queryGridList(staffResult.getData().getAreaCode(), StrConstant.EPMETY_STR,crmRes.getData()); + } else { + //当前客户没有子客户,根据agencyId查询下一级网格 + gridList=screenAgencyService.queryGridList(StrConstant.EPMETY_STR,staffResult.getData().getId(),null); + } + if (CollectionUtils.isNotEmpty(gridList)) { + gridList.forEach(gridDTO -> { + ProjectNextAgencyResultDTO grid = new ProjectNextAgencyResultDTO(); + grid.setOrgId(gridDTO.getGridId()); + grid.setOrgName(gridDTO.getGridName()); + grid.setOrgType("grid"); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //只有当前客户存在子客户时,才返回areaCode + grid.setAreaCode(gridDTO.getAreaCode()); + } + resultList.add(grid); + }); + } + return resultList; + } + + /** + * 群众不满列表,改为从指标库的screen_project_data取值,sql里面写死<75分的展示 + * + * @param formDTO + * @return com.epmet.dto.result.project.MassesDiscontentResultV2DTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public List queryMassesDiscontentMultic(MassesDiscontentFormV2DTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + formDTO.setEndDate(getDateId(ProjectConstant.YESTERDAY)); + formDTO.setStartDate(getDateId(formDTO.getTimeSection())); + log.info(JSON.toJSONString(formDTO,true)); + //已结案、并且来源于议题、在当前时间范围内的、 + List list = projectDao.selectMassesDiscontentMultic(formDTO.getAgencyId(), + formDTO.getAreaCode(), + formDTO.getStartDate(), + formDTO.getEndDate(), + formDTO.getSortType()); + list.forEach(project -> { + project.setPhotos(screenProjectDataDao.selectProjectImgs(project.getProjectId(), project.getCustomerId())); + }); + return list; + } + + /** + * @Description 处理时间 + * @Param dateType + * @author zxc + * @date 2021/5/18 2:28 下午 + */ + public String getDateId(String dateType){ + String result = DateUtils.getBeforeNDay(NumConstant.ONE); + switch (dateType) { + case ProjectConstant.THREE_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.NINETY); + break; + case ProjectConstant.SIX_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.ONE_HUNDRED_AND_EIGHTY); + break; + case ProjectConstant.TWELVE_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.THREE_HUNDRED_AND_SIXTY_FIVE); + break; + case ProjectConstant.YESTERDAY: + result = DateUtils.getBeforeNDay(NumConstant.ONE); + break; + default: + } + return result; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java index bfc46d03bd..a087e1c3c6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java @@ -107,17 +107,17 @@ public class DateUtils { } /** - * @Description 得到上个月的monthId - * @param + * @Description 前n个月 + * @param beforeMonthNum * @return * @author wangc * @date 2020.08.20 10:19 **/ - public String getPreviousMonthId(){ + public String getPreviousMonthId(int beforeMonthNum){ SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); // 设置为当前时间 - calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); // 设置为上一个月 + calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - beforeMonthNum); // 设置为上一个月 return format.format(calendar.getTime()); } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml index d06d7ac03d..fced0091a6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml @@ -267,6 +267,78 @@ DESC + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 03dcd38d40..83770370b5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -116,6 +116,7 @@ del_flag = '0' AND pid = '0' AND agency_id = #{agencyId} + AND customer_id = #{customerId} + + + + + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index f00cc4c23e..5b573343e2 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -92,13 +92,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -206,13 +206,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -278,13 +278,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml index ad0132dd85..35bf90d165 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml @@ -34,16 +34,16 @@ score.ORG_TYPE orgType FROM screen_index_data_yearly score - + - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 0f0cb8c58c..543b9d3eb4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -60,15 +60,17 @@ SELECT - scj.ID, - IFNULL(avg( scj.JOIN_TOTAL ),0) AS total, - IFNULL(ROUND( avg( scj.AVG_JOIN ), 1 ),0) AS averageJoin, - IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) AS monthIncr, - (case when IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) >0 then 'incr' - when IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end )as monthTrend, - ROUND( IFNULL(avg( scj.AVG_ISSUE ),0), 1 ) AS averageIssue, - IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) AS issueCompareLatestMonth, - ( - case when IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) > 0 then 'incr' - when IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end - )as issueCompareLatestTrend, - IFNULL(avg( scj.AGVG_JOIN_UP_RATE) ,0) AS joinCompareLatestMonth, - ( - case when IFNULL(avg( scj.AGVG_JOIN_UP_RATE ),0) > 0 then 'incr' - when IFNULL(avg( scj.AGVG_JOIN_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end - )as joinCompareLatestTrend + ifnull(sum(suj.JOIN_TOTAL),0) as total, + 0 as monthIncr, + ''as monthTrend, + round(IFNULL(sum(suj.avg_issue_fz)/sum(suj.avg_issue_fm),0),2) as averageIssue, + 0 as issueCompareLatestMonth, + '' as issueCompareLatestTrend, + round(ifnull(sum(suj.avg_join_fz)/sum(suj.avg_join_fm),0),2)as averageJoin, + 0 as joinCompareLatestMonth, + '' as joinCompareLatestTrend FROM - screen_user_join scj - LEFT JOIN screen_customer_agency agency ON scj.org_id = agency.agency_id + screen_user_join suj + INNER JOIN screen_customer_agency sca ON ( suj.ORG_ID = sca.AGENCY_ID AND sca.DEL_FLAG = '0' ) WHERE - scj.DEL_FLAG = '0' - AND scj.MONTH_ID = #{monthId} - AND agency.PARENT_AREA_CODE =#{areaCode} + suj.ORG_TYPE = 'agency' + AND sca.PARENT_AREA_CODE = #{areaCode} + AND suj.MONTH_ID = #{monthId} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java new file mode 100644 index 0000000000..c5fed7b1cf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织群组总数-接口入参 + * @Auth sun + */ +@Data +public class AgencyGroupTotalFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyGroupTotalFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月份ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 当前组织及下级小组总数 + */ + private Integer groupTotal = 0; + + /** + * 当前组织及下级楼院小组总数 + */ + private Integer ordinaryTotal = 0; + + /** + * 当前组织及下级支部小组总数 + */ + private Integer branchTotal = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java new file mode 100644 index 0000000000..9fb08407ce --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织热议话题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyHotTopicFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyHotTopicFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 话题总数 + */ + private Integer topicTotal = 0; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status = ""; + + /** + * 状态话题数量 + */ + private Integer topicCount = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java new file mode 100644 index 0000000000..d57740cb12 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java @@ -0,0 +1,200 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织议题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java new file mode 100644 index 0000000000..7702a90a4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java @@ -0,0 +1,146 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织项目数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyProjectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyProjectForm extends CustomerClientShowGroup {} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal = 0; + + /** + * 截止当日处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal = 0; + + /** + * 截止当日处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio = new BigDecimal("0"); + + /** + * 截止当日已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal = 0; + + /** + * 截止当日已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal = 0; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal = 0; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio = new BigDecimal("0"); + + /** + * 当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectIncr = 0; + + /** + * 当日处理中项目数 【当前组织及下级前一日新增处理中项目数】 + */ + private Integer pendingIncr = 0; + + /** + * 当日已结案项目数 【当前组织及下级前一日新增结案项目数】 + */ + private Integer closedIncr = 0; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr = 0; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java new file mode 100644 index 0000000000..bf7d2d3478 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java @@ -0,0 +1,109 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织机关注册用户数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyRegUserFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyRegUserFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + BigDecimal bi = new BigDecimal(0); + /** + * 客户id + */ + private String customerId; + + /** + * 机关id + */ + private String agencyId; + + /** + * + */ + private String dateId; + + /** + * + */ + private String weekId = ""; + + /** + * + */ + private String yearId = ""; + + /** + * 注册用户总数 + */ + private Integer regTotal = 0; + + /** + * 居民总数 + */ + private Integer resiTotal = 0; + + /** + * 热心居民总数 + */ + private Integer warmHeartedTotal = 0; + + /** + * 党员总数 + */ + private Integer partymemberTotal = 0; + + /** + * 本日注册居民日增量 + */ + private Integer regIncr = 0; + + /** + * 本日热心居民日增量 + */ + private Integer warmIncr = 0; + + /** + * 本日党员认证日增量 + */ + private Integer partymemberIncr = 0; + + /** + * 居民总数占比 + */ + private BigDecimal resiProportion = bi; + + /** + * 党员总数占比 + */ + private BigDecimal partymemberProportion = bi; + + /** + * 热心居民占比 + */ + private BigDecimal warmHeartedProportion = bi; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java new file mode 100644 index 0000000000..046b947bec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织话题转议题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyTopicIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyTopicIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyTopicIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 已转议题数量 + */ + private Integer issueTotal; + + /** + * 已转议题当日增量 + */ + private Integer issueIncr; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java new file mode 100644 index 0000000000..6bb5eac899 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织状态话题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyTopicStatusFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyTopicStatusForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyTopicStatusForm.class) + private List dataList; + + @Data + public static class DataList { + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题状态ID 关联dim_topic_status表 + 讨论中 discussing + 已屏蔽 hidden + 已关闭 closed + 已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 指定状态的话题数量 + */ + private Integer topicCount; + + /** + * 话题状态百分比 指定状态话题数/话题总数 + 总数在topic_total_agency_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 单位时间内的状态话题的增加数 + */ + private Integer topicIncrement; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java new file mode 100644 index 0000000000..8fb2dc7e25 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格群组总数-接口入参 + * @Auth sun + */ +@Data +public class GridGroupTotalFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {saveList.class}) + private List dataList; + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月份ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 网格下小组总数 + */ + private Integer groupTotal = 0; + + /** + * 网格下楼院小组总数 + */ + private Integer ordinaryTotal = 0; + + /** + * 网格下支部小组总数 + */ + private Integer branchTotal = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java new file mode 100644 index 0000000000..54d1029231 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-网格热议话题数据-接口入参 + * @Auth sun + */ +@Data +public class GridHotTopicFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {GridHotTopicFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 话题总数 + */ + private Integer topicTotal = 0; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status = ""; + + /** + * 状态话题数量 + */ + private Integer topicCount = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java new file mode 100644 index 0000000000..4fd03e434b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java @@ -0,0 +1,200 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格议题数据-接口入参 + * @Auth sun + */ +@Data +public class GridIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java new file mode 100644 index 0000000000..b85f741c82 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java @@ -0,0 +1,145 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格项目数据-接口入参 + * @Auth sun + */ +@Data +public class GridProjectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridProjectForm extends CustomerClientShowGroup {} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridProjectForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日网格下项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal = 0; + + /** + * 截止当日网格下处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal = 0; + + /** + * 截止当日网格下处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio = new BigDecimal("0"); + + /** + * 截止当日网格下已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal = 0; + + /** + * 截止当日网格下已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal = 0; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal = 0; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio = new BigDecimal("0"); + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr = 0; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr = 0; + + /** + * 当日网格下项目总数 【该网格下项目总数】 + */ + private Integer projectIncr = 0; + + /** + * 当日网格下处理中项目数 【该网格下未结案项目总数】 + */ + private Integer pendingIncr = 0; + + /** + * 当日网格下已结案项目数 【该网格下已结案项目总数】 + */ + private Integer closedIncr = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java new file mode 100644 index 0000000000..84f18f226c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java @@ -0,0 +1,114 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格注册用户数据-接口入参 + * @Auth sun + */ +@Data +public class GridRegUserFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {GridRegUserFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + BigDecimal bi = new BigDecimal(0); + /** + * 客户id + */ + private String customerId; + + /** + * 机关id + */ + private String agencyId; + + /** + * 网格id + */ + private String gridId; + + /** + * 日维度Id + */ + private String dateId; + + /** + * 周维度Id + */ + private String weekId = ""; + + /** + * 年维度Id + */ + private String yearId = ""; + + /** + * 注册用户总数 + */ + private Integer regTotal = 0; + + /** + * 居民总数 + */ + private Integer resiTotal = 0; + + /** + * 热心居民总数 + */ + private Integer warmHeartedTotal = 0; + + /** + * 党员总数 + */ + private Integer partymemberTotal = 0; + + /** + * 本日注册居民日增量 + */ + private Integer regIncr = 0; + + /** + * 本日热心居民日增量 + */ + private Integer warmIncr = 0; + + /** + * 本日党员认证日增量 + */ + private Integer partymemberIncr = 0; + + /** + * 居民总数占比 + */ + private BigDecimal resiProportion = bi; + + /** + * 党员总数占比 + */ + private BigDecimal partymemberProportion = bi; + + /** + * 热心居民占比 + */ + private BigDecimal warmHeartedProportion = bi; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java new file mode 100644 index 0000000000..bd40463640 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java @@ -0,0 +1,85 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格话题转议题数据-接口入参 + * @Auth sun + */ +@Data +public class GridTopicIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridTopicIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridTopicIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 新增转议题数 + */ + private Integer issueIncr; + + /** + * 转议题总数 + */ + private Integer issueTotal; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java new file mode 100644 index 0000000000..519ea28a37 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java @@ -0,0 +1,99 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格状态话题数据-接口入参 + * @Auth sun + */ +@Data +public class GridTopicStatusFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridTopicStatusForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridTopicStatusForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题状态ID 讨论中 discussing + 已屏蔽 hidden + 已关闭 closed + 已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 + */ + private Integer topicCount; + + /** + * 话题状态占比 指定状态话题数/话题总数 + 总数在topic_total_grid_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 + */ + private Integer topicIncrement; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/.gitkeep b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java new file mode 100644 index 0000000000..3f9c614f8a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java @@ -0,0 +1,181 @@ +package com.epmet.dto.extract; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:32 + */ +@Data +public class FactAgencyGovernDailyDTO implements Serializable { + private static final long serialVersionUID = 4776545209536007717L; + private String id; + /** + * 客户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; + + /** + * 删除标识 默认为0 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java new file mode 100644 index 0000000000..778ffcb9a4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java @@ -0,0 +1,193 @@ +package com.epmet.dto.extract; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:34 + */ +@Data +public class FactGridGovernDailyDTO implements Serializable { + private static final long serialVersionUID = -5492115478082510064L; + private String id; + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属的组织id + */ + private String pid; + + /** + * 网格所有上级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; + + /** + * 11、来源于议题的项目,未出网格结案并且已解决的项目数 + */ + private Integer fromIssueResolvedInGridCount; + + /** + * 12、来源于议题的项目,未出网格结案并且无需解决的项目数 + */ + private Integer fromIssueUnResolvedInGridCount; + + /** + * 13、来源于项目立项的项目,未出网格结案,并且已解决的项目数;因现在网格不能立项,所以此列默认为0 + */ + private Integer fromAgencyResolvedInGridCount; + + /** + * 14、来源于项目立项的项目,未出网格结案,并且无需解决的项目数;因现在网格不能立项,所以此列默认为0 + */ + private Integer fromAgencyUnResolvedInGridCount; + + /** + * 15、未出当前网格的,结案项目数=11+12+13+14 + */ + private Integer gridSelfGovernProjectTotal; + + + /** + * 当前网格内出来的项目:由社区结案(已解决+未解决)的项目总数 + */ + private Integer communityClosedCount; + + /** + * 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数 + */ + private Integer streetClosedCount; + + /** + * 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数 + */ + private Integer districtDeptClosedCount; + + /** + * 删除标识 默认为0 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java new file mode 100644 index 0000000000..3f1c3a1bc7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.extract.form; + +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:28 + */ +@Data +public class AgencyGovernDailyFormDTO implements Serializable { + private static final long serialVersionUID = 106752296400100448L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java new file mode 100644 index 0000000000..173ba43011 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.extract.form; + +import com.epmet.dto.extract.FactGridGovernDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:36 + */ +@Data +public class GridGovernDailyFormDTO implements Serializable { + private static final long serialVersionUID = 1630151176835406040L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java new file mode 100644 index 0000000000..f7b43d8e2f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.project.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/11 14:42 + */ +@Data +public class UpdateProjectSatisfactionScoreFormDTO implements Serializable { + private static final long serialVersionUID = 8358341102854725024L; + private String projectId; + private String projectCustomerId; + private List customerIdList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java index 29d988da64..9a1bc174c1 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java @@ -99,6 +99,35 @@ public class ScreenGovernRankDataDailyDTO implements Serializable { */ 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已删除 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index 1d42d5964f..fe859bfac0 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -180,5 +180,9 @@ public class ScreenProjectDataDTO implements Serializable { private String topicId; private Integer responseCount; + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java index aca9d358ce..f0f6422e94 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java @@ -115,4 +115,9 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { * 议题图片地址 */ private String[] projectImgUrl; + + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java new file mode 100644 index 0000000000..f5b4cdb15d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.screencoll.form; + +import com.epmet.dto.screen.ScreenGovernRankDataDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 10:04 + */ +@Data +public class GovernRankDataDailyFormDTO implements Serializable { + + private static final long serialVersionUID = 3485797660632260565L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java index b160224471..ce78cc21ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java @@ -50,6 +50,16 @@ public class UserJoinFormDTO implements Serializable { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 总的参与次数 */ @@ -59,4 +69,14 @@ public class UserJoinFormDTO implements Serializable { * 平均参与度 */ private BigDecimal avgJoin; + + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java new file mode 100644 index 0000000000..0c6669c3bd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/6/24 5:19 下午 + * @DESC + */ +public interface BaseReportConstant { + + String DATA_IS_NULL = "上传%s数据为空"; + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java new file mode 100644 index 0000000000..9219f505a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java @@ -0,0 +1,16 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/7/9 3:24 下午 + * @DESC + */ +public interface GovernConstant { + + /** + * 增长:incr;下降:decr; 相等 :eq; + */ + String INCR = "incr"; + String DECR = "decr"; + String EQ = "eq"; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java new file mode 100644 index 0000000000..f8990a9a8f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java @@ -0,0 +1,201 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.basereport.form.*; +import com.epmet.service.BaseReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +@RestController +@RequestMapping("basereport") +public class BaseReportController { + + @Autowired + private BaseReportService baseReportService; + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + @PostMapping("gridreguser") + public Result gridRegUser(@RequestBody GridRegUserFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridRegUserFormDTO.saveList.class); + baseReportService.gridRegUser(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + @PostMapping("agencyreguser") + public Result agencyRegUser(@RequestBody AgencyRegUserFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyRegUserFormDTO.saveList.class); + baseReportService.agencyRegUser(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + @PostMapping("gridgrouptotal") + public Result gridGroupTotal(@RequestBody GridGroupTotalFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridGroupTotalFormDTO.saveList.class); + baseReportService.gridGroupTotal(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + @PostMapping("agencygrouptotal") + public Result agencyGroupTotal(@RequestBody AgencyGroupTotalFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyGroupTotalFormDTO.saveList.class); + baseReportService.agencyGroupTotal(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + @PostMapping("gridhottopic") + public Result gridHotTopic(@RequestBody GridHotTopicFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridHotTopicFormDTO.saveList.class); + baseReportService.gridHotTopic(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + @PostMapping("agencyhottopic") + public Result agencyHotTopic(@RequestBody AgencyHotTopicFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyHotTopicFormDTO.saveList.class); + baseReportService.agencyHotTopic(formDTO); + return new Result(); + } + + /** + * @Description 网格状态话题数据-008 + * @Param formDTO + * @author zxc + * @date 2021/6/25 3:09 下午 + */ + @PostMapping("gridtopicstatus") + public Result gridTopicStatus(@RequestBody GridTopicStatusFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridTopicStatusFormDTO.GridTopicStatusForm.class); + baseReportService.gridTopicStatus(formDTO); + return new Result(); + } + + /** + * @Description 组织状态话题数据-007 + * @Param formDTO + * @author zxc + * @date 2021/6/25 3:09 下午 + */ + @PostMapping("agencytopicstatus") + public Result agencyTopicStatus(@RequestBody AgencyTopicStatusFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyTopicStatusFormDTO.AgencyTopicStatusForm.class); + baseReportService.agencyTopicStatus(formDTO); + return new Result(); + } + + /** + * @Description 网格话题转议题数据-006 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:51 下午 + */ + @PostMapping("gridtopicissue") + public Result gridTopicIssue(@RequestBody GridTopicIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridTopicIssueFormDTO.GridTopicIssueForm.class); + baseReportService.gridTopicIssue(formDTO); + return new Result(); + } + + /** + * @Description 组织话题转议题数据-005 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencytopicissue") + public Result agencyTopicIssue(@RequestBody AgencyTopicIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyTopicIssueFormDTO.AgencyTopicIssueForm.class); + baseReportService.agencyTopicIssue(formDTO); + return new Result(); + } + + /** + * @Description 网格议题数据-004 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("gridissue") + public Result gridIssue(@RequestBody GridIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridIssueFormDTO.GridIssueForm.class); + baseReportService.gridIssue(formDTO); + return new Result(); + } + + /** + * @Description 组织议题数据-003 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencyissue") + public Result agencyIssue(@RequestBody AgencyIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyIssueFormDTO.AgencyIssueForm.class); + baseReportService.agencyIssue(formDTO); + return new Result(); + } + + /** + * @Description 网格项目数据-002 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("gridproject") + public Result gridProject(@RequestBody GridProjectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridProjectFormDTO.GridProjectForm.class); + baseReportService.gridProject(formDTO); + return new Result(); + } + + /** + * @Description 组织项目数据-001 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencyproject") + public Result agencyProject(@RequestBody AgencyProjectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyProjectFormDTO.AgencyProjectForm.class); + baseReportService.agencyProject(formDTO); + return new Result(); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 202dac9013..7f71ea10ff 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -23,6 +23,7 @@ import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.project.form.UpdateProjectSatisfactionScoreFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; @@ -44,7 +45,9 @@ import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; +import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -123,6 +126,8 @@ public class DemoController { private FactAgencyGovernDailyService factAgencyGovernDailyService; @Autowired private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; + @Autowired + private DimCustomerService dimCustomerService; @GetMapping("testAlarm") public void testAlarm() { @@ -944,4 +949,33 @@ public class DemoController { return new Result(); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 将产品内部客户,来源于议题并且已结案的项目,赋值满意度得分 + * @Date 2021/6/23 15:55 + **/ + @PostMapping("update-satisfaction-core") + public Result updateProjectSatisfactionScore(@RequestBody UpdateProjectSatisfactionScoreFormDTO formDTO){ + if(StringUtils.isNotBlank(formDTO.getProjectId())){ + screenProjectSettleService.updateProjectSatisfactionScore(formDTO.getProjectCustomerId(),null,formDTO.getProjectId()); + return new Result().ok("项目满意度得分更新成功"); + } + if(CollectionUtils.isNotEmpty(formDTO.getCustomerIdList())){ + formDTO.getCustomerIdList().forEach(customerId->{ + screenProjectSettleService.updateProjectSatisfactionScore(customerId,null,null); + log.info("更新完成"); + }); + }else{ + List customerIds=dimCustomerService.getAllCustomerId(); + customerIds.forEach(customerId->{ + screenProjectSettleService.updateProjectSatisfactionScore(customerId,null,null); + log.info("所有客户数据更新完成"); + }); + } + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java new file mode 100644 index 0000000000..77913ac0d9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java @@ -0,0 +1,74 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; +import com.epmet.service.GovernanceDataReportService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.sql.ResultSet; + +/** + * 治理能力数据上报 + * + * @author zhaoqifeng + * @date 2021/6/24 15:16 + */ +@RestController +@RequestMapping("governance") +public class GovernanceDataReportController { + + @Resource + private GovernanceDataReportService governanceDataReportService; + + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 10:02 + */ + @PostMapping("governrankdatadaily") + public Result governRankDataDaily(@RequestHeader("CustomerId") String customerId, @RequestBody GovernRankDataDailyFormDTO formDTO) { + governanceDataReportService.insertGovernRankDataDaily(formDTO, customerId); + return new Result(); + } + + + /** + * 组织的治理指数,按天统计 + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 15:38 + */ + @PostMapping("agencygoverndaily") + public Result agencyGovernDaily(@RequestHeader("CustomerId") String customerId, @RequestBody AgencyGovernDailyFormDTO formDTO) { + governanceDataReportService.insertAgencyGovernDaily(formDTO, customerId); + return new Result(); + } + + /** + * 网格的治理指数,按天统计 + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 15:38 + */ + @PostMapping("gridgoverndaily") + public Result gridGovernDaily(@RequestHeader("CustomerId") String customerId, @RequestBody GridGovernDailyFormDTO formDTO) { + governanceDataReportService.insertGridGovernDaily(formDTO, customerId); + return new Result(); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 9f2a4b06cd..9add28ae1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -147,7 +147,11 @@ public class IndexCalculateController { long start = System.currentTimeMillis(); Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); if (aBoolean) { - log.error("客户Id:{},monthId:{},全部指标计算完成,结果:{},总耗时:{}秒", formDTO.getCustomerId(), formDTO.getMonthId(), aBoolean, (System.currentTimeMillis() - start) / 1000); + log.error("客户Id:{},monthId:{},全部指标计算完成,结果:{},总耗时:{}秒", + formDTO.getCustomerId(), + formDTO.getMonthId(), + aBoolean, + (System.currentTimeMillis() - start) / 1000); } redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index 1cdb4a1e8d..4083242997 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -18,12 +18,12 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -46,4 +46,24 @@ public interface ScreenProjectDataDao extends BaseDao { void insertBatch(@Param("list") List list); void updateBatch(@Param("list") List list,@Param("dateId") String dateId); + + /** + * 根据项目ID删除数据 + * @author zhaoqifeng + * @date 2021/7/9 17:33 + * @param projectId + * @return int + */ + int deleteByProjectId(@Param("customerId") String customerId, @Param("projectId") String projectId); + + /** + * 根据项目ID删除数据 + * @author zhaoqifeng + * @date 2021/7/9 17:33 + * @param list + * @return int + */ + void deleteByProjectIds(@Param("customerId") String customerId, @Param("list") List list); + + int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java index 4904f32724..ff563a9f6e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java @@ -37,4 +37,6 @@ public interface ScreenProjectImgDataDao extends BaseDao list); void insertBatch(@Param("list") List list); + + int deleteByProjectId(@Param("customerId") String customerId, @Param("projectId") String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java index b63726e8ac..02757feb13 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -37,7 +37,6 @@ public interface ScreenUserJoinDao extends BaseDao { * 11、基层治理-公众参与 * 0) 查询上月的基础数据,可用来计算本月的增长率 * @param customerId - * @param yearId * @param monthId * @param orgIds 组织Id集合 * @return java.util.List @@ -45,7 +44,6 @@ public interface ScreenUserJoinDao extends BaseDao { * @Date 14:46 2020-08-21 **/ List selectLastMonthScreenUserJoinList(@Param("customerId") String customerId, - @Param("yearId") String yearId, @Param("monthId") String monthId, @Param("orgIds") String[] orgIds); @@ -62,6 +60,17 @@ public interface ScreenUserJoinDao extends BaseDao { Integer deleteUserJoin(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * @Description 根据类别删除 + * @Param customerId + * @Param monthId + * @Param delFlag + * @author zxc + * @date 2021/7/9 2:21 下午 + */ + Integer deleteUserJoinByCategory(@Param("customerId") String customerId,@Param("monthId") String monthId, + @Param("delFlag") String delFlag); + /** * 11、基层治理-公众参与 * 2) 在批量新增 @@ -72,4 +81,14 @@ public interface ScreenUserJoinDao extends BaseDao { * @Date 10:52 2020-08-18 **/ void batchInsertUserJoin(@Param("list") List list, @Param("customerId")String customerId); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("flag")String flag); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index c4047cb0b3..704aa3ee26 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -28,6 +28,7 @@ import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -163,4 +164,34 @@ public interface ProjectDao extends BaseDao { String selectValueByKey(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey); List selectProjectListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("projectOrigin") String projectOrigin); + + /** + * 计算某个项目的群满意度得分 + * + * @param customerId + * @param projectId + * @return 得分 + */ + BigDecimal selectProjectSatisfactionScore(@Param("customerId")String customerId, + @Param("projectId")String projectId); + + /** + * 查询当天(dateId)有评价记录的项目id + * + * @param customerId + * @param dateId + * @return + */ + List selectEvaluateProjectIds(@Param("customerId") String customerId, @Param("dateId")String dateId); + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + List selectClosedProjectIds(@Param("customerId")String customerId, + @Param("origin")String origin, + @Param("projectStatus")String projectStatus); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java new file mode 100644 index 0000000000..66a80a58fe --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java @@ -0,0 +1,227 @@ +package com.epmet.dao.stats; + +import com.epmet.dto.basereport.form.AgencyProjectFormDTO; +import com.epmet.dto.basereport.form.AgencyRegUserFormDTO; +import com.epmet.dto.basereport.form.GridRegUserFormDTO; +import com.epmet.dto.basereport.form.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +@Mapper +public interface BaseReportDao { + + /** + * @Description 根据dateId删除客户网格注册用户数据 + * @author sun + */ + int delGridRegUser(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格注册用户数据 + * @author sun + */ + void insertBatchGridRegUser(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织注册用户数据 + * @author sun + */ + int delAgencyRegUser(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织注册用户数据 + * @author sun + */ + void insertBatchAgencyRegUser(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户网格群组总数数据 + * @author sun + */ + int delGridGroupTotal(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格群组总数数据 + * @author sun + */ + void insertBatchGridGroupTotal(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织群组总数数据 + * @author sun + */ + int delAgencyGroupTotal(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织群组总数数据 + * @author sun + */ + void insertBatchAgencyGroupTotal(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户网格热议话题数据 + * @author sun + */ + int delGridHotTopic(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格热议话题数据 + * @author sun + */ + void insertBatchGridHotTopic(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织热议话题数据 + * @author sun + */ + int delAgencyHotTopic(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织热议话题数据 + * @author sun + */ + void insertBatchAgencyHotTopic(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织项目数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/24 5:30 下午 + */ + int delAgencyProject(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增组织项目数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 9:14 上午 + */ + void insertAgencyProject(@Param("list")List dataList); + + /** + * @Description 根据dateId删除客户网格项目数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 10:36 上午 + */ + int delGridProject(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增网格项目数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 10:37 上午 + */ + void insertGridProject(@Param("list")List dataList); + + /** + * @Description 删除组织议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 10:53 上午 + */ + int delAgencyIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增组织议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 10:54 上午 + */ + void insertAgencyIssue(@Param("list")List dataList); + + /** + * @Description 删除网格议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:00 下午 + */ + int delGridIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增网格议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:00 下午 + */ + void insertGridIssue(@Param("list")List dataList); + + /** + * @Description 删除组织话题转议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:13 下午 + */ + int delAgencyTopicIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增组织话题转议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:14 下午 + */ + void insertAgencyTopicIssue(@Param("list")List dataList); + + /** + * @Description 删除网格话题转议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:41 下午 + */ + int delGridTopicIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增网格话题转议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:41 下午 + */ + void insertGridTopicIssue(@Param("list")List dataList); + + /** + * @Description 删除组织状态话题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 3:17 下午 + */ + int delAgencyTopicStatus(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 增加组织状态话题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 3:18 下午 + */ + void insertAgencyTopicStatus(@Param("list")List dataList); + + /** + * @Description 删除网格状态话题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 3:30 下午 + */ + int delGridTopicStatus(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 增加网格状态话题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 3:30 下午 + */ + void insertGridTopicStatus(@Param("list")List dataList); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java index 8bbe10f526..d2f2c16625 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java @@ -18,13 +18,11 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; import java.math.BigDecimal; -import java.util.Date; /** * 基层治理-治理能力排行数据(按月统计) @@ -99,4 +97,33 @@ public class ScreenGovernRankDataDailyEntity extends BaseEpmetEntity { */ private BigDecimal satisfactionRatio; + /** + * 响应数 + */ + private Integer responseCount; + /** + * 项目转入次数 + */ + private Integer transferCount; + /** + * 解决项目数 + */ + private Integer resolvedCount; + /** + * 已关闭项目数 + */ + private Integer closedCount; + /** + * 自治项目数 + */ + private Integer governCount; + /** + * 满意项目数 + */ + private Integer satisfactionCount; + /** + * 已关闭项目(由议题转的项目)数 + */ + private Integer closedProjectCount; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java index 9ef584bad8..52c9a19ab3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java @@ -144,5 +144,8 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity { */ private String allParentIds; - + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java index 138e19cd30..a0fc71b676 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java @@ -92,6 +92,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 人均议题较上月增长率(采集的时候后台自己计算) */ @@ -107,6 +117,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgJoin; + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; + /** * 平均参与度较上月增长率(采集的时候后台自己计算) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java index a9f266edf4..6991c2e9be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java @@ -5,6 +5,8 @@ import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginExtractService; @@ -21,6 +23,7 @@ import org.apache.rocketmq.common.message.MessageExt; import org.redisson.api.RLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.RedisTemplate; import javax.annotation.PreDestroy; import java.util.Date; @@ -41,24 +44,16 @@ import java.util.stream.Collectors; public class ProjectChangedCustomListener implements MessageListenerConcurrently { private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * 控制通知类型消息的消费频率 - */ - private static final Cache customerIdCache = CacheBuilder.newBuilder().maximumSize(NumConstant.ONE_HUNDRED) - .expireAfterWrite(NumConstant.THIRTY,TimeUnit.SECONDS).build(); + + private RedisUtils redisUtils; @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { long start = System.currentTimeMillis(); try { - List customerIds = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList()); - for (String customerId : customerIds) { - //获取缓存 如果不存在缓存中 则执行消费 并放入缓存中 - String ifPresent = customerIdCache.getIfPresent(customerId); - if (StringUtils.isBlank(ifPresent)){ - consumeMessage(customerId); - customerIdCache.put(customerId,customerId); - } + List msgStrs = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList()); + for (String msgStr : msgStrs) { + consumeMessage(msgStr); } } catch (Exception e) { //失败不重发 @@ -76,6 +71,23 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently log.warn("consumeMessage msg body is blank"); return; } + + if (redisUtils == null) { + redisUtils = SpringContextUtils.getBean(RedisUtils.class); + } + + String redisKey = RedisKeys.getProjectChangedMsgDistinceKey(msgObj.getCustomerId()); + if (redisUtils.get(redisKey) == null) { + consumeMessage(msgObj); + log.info("消费了项目变动消息,customer id:{}", msgObj.getCustomerId()); + // 有效期30秒 + redisUtils.set(redisKey, msg, 30); + } else { + log.info("该客户的项目变动消息刚刚消费,请等待30秒,customer id:{}", msgObj.getCustomerId()); + } + } + + public void consumeMessage(ProjectChangedMQMsg msgObj) { DistributedLock distributedLock = null; RLock lock = null; try { @@ -128,6 +140,7 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently } } } + @PreDestroy public void saveCalStatus() { //todo diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java new file mode 100644 index 0000000000..50b5f3579d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java @@ -0,0 +1,109 @@ +package com.epmet.service; + + +import com.epmet.dto.basereport.form.*; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +public interface BaseReportService { + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + void gridRegUser(GridRegUserFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + void agencyRegUser(AgencyRegUserFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + void gridGroupTotal(GridGroupTotalFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + void agencyGroupTotal(AgencyGroupTotalFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + void gridHotTopic(GridHotTopicFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + void agencyHotTopic(AgencyHotTopicFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格状态话题数据-008 + * @author sun + */ + void gridTopicStatus(GridTopicStatusFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织状态话题数据-007 + * @author sun + */ + void agencyTopicStatus(AgencyTopicStatusFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格话题转议题数据-006 + * @author sun + */ + void gridTopicIssue(GridTopicIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织话题转议题数据-005 + * @author sun + */ + void agencyTopicIssue(AgencyTopicIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格议题数据-004 + * @author sun + */ + void gridIssue(GridIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织议题数据-003 + * @author sun + */ + void agencyIssue(AgencyIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格项目数据-002 + * @author sun + */ + void gridProject(GridProjectFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织项目数据-001 + * @author sun + */ + void agencyProject(AgencyProjectFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java new file mode 100644 index 0000000000..db9808bf3f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java @@ -0,0 +1,48 @@ +package com.epmet.service; + +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; + +/** + * 治理能力数据上报 + * + * @author zhaoqifeng + * @date 2021/6/24 15:18 + */ +public interface GovernanceDataReportService { + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 10:14 + */ + void insertGovernRankDataDaily(GovernRankDataDailyFormDTO formDTO, String customerId); + + /** + * 组织的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + void insertAgencyGovernDaily(AgencyGovernDailyFormDTO formDTO, String customerId); + + /** + * 网格的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + void insertGridGovernDaily(GridGovernDailyFormDTO formDTO, String customerId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java index 0504164079..647d0650a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java @@ -18,8 +18,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; +import java.util.List; + /** * 组织的治理指数,按天统计 * @@ -38,4 +41,23 @@ public interface FactAgencyGovernDailyService extends BaseService list); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java index 15447342ab..6d62d67c29 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java @@ -18,9 +18,12 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.FactGridGovernDailyDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; +import java.util.List; + /** * 网格的治理指数,按天统计 * @@ -41,4 +44,22 @@ public interface FactGridGovernDailyService extends BaseService list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java index 6629836e02..9cae42b818 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java @@ -17,10 +17,13 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.*; import com.epmet.dao.evaluationindex.extract.FactAgencyGovernDailyDao; +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; @@ -301,6 +304,36 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FactAgencyGovernDailyEntity :: getCustomerId, customerId) + .eq(FactAgencyGovernDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:56 + */ + @Override + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, FactAgencyGovernDailyEntity.class)); + } + private FactAgencyGovernDailyEntity initEntity(DimAgencyDTO agency, String dateId) { FactAgencyGovernDailyEntity entity = new FactAgencyGovernDailyEntity(); entity.setCustomerId(agency.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java index 68523f199c..56346813b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java @@ -17,19 +17,19 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DimObjectActionConstant; import com.epmet.constant.DimObjectStatusConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dao.evaluationindex.extract.FactGridGovernDailyDao; +import com.epmet.dto.extract.FactGridGovernDailyDTO; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.dto.org.GridInfoDTO; -import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridClosedTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; @@ -247,6 +247,36 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FactGridGovernDailyEntity :: getCustomerId, customerId) + .eq(FactGridGovernDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 16:09 + */ + @Override + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, FactGridGovernDailyEntity.class)); + } + private Map getGovernGridClosedTotalCommonDTOMap(String customerId, List gridIds) { Map resultMap = new HashMap<>(); for (String gridId : gridIds) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java index fe147887b0..c9fa1b17d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java @@ -24,4 +24,14 @@ public interface ScreenProjectSettleService { */ void extractScreenData(ScreenCentralZoneDataFormDTO param); + /** + * 更新项目得分 + * + * @param customerId + * @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + * @param projectId 项目id可为空 + * @return void + */ + void updateProjectSatisfactionScore(String customerId,String dateId,String projectId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java index e93b4eba0c..93ab6289a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java @@ -348,7 +348,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -356,10 +362,16 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe List gridList = factOriginProjectLogDailyService.getGridSelfDaily(customerId, dateId); if (CollectionUtils.isNotEmpty(gridList)) { list.forEach(entity -> gridList.stream().filter(gridAbility -> entity.getOrgId().equals(gridAbility.getOrgId())).forEach(grid -> { - BigDecimal resolveCount = new BigDecimal(grid.getSum()); - BigDecimal selfCount = new BigDecimal(grid.getCount()); if (grid.getSum() != NumConstant.ZERO) { - entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal resolveCount = new BigDecimal(grid.getSum()); + BigDecimal selfCount = new BigDecimal(grid.getCount()); + BigDecimal ratio = selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernCount(grid.getCount()); + entity.setClosedCount(grid.getSum()); + entity.setGovernRatio(ratio); } })); } @@ -371,7 +383,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); } })); } @@ -383,7 +401,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -422,7 +446,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -434,7 +464,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); } })); } @@ -445,7 +481,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -457,7 +499,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -495,7 +543,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); } })); } @@ -507,7 +561,14 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); + } })); } @@ -518,7 +579,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -530,7 +597,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -568,7 +641,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -580,7 +659,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); } })); } @@ -591,7 +676,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -603,7 +694,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index a6a916602d..9bae1a2869 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.GovernConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; @@ -76,6 +77,14 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { *

* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 * + * + * ================================================================================================================ + * ================================================================================================================ + * 2021-07-09 新注释 + * 公众参与里的指标含义说明: + * 总参与:议题参与的次数(比如 表决 等行为,产品只有表决行为,其他三个街道 包含评论数、点赞数、点踩数) + * 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/25 10:24 上午 @@ -86,9 +95,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.warn("extractTotalDataMonthly param is error,param:{}", JSON.toJSONString(formDTO)); return false; } - extractGridUserJoin(formDTO); - extractAgencyUserJoin(formDTO); - return null; + gridUserJoinCal(formDTO); + agencyUserJoinCal(formDTO); + return true; } private void extractGridUserJoin(ExtractScreenFormDTO formDTO) { @@ -178,7 +187,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { @@ -219,7 +228,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); Map orgMemberCount = new HashMap<>(); if (!CollectionUtils.isEmpty(issueTotal)) { - //获取每个网格的应表决人数 + //获取每个网格的应表决人数 (组成员数去重) List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); if (CollectionUtils.isEmpty(memberCountList)) { log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); @@ -253,12 +262,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } }); } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); - } - - public static void main(String[] args) { - BigDecimal bigDecimal = new BigDecimal(0); - bigDecimal = bigDecimal.add(new BigDecimal(0 / (1 * 1.0))); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map result) { @@ -274,7 +278,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } else if (org instanceof DimAgencyEntity) { DimAgencyEntity agency = (DimAgencyEntity) org; entity.setCustomerId(agency.getCustomerId()); - entity.setOrgType(agency.getLevel()); + entity.setOrgType(OrgTypeConstant.AGENCY); entity.setOrgId(agency.getId()); entity.setParentId(agency.getPid()); entity.setOrgName(agency.getAgencyName()); @@ -289,6 +293,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(new BigDecimal(0)); entity.setAgvgJoinUpRate(new BigDecimal("0")); entity.setAgvgJoinUpFlag(""); + entity.setAvgIssueFz(NumConstant.ZERO); + entity.setAvgIssueFm(NumConstant.ZERO); + entity.setAvgJoinFz(NumConstant.ZERO); + entity.setAvgJoinFm(NumConstant.ZERO); result.put(entity.getOrgId(), entity); } @@ -304,4 +312,290 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { public Boolean extractPerTotalDataDaily(ExtractScreenFormDTO formDTO) { return null; } + + /** + * @Description 基层治理-公众参与【网格-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void gridUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下所有网格 + List orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(orgList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + //获取议题月份增量 + List issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(issueTotal)) { + return; + } + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(userCountList)) { + return; + } + // list 转 map 以orgId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + for (FactIssueGridMonthlyEntity issue : issueTotal) { + String gridId = issue.getGridId(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + // 议题本月增长 + entity.setJoinTotal(issue.getIssueIncr()); + // 网格下 注册居民本月增量,党员认证本月增量,截止本月底居民总数 + GridUserCountResultDTO user = userCountMap.get(gridId); + if (user == null) { + continue; + } + // 议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + log.debug("issue:{}", JSON.toJSONString(issue)); + log.debug("user:{}", JSON.toJSONString(user)); + if (!user.getRegTotal().equals(0)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + // 人均议题 + entity.setAvgIssue(avgIssueCount); + } + } + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.GRID_ID); + Map gridMemberCount = new HashMap<>(16); + // 议题月份增量不为空 + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个网格的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.GRID_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + return; + } + // 网格下的组员 + gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + /** + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:网格内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + */ + // 根据网格ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + //遍历实际参与人数 + for (Map.Entry> entry : voteMap.entrySet()) { + String gridId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + List issueList = entry.getValue(); + BigDecimal realJoinCount = new BigDecimal(0); + // 网格下 议题个数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); + // 网格下 组员人数 + Integer memberCount = gridMemberCount.get(gridId); + for (IssueVoteUserCountResultDTO vote : issueList) { + // 每个议题参与人数求和 + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != NumConstant.ZERO) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoinFz(Integer.valueOf(avgFz.toString())); + entity.setAvgJoinFm(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID); + } + + /** + * @Description 基层治理-公众参与【组织-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void agencyUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下的所有组织 + List agencyList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(agencyList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + agencyList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + // 查询组织下 议题月增长,截止本月议题总数 + List issueTotal = factIssueAgencyMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserAgencyMonthlyService.selectAgencyUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + // 以agencyId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + Set agencyIdSet = new HashSet<>(); + if (!CollectionUtils.isEmpty(issueTotal)) { + issueTotal.forEach(issue -> { + String agencyId = issue.getAgencyId(); + agencyIdSet.add(agencyId); + ScreenUserJoinEntity entity = insertMap.get(agencyId); + if (entity == null){ + return; + } + entity.setJoinTotal(issue.getIssueIncr()); + GridUserCountResultDTO user = userCountMap.get(agencyId); + // 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + if (!user.getRegTotal().equals(NumConstant.ZERO)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()), NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + entity.setAvgIssue(avgIssueCount); + } + }); + List> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); + partition.forEach(list -> { + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); + Map orgMemberCount = new HashMap<>(16); + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个组织的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); + return; + } + // (k,v) = (agencyId,组织下的人) + orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + // 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + // 根据组织ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + for (Map.Entry> entry : voteMap.entrySet()) { + String orgId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(orgId); + List issueList = entry.getValue(); + // 实际参与人数 + BigDecimal realJoinCount = new BigDecimal(NumConstant.ZERO); + // 组织下 的议题数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(NumConstant.ZERO).getIssueCount()); + // 组织下应参与人数 + Integer memberCount = orgMemberCount.get(orgId); + for (IssueVoteUserCountResultDTO vote : issueList) { + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != 0) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoin(realJoinCount.divide(votedByIssueCount, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + entity.setAvgJoinFz(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoinFm(Integer.valueOf(avgFz.toString())); + } + } + }); + } + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.AGENCY); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.AGENCY); + } + + public ArrayList dispose(ExtractScreenFormDTO formDTO,Map insertMap,String flag) { + String beforeNMonthByMonth = DateUtils.getBeforeNMonthByMonth(NumConstant.ONE, formDTO.getMonthId()); + List screenUserJoinEntities = screenUserJoinService.selectScreenUserJoin(formDTO.getCustomerId(), beforeNMonthByMonth, flag); + ArrayList insertList = new ArrayList<>(insertMap.values()); + if (CollectionUtils.isEmpty(screenUserJoinEntities)) { + insertList.forEach(l -> { + // 总的参与次数较上月增长率 + if (l.getJoinTotal().equals(NumConstant.ZERO)) { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } else if (l.getJoinTotal() > NumConstant.ZERO) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 人均议题较上月增长率 + if (l.getAvgIssue().equals(NumConstant.ZERO_DECIMAL)) { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAvgIssueUpFlag(GovernConstant.INCR); + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 平均参与度较上月增长率 + if (l.getAvgJoin().equals(NumConstant.ZERO_DECIMAL)) { + l.setAgvgJoinUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + }); + } else { + insertList.forEach(l -> { + screenUserJoinEntities.forEach(s -> { + if (l.getOrgId().equals(s.getOrgId())) { + // 总的参与次数较上月增长率 + if (l.getJoinTotal() > s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + if (s.getJoinTotal().compareTo(NumConstant.ZERO) == 0){ + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (l.getJoinTotal() < s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.DECR); + if (s.getJoinTotal().compareTo(NumConstant.ZERO) == 0){ + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } + // 人均议题较上月增长率 + Integer re = l.getAvgIssue().compareTo(s.getAvgIssue()); + if (re.equals(NumConstant.ONE)) { + l.setAvgIssueUpFlag(GovernConstant.INCR); + if (s.getAvgIssue().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (re.equals(NumConstant.ONE_NEG)) { + l.setAvgIssueUpFlag(GovernConstant.DECR); + if (s.getAvgIssue().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } + // 平均参与度较上月增长率 + Integer avgJoinRe = l.getAvgJoin().compareTo(s.getAvgJoin()); + if (avgJoinRe.equals(NumConstant.ONE)) { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + if (s.getAvgJoin().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (avgJoinRe.equals(NumConstant.ONE_NEG)) { + l.setAgvgJoinUpFlag(GovernConstant.DECR); + if (s.getAvgJoin().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setAgvgJoinUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } + } + }); + }); + } + return insertList; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 14d6fade19..600786782c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -324,6 +324,13 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } catch (Exception e) { log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); } + try{ + //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数 + //dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + screenProjectSettleService.updateProjectSatisfactionScore(customerId,dateId,null); + }catch(Exception e){ + log.error("群众不满得分更新失败"); + } } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java index 781211b4bf..0b4a519efe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -102,6 +102,8 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } else { meta.setLinkUserId(meta.getLinkName()); } + //项目满意度得分 + meta.setSatisfactionScore(projectService.calProjectSatisfactionScore(param.getCustomerId(),meta.getProjectId())); return meta; })).collect(Collectors.toList()); } @@ -170,4 +172,43 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } + /** + * 更新项目得分 + * + * @param customerId + * @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + * @param projectId 项目id可为空 + * @return void + */ + @Override + public void updateProjectSatisfactionScore(String customerId, String dateId,String projectId) { + log.info("customerId="+customerId+";dateId="+dateId+";projectId="+projectId); + if(StringUtils.isNotBlank(projectId)){ + BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, projectId); + log.warn("单独计算projectId=" + projectId + "满意度得分:" + calProjectSatisfactionScore); + targetDbService.updateProjectSatisfactionScore(projectId,calProjectSatisfactionScore); + return; + } + List projectIds=new ArrayList<>(); + if(StringUtils.isNotBlank(dateId)){ + log.warn("按日期计算"); + List list=projectService.selectEvaluateProjectIds(customerId,dateId); + if(!CollectionUtils.isEmpty(list)){ + projectIds.addAll(list); + } + }else{ + log.warn("计算当前客户下,来源于议题已结案的项目对应的满意度得分"); + // 只有来源于议题的项目,才有分数 + List closedProjectIds=projectService.selectClosedProjectIds(customerId,"issue","closed"); + if(!CollectionUtils.isEmpty(closedProjectIds)){ + projectIds.addAll(closedProjectIds); + } + } + projectIds.forEach(id -> { + BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, id); + log.warn("projectId=" + id + "满意度得分:" + calProjectSatisfactionScore); + targetDbService.updateProjectSatisfactionScore(id, calProjectSatisfactionScore); + }); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 961970fc9b..b5d77983b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -679,7 +679,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ partition.forEach(publish -> { List index1SampleValues = new ArrayList<>(); publish.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -769,7 +769,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -782,6 +782,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ } else { // 治理能力的六个五级指标 List> communityGovernAbility = disposeFiveLevel(form); + log.info("治理能力的六个五级指标==="+communityGovernAbility.toString()); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); }else{ @@ -860,7 +861,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); List index1SampleValues = new ArrayList<>(); serviceAvg.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -962,6 +963,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ orgIds.forEach(org -> { SubCommunityAvgResultDTO s = new SubCommunityAvgResultDTO(); s.setAgencyId(org.getOrgId()); + s.setParentId(org.getPid()); subAvgScores.add(s); }); // 把除去孔村镇的数据赋值,孔村在下边单独处理 @@ -1016,7 +1018,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ kongCunGovernAbility.forEach(k -> { k.put("AGENCY_ID",k.get("AGENCY_ID")); - k.put("PARENT_ID",NumConstant.ZERO_STR); + k.put("PARENT_ID",k.get("PARENT_ID")); }); } if (!CollectionUtils.isEmpty(communityGovernAbility)){ @@ -1045,7 +1047,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ kongCunActivityCountList.forEach(k -> { k.put("AGENCY_ID",k.get("AGENCY_ID")); - k.put("PARENT_ID",NumConstant.ZERO_STR); + k.put("PARENT_ID",k.get("PARENT_ID")); }); } if (!CollectionUtils.isEmpty(ActivityCountList)){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java index 0fa086cfb7..9775908921 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java @@ -118,4 +118,23 @@ public interface ScreenGovernRankDataDailyService extends BaseService entityList); + + /** + * 删除数据 + * @author zhaoqifeng + * @date 2021/6/24 14:46 + * @param customerId + * @param dateId + * @return java.lang.Integer + */ + Integer deleteGovernRankDataDaily(String customerId, String dateId); + + /** + * 批量插入 + * @author zhaoqifeng + * @date 2021/6/24 15:24 + * @param list + * @return void + */ + void insertBatch(List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index b6f2c25c15..7b82707c91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java @@ -24,6 +24,7 @@ import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -124,4 +125,6 @@ public interface ScreenProjectDataService extends BaseService meta,List orient); + + int updateProjectSatisfactionScore(String projectId, BigDecimal calProjectSatisfactionScore); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java index 0a42c758a4..e3574393e8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java @@ -36,9 +36,20 @@ public interface ScreenUserJoinService extends BaseService * * @param formDTO * @param list + * @param delFlag 删除标志 agency,grid * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/27 4:40 下午 */ - Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list); + Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list,String delFlag); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(String customerId,String monthId,String flag); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java index 3c48645963..ca03285245 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; @@ -167,4 +168,36 @@ public class ScreenGovernRankDataDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ScreenGovernRankDataDailyEntity :: getCustomerId, customerId) + .eq(ScreenGovernRankDataDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:24 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, ScreenGovernRankDataDailyEntity.class)); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index 40888aced8..5e14db736e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; @@ -60,12 +61,6 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl page(Map params) { @@ -173,14 +168,8 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl deleteWrapper = new QueryWrapper<>(); - deleteWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); - baseDao.delete(deleteWrapper); - QueryWrapper screenProjectImgDataEntityQueryWrapper = new QueryWrapper<>(); - screenProjectImgDataEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); - screenProjectImgDataDao.delete(screenProjectImgDataEntityQueryWrapper); + baseDao.deleteByProjectId(param.getCustomerId(), item.getProjectId()); + screenProjectImgDataDao.deleteByProjectId(param.getCustomerId(), item.getProjectId()); //如果orgType未知,获取一下 // if ("unknown".equals(item.getOrgType())){ @@ -281,4 +270,9 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl implements ScreenUserJoinService { @Override - @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Transactional(rollbackFor = Exception.class) - public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list) { + public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list, String delFlag) { if (formDTO == null || StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId()) || CollectionUtils.isEmpty(list)) { log.error("deleteAndInsertBatch param is error"); return false; } int deleteNum; do { - deleteNum = baseDao.deleteUserJoin(formDTO.getCustomerId(), formDTO.getMonthId()); + deleteNum = baseDao.deleteUserJoinByCategory(formDTO.getCustomerId(), formDTO.getMonthId(),delFlag); } while (deleteNum != NumConstant.ZERO); @@ -72,7 +72,6 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl lastMonthJoinList = baseDao.selectLastMonthScreenUserJoinList(formDTO.getCustomerId(), - dimIdBean.getYearId(), dimIdBean.getMonthId(), orgIds); @@ -124,6 +123,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl selectScreenUserJoin(String customerId, String monthId, String flag) { + return baseDao.selectScreenUserJoin(customerId, monthId, flag); + } + /** * 计算 本月数值 相较于 上月数值,的增长率 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index 5bb05989fe..3b96365fbe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.CompareConstant; import com.epmet.constant.DataSourceConstant; @@ -35,6 +36,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.service.evaluationindex.screen.ScreenEventImgDataService; import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -54,6 +56,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2020-05-11 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @@ -374,34 +377,36 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { orgIds[i] = formDTO.getDataList().get(i).getOrgId(); } - String[] lastMonth = this.lastMonthDate(); + /*String[] lastMonth = this.lastMonthDate(); // 获取上个月的基本数据 - String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE]; + String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/ + String monthId= DateUtils.getBeforeNMonthByMonth(1,formDTO.getMonthId()); List lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, - lastMonth[NumConstant.ZERO], - moneth, + monthId, orgIds); // 定义本月待添加数据的集合 List curMonthJoinEntityList = new ArrayList<>(); // 增加率计算 if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { + log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId的上月已有数据集合长度="+lastMonthJoinList.size()); // 存在上个月的数据 (本月-上月)/上月 *100 for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) { for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { if (formDTO.getDataList().get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) { ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.getDataList().get(i), ScreenUserJoinEntity.class); - entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal())); - entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal())); - entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgIssue(), formDTO.getDataList().get(j).getAvgIssue())); - entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgIssue(), formDTO.getDataList().get(j).getAvgIssue())); - entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgJoin(), formDTO.getDataList().get(j).getAvgJoin())); - entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgJoin(), formDTO.getDataList().get(j).getAvgJoin())); + entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getJoinTotal(), formDTO.getDataList().get(i).getJoinTotal())); + entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getJoinTotal(), formDTO.getDataList().get(i).getJoinTotal())); + entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getAvgIssue(), formDTO.getDataList().get(i).getAvgIssue())); + entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getAvgIssue(), formDTO.getDataList().get(i).getAvgIssue())); + entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getAvgJoin(), formDTO.getDataList().get(i).getAvgJoin())); + entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getAvgJoin(), formDTO.getDataList().get(i).getAvgJoin())); curMonthJoinEntityList.add(entity); } } } } else { + log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId上月不存在数据。"); // 计算增长率后的 待新增数据 BigDecimal zero = new BigDecimal(NumConstant.ZERO); // 不存在上个月的数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java new file mode 100644 index 0000000000..b00c8cace6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java @@ -0,0 +1,302 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.BaseReportConstant; +import com.epmet.dao.stats.BaseReportDao; +import com.epmet.dto.basereport.form.*; +import com.epmet.service.BaseReportService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +@Service +@Slf4j +public class BaseReportServiceImpl implements BaseReportService { + + @Autowired + private BaseReportDao baseReportDao; + + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridRegUser(GridRegUserFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridRegUser(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridRegUser(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyRegUser(AgencyRegUserFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyRegUser(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyRegUser(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridGroupTotal(GridGroupTotalFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridGroupTotal(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridGroupTotal(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyGroupTotal(AgencyGroupTotalFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyGroupTotal(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyGroupTotal(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridHotTopic(GridHotTopicFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridHotTopic(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridHotTopic(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyHotTopic(AgencyHotTopicFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyHotTopic(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyHotTopic(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格状态话题数据-008 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridTopicStatus(GridTopicStatusFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridTopicStatus(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridTopicStatus(p); + }); + } + + /** + * @Param formDTO + * @Description 组织状态话题数据-007 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyTopicStatus(AgencyTopicStatusFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyTopicStatus(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyTopicStatus(p); + }); + } + + /** + * @Param formDTO + * @Description 网格话题转议题数据-006 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridTopicIssue(GridTopicIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridTopicIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridTopicIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 组织话题转议题数据-005 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyTopicIssue(AgencyTopicIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyTopicIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyTopicIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 网格议题数据-004 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridIssue(GridIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 组织议题数据-003 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyIssue(AgencyIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 网格项目数据-002 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridProject(GridProjectFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridProject(p); + }); + } + + /** + * @Param formDTO + * @Description 组织项目数据-001 + * @author sun + */ + @Override + public void agencyProject(AgencyProjectFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyProject(p); + }); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java new file mode 100644 index 0000000000..63e588c647 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java @@ -0,0 +1,112 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenGovernRankDataDailyEntity; +import com.epmet.service.GovernanceDataReportService; +import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import com.epmet.service.evaluationindex.screen.ScreenGovernRankDataDailyService; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:19 + */ +@Service +public class GovernanceDataReportServiceImpl implements GovernanceDataReportService { + @Resource + private ScreenGovernRankDataDailyService screenGovernRankDataDailyService; + @Resource + private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Resource + private FactGridGovernDailyService factGridGovernDailyService; + + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 10:14 + */ + @Override + public void insertGovernRankDataDaily(GovernRankDataDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.SIX) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = screenGovernRankDataDailyService.deleteGovernRankDataDaily(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + screenGovernRankDataDailyService.insertBatch(formDTO.getDataList()); + } + } + + /** + * 组织的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + @Override + public void insertAgencyGovernDaily(AgencyGovernDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.EIGHT) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = factAgencyGovernDailyService.deleteAgencyGovernData(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + factAgencyGovernDailyService.insertBatch(formDTO.getDataList()); + } + } + + /** + * 网格的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + @Override + public void insertGridGovernDaily(GridGovernDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.EIGHT) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = factGridGovernDailyService.deleteGridGovernData(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + factGridGovernDailyService.insertBatch(formDTO.getDataList()); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index db9a4add14..e826c9f9e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -27,6 +27,7 @@ import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.Set; @@ -163,4 +164,31 @@ public interface ProjectService extends BaseService { List getProjectSatisfaction(String customerId); List selectProjectListByDateId(String customerId, String yesterdayStr, String projectOriginAgency); + /** + * 计算某个项目的群满意度得分 + * + * @param customerId + * @param projectId + * @return 得分 + */ + BigDecimal calProjectSatisfactionScore(String customerId,String projectId); + + /** + * 查询当天(dateId)有评价记录的项目id + * + * @param customerId + * @param dateId + * @return + */ + List selectEvaluateProjectIds(String customerId, String dateId); + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param origin :issue,agency + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + List selectClosedProjectIds(String customerId,String origin ,String projectStatus); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index f7aa9d8754..f67bff807c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -201,5 +202,42 @@ public class ProjectServiceImpl extends BaseServiceImpl selectEvaluateProjectIds(String customerId, String dateId) { + return baseDao.selectEvaluateProjectIds(customerId,dateId); + } + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param origin 来源:issue, agency + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + @Override + public List selectClosedProjectIds(String customerId, String origin,String projectStatus) { + return baseDao.selectClosedProjectIds(customerId,origin,projectStatus); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql new file mode 100644 index 0000000000..5daf6faa5a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql @@ -0,0 +1,11 @@ +-- epmet_evaluation_index库执行以下sql: 增加群众不满得分 +alter table `epmet_evaluation_index`.screen_project_data add COLUMN `SATISFACTION_SCORE` decimal(10,6) DEFAULT NULL COMMENT '满意度得分' AFTER LATITUDE; + +ALTER TABLE `epmet_evaluation_index`.`screen_govern_rank_data_daily` + ADD COLUMN `RESPONSE_COUNT` int(11) NULL COMMENT '响应次数' AFTER `RESPONSE_RATIO`, + ADD COLUMN `TRANSFER_COUNT` int(11) NULL COMMENT '项目转入次数' AFTER `RESPONSE_COUNT`, + ADD COLUMN `RESOLVED_COUNT` int(11) NULL COMMENT '解决项目数' AFTER `RESOLVED_RATIO`, + ADD COLUMN `CLOSED_COUNT` int(11) NULL COMMENT '已关闭项目数' AFTER `RESOLVED_COUNT`, + ADD COLUMN `GOVERN_COUNT` int(11) NULL COMMENT '自治项目数' AFTER `GOVERN_RATIO`, + ADD COLUMN `SATISFACTION_COUNT` int(11) NULL COMMENT '满意项目数' AFTER `SATISFACTION_RATIO`, + ADD COLUMN `CLOSED_PROJECT_COUNT` int(11) NULL COMMENT '已关闭项目(由议题转的项目)数' AFTER `SATISFACTION_COUNT`; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql new file mode 100644 index 0000000000..7c9f7a9e3d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql @@ -0,0 +1,7 @@ +ALTER TABLE `epmet_evaluation_index`.`screen_user_join` + ADD COLUMN `AVG_ISSUE_FZ` int(11) NULL DEFAULT 0 COMMENT '人均议题分子' AFTER `AVG_ISSUE`, + ADD COLUMN `AVG_ISSUE_FM` int(11) NULL DEFAULT 0 COMMENT '人均议题分母' AFTER `AVG_ISSUE_FZ`, + ADD COLUMN `AVG_JOIN_FZ` int(11) NULL DEFAULT 0 COMMENT '平均参与度分子' AFTER `AVG_JOIN`, + ADD COLUMN `AVG_JOIN_FM` int(11) NULL DEFAULT 0 COMMENT '平均参与度分母' AFTER `AVG_JOIN_FZ`, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`ID`) USING BTREE; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index a5c0960f9c..280de575cf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -297,8 +297,7 @@ SELECT a.AGENCY_ID, a.count AS "sum", - IFNULL( b.count, - 0 ) AS "count" + IFNULL( b.count, 0 ) + IFNULL( c.count, 0 ) AS "count" FROM (SELECT da.ID AS AGENCY_ID, COUNT( f.ID ) AS "count" @@ -599,12 +620,24 @@ AND f.DATE_ID <= #{dateId} GROUP BY da.ID ) b ON a.AGENCY_ID = b.AGENCY_ID + LEFT JOIN + (SELECT da.ID AS AGENCY_ID, + COUNT(DISTINCT f.ID ) AS "count" + FROM fact_origin_project_log_daily f + INNER JOIN dim_agency da ON f.PIDS LIKE CONCAT( '%', da.ID, '%' ) + AND da.`LEVEL` = #{level} + WHERE + ACTION_CODE = 'response' + AND f.IS_ACTIVE = 1 + AND f.CUSTOMER_ID = #{customerId} + AND f.DATE_ID <= #{dateId} + GROUP BY da.ID ) c + ON a.AGENCY_ID = c.AGENCY_ID SELECT sca.AGENCY_ID, - sca.pid AS PARENT_ID, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PARENT_ID, #{monthId} AS MONTH_ID, #{quarterId} AS QUARTER_ID, #{yearId} AS YEAR_ID, @@ -317,7 +317,7 @@ SELECT sca.AGENCY_ID, - sca.pid AS PARENT_ID, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PARENT_ID, #{monthId} AS MONTH_ID, #{quarterId} AS QUARTER_ID, #{yearId} AS YEAR_ID, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml index b070adb978..bebe7d6194 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml @@ -199,7 +199,7 @@ SELECT sca.AGENCY_ID, - sca.PID AS PARENT_ID, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PARENT_ID, #{monthId} AS MONTH_ID, #{quarterId} AS QUARTER_ID, #{yearId} AS YEAR_ID, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index b60f152f95..1b6d972783 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -396,8 +396,8 @@ SELECT sca.CUSTOMER_ID, sca.AGENCY_ID AS orgId, - sca.PID, - sca.PIDS, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PID, + IF(sca.PIDS = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PIDS) AS PIDS, sca.`LEVEL` AS orgType, sca.AREA_CODE FROM screen_customer_agency sca diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml index b38ec6cce5..b738c0f217 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml @@ -52,7 +52,14 @@ 0 AS RESPONSE_RATIO, 0 AS RESOLVED_RATIO, 0 AS GOVERN_RATIO, - 0 AS SATISFACTION_RATIO + 0 AS SATISFACTION_RATIO, + 0 AS RESPONSE_COUNT, + 0 AS TRANSFER_COUNT, + 0 AS RESOLVED_COUNT, + 0 AS CLOSED_COUNT, + 0 AS GOVERN_COUNT, + 0 AS SATISFACTION_COUNT, + 0 AS CLOSED_PROJECT_COUNT FROM screen_customer_agency WHERE @@ -69,7 +76,14 @@ 0 AS RESPONSE_RATIO, 0 AS RESOLVED_RATIO, 0 AS GOVERN_RATIO, - 0 AS SATISFACTION_RATIO + 0 AS SATISFACTION_RATIO, + 0 AS RESPONSE_COUNT, + 0 AS TRANSFER_COUNT, + 0 AS RESOLVED_COUNT, + 0 AS CLOSED_COUNT, + 0 AS GOVERN_COUNT, + 0 AS SATISFACTION_COUNT, + 0 AS CLOSED_PROJECT_COUNT FROM screen_customer_grid WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 51c75a1c17..db38763cb5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -46,6 +46,20 @@ and DATE_FORMAT(PROJECT_CREATE_TIME,'%Y%m%d') = #{dateId} limit 1000 + + delete from screen_project_data + where PROJECT_ID = #{projectId} + AND customer_id = #{customerId} + + + + delete from screen_project_data + where 1=1 + AND customer_id = #{customerId} + + PROJECT_ID = #{projectId} + + + SELECT * FROM screen_user_join + WHERE DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND ORG_TYPE = #{flag} + AND MONTH_ID = #{monthId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index f73f12eb5f..0b60e3efd5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -170,4 +170,54 @@ AND del_flag = '0' AND DATE_FORMAT( CREATED_TIME, '%Y%m%d' ) = #{dateId} + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml new file mode 100644 index 0000000000..5bd8912385 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml @@ -0,0 +1,931 @@ + + + + + + DELETE + FROM + fact_reg_user_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_reg_user_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + year_id, + reg_total, + resi_total, + warm_hearted_total, + partymember_total, + reg_incr, + warm_incr, + partymember_incr, + resi_proportion, + partymember_proportion, + warm_hearted_proportion, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.yearId}, + #{item.regTotal}, + #{item.resiTotal}, + #{item.warmHeartedTotal}, + #{item.partymemberTotal}, + #{item.regIncr}, + #{item.warmIncr}, + #{item.partymemberIncr}, + #{item.resiProportion}, + #{item.partymemberProportion}, + #{item.warmHeartedProportion}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_reg_user_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_reg_user_agency_daily + ( + id, + customer_id, + agency_id, + date_id, + week_id, + year_id, + reg_total, + resi_total, + warm_hearted_total, + partymember_total, + reg_incr, + warm_incr, + partymember_incr, + resi_proportion, + partymember_proportion, + warm_hearted_proportion, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.dateId}, + #{item.weekId}, + #{item.yearId}, + #{item.regTotal}, + #{item.resiTotal}, + #{item.warmHeartedTotal}, + #{item.partymemberTotal}, + #{item.regIncr}, + #{item.warmIncr}, + #{item.partymemberIncr}, + #{item.resiProportion}, + #{item.partymemberProportion}, + #{item.warmHeartedProportion}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_group_total_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_group_total_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + group_total, + ordinary_total, + branch_total, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupTotal}, + #{item.ordinaryTotal}, + #{item.branchTotal}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_group_total_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_group_total_agency_daily + ( + id, + customer_id, + agency_id, + pid, + date_id, + week_id, + month_id, + quarter_id, + year_id, + group_total, + ordinary_total, + branch_total, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupTotal}, + #{item.ordinaryTotal}, + #{item.branchTotal}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_topic_hotdiscuss_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_topic_hotdiscuss_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + topic_total, + status, + topic_count, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicTotal}, + #{item.status}, + #{item.topicCount}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_topic_hotdiscuss_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_topic_hotdiscuss_agency_daily + ( + id, + customer_id, + agency_id, + pid, + date_id, + week_id, + month_id, + quarter_id, + year_id, + topic_total, + status, + topic_count, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicTotal}, + #{item.status}, + #{item.topicCount}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + + DELETE FROM fact_agency_project_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_agency_project_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + PARENT_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + PROJECT_TOTAL, + PENDING_TOTAL, + PENDING_RATIO, + CLOSED_TOTAL, + CLOSED_RATIO, + RESOLVED_TOTAL, + RESOLVED_RATIO, + UNRESOLVED_TOTAL, + UNRESOLVED_RATIO, + PROJECT_INCR, + PENDING_INCR, + CLOSED_INCR, + RESOLVED_INCR, + UNRESOLVED_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.parentId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.projectTotal}, + #{i.pendingTotal}, + #{i.pendingRatio}, + #{i.closedTotal}, + #{i.closedRatio}, + #{i.resolvedTotal}, + #{i.resolvedRatio}, + #{i.unresolvedTotal}, + #{i.unresolvedRatio}, + #{i.projectIncr}, + #{i.pendingIncr}, + #{i.closedIncr}, + #{i.resolvedIncr}, + #{i.unresolvedIncr}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + + INSERT INTO fact_grid_project_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + PROJECT_TOTAL, + PENDING_TOTAL, + PENDING_RATIO, + CLOSED_TOTAL, + CLOSED_RATIO, + RESOLVED_TOTAL, + RESOLVED_RATIO, + UNRESOLVED_TOTAL, + UNRESOLVED_RATIO, + PROJECT_INCR, + PENDING_INCR, + CLOSED_INCR, + RESOLVED_INCR, + UNRESOLVED_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.projectTotal}, + #{i.pendingTotal}, + #{i.pendingRatio}, + #{i.closedTotal}, + #{i.closedRatio}, + #{i.resolvedTotal}, + #{i.resolvedRatio}, + #{i.unresolvedTotal}, + #{i.unresolvedRatio}, + #{i.projectIncr}, + #{i.pendingIncr}, + #{i.closedIncr}, + #{i.resolvedIncr}, + #{i.unresolvedIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_grid_project_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_issue_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERt INTO fact_issue_agency_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + PID, + YEAR_ID, + QUARTER_ID, + MONTH_ID, + WEEK_ID, + DATE_ID, + ISSUE_INCR, + ISSUE_TOTAL, + SHIFT_PROJECT_INCR, + SHIFT_PROJECT_TOTAL, + SHIFT_PROJECT_PERCENT, + VOTING_INCR, + VOTING_TOTAL, + VOTING_PERCENT, + CLOSED_INCR, + CLOSED_RESOLVED_INCR, + CLOSED_UNRESOLVED_INCR, + CLOSED_TOTAL, + CLOSED_RESOLVED_TOTAL, + CLOSED_UNRESOLVED_TOTAL, + CLOSED_PERCENT, + CLOSED_RESOLVED_PERCENT, + CLOSED_UNRESOLVED_PERCENT, + CLOSED_CASE_INCR, + CLOSED_CASE_RESOLVED_INCR, + CLOSED_CASE_UNRESOLVED_INCR, + CLOSED_CASE_TOTAL, + CLOSED_CASE_RESOLVED_TOTAL, + CLOSED_CASE_UNRESOLVED_TOTAL, + CLOSED_CASE_RESOLVED_PERCENT, + CLOSED_CASE_UNRESOLVED_PERCENT, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + DEL_FLAG, + UPDATED_TIME) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.pid}, + #{i.yearId}, + #{i.quarterId}, + #{i.monthId}, + #{i.weekId}, + #{i.dateId}, + #{i.issueIncr}, + #{i.issueTotal}, + #{i.shiftProjectIncr}, + #{i.shiftProjectTotal}, + #{i.shiftProjectPercent}, + #{i.votingIncr}, + #{i.votingTotal}, + #{i.votingPercent}, + #{i.closedIncr}, + #{i.closedResolvedIncr}, + #{i.closedUnresolvedIncr}, + #{i.closedTotal}, + #{i.closedResolvedTotal}, + #{i.closedUnresolvedTotal}, + #{i.closedPercent}, + #{i.closedResolvedPercent}, + #{i.closedUnresolvedPercent}, + #{i.closedCaseIncr}, + #{i.closedCaseResolvedIncr}, + #{i.closedCaseUnresolvedIncr}, + #{i.closedCaseTotal}, + #{i.closedCaseResolvedTotal}, + #{i.closedCaseUnresolvedTotal}, + #{i.closedCaseResolvedPercent}, + #{i.closedCaseUnresolvedPercent}, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + 0, + NOW() + ) + + + + + + INSERT INTO fact_issue_grid_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + YEAR_ID, + QUARTER_ID, + MONTH_ID, + WEEK_ID, + DATE_ID, + ISSUE_INCR, + ISSUE_TOTAL, + SHIFT_PROJECT_INCR, + SHIFT_PROJECT_TOTAL, + SHIFT_PROJECT_PERCENT, + VOTING_INCR, + VOTING_TOTAL, + VOTING_PERCENT, + CLOSED_INCR, + CLOSED_RESOLVED_INCR, + CLOSED_UNRESOLVED_INCR, + CLOSED_TOTAL, + CLOSED_RESOLVED_TOTAL, + CLOSED_UNRESOLVED_TOTAL, + CLOSED_PERCENT, + CLOSED_RESOLVED_PERCENT, + CLOSED_UNRESOLVED_PERCENT, + CLOSED_CASE_INCR, + CLOSED_CASE_RESOLVED_INCR, + CLOSED_CASE_UNRESOLVED_INCR, + CLOSED_CASE_TOTAL, + CLOSED_CASE_RESOLVED_TOTAL, + CLOSED_CASE_UNRESOLVED_TOTAL, + CLOSED_CASE_RESOLVED_PERCENT, + CLOSED_CASE_UNRESOLVED_PERCENT, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + DEL_FLAG, + UPDATED_TIME) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.yearId}, + #{i.quarterId}, + #{i.monthId}, + #{i.weekId}, + #{i.dateId}, + #{i.issueIncr}, + #{i.issueTotal}, + #{i.shiftProjectIncr}, + #{i.shiftProjectTotal}, + #{i.shiftProjectPercent}, + #{i.votingIncr}, + #{i.votingTotal}, + #{i.votingPercent}, + #{i.closedIncr}, + #{i.closedResolvedIncr}, + #{i.closedUnresolvedIncr}, + #{i.closedTotal}, + #{i.closedResolvedTotal}, + #{i.closedUnresolvedTotal}, + #{i.closedPercent}, + #{i.closedResolvedPercent}, + #{i.closedUnresolvedPercent}, + #{i.closedCaseIncr}, + #{i.closedCaseResolvedIncr}, + #{i.closedCaseUnresolvedIncr}, + #{i.closedCaseTotal}, + #{i.closedCaseResolvedTotal}, + #{i.closedCaseUnresolvedTotal}, + #{i.closedCaseResolvedPercent}, + #{i.closedCaseUnresolvedPercent}, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + 0, + NOW() + ) + + + + + + DELETE FROM fact_issue_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_topic_issue_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_topic_issue_agency_daily + ( + ID, + CUSTOMER_ID, + PID, + AGENCY_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_TOTAL, + ISSUE_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.pid}, + #{i.agencyId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.issueTotal}, + #{i.issueIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + INSERT INTO fact_topic_issue_grid_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_INCR, + ISSUE_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.issueIncr}, + #{i.issueTotal}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_topic_issue_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_topic_status_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_topic_status_agency_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_STATUS_ID, + TOPIC_COUNT, + TOPIC_PROPORTION, + TOPIC_INCREMENT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.pid}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.topicStatusId}, + #{i.topicCount}, + #{i.topicProportion}, + #{i.topicIncrement}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + INSERT INTO fact_topic_status_grid_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_STATUS_ID, + TOPIC_COUNT, + TOPIC_PROPORTION, + TOPIC_INCREMENT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.topicStatusId}, + #{i.topicCount}, + #{i.topicProportion}, + #{i.topicIncrement}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_topic_status_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index d53204f039..38d49f3929 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -30,7 +30,7 @@ public class AccessServiceImpl implements AccessService { listOpePermsFormDTO.setCurrGridId(currGridId); Result> result = govAccessFeignClient.listOperationPermissions(listOpePermsFormDTO); if (!result.success()) { - logger.error("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); + logger.warn("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java index b9cbcdc232..933bdbb492 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java @@ -101,4 +101,9 @@ public class AgencysResultDTO implements Serializable { * 当前组织对应客户根组织级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) */ private String rootlevel; + + /** + * 当前agencyId所属的客户id + */ + private String customerId; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java index 3c96aa6df6..d111551123 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -38,4 +39,14 @@ public class LatestCustomerResultDTO implements Serializable { * 性别0未知1男2女 */ private Integer gender; + + /** + * 是否有字客户 + */ + private Boolean haveSubCustomer; + + /** + * 子客户列表 + */ + private List subCustomerIds; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java index 60683bf779..b9222196f9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -19,7 +19,6 @@ package com.epmet.dto.result; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -43,4 +42,13 @@ public class ParentListResultDTO implements Serializable { private String name = ""; + /** + * 省级:province; 市级: city; 区县级: district ;乡(镇、街道)级:street ;社区级:community + */ + private String level=""; + + /** + * 增加此返回值,为了调试用 + */ + private String areaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4e28d10dc1..1b99ac96f3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -342,4 +342,14 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customerstaffgrid/gridstaff") Result> selectGridStaffByGridIds(@RequestBody List gridIds); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param customerId + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @GetMapping(value = "/gov/org/customeragency/getareacodeswitch/{customerId}") + Result getAreaCodeSwitch(@PathVariable("customerId")String customerId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4976297323..0d13438885 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -197,4 +197,16 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> selectGridStaffByGridIds(List gridIds) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds); } + + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @Override + public Result getAreaCodeSwitch(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index b88368a11d..bb6308fd11 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -17,7 +17,6 @@ package com.epmet.controller; -import com.baomidou.mybatisplus.extension.api.R; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -34,13 +33,12 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerOrgParameterService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Map; import java.util.Set; @@ -58,6 +56,8 @@ public class CustomerAgencyController { @Autowired private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerOrgParameterService customerOrgParameterService; @GetMapping("page") public Result> page(@RequestParam Map params) { @@ -297,4 +297,9 @@ public class CustomerAgencyController { Result organizeTree(@PathVariable("agencyId") String agencyId) { return new Result().ok(customerAgencyService.organizeTree(agencyId)); } + + @GetMapping("getareacodeswitch/{customerId}") + public Result getAreaCodeSwitch(@PathVariable("customerId")String customerId){ + return new Result().ok(customerOrgParameterService.getAreaCodeSwitch(customerId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java index 536cfdb330..7b6a784a83 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java @@ -129,6 +129,9 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl getLatestCustomer(String userId) { LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO(); + resultDTO.setHaveSubCustomer(false); + resultDTO.setSubCustomerIds(new ArrayList<>()); + CustomerStaffAgencyDTO customerStaffAgencyDTO = baseDao.selectLatestCustomerByStaff(userId); resultDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId()); @@ -150,6 +153,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); if (customerResult.success() && null != customerResult.getData()) { resultDTO.setCustomerName(customerResult.getData().getCustomerName()); + resultDTO.setHaveSubCustomer(customerResult.getData().getHaveSubCustomer()); + resultDTO.setSubCustomerIds(customerResult.getData().getSubCustomerIds()); }else{ log.warn(String.format("根据客户id:%s,查询客户信息失败",customerDTO.getId())); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index d5be20752e..43c87b57b5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -178,7 +178,7 @@ public interface ProjectConstant { String EVALUATE_GOOD = "good"; String EVALUATE_BAD = "bad"; String EVALUATE_PERFECT = "perfect"; - + String EVALUATE="evaluate"; /** * 三个月,六个月,12个月 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java index acc06b2281..c1e07bf6bf 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java @@ -20,16 +20,20 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ProjectConstant; @@ -39,25 +43,28 @@ import com.epmet.dao.ProjectSatisfactionStatisticsDao; import com.epmet.dto.ProjectSatisfactionDetailDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.entity.ProjectEntity; import com.epmet.entity.ProjectSatisfactionDetailEntity; import com.epmet.entity.ProjectSatisfactionStatisticsEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.redis.ProjectRedis; import com.epmet.redis.ProjectSatisfactionDetailRedis; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.ProjectSatisfactionDetailService; import com.epmet.service.ProjectSatisfactionStatisticsService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.redisson.api.RLock; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @@ -91,6 +98,10 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl page(Map params) { @@ -240,6 +251,21 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl subCustomerIds; } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java index 63ad887526..2911420fe3 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java @@ -17,10 +17,15 @@ package com.epmet.redis; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.CustomerDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Map; + /** * 客户表 * @@ -32,6 +37,11 @@ public class CustomerRedis { @Autowired private RedisUtils redisUtils; + /** + * 客户信息rediskey前缀 + */ + private String customerInfoKeyPref="epmet:customer:info:"; + public void delete(Object[] ids) { } @@ -44,4 +54,26 @@ public class CustomerRedis { return null; } + + /** + * 查询客户基本信息 + */ + public CustomerDTO queryCustomerInfo(String customerId) { + String customerInfoKey=customerInfoKeyPref.concat(customerId); + Map customerDtoMap = redisUtils.hGetAll(customerInfoKey); + if (MapUtil.isEmpty(customerDtoMap)) { + return null; + } + CustomerDTO customerDTO = BeanUtil.mapToBean(customerDtoMap, CustomerDTO.class, true); + return customerDTO; + } + + /** + * 将客户基本信息放到redis,有效期一天 + */ + public void saveCustomerInfo(String customerId, CustomerDTO data) { + String customerInfoKey = customerInfoKeyPref.concat(customerId); + Map customerDtoMap = BeanUtil.beanToMap(data); + redisUtils.hMSet(customerInfoKey, customerDtoMap,RedisUtils.DEFAULT_EXPIRE); + } } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java index 72727b7f22..6a3a82127d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java @@ -27,14 +27,20 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.CustomerRelationDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerRelationDTO; import com.epmet.entity.CustomerRelationEntity; +import com.epmet.redis.CustomerRedis; import com.epmet.service.CustomerRelationService; +import com.epmet.service.CustomerService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -48,6 +54,10 @@ import java.util.Map; @Slf4j @Service public class CustomerRelationServiceImpl extends BaseServiceImpl implements CustomerRelationService { + @Autowired + private CustomerRedis customerRedis; + @Autowired + private CustomerService customerService; @Override public PageData page(Map params) { @@ -146,7 +156,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl getAllSubCustomerIds(String customerId) { - return baseDao.selectAllSubCustomerIds(customerId); + CustomerDTO customerDTO = customerRedis.queryCustomerInfo(customerId); + if (null != customerDTO) { + return customerDTO.getSubCustomerIds(); + } + CustomerDTO data = customerService.get(customerId); + if (null != data) { + data.setSubCustomerIds(baseDao.selectAllSubCustomerIds(customerId)); + data.setHaveSubCustomer(CollectionUtils.isNotEmpty(data.getSubCustomerIds()) ? true : false); + customerRedis.saveCustomerInfo(customerId, data); + return data.getSubCustomerIds(); + } + return new ArrayList<>(); } } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 341aa441e8..f66c547f6c 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -215,7 +215,16 @@ public class CustomerServiceImpl extends BaseServiceImpl getCustomerInfo(CustomerDTO dto) { CustomerEntity entity = baseDao.selectById(dto.getId()); - return new Result().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class)); + List customerIds=customerRelationService.getAllSubCustomerIds(dto.getId()); + CustomerDTO customerDTO=ConvertUtils.sourceToTarget(entity, CustomerDTO.class); + if(CollectionUtils.isEmpty(customerIds)){ + customerDTO.setHaveSubCustomer(false); + customerDTO.setSubCustomerIds(new ArrayList<>()); + }else{ + customerDTO.setHaveSubCustomer(true); + customerDTO.setSubCustomerIds(customerIds); + } + return new Result().ok(customerDTO); } @Override