From a668d5a7a25eed3a0d915f47b884f47bba04b718 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 18 Jun 2020 09:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=B0=8F=E7=BB=84=E6=97=A5?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constant/DataSourceConstant.java | 1 + .../com/epmet/constant/GroupConstant.java | 19 +++ .../group/form/GridGroupPeopleFormDTO.java | 30 ++++ .../form/GridGroupPeopleTotalFormDTO.java | 30 ++++ .../dto/group/form/GridGroupTotalFormDTO.java | 25 +++ .../dto/group/form/GroupIncrFormDTO.java | 30 ++++ .../result/CustomerGridInfoResultDTO.java | 30 ++++ .../dto/group/result/DimTimeResultDTO.java | 37 +++++ .../result/GridGroupPeopleResultDTO.java | 30 ++++ .../result/GridGroupPeopleTotalResultDTO.java | 25 +++ .../group/result/GridGroupTotalResultDTO.java | 25 +++ .../group/result/GroupGridDailyResultDTO.java | 125 ++++++++++++++ .../dto/group/result/GroupIncrResultDTO.java | 25 +++ .../dto/stats/FactGroupAgencyDailyDTO.java | 156 ++++++++++++++++++ .../dto/stats/FactGroupAgencyMonthlyDTO.java | 146 ++++++++++++++++ .../dto/stats/FactGroupGridDailyDTO.java | 156 ++++++++++++++++++ .../data-statistical-server/pom.xml | 20 ++- .../controller/StatsGroupController.java | 36 ++++ .../com/epmet/dao/group/GroupDataDao.java | 50 ++++++ .../java/com/epmet/dao/stats/DimDateDao.java | 4 + .../java/com/epmet/dao/stats/DimGridDao.java | 6 + .../dao/stats/FactGroupAgencyDailyDao.java | 33 ++++ .../dao/stats/FactGroupAgencyMonthlyDao.java | 33 ++++ .../dao/stats/FactGroupGridDailyDao.java | 44 +++++ .../stats/FactGroupAgencyDailyEntity.java | 126 ++++++++++++++ .../stats/FactGroupAgencyMonthlyEntity.java | 116 +++++++++++++ .../stats/FactGroupGridDailyEntity.java | 126 ++++++++++++++ .../com/epmet/service/StatsGroupService.java | 15 ++ .../epmet/service/group/GroupDataService.java | 22 +++ .../group/impl/GroupDataServiceImpl.java | 118 +++++++++++++ .../service/impl/StatsGroupServiceImpl.java | 60 +++++++ .../stats/FactGroupAgencyDailyService.java | 95 +++++++++++ .../stats/FactGroupAgencyMonthlyService.java | 95 +++++++++++ .../stats/FactGroupGridDailyService.java | 103 ++++++++++++ .../impl/FactGroupAgencyDailyServiceImpl.java | 100 +++++++++++ .../FactGroupAgencyMonthlyServiceImpl.java | 99 +++++++++++ .../impl/FactGroupGridDailyServiceImpl.java | 117 +++++++++++++ .../src/main/resources/bootstrap.yml | 7 +- .../resources/mapper/group/GroupDataDao.xml | 71 ++++++++ .../resources/mapper/stats/DimDateDao.xml | 18 ++ .../resources/mapper/stats/DimGridDao.xml | 12 ++ .../mapper/stats/FactGroupAgencyDailyDao.xml | 34 ++++ .../stats/FactGroupAgencyMonthlyDao.xml | 32 ++++ .../mapper/stats/FactGroupGridDailyDao.xml | 68 ++++++++ 44 files changed, 2545 insertions(+), 5 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleTotalFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupTotalFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupIncrFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/CustomerGridInfoResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/DimTimeResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleTotalResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupTotalResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupIncrResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyDailyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyMonthlyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupGridDailyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyMonthlyDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyDailyEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyMonthlyEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupGridDailyEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyMonthlyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyMonthlyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java index f79ab899cf..196aa19dcf 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java @@ -8,5 +8,6 @@ public interface DataSourceConstant { String GOV_PROJECT = "govProject"; String GOV_VOICE = "govVoice"; String OPER_CRM = "operCrm"; + String RESI_GROUP = "resiGroup"; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java new file mode 100644 index 0000000000..b5465e4a7b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:02 + */ +public interface GroupConstant { + + /** + * eg: 2020W10 = 2020年第10周 + */ + String W = "W"; + + /** + * eg: 2020Q01 = 2020年第一季度 + */ + String Q = "Q"; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleFormDTO.java new file mode 100644 index 0000000000..b3d731a8d3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:34 + */ +@Data +public class GridGroupPeopleFormDTO implements Serializable { + + private static final long serialVersionUID = -3634745091993094743L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小组状态 + */ + private String state = "approved"; + + /** + * 人员状态 + */ + private String status = "removed"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleTotalFormDTO.java new file mode 100644 index 0000000000..637f10be08 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupPeopleTotalFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:34 + */ +@Data +public class GridGroupPeopleTotalFormDTO implements Serializable { + + private static final long serialVersionUID = -6415141711878464704L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小组状态 + */ + private String state = "approved"; + + /** + * 人员状态 + */ + private String status = "removed"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupTotalFormDTO.java new file mode 100644 index 0000000000..3e97445cea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GridGroupTotalFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:34 + */ +@Data +public class GridGroupTotalFormDTO implements Serializable { + + private static final long serialVersionUID = 4605386326533905365L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小组状态 + */ + private String state = "approved"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupIncrFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupIncrFormDTO.java new file mode 100644 index 0000000000..6d6e981037 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupIncrFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/17 16:45 + */ +@Data +public class GroupIncrFormDTO implements Serializable { + + private static final long serialVersionUID = 4498126701378094617L; + + /** + * 小组状态 只算 state = “approved” + */ + private String state = "approved"; + + /** + * 客户ID + */ + private String customerId; + + /** + * 日期(昨日) + */ + private String yesterday; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/CustomerGridInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/CustomerGridInfoResultDTO.java new file mode 100644 index 0000000000..e81d03439f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/CustomerGridInfoResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 14:48 + */ +@Data +public class CustomerGridInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 6635092874863425910L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格所属机关ID + */ + private String agencyId; + + /** + * 客户ID + */ + private String customerId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/DimTimeResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/DimTimeResultDTO.java new file mode 100644 index 0000000000..fad5e3ed86 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/DimTimeResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.group.result; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/17 19:16 + */ +public class DimTimeResultDTO implements Serializable { + + private static final long serialVersionUID = -2863598069938303232L; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月Id + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleResultDTO.java new file mode 100644 index 0000000000..ce1667a123 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:31 + */ +@Data +public class GridGroupPeopleResultDTO implements Serializable { + + private static final long serialVersionUID = -7251423227553175946L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组ID + */ + private String groupId; + + /** + * 网格下-每个小组内成员的数量【人员状态 不为 removed】 + */ + private Integer groupCount; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleTotalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleTotalResultDTO.java new file mode 100644 index 0000000000..ae7bc8a19f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupPeopleTotalResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:31 + */ +@Data +public class GridGroupPeopleTotalResultDTO implements Serializable { + + private static final long serialVersionUID = -6131166787256682153L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格下的小组成员总数量 + */ + private Integer gridGroupPeopleTotal; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupTotalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupTotalResultDTO.java new file mode 100644 index 0000000000..055fd3f947 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GridGroupTotalResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 16:31 + */ +@Data +public class GridGroupTotalResultDTO implements Serializable { + + private static final long serialVersionUID = 1099735509481708988L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格下的小组数量 + */ + private Integer gridGroupTotal; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java new file mode 100644 index 0000000000..23a9312e63 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java @@ -0,0 +1,125 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/16 17:25 + */ +@Data +public class GroupGridDailyResultDTO implements Serializable { + + private static final long serialVersionUID = 3206418216410331158L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 网格数 当前网格下的网格数 + */ + private Integer gridTotal = 0; + + /** + * 小组数 + */ + private Integer groupTotal = 0; + + /** + * 网格下所有组内总人数 不去重 + */ + private Integer groupMemberTotal; + + /** + * 小组平均人数 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 + */ + private Integer groupMedian; + + /** + * 小组增量 + */ + private Integer groupIncr = 0; + + /** + * 小组成员最大数 + */ + private Integer groupMemberMaxCount; + + /** + * 最多成员小组ID + */ + private String maxMemberGroupId; + + /** + * 小组成员最小数 + */ + private Integer groupMemberMinCount = 1; + + /** + * 最少成员小组ID + */ + private String minMemberGroupId; + + /** + * 删除标识 未删除:0,已删除:1 + */ + private String delFlag = "0"; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupIncrResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupIncrResultDTO.java new file mode 100644 index 0000000000..df09ee4bf3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupIncrResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/17 16:48 + */ +@Data +public class GroupIncrResultDTO implements Serializable { + + private static final long serialVersionUID = 5536872354876581582L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组日增数 + */ + private Integer groupIncr = 0; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyDailyDTO.java new file mode 100644 index 0000000000..a33b74dac2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyDailyDTO.java @@ -0,0 +1,156 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 组-机关日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactGroupAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机构ID + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格总数 截至统计日期 + */ + private Integer gridTotal; + + /** + * 网格小组数(包含所有下级机关的网格小组) 截至统计日期 + */ + private Integer groupTotalCount; + + /** + * 机关下网格小组人数总计 不去重 + */ + private Integer groupMemberTotalCount; + + /** + * 小组平均人数 截至统计日期 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 + */ + private Integer groupMedian; + + /** + * 当天小组增量 + */ + private Integer groupIncr; + + /** + * 小组最大成员数 + */ + private String groupMemberMaxCount; + + /** + * 最多成员小组ID + */ + private String maxMemberGroupId; + + /** + * 小组最小成员数 + */ + private String groupMemberMinCount; + + /** + * 最少成员小组ID + */ + private String minMemberGroupId; + + /** + * 删除标识 未删除:0,已删除:1 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyMonthlyDTO.java new file mode 100644 index 0000000000..54b01164a4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupAgencyMonthlyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 组-机关月统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactGroupAgencyMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计月份ID 关联月份dim表 + */ + private String monthId; + + /** + * 统计季度ID + */ + private String quarterId; + + /** + * 统计年份ID + */ + private String yearId; + + /** + * 网格数 截至到月末的机关下网格数 + */ + private Integer gridTotal; + + /** + * 小组数 截止到月末的新增数(该月内所有的新增数字之和) + */ + private Integer groupTotal; + + /** + * 机关下网格组内总人数 不去重 + */ + private Integer groupMemberTotal; + + /** + * 小组平均人数 月末一天的平均数 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 月末一天的中位数(人) + */ + private Integer groupMedian; + + /** + * 小组增量 + */ + private Integer groupIncr; + + /** + * 小组成员最大数 + */ + private Integer groupMemberMaxCount; + + /** + * 成员最多小组ID + */ + private String maxMemberGroupId; + + /** + * 小组成员最小数 + */ + private Integer groupMemberMinCount; + + /** + * 成员最少小组ID + */ + private String minMemberGroupId; + + /** + * 删除标识 未删除:0,已删除:1 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupGridDailyDTO.java new file mode 100644 index 0000000000..48503b3623 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupGridDailyDTO.java @@ -0,0 +1,156 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 组-网格日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactGroupGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 网格数 当前网格下的网格数 + */ + private Integer gridTotal; + + /** + * 小组数 + */ + private Integer groupTotal; + + /** + * 网格下所有组内总人数 不去重 + */ + private Integer groupMemberTotal; + + /** + * 小组平均人数 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 + */ + private Integer groupMedian; + + /** + * 小组增量 + */ + private Integer groupIncr; + + /** + * 小组成员最大数 + */ + private Integer groupMemberMaxCount; + + /** + * 最多成员小组ID + */ + private String maxMemberGroupId; + + /** + * 小组成员最小数 + */ + private Integer groupMemberMinCount; + + /** + * 最少成员小组ID + */ + private String minMemberGroupId; + + /** + * 删除标识 未删除:0,已删除:1 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index dcd55b9ad9..0ff2d4d849 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -129,11 +129,17 @@ epmet_gov_voice_user EpmEt-db-UsEr - + - - epmet_oper_crm_user - EpmEt-db-UsEr + + epmet_oper_crm_user + EpmEt-db-UsEr + + + + + epmet_resi_group_user + EpmEt-db-UsEr 0 @@ -205,6 +211,12 @@ epmet elink@8473066 + + + + epmet_resi_group_user + EpmEt-db-UsEr + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java new file mode 100644 index 0000000000..7f2dd5ee76 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.service.StatsGroupService; +import com.epmet.service.group.GroupDataService; +import com.epmet.service.stats.FactGroupGridDailyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author zxc + * @CreateTime 2020/6/16 13:21 + */ +@RestController +@RequestMapping("statsgroup") +public class StatsGroupController { + + @Autowired + private StatsGroupService statsGroupService; + + /** + * @Description 统计 “小组” 有关数据, dim:【网格-日】 + * 网格数、小组数、网格下所有组内人数(不去重) + * 小组平均人数、小组人数中位数、小组增量 + * 小组成员最大数、最多成员小组ID + * 小组成员最小数、最少成员小组ID + * @author zxc + */ + @PostMapping("groupgriddaily") + public void groupGridDaily(){ + statsGroupService.groupGridDaily(); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java new file mode 100644 index 0000000000..bd93d50689 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java @@ -0,0 +1,50 @@ +package com.epmet.dao.group; + +import com.epmet.dto.group.form.GridGroupPeopleFormDTO; +import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; +import com.epmet.dto.group.form.GridGroupTotalFormDTO; +import com.epmet.dto.group.form.GroupIncrFormDTO; +import com.epmet.dto.group.result.GridGroupPeopleResultDTO; +import com.epmet.dto.group.result.GridGroupPeopleTotalResultDTO; +import com.epmet.dto.group.result.GridGroupTotalResultDTO; +import com.epmet.dto.group.result.GroupIncrResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author zxc + * @CreateTime 2020/6/16 13:22 + */ +@Mapper +public interface GroupDataDao { + + /** + * @Description 查询网格下的小组总数,状态为 “approved” + * @param formDTO + * @author zxc + */ + List selectGridGroupTotal(GridGroupTotalFormDTO formDTO); + + /** + * @Description 查询网格下的小组成员总数 , 人员状态不为 “removed” + * @param formDTO + * @author zxc + */ + List selectGridGroupPeopleTotal(GridGroupPeopleTotalFormDTO formDTO); + + /** + * @Description 查询每个小组的人数 + * @param formDTO + * @author zxc + */ + List selectEveryGroupPeopleCount(GridGroupPeopleFormDTO formDTO); + + /** + * @Description 查询网格下的小组日增数 + * @param formDTO + * @author zxc + */ + List selectGroupIncr(GroupIncrFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java index 3a1436cbcc..f9091f4be4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java @@ -18,9 +18,11 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.group.result.DimTimeResultDTO; import com.epmet.dto.stats.DimDateDTO; import com.epmet.entity.stats.DimDateEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -47,4 +49,6 @@ public interface DimDateDao extends BaseDao { DimDateDTO getLatestDimDate(); int insertOne(DimDateEntity dimDateEntity); + + DimTimeResultDTO selectDimTime(@Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java index a2d36e2481..4793b49558 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java @@ -19,12 +19,15 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.dto.group.result.CustomerGridInfoResultDTO; import com.epmet.entity.stats.DimGridEntity; import org.apache.ibatis.annotations.Mapper; import java.util.Date; import java.util.List; +import java.util.List; + /** * 客户网格维度 * @@ -36,4 +39,7 @@ public interface DimGridDao extends BaseDao { DimGridEntity getLastCreatedGridDimEntity(); + + List selectCustomerGrid(); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java new file mode 100644 index 0000000000..6a3f343a9a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactGroupAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组-机关日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactGroupAgencyDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyMonthlyDao.java new file mode 100644 index 0000000000..7928b13b0a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyMonthlyDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组-机关月统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactGroupAgencyMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java new file mode 100644 index 0000000000..8c1a636d3c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java @@ -0,0 +1,44 @@ +/** + * 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.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.group.result.GroupGridDailyResultDTO; +import com.epmet.entity.stats.FactGroupGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 组-网格日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactGroupGridDailyDao extends BaseDao { + + /** + * @Description 插入小组【网格-日】 + * @param formDto + * @author zxc + */ + void insertGroupGridDaily(@Param("formDto") List formDto); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyDailyEntity.java new file mode 100644 index 0000000000..e3ee31e7ec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyDailyEntity.java @@ -0,0 +1,126 @@ +/** + * 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.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 组-机关日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_group_agency_daily") +public class FactGroupAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机构ID + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格总数 截至统计日期 + */ + private Integer gridTotal; + + /** + * 网格小组数(包含所有下级机关的网格小组) 截至统计日期 + */ + private Integer groupTotalCount; + + /** + * 机关下网格小组人数总计 不去重 + */ + private Integer groupMemberTotalCount; + + /** + * 小组平均人数 截至统计日期 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 + */ + private Integer groupMedian; + + /** + * 当天小组增量 + */ + private Integer groupIncr; + + /** + * 小组最大成员数 + */ + private String groupMemberMaxCount; + + /** + * 最多成员小组ID + */ + private String maxMemberGroupId; + + /** + * 小组最小成员数 + */ + private String groupMemberMinCount; + + /** + * 最少成员小组ID + */ + private String minMemberGroupId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyMonthlyEntity.java new file mode 100644 index 0000000000..b7902589c7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupAgencyMonthlyEntity.java @@ -0,0 +1,116 @@ +/** + * 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.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 组-机关月统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_group_agency_monthly") +public class FactGroupAgencyMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计月份ID 关联月份dim表 + */ + private String monthId; + + /** + * 统计季度ID + */ + private String quarterId; + + /** + * 统计年份ID + */ + private String yearId; + + /** + * 网格数 截至到月末的机关下网格数 + */ + private Integer gridTotal; + + /** + * 小组数 截止到月末的新增数(该月内所有的新增数字之和) + */ + private Integer groupTotal; + + /** + * 机关下网格组内总人数 不去重 + */ + private Integer groupMemberTotal; + + /** + * 小组平均人数 月末一天的平均数 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 月末一天的中位数(人) + */ + private Integer groupMedian; + + /** + * 小组增量 + */ + private Integer groupIncr; + + /** + * 小组成员最大数 + */ + private Integer groupMemberMaxCount; + + /** + * 成员最多小组ID + */ + private String maxMemberGroupId; + + /** + * 小组成员最小数 + */ + private Integer groupMemberMinCount; + + /** + * 成员最少小组ID + */ + private String minMemberGroupId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupGridDailyEntity.java new file mode 100644 index 0000000000..3c23206bc8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupGridDailyEntity.java @@ -0,0 +1,126 @@ +/** + * 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.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 组-网格日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_group_grid_daily") +public class FactGroupGridDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 网格数 当前网格下的网格数 + */ + private Integer gridTotal; + + /** + * 小组数 + */ + private Integer groupTotal; + + /** + * 网格下所有组内总人数 不去重 + */ + private Integer groupMemberTotal; + + /** + * 小组平均人数 + */ + private Integer groupMemberAvgCount; + + /** + * 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 + */ + private Integer groupMedian; + + /** + * 小组增量 + */ + private Integer groupIncr; + + /** + * 小组成员最大数 + */ + private Integer groupMemberMaxCount; + + /** + * 最多成员小组ID + */ + private String maxMemberGroupId; + + /** + * 小组成员最小数 + */ + private Integer groupMemberMinCount; + + /** + * 最少成员小组ID + */ + private String minMemberGroupId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java new file mode 100644 index 0000000000..d792170796 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +/** + * @Author zxc + * @CreateTime 2020/6/16 14:14 + */ +public interface StatsGroupService { + + /** + * @Description 统计 “小组” 有关数据, dim:【网格-日】 + * @author zxc + */ + void groupGridDaily(); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java new file mode 100644 index 0000000000..2b921314cb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java @@ -0,0 +1,22 @@ +package com.epmet.service.group; + +import com.epmet.dto.group.result.CustomerGridInfoResultDTO; +import com.epmet.dto.group.result.GroupGridDailyResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @CreateTime 2020/6/16 13:22 + */ +public interface GroupDataService { + + /** + * @Description 统计 “小组” 有关数据, dim:【网格-日】 + * @param customerId + * @param gridsInfo + * @author zxc + */ + List groupGridDaily(String customerId, List gridsInfo); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java new file mode 100644 index 0000000000..c143d10a28 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java @@ -0,0 +1,118 @@ +package com.epmet.service.group.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.group.GroupDataDao; +import com.epmet.dao.stats.DimDateDao; +import com.epmet.dto.group.form.GridGroupPeopleFormDTO; +import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; +import com.epmet.dto.group.form.GridGroupTotalFormDTO; +import com.epmet.dto.group.form.GroupIncrFormDTO; +import com.epmet.dto.group.result.*; +import com.epmet.service.group.GroupDataService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Author zxc + * @CreateTime 2020/6/16 13:23 + */ +@Service +@DataSource(DataSourceConstant.RESI_GROUP) +public class GroupDataServiceImpl implements GroupDataService { + + @Autowired + private GroupDataDao groupDataDao; + @Autowired + private DimDateDao dimDateDao; + + /** + * @Description 统计 “小组” 有关数据, dim:【网格-日】 + * @param customerId + * @param gridsInfo + * @author zxc + */ + @Override + public List groupGridDaily(String customerId, List gridsInfo) { + String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); + DimTimeResultDTO dimTime = dimDateDao.selectDimTime(dateId); + List result = new ArrayList<>(); + + // 1. 网格下有多少小组,只算 state = ‘approved’ + GridGroupTotalFormDTO formDTO = new GridGroupTotalFormDTO(); + formDTO.setCustomerId(customerId); + List gridGroupTotalResultDTOS = groupDataDao.selectGridGroupTotal(formDTO); + gridsInfo.forEach(grid -> { + GroupGridDailyResultDTO dailyResult = new GroupGridDailyResultDTO(); + BeanUtils.copyProperties(dimTime,dailyResult); + dailyResult.setAgencyId(grid.getAgencyId()); + gridGroupTotalResultDTOS.forEach(groupTotal -> { + if (grid.getGridId().equals(groupTotal.getGridId())){ + dailyResult.setGroupTotal(groupTotal.getGridGroupTotal()); + dailyResult.setGridId(grid.getGridId()); + } + }); + result.add(dailyResult); + }); + // 2. 网格下所有组内人数和(不需要去重) 人员状态 != "removed" + GridGroupPeopleTotalFormDTO peopleTotalFormDTO = new GridGroupPeopleTotalFormDTO(); + peopleTotalFormDTO.setCustomerId(customerId); + List gridGroupPeopleTotalResultDTOS = groupDataDao.selectGridGroupPeopleTotal(peopleTotalFormDTO); + result.forEach(grid -> { + gridGroupPeopleTotalResultDTOS.forEach(groupPeopleTotal -> { + if (grid.getGridId().equals(groupPeopleTotal.getGridId())){ + grid.setGroupMemberTotal(groupPeopleTotal.getGridGroupPeopleTotal()); + } + }); + }); + // 3. 网格下小组平均人数 + result.forEach(grid -> { + grid.setGroupMemberAvgCount(grid.getGroupMemberTotal()/grid.getGroupTotal()); + }); + // 4. 网格下小组人数中位数 + GridGroupPeopleFormDTO everyGroupPeople = new GridGroupPeopleFormDTO(); + everyGroupPeople.setCustomerId(customerId); + List everyGroupPeopleCount = groupDataDao.selectEveryGroupPeopleCount(everyGroupPeople); + Map> collect = everyGroupPeopleCount.stream().collect(Collectors.groupingBy(every -> every.getGridId())); + Set>> entries = collect.entrySet(); + entries.forEach(everyGroup -> { + List value = everyGroup.getValue(); + List groupPeopleSorted = value.stream().sorted(Comparator.comparing(GridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList()); + Integer groupPeopleMedian = groupPeopleSorted.size() % 2 == 0 ? + (groupPeopleSorted.get(groupPeopleSorted.size() / 2 - 1).getGroupCount() + groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount()) / 2 : + groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount(); + result.forEach(grid -> { + if (groupPeopleSorted.get(0).getGridId().equals(grid.getGridId())){ + grid.setGroupMedian(groupPeopleMedian);//中位数 + //网格下小组成员最大数 + grid.setGroupMemberMaxCount(groupPeopleSorted.get(NumConstant.ZERO).getGroupCount()); + //最多成员小组ID + grid.setMaxMemberGroupId(groupPeopleSorted.get(NumConstant.ZERO).getGroupId()); + //网格下小组成员最小数 + grid.setGroupMemberMinCount(groupPeopleSorted.get(groupPeopleSorted.size()-NumConstant.ONE).getGroupCount()); + //最少成员小组ID + grid.setMinMemberGroupId(groupPeopleSorted.get(groupPeopleSorted.size()-NumConstant.ONE).getGroupId()); + } + }); + }); + //TODO 网格下小组增量 + GroupIncrFormDTO groupIncr = new GroupIncrFormDTO(); + groupIncr.setCustomerId(customerId); + groupIncr.setYesterday(dateId); + List groupIncrResult = groupDataDao.selectGroupIncr(groupIncr); + result.forEach(grid -> { + groupIncrResult.forEach(gridIncr -> { + if (grid.getGridId().equals(gridIncr.getGridId())){ + grid.setGroupIncr(gridIncr.getGroupIncr()); + } + }); + }); + return result; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java new file mode 100644 index 0000000000..f647c7439a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -0,0 +1,60 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dao.stats.DimGridDao; +import com.epmet.dao.stats.FactGroupGridDailyDao; +import com.epmet.dto.group.result.CustomerGridInfoResultDTO; +import com.epmet.dto.group.result.GroupGridDailyResultDTO; +import com.epmet.service.StatsGroupService; +import com.epmet.service.group.GroupDataService; +import com.epmet.service.stats.FactGroupGridDailyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @Author zxc + * @CreateTime 2020/6/16 14:14 + */ +@Service +public class StatsGroupServiceImpl implements StatsGroupService { + + @Autowired + private DimGridDao dimGridDao; + @Autowired + private GroupDataService groupDataService; + @Autowired + private FactGroupGridDailyService factGroupGridDailyService; + + /** + * @Description 统计【网格-日】 + * @param + * @author zxc + */ + @Override + public void groupGridDaily() { + + //每个客户下的网格信息 + List customerGridInfos = dimGridDao.selectCustomerGrid(); + if (customerGridInfos.size() == NumConstant.ZERO){ + return; + } + //根据customerId分组 + Map> collect = customerGridInfos.stream().collect(Collectors.groupingBy(gridInfo -> gridInfo.getCustomerId())); + Set>> entries = collect.entrySet(); + entries.forEach(customerGridInfo -> { + String customerId = customerGridInfo.getKey(); + List gridsInfo = customerGridInfo.getValue(); + if (gridsInfo.size() != NumConstant.ZERO){ + List resultDTOS = groupDataService.groupGridDaily(customerId, gridsInfo); + //执行插入 fact_group_grid_daily + factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS); + } + }); + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java new file mode 100644 index 0000000000..3801b7b9b2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java @@ -0,0 +1,95 @@ +/** + * 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.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.FactGroupAgencyDailyDTO; +import com.epmet.entity.stats.FactGroupAgencyDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 组-机关日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactGroupAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactGroupAgencyDailyDTO + * @author generator + * @date 2020-06-16 + */ + FactGroupAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void save(FactGroupAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void update(FactGroupAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-16 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyMonthlyService.java new file mode 100644 index 0000000000..7e851aa6da --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyMonthlyService.java @@ -0,0 +1,95 @@ +/** + * 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.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.FactGroupAgencyMonthlyDTO; +import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 组-机关月统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactGroupAgencyMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactGroupAgencyMonthlyDTO + * @author generator + * @date 2020-06-16 + */ + FactGroupAgencyMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void save(FactGroupAgencyMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void update(FactGroupAgencyMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-16 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java new file mode 100644 index 0000000000..b8e1ad06ab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java @@ -0,0 +1,103 @@ +/** + * 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.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.group.result.GroupGridDailyResultDTO; +import com.epmet.dto.stats.FactGroupGridDailyDTO; +import com.epmet.entity.stats.FactGroupGridDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 组-网格日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactGroupGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactGroupGridDailyDTO + * @author generator + * @date 2020-06-16 + */ + FactGroupGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void save(FactGroupGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void update(FactGroupGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-16 + */ + void delete(String[] ids); + + /** + * @Description 统计小组【网格-日】 + * @param formDto + * @author zxc + */ + void statisticsGroupGridDaily(List formDto); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..7f2822e763 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java @@ -0,0 +1,100 @@ +/** + * 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.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.stats.FactGroupAgencyDailyDao; +import com.epmet.dto.stats.FactGroupAgencyDailyDTO; +import com.epmet.entity.stats.FactGroupAgencyDailyEntity; +import com.epmet.service.stats.FactGroupAgencyDailyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 组-机关日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactGroupAgencyDailyServiceImpl extends BaseServiceImpl implements FactGroupAgencyDailyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactGroupAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactGroupAgencyDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactGroupAgencyDailyDTO get(String id) { + FactGroupAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactGroupAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactGroupAgencyDailyDTO dto) { + FactGroupAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactGroupAgencyDailyDTO dto) { + FactGroupAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyMonthlyServiceImpl.java new file mode 100644 index 0000000000..bf8da031c4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyMonthlyServiceImpl.java @@ -0,0 +1,99 @@ +/** + * 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.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.stats.FactGroupAgencyMonthlyDao; +import com.epmet.dto.stats.FactGroupAgencyMonthlyDTO; +import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; +import com.epmet.service.stats.FactGroupAgencyMonthlyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 组-机关月统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactGroupAgencyMonthlyServiceImpl extends BaseServiceImpl implements FactGroupAgencyMonthlyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactGroupAgencyMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactGroupAgencyMonthlyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactGroupAgencyMonthlyDTO get(String id) { + FactGroupAgencyMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactGroupAgencyMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactGroupAgencyMonthlyDTO dto) { + FactGroupAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactGroupAgencyMonthlyDTO dto) { + FactGroupAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyMonthlyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java new file mode 100644 index 0000000000..68ddd26178 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java @@ -0,0 +1,117 @@ +/** + * 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.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.group.result.GroupGridDailyResultDTO; +import com.epmet.dto.stats.FactGroupGridDailyDTO; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.stats.FactGroupGridDailyDao; +import com.epmet.entity.stats.FactGroupGridDailyEntity; +import com.epmet.service.StatsGroupService; +import com.epmet.service.group.GroupDataService; +import com.epmet.service.stats.FactGroupGridDailyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 组-网格日统计数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactGroupGridDailyServiceImpl extends BaseServiceImpl implements FactGroupGridDailyService { + + @Autowired + private StatsGroupService statsGroupService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactGroupGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactGroupGridDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactGroupGridDailyDTO get(String id) { + FactGroupGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactGroupGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactGroupGridDailyDTO dto) { + FactGroupGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactGroupGridDailyDTO dto) { + FactGroupGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupGridDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 统计小组【网格-日】 + * @param + * @author zxc + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void statisticsGroupGridDaily(List formDto) { + baseDao.insertGroupGridDaily(formDto); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index 5bfa6c0bb7..3bed21f9fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -145,7 +145,12 @@ dynamic: url: @datasource.druid.crm.url@ username: @datasource.druid.crm.username@ password: @datasource.druid.crm.password@ - + resiGroup: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.group.url@ + username: @datasource.druid.group.username@ + password: @datasource.druid.group.password@ + thread: # 线程池配置 threadPool: diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml new file mode 100644 index 0000000000..e0f4ee8be0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml index c0d460ae90..94eb88062b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml @@ -31,4 +31,22 @@ VALUES (#{id}, #{dateName}, #{dayOfWeek}, #{dayOfWeekName}, #{weekId}, #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}) + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index 67d130dfde..d71a9799a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -11,5 +11,17 @@ LIMIT 1 + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml new file mode 100644 index 0000000000..2e526090dc --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml new file mode 100644 index 0000000000..956e399ed0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml new file mode 100644 index 0000000000..03b90c7c14 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO fact_group_grid_daily (ID, AGENCY_ID, GRID_ID, DATE_ID, WEEK_ID, MONTH_ID, YEAR_ID, QUARTER_ID, GRID_TOTAL, + GROUP_TOTAL, GROUP_MEMBER_TOTAL, GROUP_MEMBER_AVG_COUNT, GROUP_MEDIAN, GROUP_INCR, GROUP_MEMBER_MAX_COUNT, MAX_MEMBER_GROUP_ID, + GROUP_MEMBER_MIN_COUNT, MIN_MEMBER_GROUP_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + VALUES + + ( + REPLACE(UUID(),'-',''), + #{grid.agencyId}, + #{grid.gridId}, + #{grid.dateId}, + #{grid.weekId}, + #{grid.monthId}, + #{grid.yearId}, + #{grid.quarterId}, + #{grid.gridTotal}, + #{grid.groupTotal}, + #{grid.groupMemberTotal}, + #{grid.groupMemberAvgCount}, + #{grid.groupMedian}, + #{grid.groupIncr}, + #{grid.groupMemberMaxCount}, + #{grid.maxMemberGroupId}, + #{grid.groupMemberMinCount}, + #{grid.minMemberGroupId}, + #{grid.delFlag}, + #{grid.revision}, + #{grid.createdBy}, + NOW(), + #{grid.updatedBy}, + NOW() + ) + + + + \ No newline at end of file