From 0b54d26c6aadf46391de391b8e1c9d51e5219451 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 25 May 2021 09:37:56 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=A4=E5=BC=A0=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.15__govern.sql | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql new file mode 100644 index 0000000000..7777abc992 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql @@ -0,0 +1,97 @@ +-- epmet_data_statistical新增两张表,治理指数网格按天统计,治理指数按组织按天统计 + +-- /* +-- Navicat Premium Data Transfer +-- +-- Source Server : 192.168.1.130 +-- Source Server Type : MySQL +-- Source Server Version : 50728 +-- Source Host : 192.168.1.130:3306 +-- Source Schema : epmet_data_statistical +-- +-- Target Server Type : MySQL +-- Target Server Version : 50728 +-- File Encoding : 65001 +-- +-- Date: 25/05/2021 09:31:39 +-- */ +-- +-- SET NAMES utf8mb4; +-- SET FOREIGN_KEY_CHECKS = 0; +-- +-- -- ---------------------------- +-- -- Table structure for fact_agency_govern_daily +-- -- ---------------------------- +-- DROP TABLE IF EXISTS `fact_agency_govern_daily`; +-- CREATE TABLE `fact_agency_govern_daily` ( +-- `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键,customer_id+AGENCY_ID+date_id只有一条记录', +-- `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id', +-- `DATE_ID` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据更新至:yyyyMMdd; ', +-- `AGENCY_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织id', +-- `LEVEL` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'agency_id所属的机关级别(社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province)', +-- `PID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织i所属的组织id', +-- `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织i所有上级id', +-- `PROBLEM_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '界面展示:问题解决总数=1+2+3+4+5+6+7+8', +-- `GROUP_SELF_GOVERN_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数', +-- `GRID_SELF_GOVERN_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数', +-- `COMMUNITY_CLOSED_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:社区解决占比=COMMUNITY_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数', +-- `STREET_CLOSED_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:街道解决占比=STREET_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数', +-- `DISTRICT_DEPT_CLOSED_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:区直部门解决占比=DISTRICT_DEPT_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数', +-- `TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '1、当前组织内,话题关闭已解决数', +-- `TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '2、当前组织内,话题关闭无需解决数', +-- `ISSUE_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '3、当前组织内,议题关闭已解决数', +-- `ISSUE_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '4、当前组织内,议题关闭无需解决数', +-- `ISSUE_PROJECT_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '5、当前组织内:来源于议题的项目:结案已解决数', +-- `ISSUE_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '6、当前组织内:来源于议题的项目:结案无需解决数', +-- `APPROVAL_PROJECT_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '7、当前组织内:项目立项,结案已解决数;默认为0,', +-- `APPROVAL_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '8、当前组织内:项目立项,结案无需解决数;默认为0,', +-- `IN_GROUP_TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '9、当前组织内,未出小组即未转议题的:话题关闭已解决数', +-- `IN_GROUP_TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '10、当前组织内,未出小组即未转议题的:话题关闭无需解决数', +-- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL DEFAULT 0 COMMENT '未出当前网格的,结案项目数', +-- `COMMUNITY_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由社区结案的项目总数', +-- `STREET_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由街道结案的项目总数', +-- `DISTRICT_DEPT_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由区直部门结案的项目总数', +-- `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', +-- `REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁', +-- `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', +-- `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间:第一次提交审核的时间,注意和历史表的第一条记录时间一致', +-- `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人', +-- `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间', +-- PRIMARY KEY (`ID`) USING BTREE +-- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '组织的治理指数,按天统计' ROW_FORMAT = Dynamic; +-- +-- -- ---------------------------- +-- -- Table structure for fact_grid_govern_daily +-- -- ---------------------------- +-- DROP TABLE IF EXISTS `fact_grid_govern_daily`; +-- CREATE TABLE `fact_grid_govern_daily` ( +-- `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键,customer_id+grid_id+date_id只有一条记录', +-- `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id', +-- `DATE_ID` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据更新至:yyyyMMdd; ', +-- `GRID_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网格id', +-- `PID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网格所属的组织id', +-- `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网格所有上级id', +-- `PROBLEM_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '界面展示:问题解决总数=1+2+3+4+5+6+7+8', +-- `GROUP_SELF_GOVERN_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数', +-- `GRID_SELF_GOVERN_RATIO` decimal(10, 6) NOT NULL COMMENT '界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数', +-- `TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '1、当前网格内,话题关闭已解决数', +-- `TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '2、当前网格内,话题关闭无需解决数', +-- `ISSUE_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '3、当前网格内,议题关闭已解决数', +-- `ISSUE_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '4、当前网格内,议题关闭无需解决数', +-- `ISSUE_PROJECT_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '5、当前网格内:来源于议题的项目:结案已解决数', +-- `ISSUE_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '6、当前网格内:来源于议题的项目:结案无需解决数', +-- `APPROVAL_PROJECT_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '7、当前网格内:项目立项,结案已解决数;默认为0,', +-- `APPROVAL_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '8、当前网格内:项目立项,结案无需解决数;默认为0,', +-- `IN_GROUP_TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '9、当前网格内,未出小组即未转议题的:话题关闭已解决数', +-- `IN_GROUP_TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '10、当前网格内,未出小组即未转议题的:话题关闭无需解决数', +-- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL COMMENT '未出当前网格的,结案项目数', +-- `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', +-- `REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁', +-- `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', +-- `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间:第一次提交审核的时间,注意和历史表的第一条记录时间一致', +-- `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人', +-- `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间', +-- PRIMARY KEY (`ID`) USING BTREE +-- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网格的治理指数,按天统计' ROW_FORMAT = Dynamic; +-- +-- SET FOREIGN_KEY_CHECKS = 1; From 93277b9580ab1fe22e63737e753a6711a2609e30 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 25 May 2021 15:25:19 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E7=BB=84=E7=BB=87/=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E4=B8=8B=E5=93=8D=E5=BA=94=E8=A7=A3=E5=86=B3=E6=BB=A1=E6=84=8F?= =?UTF-8?q?=E8=87=AA=E6=B2=BB=E7=8E=87=E6=9F=A5=E8=AF=A2=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=BC=95=E5=85=A5epmet=5Fevaluation=5Findex=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/DataSourceConstant.java | 2 + .../dto/datastats/form/GovrnRatioFormDTO.java | 33 ++++++++++ .../datastats/result/GovrnRatioResultDTO.java | 27 +++++++++ .../data-aggregator-server/pom.xml | 60 ++++++++++++++----- .../controller/DataStatsController.java | 15 +++++ .../evaluationindex/EvaluationIndexDao.java | 37 ++++++++++++ .../service/datastats/DataStatsService.java | 7 +++ .../datastats/impl/DataStatsServiceImpl.java | 32 ++++++++++ .../EvaluationIndexService.java | 18 ++++++ .../impl/EvaluationIndexServiceImpl.java | 40 +++++++++++++ .../src/main/resources/bootstrap.yml | 11 +++- .../evaluationindex/EvaluationIndexDao.xml | 23 +++++++ 12 files changed, 286 insertions(+), 19 deletions(-) create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GovrnRatioResultDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java index b5395e65b6..ce186bfffc 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java @@ -28,4 +28,6 @@ public interface DataSourceConstant { String OPER_CRM="opercrm"; String DATA_STATISTICAL="datastatistical"; + + String EVALUATION_INDEX = "evaluationIndex"; } 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 new file mode 100644 index 0000000000..7e5407a8ef --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dataaggre.dto.datastats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 治理实况-组织/网格下响应解决满意自治率-接口入参 + * @Auth sun + */ +@Data +public class GovrnRatioFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 组织Id + */ + @NotBlank(message = "组织或网格Id不能为空", groups = GovrnRatioFormDTO.AgencyGrid.class) + private String orgId; + /** + * 组织:agency 网格:grid + */ + @NotBlank(message = "网格Id不能为空", groups = GovrnRatioFormDTO.AgencyGrid.class) + private String orgType; + /** + * 日维度Id[日期,不传值默认查前一天的【格式:20210101】] + */ + private String dateId; + public interface AgencyGrid extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GovrnRatioResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GovrnRatioResultDTO.java new file mode 100644 index 0000000000..75a6f5ee1b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/GovrnRatioResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dataaggre.dto.datastats.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 治理实况-组织/网格下响应解决满意自治率-接口返参 + * @Auth sun + */ +@Data +public class GovrnRatioResultDTO implements Serializable { + private static final long serialVersionUID = 466974582608407121L; + //组织或网格Id + private String orgId; + //组织:agency 网格:grid + private String orgType; + //响应率 + private String responseRatio = "0%"; + //解决率 + private String resolvedRatio = "0%"; + //自治率 + private String governRatio = "0%"; + //满意率 + private String satisfactionRatio = "0%"; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index a2cc3bc297..ab8c36be1a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -158,11 +158,18 @@ EpmEt-db-UsEr - + - - epmet_data_statistical_user - EpmEt-db-UsEr + + epmet_data_statistical_user + EpmEt-db-UsEr + + + + + + epmet_evaluation_index_user + EpmEt-db-UsEr 0 @@ -246,11 +253,18 @@ EpmEt-db-UsEr - + - - epmet_data_statistical_user - EpmEt-db-UsEr + + epmet_data_statistical_user + EpmEt-db-UsEr + + + + + + epmet_evaluation_index_user + EpmEt-db-UsEr 0 @@ -334,11 +348,18 @@ elink@833066 - + - - epmet - elink@833066 + + epmet + elink@833066 + + + + + + epmet + elink@833066 0 @@ -422,11 +443,18 @@ EpmEt-db-UsEr - + - - epmet_data_statistical_user - EpmEt-db-UsEr + + epmet_data_statistical_user + EpmEt-db-UsEr + + + + + + epmet_evaluation_index_user + EpmEt-db-UsEr 0 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java index 74b2552e43..a56d769119 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.controller; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.dto.datastats.form.*; @@ -200,4 +201,18 @@ public class DataStatsController { return new Result>().ok(dataStatsService.subGridGovrnList(formDTO)); } + /** + * @Param formDTO + * @Description 治理实况-组织/网格下响应解决满意自治率 + * @author sun + */ + @PostMapping("governratio") + public Result governRatio(@RequestBody GovrnRatioFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GovrnRatioFormDTO.AgencyGrid.class); + if (!"agency".equals(formDTO.getOrgType()) && !"grid".equals(formDTO.getOrgType())) { + throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType())); + } + return new Result().ok(dataStatsService.governRatio(formDTO)); + } + } 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 new file mode 100644 index 0000000000..c9084a0b4b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java @@ -0,0 +1,37 @@ +/** + * 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.dao.evaluationindex; + +import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Author sun + * @Description 指标统计服务 + */ +@Mapper +public interface EvaluationIndexDao { + + /** + * @Param formDTO + * @Description 按类型、日期查询治理指数下响应解决满意自治四个统计率 + * @author sun + */ + GovrnRatioResultDTO getAgnecyOrGridGoverRatio(@Param("orgId") String orgId, @Param("orgType") String orgType, @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/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index 472bc277b4..8b08a765d2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -152,4 +152,11 @@ public interface DataStatsService { * @author sun */ List subGridGovrnList(GridGovrnFormDTO formDTO); + + /** + * @Param formDTO + * @Description 治理实况-组织/网格下响应解决满意自治率 + * @author sun + */ + GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); } 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 59bca42a8a..c636d2fe11 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 @@ -14,6 +14,7 @@ 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.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -39,6 +40,8 @@ import java.util.stream.Collectors; public class DataStatsServiceImpl implements DataStatsService { @Autowired private DataStatsDao dataStatsDao; + @Autowired + private EvaluationIndexService indexService; /** @@ -1243,4 +1246,33 @@ public class DataStatsServiceImpl implements DataStatsService { return resultList; } + /** + * @Param formDTO + * @Description 治理实况-组织/网格下响应解决满意自治率 + * @author sun + */ + @Override + public GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO) { + GovrnRatioResultDTO resultDTO = new GovrnRatioResultDTO(); + resultDTO.setOrgId(formDTO.getOrgId()); + resultDTO.setOrgType(formDTO.getOrgType()); + + //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 + if (StringUtils.isBlank(formDTO.getDateId())) { + Date yesterday = DateUtils.addDateDays(new Date(), -1); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); + formDTO.setDateId(format.format(yesterday)); + } + + //1.按类型、日期查询治理指数下响应解决满意自治四个统计率 + GovrnRatioResultDTO dto = indexService.governRatio(formDTO); + if (null != dto) { + resultDTO.setResponseRatio(dto.getResponseRatio()); + resultDTO.setResolvedRatio(dto.getResolvedRatio()); + resultDTO.setGovernRatio(dto.getGovernRatio()); + resultDTO.setSatisfactionRatio(dto.getSatisfactionRatio()); + } + return resultDTO; + } + } 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 new file mode 100644 index 0000000000..909a3dc208 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java @@ -0,0 +1,18 @@ +package com.epmet.dataaggre.service.evaluationindex; + +import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO; +import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; + +/** + * @Author sun + * @Description 指标统计服务 + */ +public interface EvaluationIndexService { + + /** + * @Param formDTO + * @Description 治理实况-组织/网格下响应解决满意自治率 + * @author sun + */ + GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); +} 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 new file mode 100644 index 0000000000..bec7bafd90 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java @@ -0,0 +1,40 @@ +package com.epmet.dataaggre.service.evaluationindex.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dataaggre.constant.DataSourceConstant; +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.service.evaluationindex.EvaluationIndexService; +import lombok.extern.slf4j.Slf4j; +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.Date; + +/** + * @Author sun + * @Description 指标统计服务 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +@Slf4j +public class EvaluationIndexServiceImpl implements EvaluationIndexService { + @Autowired + private EvaluationIndexDao evaluationIndexDao; + + /** + * @Param formDTO + * @Description 按类型、日期查询治理指数下响应解决满意自治四个统计率 + * @author sun + */ + @Override + public GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO) { + return evaluationIndexDao.getAgnecyOrGridGoverRatio(formDTO.getOrgId(),formDTO.getOrgType(),formDTO.getDateId()); + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index cd8b7b8ef1..ab888fc91c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -131,9 +131,14 @@ dynamic: password: @datasource.druid.opercrm.password@ datastatistical: driver-class-name: com.mysql.cj.jdbc.Driver - url: @datasource.druid.opercrm.url@ - username: @datasource.druid.opercrm.username@ - password: @datasource.druid.opercrm.password@ + url: @datasource.druid.stats.url@ + username: @datasource.druid.stats.username@ + password: @datasource.druid.stats.password@ + evaluationIndex: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.evaluationIndex.url@ + username: @datasource.druid.evaluationIndex.username@ + password: @datasource.druid.evaluationIndex.password@ feign: hystrix: enabled: true 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 new file mode 100644 index 0000000000..a0c2e0c245 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file From 64e3084e660997401f806eecb4804674447f14cf Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 25 May 2021 16:01:19 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E7=BD=91=E6=A0=BCv1,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/DemoController.java | 9 + .../extract/FactGridGovernDailyDao.java | 4 +- .../extract/FactOriginIssueMainDailyDao.java | 17 ++ .../extract/FactOriginTopicMainDailyDao.java | 18 ++ .../extract/FactGridGovernDailyEntity.java | 25 +- .../extract/GovernGridTotalCommonDTO.java | 18 ++ .../FactOriginIssueMainDailyService.java | 14 + .../FactOriginTopicMainDailyService.java | 15 ++ .../impl/FactGridGovernDailyServiceImpl.java | 251 +++++++++++++++++- .../FactOriginIssueMainDailyServiceImpl.java | 17 ++ .../FactOriginTopicMainDailyServiceImpl.java | 18 ++ .../db/migration/V0.0.15__govern.sql | 4 +- .../extract/FactGridGovernDailyDao.xml | 11 +- .../extract/FactOriginIssueMainDailyDao.xml | 32 +++ .../extract/FactOriginTopicMainDailyDao.xml | 31 +++ 15 files changed, 473 insertions(+), 11 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridTotalCommonDTO.java 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 644830e3a2..63be2f1da0 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 @@ -37,6 +37,7 @@ import com.epmet.entity.stats.DimMonthEntity; import com.epmet.service.StatsDemoService; import com.epmet.service.StatsPartyMemberVanguardService; import com.epmet.service.evaluationindex.extract.dataToIndex.*; +import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactGroupActDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; @@ -116,6 +117,8 @@ public class DemoController { private StatsPartyMemberVanguardService statsPartyMemberVanguardService; @Autowired private FactGroupActDailyService factGroupActDailyService; + @Autowired + private FactGridGovernDailyService factGridGovernDailyService; @GetMapping("testAlarm") public void testAlarm() { @@ -890,4 +893,10 @@ public class DemoController { factGroupActDailyService.extractAgencyGroupActDaily(customerId,dateId); return new Result(); } + + @PostMapping("extractgridgoverndaily") + public Result extractFactGridGovernDaily(@RequestParam("customerId") String customerId,@RequestParam("dateId")String dateId){ + factGridGovernDailyService.extractFactGridGovernDaily(customerId,dateId); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java index 5d35359bc7..1408abaeff 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridGovernDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 网格的治理指数,按天统计 @@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactGridGovernDailyDao extends BaseDao { - + + int deleteBatchByCustomerIdAndDateId(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("limit") int limit); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index 280e38213e..ee2e78aaa3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -25,6 +25,7 @@ import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.ShiftProjectCountResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -225,4 +226,20 @@ public interface FactOriginIssueMainDailyDao extends BaseDao */ List selectPartyMemberIssueStaticByGrid(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 3、当前网格内,议题关闭已解决数 + * 4、当前网格内,议题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param issueStatus 议题状态 voting 已转项目:shift_project 已关闭:closed_resloved + * @param resolveType unresolved,resolved + * @return + */ + List selectGroupByGridId(@Param("customerId")String customerId, + @Param("gridIds")List gridIds, + @Param("issueStatus")String issueStatus, + @Param("resolveType")String resolveType); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java index f34fbf3a4b..96ecdef6c6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.extract.result.CreateTopicCountResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -159,4 +160,21 @@ public interface FactOriginTopicMainDailyDao extends BaseDao */ List selectPartyMemberTopicStaticByGrid(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 1、当前网格内,话题关闭已解决数 + * 2、当前网格内,话题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param topicStatus 话题状态(讨论中 - discussing、 已屏蔽 - hidden、 已关闭 - closed) + * @param closedStatus unresolved,resolved + * @return + */ + List selectTopicGroupByGridId(@Param("customerId")String customerId, + @Param("gridIds")List gridIds, + @Param("topicStatus")String topicStatus, + @Param("closedStatus")String closedStatus, + @Param("shiftIssue")String shiftIssue); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java index 0fcff9c663..0e7b1cb889 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java @@ -19,6 +19,8 @@ package com.epmet.entity.evaluationindex.extract; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import lombok.Data; import lombok.EqualsAndHashCode; @@ -128,8 +130,29 @@ public class FactGridGovernDailyEntity extends BaseEpmetEntity { private Integer inGroupTopicUnResolvedCount; /** - * 未出当前网格的,结案项目数 + * 11、未出当前网格的,结案项目数 */ private Integer gridSelfGovernProjectTotal; + public FactGridGovernDailyEntity() { + this.customerId = StrConstant.EPMETY_STR; + this.dateId = StrConstant.EPMETY_STR; + this.gridId = StrConstant.EPMETY_STR; + this.pid = StrConstant.EPMETY_STR; + this.pids = StrConstant.EPMETY_STR; + this.problemResolvedCount = NumConstant.ZERO; + this.groupSelfGovernRatio=BigDecimal.ZERO; + this.gridSelfGovernProjectTotal=NumConstant.ZERO; + this.topicResolvedCount=NumConstant.ZERO; + this.topicUnResolvedCount=NumConstant.ZERO; + this.issueResolvedCount=NumConstant.ZERO; + this.issueUnResolvedCount=NumConstant.ZERO; + this.issueProjectResolvedCount=NumConstant.ZERO; + this.issueProjectUnResolvedCount=NumConstant.ZERO; + this.approvalProjectResolvedCount=NumConstant.ZERO; + this.approvalProjectUnResolvedCount=NumConstant.ZERO; + this.inGroupTopicResolvedCount=NumConstant.ZERO; + this.inGroupTopicUnResolvedCount=NumConstant.ZERO; + this.gridSelfGovernProjectTotal=NumConstant.ZERO; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridTotalCommonDTO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridTotalCommonDTO.java new file mode 100644 index 0000000000..38dae54c41 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridTotalCommonDTO.java @@ -0,0 +1,18 @@ +package com.epmet.entity.evaluationindex.extract; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 网格的治理指数,按天统计 计算过程中,通用dto + * + * @author yinzuomei@elink-cn.com + * @date 2021/5/25 13:43 + */ +@Data +public class GovernGridTotalCommonDTO implements Serializable { + private String customerId; + private String gridId; + private Integer total; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java index a1e4ac55de..648891b0cc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java @@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import java.util.List; import java.util.Map; @@ -122,4 +123,17 @@ public interface FactOriginIssueMainDailyService extends BaseService */ Map getPartyMemberIssueStatic(String customerId, String dateId, String type); + + /** + * 3、当前网格内,议题关闭已解决数 + * 4、当前网格内,议题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param issueStatus 议题状态 voting 已转项目:shift_project 已关闭:closed_resloved + * @param resolveType unresolved,resolved + * @return + */ + List queryGridIssueValue(String customerId, List gridIds, String issueStatus, String resolveType); } \ 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/FactOriginTopicMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java index aa66fc44e0..2cae521855 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java @@ -23,6 +23,7 @@ import com.epmet.dto.extract.result.CreateTopicCountResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import java.util.List; import java.util.Map; @@ -123,4 +124,18 @@ public interface FactOriginTopicMainDailyService extends BaseService */ Map getPartyMemberTopicStatic(String customerId, String dateId, String type); + + /** + * 1、当前网格内,话题关闭已解决数 + * 2、当前网格内,话题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param topicStatus 话题状态(讨论中 - discussing、 已屏蔽 - hidden、 已关闭 - closed) + * @param closedStatus unresolved,resolved + * @param shiftIssue 是否转为议题,0:false,1:true; + * @return + */ + List queryGridTopicValue(String customerId, List gridIds, String topicStatus, String closedStatus, String shiftIssue); } \ 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/FactGridGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java index 38b5a2d8a0..d3ebd1edc9 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 @@ -18,19 +18,29 @@ package com.epmet.service.evaluationindex.extract.todata.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DimObjectStatusConstant; +import com.epmet.constant.ProjectConstant; import com.epmet.dao.evaluationindex.extract.FactGridGovernDailyDao; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; -import com.epmet.service.group.GroupDataService; -import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.org.CustomerGridService; 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.math.BigDecimal; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 网格的治理指数,按天统计 @@ -42,9 +52,9 @@ import java.util.List; @Service public class FactGridGovernDailyServiceImpl extends BaseServiceImpl implements FactGridGovernDailyService { @Autowired - private GroupDataService groupDataService; + private FactOriginTopicMainDailyService factOriginTopicMainDailyService; @Autowired - private CustomerAgencyService customerAgencyService; + private FactOriginIssueMainDailyService factOriginIssueMainDailyService; @Autowired private CustomerGridService customerGridService; @@ -62,13 +72,242 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl insertEntityList=this.constructFactGridGovernDailyEntityList(customerId,dateId,gridInfoDTOList); + // log.info(JSON.toJSONString(insertEntityList,true)); + + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.SIX); + + Map topicResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED,NumConstant.ZERO_STR); + Map topicUnResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED,NumConstant.ZERO_STR); + + Map issueResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED); + Map issueUnResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED); + + for(FactGridGovernDailyEntity insertEntity:insertEntityList){ + //1、当前网格内,话题关闭已解决数 + if(topicResolvedMap.containsKey(insertEntity.getGridId())){ + insertEntity.setTopicResolvedCount(topicResolvedMap.get(insertEntity.getGridId())); + } + //2、当前网格内,话题关闭无需解决数 + if(topicUnResolvedMap.containsKey(insertEntity.getGridId())){ + insertEntity.setTopicUnResolvedCount(topicUnResolvedMap.get(insertEntity.getGridId())); + } + //3、当前网格内,议题关闭已解决数 + if(issueResolvedMap.containsKey(insertEntity.getGridId())){ + insertEntity.setIssueResolvedCount(issueResolvedMap.get(insertEntity.getGridId())); + } + //4、当前网格内,议题关闭无需解决数 + if(issueUnResolvedMap.containsKey(insertEntity.getGridId())){ + insertEntity.setIssueUnResolvedCount(issueUnResolvedMap.get(insertEntity.getGridId())); + } + + // todo + // 5、当前网格内:来源于议题的项目:结案已解决数 + insertEntity.setIssueProjectResolvedCount(calIssueProjectResolvedCount(customerId,insertEntity.getGridId())); + // 6、当前网格内:来源于议题的项目:结案无需解决数 + insertEntity.setIssueProjectUnResolvedCount(calIssueProjectUnResolvedCount(customerId,insertEntity.getGridId())); + //7、当前网格内:项目立项,结案已解决数;默认为0, + insertEntity.setApprovalProjectResolvedCount(calApprovalProjectResolvedCount(customerId,insertEntity.getGridId())); + // 8、当前网格内:项目立项,结案无需解决数;默认为0, + insertEntity.setApprovalProjectUnResolvedCount(calApprovalProjectUnResolvedCount(customerId,insertEntity.getGridId())); + + + // 9、当前网格内,未出小组即未转议题的:话题关闭已解决数 + insertEntity.setInGroupTopicResolvedCount(calInGroupTopicResolvedCount(customerId,insertEntity.getGridId())); + // 10、当前网格内,未出小组即未转议题的:话题关闭无需解决数 + insertEntity.setInGroupTopicUnResolvedCount(calInGroupTopicUnResolvedCount(customerId,insertEntity.getGridId())); + // 11、未出当前网格的,结案项目数 + insertEntity.setGridSelfGovernProjectTotal(calGridSelfGovernProjectTotal(customerId,insertEntity.getGridId())); + + + //界面展示:1、问题解决总数=1+2+3+4+5+6+7+8 + insertEntity.setProblemResolvedCount(insertEntity.getTopicResolvedCount()+insertEntity.getTopicUnResolvedCount() + +insertEntity.getIssueResolvedCount()+insertEntity.getIssueUnResolvedCount() + +insertEntity.getIssueProjectResolvedCount()+insertEntity.getIssueProjectUnResolvedCount() + +insertEntity.getApprovalProjectResolvedCount()+insertEntity.getApprovalProjectUnResolvedCount()); + + //界面展示:2、党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数 + int groupSelfGovernRatioFz=insertEntity.getInGroupTopicResolvedCount()+insertEntity.getInGroupTopicUnResolvedCount(); + if (NumConstant.ZERO == groupSelfGovernRatioFz || NumConstant.ZERO == insertEntity.getProblemResolvedCount()) { + insertEntity.setGroupSelfGovernRatio(BigDecimal.ZERO); + }else{ + String groupSelfGovernRatioStr = numberFormat.format((float) groupSelfGovernRatioFz / insertEntity.getProblemResolvedCount()); + insertEntity.setGroupSelfGovernRatio(new BigDecimal(groupSelfGovernRatioStr)); + } + + //界面展示:3、网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + if(NumConstant.ZERO==insertEntity.getGridSelfGovernProjectTotal()||NumConstant.ZERO == insertEntity.getProblemResolvedCount()){ + insertEntity.setGridSelfGovernRatio(BigDecimal.ZERO); + }else{ + String gridSelfGovernRatioStr = numberFormat.format((float) insertEntity.getGridSelfGovernProjectTotal() / insertEntity.getProblemResolvedCount()); + insertEntity.setGridSelfGovernRatio(new BigDecimal(gridSelfGovernRatioStr)); + } + } + // 先删除,后新增 + // 3、批量删除 + int deleteNum; + do { + deleteNum = baseDao.deleteBatchByCustomerIdAndDateId(customerId, dateId, NumConstant.TWO_HUNDRED); + } while (deleteNum > NumConstant.ZERO); + + // 4、插入数据 + this.insertBatch(insertEntityList); + log.info("extractFactGridGovernDaily completed"); } + + /** + * 构造要插入的数据,每个网格一天一条数据,初始赋值0 + * + * @param customerId + * @param dateId + * @param gridInfoDTOList + * @return com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity + */ + private List constructFactGridGovernDailyEntityList(String customerId, String dateId, List gridInfoDTOList) { + List insertEntityList = new ArrayList<>(); + for (GridInfoDTO gridInfoDTO : gridInfoDTOList) { + FactGridGovernDailyEntity entity = new FactGridGovernDailyEntity(); + entity.setCustomerId(customerId); + entity.setDateId(dateId); + entity.setGridId(gridInfoDTO.getGridId()); + entity.setPid(gridInfoDTO.getPid()); + entity.setPids(gridInfoDTO.getPids()); + insertEntityList.add(entity); + } + return insertEntityList; + } + + /** + * 1、当前网格内,话题关闭已解决数 + * 2、当前网格内,话题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param topicStatus 话题状态(讨论中 - discussing、 已屏蔽 - hidden、 已关闭 - closed) + * @param closedStatus unresolved,resolved + * @param shiftIssue 是否转为议题,0:false,1:true; + * @return + */ + private Map getTopicMap(String customerId, List gridIds, String topicStatus, String closedStatus,String shiftIssue) { + Map resultMap = new HashMap<>(); + List list = factOriginTopicMainDailyService.queryGridTopicValue(customerId, gridIds, topicStatus, closedStatus,shiftIssue); + for (GovernGridTotalCommonDTO gridTotalCommonDTO : list) { + resultMap.put(gridTotalCommonDTO.getGridId(), gridTotalCommonDTO.getTotal()); + } + return resultMap; + } + + /** + * 3、当前网格内,议题关闭已解决数 + * 4、当前网格内,议题关闭无需解决数 + * 这两个值可以通过此方法获得 + * + * @param customerId + * @param gridIds + * @param issueStatus 议题状态 voting 已转项目:shift_project 已关闭:closed_resloved + * @param resolveType unresolved,resolved + * @return + */ + private Map getIssueMap(String customerId, List gridIds, String issueStatus, String resolveType) { + Map resultMap = new HashMap<>(); + List list = factOriginIssueMainDailyService.queryGridIssueValue(customerId, gridIds, issueStatus, resolveType); + for (GovernGridTotalCommonDTO gridTotalCommonDTO : list) { + resultMap.put(gridTotalCommonDTO.getGridId(), gridTotalCommonDTO.getTotal()); + } + return resultMap; + } + + + /** + * 5、当前网格内:来源于议题的项目:结案已解决数 + * + * @param customerId + * @param gridId + */ + private Integer calIssueProjectResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + /** + * 6、当前网格内:来源于议题的项目:结案无需解决数 + * + * @param customerId + * @param gridId + */ + private Integer calIssueProjectUnResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + + /** + * 7、当前网格内:项目立项,结案已解决数;默认为0, + * + * @param customerId + * @param gridId + */ + private Integer calApprovalProjectResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + + /** + * 8、当前网格内:项目立项,结案无需解决数;默认为0, + * + * @param customerId + * @param gridId + */ + private Integer calApprovalProjectUnResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + /** + * 9、当前网格内,未出小组即未转议题的:话题关闭已解决数 + * + * @param customerId + * @param gridId + */ + private Integer calInGroupTopicResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + /** + * 10、当前网格内,未出小组即未转议题的:话题关闭无需解决数 + * + * @param customerId + * @param gridId + */ + private Integer calInGroupTopicUnResolvedCount(String customerId, String gridId) { + // todo + return 0; + } + + /** + * 11、未出当前网格的,结案项目数 + * + * @param customerId + * @param gridId + */ + private Integer calGridSelfGovernProjectTotal(String customerId, String gridId) { + // todo + return 0; + } + } \ 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/FactOriginIssueMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java index 86e60734b7..09a040e630 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueMainDailyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -169,4 +170,20 @@ public class FactOriginIssueMainDailyServiceImpl extends BaseServiceImpl queryGridIssueValue(String customerId, List gridIds, String issueStatus, String resolveType) { + return baseDao.selectGroupByGridId(customerId,gridIds,issueStatus,resolveType); + } } \ 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/FactOriginTopicMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java index ac1e8af7a3..39eeffea2c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java @@ -37,6 +37,7 @@ import com.epmet.dto.org.GridInfoDTO; import com.epmet.dto.topic.TopicOriginInfoDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.org.CustomerGridService; import com.epmet.service.topic.TopicService; @@ -359,4 +360,21 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl queryGridTopicValue(String customerId, List gridIds, String topicStatus, String closedStatus, String shiftIssue) { + return baseDao.selectTopicGroupByGridId(customerId,gridIds,topicStatus,closedStatus,shiftIssue); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql index 7777abc992..37ccee43f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql @@ -47,7 +47,7 @@ -- `APPROVAL_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '8、当前组织内:项目立项,结案无需解决数;默认为0,', -- `IN_GROUP_TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '9、当前组织内,未出小组即未转议题的:话题关闭已解决数', -- `IN_GROUP_TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '10、当前组织内,未出小组即未转议题的:话题关闭无需解决数', --- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL DEFAULT 0 COMMENT '未出当前网格的,结案项目数', +-- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL DEFAULT 0 COMMENT '11、未出当前网格的,结案项目数', -- `COMMUNITY_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由社区结案的项目总数', -- `STREET_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由街道结案的项目总数', -- `DISTRICT_DEPT_CLOSED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '当前组织内结案的项目中:由区直部门结案的项目总数', @@ -84,7 +84,7 @@ -- `APPROVAL_PROJECT_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '8、当前网格内:项目立项,结案无需解决数;默认为0,', -- `IN_GROUP_TOPIC_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '9、当前网格内,未出小组即未转议题的:话题关闭已解决数', -- `IN_GROUP_TOPIC_UN_RESOLVED_COUNT` int(11) NOT NULL DEFAULT 0 COMMENT '10、当前网格内,未出小组即未转议题的:话题关闭无需解决数', --- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL COMMENT '未出当前网格的,结案项目数', +-- `GRID_SELF_GOVERN_PROJECT_TOTAL` int(11) NOT NULL COMMENT '11、未出当前网格的,结案项目数', -- `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', -- `REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁', -- `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml index 6fa56797fa..3a13103f14 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridGovernDailyDao.xml @@ -2,6 +2,15 @@ - + + + DELETE + FROM + fact_grid_govern_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + LIMIT #{limit} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index 259e46c150..e6c00c33af 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -311,4 +311,36 @@ AND DATE_ID <= #{dateId} GROUP BY GRID_ID + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml index c8136df35a..49b0c96151 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -197,4 +197,35 @@ AND DATE_ID <= #{dateId} GROUP BY GRID_ID + + \ No newline at end of file From ac551e3f4d0cce35134239834683964c4e6d17f1 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 25 May 2021 16:33:10 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=BE=A4=E4=BC=97=E4=B8=8D=E6=BB=A1?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/constant/ProjectConstant.java | 1 + .../impl/ProjectSatisfactionStatisticsServiceImpl.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 992871d265..eec6371298 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 @@ -181,6 +181,7 @@ public interface ProjectConstant { String THREE_MONTH = "threeMonth"; String SIX_MONTH = "sixMonth"; String TWELVE_MONTH = "twelveMonth"; + String YESTERDAY = "yesterday"; /** * 排序 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java index 5ced71018a..119f217c14 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionStatisticsServiceImpl.java @@ -215,8 +215,7 @@ public class ProjectSatisfactionStatisticsServiceImpl extends BaseServiceImpl Date: Tue, 25 May 2021 17:40:07 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E7=BD=91=E6=A0=BCv2,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/ProjectConstant.java | 10 +++ .../FactOriginProjectMainDailyDao.java | 20 +++++ .../FactOriginProjectMainDailyService.java | 15 ++++ .../impl/FactGridGovernDailyServiceImpl.java | 82 ++++++++----------- ...FactOriginProjectMainDailyServiceImpl.java | 19 +++++ .../extract/FactOriginProjectMainDailyDao.xml | 33 ++++++++ 6 files changed, 133 insertions(+), 46 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index e1b0dd8a11..b714ce2210 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -71,4 +71,14 @@ public interface ProjectConstant { String ISSUE = "issue"; + + /** + * 项目来源于议题 + */ + String PROJECT_ORIGIN_ISSUE="issue"; + + /** + * 项目来源于 工作端立项 + */ + String PROJECT_ORIGIN_AGENCY="agency"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index e07a58613f..0403e29bc2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -28,6 +28,7 @@ import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -445,4 +446,23 @@ public interface FactOriginProjectMainDailyDao extends BaseDao */ List selectPartyMemberClosedProjectStaticByGrid(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 5、当前网格内:来源于议题的项目:结案已解决数、 + * 6、当前网格内:来源于议题的项目:结案无需解决数、 + * 7、当前网格内:项目立项,结案已解决数;默认为0、 + * 8、当前网格内:项目立项,结案无需解决数;默认为0、 + * + * @param customerId + * @param gridIds + * @param projectStatus 状态:待处理 pending,结案closed + * @param origin 项目来源 来源:议题issue 组织agency + * @param isResolved unresolved,resolved + * @return com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO + */ + List selectGroupByGrid(@Param("customerId")String customerId, + @Param("gridIds")List gridIds, + @Param("projectStatus")String projectStatus, + @Param("origin")String origin, + @Param("isResolved")String isResolved); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 21994e4a98..215aa74756 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -29,6 +29,7 @@ import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import java.util.List; @@ -421,4 +422,18 @@ public interface FactOriginProjectMainDailyService extends BaseService getPartyMemberClosedProjectStatic(String customerId, String dateId, String type); + /** + * 5、当前网格内:来源于议题的项目:结案已解决数、 + * 6、当前网格内:来源于议题的项目:结案无需解决数、 + * 7、当前网格内:项目立项,结案已解决数;默认为0、 + * 8、当前网格内:项目立项,结案无需解决数;默认为0、 + * + * @param customerId + * @param gridIds + * @param projectStatus 状态:待处理 pending,结案closed + * @param origin 项目来源 来源:议题issue 组织agency + * @param isResolved unresolved,resolved + * @return + */ + List queryGridProjectValue(String customerId, List gridIds, String projectStatus, String origin, String isResolved); } 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 d3ebd1edc9..b0b0abc786 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 @@ -27,6 +27,7 @@ import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.org.CustomerGridService; import lombok.extern.slf4j.Slf4j; @@ -56,6 +57,8 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl topicResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED,NumConstant.ZERO_STR); Map topicUnResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED,NumConstant.ZERO_STR); - Map issueResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED); Map issueUnResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED); + Map issueProjectResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_ISSUE,DimObjectStatusConstant.RESOLVED); + Map issueProjectUnResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_ISSUE,DimObjectStatusConstant.UNRESOLVED); + Map approvalProjectResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_AGENCY,DimObjectStatusConstant.RESOLVED); + Map approvalProjectUnResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_AGENCY,DimObjectStatusConstant.UNRESOLVED); for(FactGridGovernDailyEntity insertEntity:insertEntityList){ //1、当前网格内,话题关闭已解决数 @@ -112,18 +118,24 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl getGridProjectMap(String customerId, List gridIds, String projectStatus, String origin, String isResolved) { + Map resultMap = new HashMap<>(); + List list = factOriginProjectMainDailyService.queryGridProjectValue(customerId, gridIds, projectStatus, origin, isResolved); + for (GovernGridTotalCommonDTO gridTotalCommonDTO : list) { + resultMap.put(gridTotalCommonDTO.getGridId(), gridTotalCommonDTO.getTotal()); + } + return resultMap; } - /** - * 7、当前网格内:项目立项,结案已解决数;默认为0, - * - * @param customerId - * @param gridId - */ - private Integer calApprovalProjectResolvedCount(String customerId, String gridId) { - // todo - return 0; - } - - /** - * 8、当前网格内:项目立项,结案无需解决数;默认为0, - * - * @param customerId - * @param gridId - */ - private Integer calApprovalProjectUnResolvedCount(String customerId, String gridId) { - // todo - return 0; - } /** * 9、当前网格内,未出小组即未转议题的:话题关闭已解决数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 12550e187f..58d625f999 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -39,6 +39,7 @@ import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; +import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; @@ -639,5 +640,23 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl queryGridProjectValue(String customerId, List gridIds, String projectStatus, String origin, String isResolved) { + return baseDao.selectGroupByGrid(customerId,gridIds,projectStatus,origin,isResolved); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index c6e024c502..c76cfb8128 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -914,4 +914,37 @@ ON a.AGENCY_ID = b.AGENCY_ID + + From ec6e94809e4c7e901e062b710f3caf4928b963ba Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 25 May 2021 18:29:43 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E7=BD=91=E6=A0=BCv2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactGridGovernDailyEntity.java | 31 ++++++++- .../impl/FactGridGovernDailyServiceImpl.java | 65 ++++++++++--------- .../db/migration/V0.0.15__govern.sql | 60 +++++++++-------- 3 files changed, 93 insertions(+), 63 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java index 0e7b1cb889..ae45d7aa7d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java @@ -129,11 +129,32 @@ public class FactGridGovernDailyEntity extends BaseEpmetEntity { */ private Integer inGroupTopicUnResolvedCount; - /** - * 11、未出当前网格的,结案项目数 - */ + /** + * 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; + public FactGridGovernDailyEntity() { this.customerId = StrConstant.EPMETY_STR; this.dateId = StrConstant.EPMETY_STR; @@ -153,6 +174,10 @@ public class FactGridGovernDailyEntity extends BaseEpmetEntity { this.approvalProjectUnResolvedCount=NumConstant.ZERO; this.inGroupTopicResolvedCount=NumConstant.ZERO; this.inGroupTopicUnResolvedCount=NumConstant.ZERO; + this.fromIssueResolvedInGridCount=NumConstant.ZERO; + this.fromIssueUnResolvedInGridCount=NumConstant.ZERO; + this.fromAgencyResolvedInGridCount=NumConstant.ZERO; + this.fromAgencyUnResolvedInGridCount=NumConstant.ZERO; this.gridSelfGovernProjectTotal=NumConstant.ZERO; } } 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 b0b0abc786..4f5483e7b4 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 @@ -92,14 +92,17 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl topicResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED,NumConstant.ZERO_STR); - Map topicUnResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED,NumConstant.ZERO_STR); + Map topicResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED,null); + Map topicUnResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED,null); Map issueResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED); Map issueUnResolvedMap=getIssueMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED); Map issueProjectResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_ISSUE,DimObjectStatusConstant.RESOLVED); Map issueProjectUnResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_ISSUE,DimObjectStatusConstant.UNRESOLVED); Map approvalProjectResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_AGENCY,DimObjectStatusConstant.RESOLVED); Map approvalProjectUnResolvedMap=getGridProjectMap(customerId,null,ProjectConstant.CLOSED,ProjectConstant.PROJECT_ORIGIN_AGENCY,DimObjectStatusConstant.UNRESOLVED); + Map inGroupTopicResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.RESOLVED,NumConstant.ONE_STR); + Map inGroupTopicUnResolvedMap=getTopicMap(customerId, null,ProjectConstant.CLOSED, DimObjectStatusConstant.UNRESOLVED,NumConstant.ONE_STR); + for(FactGridGovernDailyEntity insertEntity:insertEntityList){ //1、当前网格内,话题关闭已解决数 @@ -110,6 +113,8 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl Date: Wed, 26 May 2021 10:02:39 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=94=AF=E9=83=A8=E5=BB=BA=E8=AE=BE?= =?UTF-8?q?=E3=80=81=E8=81=94=E5=BB=BA=E5=85=B1=E5=BB=BA=E7=9B=B8=E5=85=B3?= =?UTF-8?q?DB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/V0.0.14__groupact_analysis.sql | 90 +++++++++---------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql index ee35df8d10..a450ab5eec 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.14__groupact_analysis.sql @@ -1,49 +1,47 @@ -- epmet_data_statistical 库执行以下脚本 --- CREATE TABLE `fact_group_act_daily` ( --- `ID` varchar(64) NOT NULL COMMENT '主键', --- `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', --- `DATE_ID` varchar(8) NOT NULL COMMENT '数据更新至日期Id:yyyyMMdd', --- `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', --- `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', --- `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', --- `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', --- `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', --- `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', --- `LEVEL` int(11) NOT NULL COMMENT '分类等级', --- `ORGANIZE_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 组织次数;包含dateId这一天的数据', --- `PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 参加人数;包含dateId这一天的数据', --- `AVG_PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 平均参加人数;包含dateId这一天的数据', --- `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', --- `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', --- `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', --- `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', --- `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', --- `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', --- PRIMARY KEY (`ID`) USING BTREE --- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='组织活动(参加人数、组织次数、平均参加人数)按天累计值分析'; +CREATE TABLE `fact_group_act_daily` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `DATE_ID` varchar(8) NOT NULL COMMENT '数据更新至日期Id:yyyyMMdd', + `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', + `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', + `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', + `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', + `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', + `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', + `LEVEL` int(11) NOT NULL COMMENT '分类等级', + `ORGANIZE_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 组织次数;包含dateId这一天的数据', + `PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 参加人数;包含dateId这一天的数据', + `AVG_PARTICIPATE_USER_TOTAL` int(11) NOT NULL COMMENT '截止到dateId: 平均参加人数;包含dateId这一天的数据', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='组织活动(参加人数、组织次数、平均参加人数)按天累计值分析'; - - --- CREATE TABLE `fact_group_act_monthly` ( --- `ID` varchar(64) NOT NULL COMMENT '主键', --- `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', --- `MONTH_ID` varchar(8) NOT NULL COMMENT '数据维度:yyyyMM', --- `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', --- `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', --- `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', --- `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', --- `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', --- `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', --- `LEVEL` int(11) NOT NULL COMMENT '分类等级', --- `ORGANIZE_INCR` int(11) NOT NULL COMMENT '本月内:活动组织次数', --- `PARTICIPATE_USER__INCR` int(11) NOT NULL COMMENT '本月内:活动签到人数参加人数', --- `AVG_PARTICIPATE_USER_INCR` int(11) NOT NULL COMMENT '本月内:平均参加人数', --- `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', --- `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', --- `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', --- `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', --- `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', --- `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', --- PRIMARY KEY (`ID`) USING BTREE --- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='专项组活动(参加人数、组织次数、平均参加人数)按月增量分析'; \ No newline at end of file +CREATE TABLE `fact_group_act_monthly` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `MONTH_ID` varchar(8) NOT NULL COMMENT '数据维度:yyyyMM', + `ORG_ID` varchar(64) NOT NULL COMMENT '网格id', + `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid;组织:agency', + `PID` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pid=网格所属组织id;\r\n2)orgType=agency: pid=当前组织的上级组织', + `PIDS` varchar(255) DEFAULT NULL COMMENT '1)orgType=grid: pids=网格所有上级组织,包括pid;\r\n2)orgType=agency: pids=当前组织的所有上级组织,包括pid.', + `CATEGORY_CODE` varchar(255) NOT NULL COMMENT '活动分类编码', + `PARENT_CODE` varchar(255) NOT NULL COMMENT '上级分类编码', + `LEVEL` int(11) NOT NULL COMMENT '分类等级', + `ORGANIZE_INCR` int(11) NOT NULL COMMENT '本月内:活动组织次数', + `PARTICIPATE_USER__INCR` int(11) NOT NULL COMMENT '本月内:活动签到人数参加人数', + `AVG_PARTICIPATE_USER_INCR` int(11) NOT NULL COMMENT '本月内:平均参加人数', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='专项组活动(参加人数、组织次数、平均参加人数)按月增量分析'; \ No newline at end of file From f3338fc61eb40c8e2fb2e0aec3ecf7f825fc764f Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 26 May 2021 10:06:53 +0800 Subject: [PATCH 8/9] =?UTF-8?q?sql=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.15__govern.sql | 32 +++++++++++++++++++ .../db/migration/V0.0.13__add_parameter.sql | 1 + 2 files changed, 33 insertions(+) create mode 100644 epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.13__add_parameter.sql diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql index 8d469eec21..836d3a3b7a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.15__govern.sql @@ -99,3 +99,35 @@ -- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='网格的治理指数,按天统计'; -- -- SET FOREIGN_KEY_CHECKS = 1; + +# 小组成员添加是否是党员 +ALTER TABLE `epmet_data_statistical`.`fact_origin_group_member_daily` + ADD COLUMN `IS_PARTY` tinyint(1) NULL DEFAULT 0 COMMENT '是否是党员' AFTER `ACTION_CODE`; + +# 项目主表添加结案项目是否满意 +ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily` + ADD COLUMN `IS_SATISFIED` tinyint(1) NULL COMMENT '是否满意 1:是' AFTER `IS_OVERDUE`; + +# 添加治理能力按日统计表 +CREATE TABLE `epmet_evaluation_index`.`screen_govern_rank_data_daily` ( + `ID` varchar(64) NOT NULL COMMENT 'ID 主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年Id', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月份Id', + `DATE_ID` varchar(8) NOT NULL COMMENT '数据更新至:yyyyMMdd', + `ORG_TYPE` varchar(32) NOT NULL DEFAULT 'agency' COMMENT '组织类别 agency:组织;部门:department;网格:grid', + `ORG_ID` varchar(64) NOT NULL COMMENT '组织Id 可以为网格,机关id', + `PARENT_ID` varchar(64) NOT NULL COMMENT '上级组织Id', + `ORG_NAME` varchar(32) NOT NULL COMMENT '组织名称', + `RESPONSE_RATIO` decimal(10,6) DEFAULT NULL COMMENT '响应率', + `RESOLVED_RATIO` decimal(10,6) DEFAULT NULL COMMENT '解决率', + `GOVERN_RATIO` decimal(10,6) DEFAULT NULL COMMENT '自治率', + `SATISFACTION_RATIO` decimal(10,6) DEFAULT NULL COMMENT '满意率', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='基层治理-治理能力排行数据(按日统计)'; \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.13__add_parameter.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.13__add_parameter.sql new file mode 100644 index 0000000000..4f8d970ed4 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.13__add_parameter.sql @@ -0,0 +1 @@ +INSERT INTO `customer_project_parameter`(`ID`, `CUSTOMER_ID`, `PARAMETER_KEY`, `PARAMETER_NAME`, `PARAMETER_VALUE`, `DESCRIPTION`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1007', 'default', 'satisfaction', '项目满意指标', '75', '评分小于当前分的为不满意', '0', 1, '1', '2020-10-26 10:57:41', '1', '2020-10-26 10:57:45'); From 6f0593bc58e4ff379ea0c368288ca02b7f0fb397 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 26 May 2021 10:16:05 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=E7=99=BB?= =?UTF-8?q?=E9=99=86=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ThirdLoginController.java | 12 +++++ .../dto/form/ThirdSendSmsCodeFormDTO.java | 27 +++++++++++ .../com/epmet/service/ThirdLoginService.java | 12 +++-- .../service/impl/ThirdLoginServiceImpl.java | 46 +++++++++++++++++++ 4 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/ThirdSendSmsCodeFormDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 00770d82bb..144e18d024 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -104,4 +104,16 @@ public class ThirdLoginController { return new Result().ok(""); } + /** + * @param formDTO + * @author sun + * @description 单客户-工作端微信小程序登录-发送验证码 + **/ + @PostMapping(value = "sendsmscode") + public Result sendSmsCode(@RequestBody ThirdSendSmsCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,ThirdSendSmsCodeFormDTO.AddUserShowGroup.class); + thirdLoginService.sendSmsCode(formDTO); + return new Result(); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdSendSmsCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdSendSmsCodeFormDTO.java new file mode 100644 index 0000000000..d2588a27bb --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdSendSmsCodeFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 单客户-工作端微信小程序登录-发送验证码 + * @Author sun + */ +@Data +public class ThirdSendSmsCodeFormDTO implements Serializable { + private static final long serialVersionUID = -1852541457359282018L; + /** + * 小程序appId + */ + @NotBlank(message = "appId不能为空", groups = {AddUserShowGroup.class}) + private String appId; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) + private String mobile; + public interface AddUserShowGroup extends CustomerClientShowGroup {} +} diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 3d9c60cc64..c79a67d41c 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -1,9 +1,6 @@ package com.epmet.service; -import com.epmet.dto.form.GetResiWxPhoneFormDTO; -import com.epmet.dto.form.LoginFormDTO; -import com.epmet.dto.form.ThirdStaffOrgsFormDTO; -import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -62,4 +59,11 @@ public interface ThirdLoginService { * @description 单客户-获取微信用户手机号 **/ String getResiWxPhone(GetResiWxPhoneFormDTO formDTO); + + /** + * @param formDTO + * @author sun + * @description 单客户-工作端微信小程序登录-发送验证码 + **/ + void sendSmsCode(ThirdSendSmsCodeFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index c9a6addb29..8dd958fe36 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -14,10 +14,13 @@ import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.validator.PhoneValidatorUtils; import com.epmet.constant.AuthHttpUrlConstant; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.jwt.JwtTokenProperties; @@ -56,6 +59,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** * @param formDTO @@ -589,4 +594,45 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { return phone; } + /** + * @param formDTO + * @author sun + * @description 单客户-工作端微信小程序登录-发送验证码 + **/ + @Override + public void sendSmsCode(ThirdSendSmsCodeFormDTO formDTO) { + String str = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; + //1.校验手机号是否符合规范 + if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) { + logger.warn(String.format(str, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); + throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); + } + //2.根据手机号校验用户是否存在 + //2-1.根据appId查询对应客户Id + PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId()); + //2-2.根据手机号查询到用户信息 + ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO(); + dto.setCustomerId(customer.getId()); + dto.setMobile(formDTO.getMobile()); + Result> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto); + if (!customerStaffResult.success()) { + logger.warn(String.format(str, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + throw new RenException(customerStaffResult.getCode()); + } + //3.发送短信验证码 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(formDTO.getMobile()); + sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM); + Result smsCodeResult = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); + if (!smsCodeResult.success()) { + logger.warn(String.format(str, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); + throw new RenException(smsCodeResult.getCode()); + } + //4.保存短信验证码(删除现有短信验证码 将新的短信验证码存入Redis) + SendSmsCodeFormDTO sendSmsCodeFormDTO = new SendSmsCodeFormDTO(); + sendSmsCodeFormDTO.setMobile(formDTO.getMobile()); + captchaRedis.saveSmsCode(sendSmsCodeFormDTO, smsCodeResult.getData().getCode()); + logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getMobile())); + } + }