diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java new file mode 100644 index 0000000000..338b35e1a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java @@ -0,0 +1,29 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 17:23 + */ +public interface IssueConstant { + /** + *表决中 + */ + String VOTING = "voting"; + /** + *已转项目 + */ + String SHIFT_PROJECT = "shift_project"; + /** + *已关闭 + */ + String CLOSED = "closed"; + /** + *已解决 + */ + String RESLOVED = "resloved"; + /** + *未解决 + */ + String UNRESLOVED = "unresloved"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueAgencyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueAgencyDTO.java new file mode 100644 index 0000000000..065f10279f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueAgencyDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.issue; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 14:06 + */ +@Data +public class IssueAgencyDTO implements Serializable { + private static final long serialVersionUID = 8258586413692513595L; + /** + * 组织ID + */ + private String agencyId; + /** + * 上级ID + */ + private String pId; + /** + * 所有上级ID + */ + private String pIds; + /** + * 状态 + */ + private String status; + /** + * 数量 + */ + private Integer count; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectAgencyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectAgencyDTO.java new file mode 100644 index 0000000000..add4fd14ff --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectAgencyDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.project; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/18 16:48 + */ +@Data +public class ProjectAgencyDTO implements Serializable { + private static final long serialVersionUID = 4581232825130630169L; + /** + * 组织ID + */ + private String agencyId; + /** + * 所有上级ID + */ + private String pIds; + /** + * 状态 + */ + private String status; + /** + * 数量 + */ + private Integer count; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java new file mode 100644 index 0000000000..4b47eb0237 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.project.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author sun + * 查询项目机关过去一个月的日统计数据 + */ +@Data +public class MonthProjectListFormDTO implements Serializable { + + private static final long serialVersionUID = -3634745091993094743L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 机关Id + */ + private String agencyId; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/.gitkeep b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java index bcd0beaed9..301099d52b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java @@ -23,10 +23,20 @@ public class ArticleGridPublishedSummaryDTO implements Serializable { * 客户id */ private String customerId; + + /** + * 机关id + */ + private String agencyId; /** * 网格Id */ private String gridId; + /** + * 发布者Id publish_type类型为 部门时 是部门id;类型为 机关时 是机关Id + */ + private String publisherId; + /** * 发布文章总数 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueAgencyDailyDTO.java new file mode 100644 index 0000000000..b32a9d9b87 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueAgencyDailyDTO.java @@ -0,0 +1,237 @@ +/** + * 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; + +import java.math.BigDecimal; + +/** + * 议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +public class FactIssueAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 更新时间 + */ + 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/FactIssueAgencyMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueAgencyMonthlyDTO.java new file mode 100644 index 0000000000..ea2b5cd11f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueAgencyMonthlyDTO.java @@ -0,0 +1,227 @@ +/** + * 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; + +import java.math.BigDecimal; + +/** + * 组织机关议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +public class FactIssueAgencyMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 当月议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当月已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当月表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当月已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当月已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当月已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当月已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当月已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当月已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 更新时间 + */ + 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/FactIssueGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueGridDailyDTO.java new file mode 100644 index 0000000000..c63ab13574 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueGridDailyDTO.java @@ -0,0 +1,237 @@ +/** + * 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; + +import java.math.BigDecimal; + +/** + * 网格议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +public class FactIssueGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 更新时间 + */ + 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/FactIssueGridMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueGridMonthlyDTO.java new file mode 100644 index 0000000000..d79586998b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactIssueGridMonthlyDTO.java @@ -0,0 +1,227 @@ +/** + * 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; + +import java.math.BigDecimal; + +/** + * 网格议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +public class FactIssueGridMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 当月议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当月已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当月表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当月已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当月已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当月已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当月已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当月已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当月已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file 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 3d55c8436c..0df16681dc 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 @@ -30,5 +30,17 @@ public interface ProjectConstant { * 项目处理进展-结案 */ String CLOSE = "close"; + /** + * 发布单位类型 机关:agency + */ + String PUBLISH_TYPE_AGENCY = "agency"; + /** + * 发布单位类型 部门:department + */ + String PUBLISH_TYPE_DEPT = "department"; + /** + * 发布单位类型 网格:grid + */ + String PUBLISH_TYPE_GRID = "grid"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index 6b44fc5c5e..1b64aa85e8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -1,14 +1,55 @@ package com.epmet.dao.issue; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.entity.issue.IssueEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface StatsIssueDao extends BaseDao { - List listAllEntities(); + + /** + * 获取当前日期组织下议题统计结果 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/17 14:13 + */ + List selectAgencyIssueTotal(@Param("customerId") String customerId); + + /** + * 获取当前日期组织下议题增量 + * @author zhaoqifeng + * @date 2020/6/18 9:55 + * @param customerId + * @param date + * @return java.util.List + */ + List selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 已关闭议题统计 + * @author zhaoqifeng + * @date 2020/6/18 14:41 + * @param customerId + * @param date + * @return java.util.List + */ + List selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 已关闭议题增量 + * @author zhaoqifeng + * @date 2020/6/18 14:41 + * @param customerId + * @param date + * @return java.util.List + */ + List selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 5ffba5ec49..32a67d173e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -34,9 +35,29 @@ import java.util.List; public interface ProjectDao extends BaseDao { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 根据客户Id查询客户项目业务表有效数据 **/ - List selectProjectList(@Param("customerId") String customerId); + List selectProjectList(ProjectEntity projectEntity); + + /** + * 已结案项目统计 + * @author zhaoqifeng + * @date 2020/6/18 17:01 + * @param customerId + * @param date + * @return java.util.List + */ + List selectAgencyClosedProjectTotal(@Param("customerId") String customerId, @Param("date") String date); + + /** + * 已结案项目增量 + * @author zhaoqifeng + * @date 2020/6/18 17:01 + * @param customerId + * @param date + * @return java.util.List + */ + List selectAgencyClosedProjectInc(@Param("customerId") String customerId, @Param("date") String date); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java index 33e3840ea5..ad0c1ca057 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -34,10 +35,10 @@ import java.util.List; public interface ProjectProcessDao extends BaseDao { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 查询客户项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) **/ - List selectProcessList(@Param("customerId") String customerId); + List selectProcessList(ProjectEntity projectEntity); } \ No newline at end of file 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 f9091f4be4..1075290163 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 @@ -35,14 +35,6 @@ import java.util.List; @Mapper public interface DimDateDao extends BaseDao { - /** - * @param dto - * @return - * @Author sun - * @Description 根据创建时间查询日维度信息 - **/ - List selectDimDate(DimDateDTO dto); - /** * 最新的按日维度 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java index 42ec2905b8..c7848dffcb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java @@ -20,6 +20,9 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.stats.DimDepartmentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 客户部门维度 @@ -30,4 +33,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DimDepartmentDao extends BaseDao { int insertOne(DimDepartmentEntity dim); + + /** + * desc:根据客户Id获取所有的部门信息 + * @param customerId + * @return + */ + List getDepartmentListByCustomerId(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java index 6e961d85c9..2fbabdec6c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java @@ -18,9 +18,12 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -29,5 +32,18 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactAgencyProjectDailyDao extends BaseDao { - + + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + List selectMonthProjectList(MonthProjectListFormDTO formDTO); + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delDateProject(FactAgencyProjectDailyEntity delEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java index 6cd1e39250..e6fb0c37b7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java @@ -29,5 +29,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactAgencyProjectMonthlyDao extends BaseDao { - + + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + void delMonthProject(FactAgencyProjectMonthlyEntity delEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java index eb09ed6ce3..1cff4fa1a8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 文章发布数量【部门】日统计表 @@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactArticlePublishedDepartmentDailyDao extends BaseDao { - + + /** + * desc:根据客户id,日期 删除数据 + * @param customerId + * @param dateId + * @return + */ + int deleteByDateId(@Param("customerId") String customerId, @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/FactIssueAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyDailyDao.java new file mode 100644 index 0000000000..be302f14a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyDailyDao.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.FactIssueAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface FactIssueAgencyDailyDao 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/FactIssueAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java new file mode 100644 index 0000000000..0621b2526e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.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.FactIssueAgencyMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组织机关议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface FactIssueAgencyMonthlyDao 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/FactIssueGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridDailyDao.java new file mode 100644 index 0000000000..7249383370 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridDailyDao.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.FactIssueGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface FactIssueGridDailyDao 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/FactIssueGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridMonthlyDao.java new file mode 100644 index 0000000000..6c11e47904 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridMonthlyDao.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.FactIssueGridMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface FactIssueGridMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java index 4609722502..6622ffe700 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java @@ -18,8 +18,13 @@ package com.epmet.dao.voice; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; import com.epmet.entity.voice.ArticleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; /** * 文章表 @@ -29,5 +34,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ArticleDao extends BaseDao { - + + /** + * desc:根据客户Id 和发布时间 获取文章总数 + * + * @param customerId + * @param publishDate + * @param publishType + * @return + */ + List getAllPublishedCount(@Param("customerId") String customerId, @Param("publishDate") Date publishDate, @Param("publishType") String publishType); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java index c91d318a87..96e8ae407f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactArticlePublishedDepartmentDailyEntity.java @@ -48,7 +48,7 @@ public class FactArticlePublishedDepartmentDailyEntity extends BaseEpmetEntity { /** * 部门ID */ - private String depsartmentId; + private String departmentId; /** * 文章累计发文数量 文章数量 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyDailyEntity.java new file mode 100644 index 0000000000..377757ab2a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyDailyEntity.java @@ -0,0 +1,207 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_issue_agency_daily") +public class FactIssueAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyMonthlyEntity.java new file mode 100644 index 0000000000..a06e51b59d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueAgencyMonthlyEntity.java @@ -0,0 +1,197 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 组织机关议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_issue_agency_monthly") +public class FactIssueAgencyMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 当月议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当月已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当月表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当月已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当月已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当月已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当月已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当月已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当月已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridDailyEntity.java new file mode 100644 index 0000000000..50d7d2ddaf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridDailyEntity.java @@ -0,0 +1,207 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 网格议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_issue_grid_daily") +public class FactIssueGridDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridMonthlyEntity.java new file mode 100644 index 0000000000..713d48f3f8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIssueGridMonthlyEntity.java @@ -0,0 +1,197 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 网格议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_issue_grid_monthly") +public class FactIssueGridMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 当月议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当月已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当月表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当月已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当月已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当月已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当月已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当月已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当月已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java new file mode 100644 index 0000000000..c5503ddefa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -0,0 +1,51 @@ +package com.epmet.service.Issue; + +import com.epmet.dto.issue.IssueAgencyDTO; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 16:01 + */ +public interface IssueService { + /** + * 获取以组织为单位议题统计结果 + * @author zhaoqifeng + * @date 2020/6/17 16:04 + * @param customerId + * @return java.util.List + */ + List getAgencyIssueTotal(String customerId); + + /** + * 获取当前日期组织下议题增量 + * @author zhaoqifeng + * @date 2020/6/18 9:56 + * @param customerId + * @param date + * @return java.util.List + */ + List getAgencyIssueInc(String customerId, String date); + + /** + * 获取截止当前日期组织下已关闭议题统计 + * @author zhaoqifeng + * @date 2020/6/18 9:56 + * @param customerId + * @param date + * @return java.util.List + */ + List getAgencyClosedIssueTotal(String customerId, String date); + + /** + * 获取当前日期组织下已关闭议题增量 + * @author zhaoqifeng + * @date 2020/6/18 9:56 + * @param customerId + * @param date + * @return java.util.List + */ + List getAgencyClosedIssueInc(String customerId, String date); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java new file mode 100644 index 0000000000..8b19129687 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -0,0 +1,61 @@ +package com.epmet.service.Issue.impl; + +import com.epmet.dao.issue.StatsIssueDao; +import com.epmet.dto.issue.IssueAgencyDTO; +import com.epmet.service.Issue.IssueService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 16:02 + */ +@Service +public class IssueServiceImpl implements IssueService { + + @Autowired + private StatsIssueDao statsIssueDao; + + @Override + public List getAgencyIssueTotal(String customerId) { + List list = statsIssueDao.selectAgencyIssueTotal(customerId); + list.forEach(dto -> { + String[] pIds = dto.getPIds().split(":"); + dto.setPId(pIds[pIds.length - 2]); + }); + return list; + } + + @Override + public List getAgencyIssueInc(String customerId, String date) { + List list = statsIssueDao.selectAgencyIssueInc(customerId, date); + list.forEach(dto -> { + String[] pIds = dto.getPIds().split(":"); + dto.setPId(pIds[pIds.length - 2]); + }); + return list; + } + + @Override + public List getAgencyClosedIssueTotal(String customerId, String date) { + List list = statsIssueDao.selectAgencyClosedIssueTotal(customerId, date); + list.forEach(dto -> { + String[] pIds = dto.getPIds().split(":"); + dto.setPId(pIds[pIds.length - 2]); + }); + return list; + } + + @Override + public List getAgencyClosedIssueInc(String customerId, String date) { + List list = statsIssueDao.selectAgencyClosedIssueInc(customerId, date); + list.forEach(dto -> { + String[] pIds = dto.getPIds().split(":"); + dto.setPId(pIds[pIds.length - 2]); + }); + return list; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java new file mode 100644 index 0000000000..89bd89f22e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java @@ -0,0 +1,20 @@ +package com.epmet.service; + +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 16:51 + */ +public interface StatsIssueService { + /** + * 机关下议题统计 + * @author zhaoqifeng + * @date 2020/6/17 16:53 + * @param customerId + * @param date + * @return void + */ + void saveIssueAgencyDaily(String customerId, Date date); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java new file mode 100644 index 0000000000..080e79dc7f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java @@ -0,0 +1,422 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.IssueConstant; +import com.epmet.dto.issue.IssueAgencyDTO; +import com.epmet.dto.project.ProjectAgencyDTO; +import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.entity.stats.FactIssueAgencyDailyEntity; +import com.epmet.entity.stats.FactIssueAgencyMonthlyEntity; +import com.epmet.service.Issue.IssueService; +import com.epmet.service.StatsIssueService; +import com.epmet.service.project.ProjectService; +import com.epmet.service.stats.DimAgencyService; +import com.epmet.service.stats.FactIssueAgencyDailyService; +import com.epmet.util.DimIdGenerator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/17 16:51 + */ +@Service +public class StatsIssueServiceImpl implements StatsIssueService { + @Autowired + private IssueService issueService; + @Autowired + private DimAgencyService dimAgencyService; + @Autowired + private ProjectService projectService; + @Autowired + private FactIssueAgencyDailyService factIssueAgencyDailyService; + + @Override + public void saveIssueAgencyDaily(String customerId, Date date) { + String dateString = DateUtils.format(date); + DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); + dimAgencyDTO.setCustomerId(customerId); + //获取当前客户下所有机关 + List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); + //获取机关下议题各种状态的数目统计 + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); + //获取机关下议题各种状态的数目增量 + List issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); + //获取机关下已关闭议题统计 + List issueAgencyClosedTotalList = issueService.getAgencyIssueInc(customerId, dateString); + //获取机关下已关闭议题增量 + List issueAgencyClosedIncList = issueService.getAgencyIssueInc(customerId, dateString); + //已结案项目统计 + List projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); + //已结案项目增量 + List projectAgencyClosedIncList = projectService.getAgencyClosedProjectInc(customerId, dateString); + //获取日期相关维度 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + + List list = new ArrayList<>(); + for (DimAgencyDTO agency : agencyList) { + FactIssueAgencyDailyEntity entity = initIssueAgencyDaily(dimId); + entity.setCustomerId(agency.getCustomerId()); + entity.setAgencyId(agency.getId()); + entity.setPid(agency.getPid()); + + String pIds; + if (null == agency.getPids() || agency.getPids().isEmpty()) { + pIds = agency.getPid().concat(":").concat(agency.getId()); + } else { + pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); + } + //总量统计 + saveTotal(issueAgencyTotalList, agency, entity, pIds); + //增量统计 + saveInc(issueAgencyIncList, agency, entity, pIds); + //已关闭议题已解决未解决统计 + if (entity.getClosedTotal() > NumConstant.ZERO) { + saveClosedTotal(issueAgencyClosedTotalList, agency, entity, pIds); + //已关闭议题已解决未解决增量统计 + if (entity.getClosedIncr() > NumConstant.ZERO) { + saveClosedInc(issueAgencyClosedIncList, agency, entity, pIds); + } + } + //已关闭项目已解决未解决统计 + if (entity.getShiftProjectTotal() > NumConstant.ZERO) { + saveClosedProjectTotal(projectAgencyClosedTotalList, agency, entity, pIds); + //已关闭项目已解决未解决增量统计 + if (entity.getClosedCaseTotal() > NumConstant.ZERO) { + saveClosedProjectInc(projectAgencyClosedIncList, agency, entity, pIds); + } + } + list.add(entity); + + factIssueAgencyDailyService.insertBatch(list); + } + } + + /** + * 已关闭项目已解决未解决增量统计 + * @author zhaoqifeng + * @date 2020/6/18 17:23 + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + */ + private void saveClosedProjectInc(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //已解决数 + int resolvedCount = NumConstant.ZERO; + //未解决数 + int unresolvedCount = NumConstant.ZERO; + + for (ProjectAgencyDTO project : list) { + if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { + if (IssueConstant.RESLOVED.equals(project.getStatus())) { + //已解决数量 + resolvedCount = resolvedCount + project.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { + //未解决数量 + unresolvedCount = unresolvedCount + project.getCount(); + } + } + } + int total = resolvedCount + unresolvedCount; + entity.setClosedCaseResolvedIncr(resolvedCount); + entity.setClosedCaseUnresolvedIncr(unresolvedCount); + entity.setClosedCaseIncr(total); + } + + /** + * 已关闭项目已解决未解决统计 + * @author zhaoqifeng + * @date 2020/6/18 17:23 + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + */ + private void saveClosedProjectTotal(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //已解决数 + int resolvedCount = NumConstant.ZERO; + //未解决数 + int unresolvedCount = NumConstant.ZERO; + + for (ProjectAgencyDTO project : list) { + if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { + if (IssueConstant.RESLOVED.equals(project.getStatus())) { + //已解决数量 + resolvedCount = resolvedCount + project.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { + //未解决数量 + unresolvedCount = unresolvedCount + project.getCount(); + } + } + } + int total = resolvedCount + unresolvedCount; + entity.setClosedCaseResolvedTotal(resolvedCount); + entity.setClosedCaseUnresolvedTotal(unresolvedCount); + entity.setClosedCaseTotal(total); + if (total > NumConstant.ZERO) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal resolved = new BigDecimal(resolvedCount); + BigDecimal unresolved = new BigDecimal(unresolvedCount); + BigDecimal closed = new BigDecimal(total); + entity.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); + entity.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); + } + } + + /** + * 议题各状态增量统计 + * + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + * @author zhaoqifeng + * @date 2020/6/18 15:55 + */ + private void saveInc(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //表决中增量 + int votingInc = NumConstant.ZERO; + //已转项目增量 + int shiftInc = NumConstant.ZERO; + //已关闭增量 + int closedInc = NumConstant.ZERO; + for (IssueAgencyDTO issueAgency : list) { + if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { + if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { + //表决中议题数量 + votingInc = votingInc + issueAgency.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { + //已转项目议题数量 + shiftInc = shiftInc + issueAgency.getCount(); + } else { + //已关闭议题数量 + closedInc = closedInc + issueAgency.getCount(); + } + } + } + int issueInc = votingInc + shiftInc + closedInc; + entity.setVotingIncr(votingInc); + entity.setShiftProjectIncr(shiftInc); + entity.setClosedIncr(closedInc); + entity.setIssueIncr(issueInc); + } + + /** + * 议题各状态数量统计 + * + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + * @author zhaoqifeng + * @date 2020/6/18 15:54 + */ + private void saveTotal(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //表决中数量 + Integer votingCount = NumConstant.ZERO; + //已转项目数量 + Integer shiftCount = NumConstant.ZERO; + //已关闭数量 + Integer closedCount = NumConstant.ZERO; + + for (IssueAgencyDTO issueAgency : list) { + if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { + if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { + //表决中议题数量 + votingCount = votingCount + issueAgency.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { + //已转项目议题数量 + shiftCount = shiftCount + issueAgency.getCount(); + } else { + //已关闭议题数量 + closedCount = closedCount + issueAgency.getCount(); + } + } + } + int issueTotal = votingCount + shiftCount + closedCount; + entity.setVotingTotal(votingCount); + entity.setShiftProjectTotal(shiftCount); + entity.setClosedTotal(closedCount); + entity.setIssueTotal(issueTotal); + if (NumConstant.ZERO != issueTotal) { + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal voting = new BigDecimal(votingCount); + BigDecimal shift = new BigDecimal(shiftCount); + BigDecimal closed = new BigDecimal(closedCount); + BigDecimal total = new BigDecimal(issueTotal); + entity.setVotingPercent(voting.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); + entity.setShiftProjectPercent(shift.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); + entity.setClosedPercent(closed.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); + + } + } + + /** + * 已关闭议题中已解决和未解决总数统计 + * + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + * @author zhaoqifeng + * @date 2020/6/18 15:48 + */ + private void saveClosedTotal(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //已解决数 + int resolvedCount = NumConstant.ZERO; + //未解决数 + int unresolvedCount = NumConstant.ZERO; + + for (IssueAgencyDTO issueAgency : list) { + if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { + if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { + //表决中议题数量 + resolvedCount = resolvedCount + issueAgency.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { + //已转项目议题数量 + unresolvedCount = unresolvedCount + issueAgency.getCount(); + } + } + } + entity.setClosedResolvedTotal(resolvedCount); + entity.setClosedUnresolvedTotal(unresolvedCount); + + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal resolved = new BigDecimal(resolvedCount); + BigDecimal unresolved = new BigDecimal(unresolvedCount); + BigDecimal closed = new BigDecimal(entity.getClosedTotal()); + entity.setClosedResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); + entity.setClosedUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); + } + + /** + * 已关闭议题中已解决和未解决增量统计 + * + * @param list + * @param agency + * @param entity + * @param pIds + * @return void + * @author zhaoqifeng + * @date 2020/6/18 15:48 + */ + private void saveClosedInc(List list, DimAgencyDTO agency, FactIssueAgencyDailyEntity entity, String pIds) { + //已解决数 + int resolvedInc = NumConstant.ZERO; + //未解决数 + int unresolvedInc = NumConstant.ZERO; + + for (IssueAgencyDTO issueAgency : list) { + if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { + if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { + //表决中议题数量 + resolvedInc = resolvedInc + issueAgency.getCount(); + } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { + //已转项目议题数量 + unresolvedInc = unresolvedInc + issueAgency.getCount(); + } + } + } + entity.setClosedResolvedIncr(resolvedInc); + entity.setClosedUnresolvedIncr(unresolvedInc); + } + + + /** + * 初始化数据 + * + * @param dimIdBean + * @return com.epmet.entity.stats.FactIssueAgencyDailyEntity + * @author zhaoqifeng + * @date 2020/6/18 10:57 + */ + private FactIssueAgencyDailyEntity initIssueAgencyDaily(DimIdGenerator.DimIdBean dimIdBean) { + FactIssueAgencyDailyEntity entity = new FactIssueAgencyDailyEntity(); + entity.setYearId(dimIdBean.getYearId()); + entity.setQuarterId(dimIdBean.getQuarterId()); + entity.setMonthId(dimIdBean.getMonthId()); + entity.setWeekId(dimIdBean.getWeekId()); + entity.setDateId(dimIdBean.getDateId()); + entity.setIssueTotal(NumConstant.ZERO); + entity.setIssueIncr(NumConstant.ZERO); + entity.setVotingTotal(NumConstant.ZERO); + entity.setVotingIncr(NumConstant.ZERO); + entity.setVotingPercent(BigDecimal.ZERO); + entity.setShiftProjectTotal(NumConstant.ZERO); + entity.setShiftProjectIncr(NumConstant.ZERO); + entity.setShiftProjectPercent(BigDecimal.ZERO); + entity.setClosedIncr(NumConstant.ZERO); + entity.setClosedResolvedIncr(NumConstant.ZERO); + entity.setClosedPercent(BigDecimal.ZERO); + entity.setClosedUnresolvedIncr(NumConstant.ZERO); + entity.setClosedTotal(NumConstant.ZERO); + entity.setClosedResolvedTotal(NumConstant.ZERO); + entity.setClosedUnresolvedTotal(NumConstant.ZERO); + entity.setClosedResolvedPercent(BigDecimal.ZERO); + entity.setClosedUnresolvedPercent(BigDecimal.ZERO); + entity.setClosedCaseIncr(NumConstant.ZERO); + entity.setClosedCaseResolvedIncr(NumConstant.ZERO); + entity.setClosedCaseUnresolvedIncr(NumConstant.ZERO); + entity.setClosedCaseTotal(NumConstant.ZERO); + entity.setClosedCaseResolvedTotal(NumConstant.ZERO); + entity.setClosedCaseUnresolvedTotal(NumConstant.ZERO); + entity.setClosedCaseResolvedPercent(BigDecimal.ZERO); + entity.setClosedCaseUnresolvedPercent(BigDecimal.ZERO); + return entity; + } + + /** + * 初始化数据 + * + * @param dimIdBean + * @return com.epmet.entity.stats.FactIssueAgencyMonthlyEntity + * @author zhaoqifeng + * @date 2020/6/18 10:58 + */ + private FactIssueAgencyMonthlyEntity initIssueAgencyMonthly(DimIdGenerator.DimIdBean dimIdBean) { + FactIssueAgencyMonthlyEntity entity = new FactIssueAgencyMonthlyEntity(); + entity.setYearId(dimIdBean.getYearId()); + entity.setQuarterId(dimIdBean.getQuarterId()); + entity.setMonthId(dimIdBean.getMonthId()); + entity.setIssueTotal(NumConstant.ZERO); + entity.setIssueIncr(NumConstant.ZERO); + entity.setVotingTotal(NumConstant.ZERO); + entity.setVotingIncr(NumConstant.ZERO); + entity.setVotingPercent(BigDecimal.ZERO); + entity.setShiftProjectTotal(NumConstant.ZERO); + entity.setShiftProjectIncr(NumConstant.ZERO); + entity.setShiftProjectPercent(BigDecimal.ZERO); + entity.setClosedIncr(NumConstant.ZERO); + entity.setClosedResolvedIncr(NumConstant.ZERO); + entity.setClosedUnresolvedIncr(NumConstant.ZERO); + entity.setClosedTotal(NumConstant.ZERO); + entity.setClosedResolvedTotal(NumConstant.ZERO); + entity.setClosedUnresolvedTotal(NumConstant.ZERO); + entity.setClosedPercent(BigDecimal.ZERO); + entity.setClosedResolvedPercent(BigDecimal.ZERO); + entity.setClosedUnresolvedPercent(BigDecimal.ZERO); + entity.setClosedCaseIncr(NumConstant.ZERO); + entity.setClosedCaseResolvedIncr(NumConstant.ZERO); + entity.setClosedCaseUnresolvedIncr(NumConstant.ZERO); + entity.setClosedCaseTotal(NumConstant.ZERO); + entity.setClosedCaseResolvedTotal(NumConstant.ZERO); + entity.setClosedCaseUnresolvedTotal(NumConstant.ZERO); + entity.setClosedCaseResolvedPercent(BigDecimal.ZERO); + entity.setClosedCaseUnresolvedPercent(BigDecimal.ZERO); + return entity; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index 6b20e06655..a5d07f16f5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -2,16 +2,23 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.dto.stats.DimDateDTO; +import com.epmet.dto.stats.DimGridDTO; +import com.epmet.entity.issue.IssueEntity; import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.entity.stats.DimDateEntity; +import com.epmet.entity.stats.DimGridEntity; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; import com.epmet.service.StatsProjectService; import com.epmet.service.project.ProjectProcessService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; +import com.epmet.util.DimIdGenerator; +import oracle.sql.NUMBER; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,6 +40,8 @@ public class StatsProjectServiceImpl implements StatsProjectService { @Autowired private DimAgencyService dimAgencyService; @Autowired + private DimGridService dimGridService; + @Autowired private DimDateService dimDateService; @Autowired private DimWeekService dimWeekService; @@ -63,13 +72,20 @@ public class StatsProjectServiceImpl implements StatsProjectService { **/ @Override public void statsAgencyProject(String customerId) { - //1:执行机关日数据统计 - agencyDateProjectStats(customerId); - //2:执行机关月数据统计 - if (Calendar.getInstance().get(Calendar.DATE) == 1) { - agencyMonthProjectStats(customerId); - } + //1:根据客户Id查询机关维度表数据 + DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); + dimAgencyDTO.setCustomerId(customerId); + List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); + + if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { + //2:执行机关日数据统计 + agencyDateProjectStats(customerId, dimAgencyList); + //3:执行机关月数据统计 + if (Calendar.getInstance().get(Calendar.DATE) == 1) { + agencyMonthProjectStats(customerId, dimAgencyList); + } + } } /** @@ -77,28 +93,21 @@ public class StatsProjectServiceImpl implements StatsProjectService { * @Author sun * @Description 数据-项目-机关日统计 **/ - private String agencyDateProjectStats(String customerId) { + private String agencyDateProjectStats(String customerId, List dimAgencyList) { Date date = yesterDay(); - //1:查询各维度表Id,方便使用 //TODO - DimDateDTO dimDateDTO = new DimDateDTO(); - dimDateDTO.setCreatedTime(date); - dimDateDTO = dimDateService.getDimDate(dimDateDTO).get(0); + //1:查询各维度表Id,方便使用 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); - //2:根据客户Id查询机关维度表数据 - DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); - dimAgencyDTO.setCustomerId(customerId); - List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); - if (null == dimAgencyList || dimAgencyList.size() < NumConstant.ONE) { - return null; - } + //2:根据客户Id查询项目业务表数据(查询当前日期之前的数据不包含当天的) + ProjectEntity projectEntity = new ProjectEntity(); + projectEntity.setCustomerId(customerId); + projectEntity.setCreatedTime(yesterDay()); + List projectList = projectService.getProjectList(projectEntity); - //3:根据客户Id查询项目业务表数据 - List projectList = projectService.getProjectList(customerId); + //3:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询当前日期之前的数据不包含当天的) + List processList = projectProcessService.getProcessList(projectEntity); - //4:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) - List processList = projectProcessService.getProcessList(customerId); - - //5:遍历统计每个机关各项指标数 + //4:遍历统计每个机关各项指标数 //批量机关日统计新增对象 List dimDateEntityList = new ArrayList<>(); //计算百分比使用,保留小数点后两位 @@ -152,7 +161,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { AtomicInteger unResolvedIncr = new AtomicInteger(0); //遍历项目进展列表数据,统计日增量数据 processList.forEach(process -> { - if (date.equals(process.getCreatedTime())) { + if (map.containsKey(process.getAgencyId()) && date.equals(process.getCreatedTime())) { if (ProjectConstant.CREATED.equals(process.getOperation())) { pendingIncr.addAndGet(1); } @@ -172,11 +181,10 @@ public class StatsProjectServiceImpl implements StatsProjectService { agencyDailyEntity.setCustomerId(customerId); agencyDailyEntity.setAgencyId(agency.getId()); agencyDailyEntity.setParentId(agency.getPid()); - //TODO - agencyDailyEntity.setDateId(""); - agencyDailyEntity.setWeekId(""); - agencyDailyEntity.setMonthId(""); - agencyDailyEntity.setYearId(""); + agencyDailyEntity.setDateId(dimId.getDateId()); + agencyDailyEntity.setWeekId(dimId.getWeekId()); + agencyDailyEntity.setMonthId(dimId.getMonthId()); + agencyDailyEntity.setYearId(dimId.getYearId()); agencyDailyEntity.setProjectTotal(projectTotal.intValue()); agencyDailyEntity.setPendingTotal(pendingTotal.intValue()); agencyDailyEntity.setClosedTotal(closedTotal.intValue()); @@ -199,8 +207,15 @@ public class StatsProjectServiceImpl implements StatsProjectService { dimDateEntityList.add(agencyDailyEntity); } - //6:批量保存机关日统计数据 + //先删后增 if (null != dimDateEntityList && dimDateEntityList.size() > NumConstant.ZERO) { + //5:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + FactAgencyProjectDailyEntity delEntity = new FactAgencyProjectDailyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setDateId(dimId.getDateId()); + factAgencyProjectDailyService.delDateProject(delEntity); + + //6:批量保存机关日统计数据 factAgencyProjectDailyService.insertBatch(dimDateEntityList); } return null; @@ -211,8 +226,76 @@ public class StatsProjectServiceImpl implements StatsProjectService { * @Author sun * @Description 数据-项目-机关月统计 **/ - private void agencyMonthProjectStats(String customerId) { + private String agencyMonthProjectStats(String customerId, List dimAgencyList) { + //1:获取个维度Id方便使用 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); + + //2:获取昨天日期所在月份的起始日期和结束日期 + MonthProjectListFormDTO formDTO = new MonthProjectListFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setStartTime(getMonthBegin(yesterDay())); + formDTO.setEndTime(getMonthEnd(yesterDay())); + //批量月数据新增对象 + List monthlyEntityList = new ArrayList<>(); + //3:遍历机关维度数据,分别统计每个组织月数据 + for (DimAgencyDTO agency : dimAgencyList) { + //4:查询上一月机关日统计数据,按时间倒序 + formDTO.setAgencyId(agency.getId()); + List projectDailyList = factAgencyProjectDailyService.getMonthProjectList(formDTO); + + //5:汇总统计上一月机关月统计数据 + //月增量中项目总数、处理中总数、已结案总数、已结案已解决总数、已结案未解决总数 + int pendingIncr = 0; + int closedIncr = 0; + int resolvedIncr = 0; + int unResolvedIncr = 0; + for (FactAgencyProjectDailyEntity date : projectDailyList) { + pendingIncr += date.getPendingIncr(); + closedIncr += date.getClosedIncr(); + resolvedIncr += date.getResolvedIncr(); + unResolvedIncr += date.getUnresolvedIncr(); + } + //6:实体字段属性赋值 + FactAgencyProjectMonthlyEntity monthlyEntity = new FactAgencyProjectMonthlyEntity(); + monthlyEntity.setCustomerId(customerId); + monthlyEntity.setAgencyId(agency.getId()); + monthlyEntity.setParentId(agency.getPid()); + monthlyEntity.setMonthId(dimId.getMonthId()); + monthlyEntity.setQuarterId(dimId.getQuarterId()); + monthlyEntity.setYearId(dimId.getYearId()); + if (null != projectDailyList && projectDailyList.size() > NumConstant.ZERO) { + FactAgencyProjectDailyEntity entity = projectDailyList.get(0); + monthlyEntity.setProjectTotal(entity.getProjectTotal()); + monthlyEntity.setPendingTotal(entity.getPendingTotal()); + monthlyEntity.setPendingRatio(entity.getPendingRatio()); + monthlyEntity.setClosedTotal(entity.getClosedTotal()); + monthlyEntity.setClosedRatio(entity.getClosedRatio()); + monthlyEntity.setResolvedTotal(entity.getResolvedTotal()); + monthlyEntity.setResolvedRatio(entity.getResolvedRatio()); + monthlyEntity.setUnresolvedTotal(entity.getUnresolvedTotal()); + monthlyEntity.setUnresolvedRatio(entity.getUnresolvedRatio()); + monthlyEntity.setProjectIncr(pendingIncr + closedIncr); + monthlyEntity.setPendingIncr(pendingIncr); + monthlyEntity.setClosedIncr(closedIncr); + monthlyEntity.setResolvedIncr(resolvedIncr); + monthlyEntity.setUnresolvedIncr(unResolvedIncr); + } + + monthlyEntityList.add(monthlyEntity); + } + + if (null != monthlyEntityList && monthlyEntityList.size() > NumConstant.ZERO) { + //7:根据客户Id、月份Id批量删除一下可能存在的历史数据 + FactAgencyProjectMonthlyEntity delEntity = new FactAgencyProjectMonthlyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setMonthId(dimId.getMonthId()); + factAgencyProjectMonthlyService.delMonthProject(delEntity); + + //8:批量保存机关月统计数据 + factAgencyProjectMonthlyService.insertBatch(monthlyEntityList); + } + return null; } /** @@ -223,14 +306,57 @@ public class StatsProjectServiceImpl implements StatsProjectService { **/ @Override public void statsGridProject(String customerId) { + //1:根据客户Id查询网格维度表数据 + List dimGridList = dimGridService.getGridListByCustomerId(customerId); + + if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) { + //2:执行机关日数据统计 + gridDateProjectStats(customerId, dimGridList); + + //3:执行机关月数据统计 + if (Calendar.getInstance().get(Calendar.DATE) == 1) { + gridMonthProjectStats(customerId, dimGridList); + } + } + } + + /** + * @param customerId + * @return + * @Author sun + * @Description 数据-项目-网格日统计 + **/ + private String gridDateProjectStats(String customerId, List dimGridList) { //1:查询各维度表Id,方便使用 - //2:根据客户Id查询网格维度表数据 - //3:根据客户Id查询项目业务表数据 - //4:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) - //5:根据客户Id查询议题表已转项目的议题数据(为了匹配项目所属的网格Id) - //6:遍历统计每个网格各项指标数据 - //7:批量保存网格日统计数据 - //8:判断当前日期是否为当月首日,执行网格月数据统计 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); + + //2:根据客户Id查询项目业务表数据(查询当前日期之前的数据不包含当天的) + ProjectEntity projectEntity = new ProjectEntity(); + projectEntity.setCustomerId(customerId); + projectEntity.setCreatedTime(yesterDay()); + List projectList = projectService.getProjectList(projectEntity); + + //3:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询当前日期之前的数据不包含当天的) + List processList = projectProcessService.getProcessList(projectEntity); + + //4:根据客户Id查询议题表已转项目的网格项目关系数据 + List gridProjectList = null; + //5:遍历统计每个网格各项指标数据 + //6:批量保存网格日统计数据 + //7:判断当前日期是否为当月首日,执行网格月数据统计 + + return null; + } + + /** + * @param customerId + * @return + * @Author sun + * @Description 数据-项目-网格月统计 + **/ + private String gridMonthProjectStats(String customerId, List dimGridList) { + + return null; } /** @@ -251,4 +377,47 @@ public class StatsProjectServiceImpl implements StatsProjectService { return date; } + /** + * @Author sun + * @Description 获取指定日期所在月份开始的时间 + **/ + public Date getMonthBegin(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + //设置为1号,当前日期既为本月第一天 + c.set(Calendar.DAY_OF_MONTH, 1); + //将小时至0 + c.set(Calendar.HOUR_OF_DAY, 0); + //将分钟至0 + c.set(Calendar.MINUTE, 0); + //将秒至0 + c.set(Calendar.SECOND, 0); + //将毫秒至0 + c.set(Calendar.MILLISECOND, 0); + //获取本月第一天的时间 + return c.getTime(); + } + + /** + * @Author sun + * @Description 获取指定日期所在月份结束的时间 + **/ + public Date getMonthEnd(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + //设置为当月最后一天 + c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH)); + //将小时至23 + c.set(Calendar.HOUR_OF_DAY, 23); + //将分钟至59 + c.set(Calendar.MINUTE, 59); + //将秒至59 + c.set(Calendar.SECOND, 59); + //将毫秒至999 + c.set(Calendar.MILLISECOND, 999); + //获取本月最后一天的时间 + System.out.println(c.getTime()); + System.out.println(c); + return c.getTime(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index 4e182db209..8dab26fefe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -3,11 +3,14 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; +import com.epmet.entity.stats.DimDepartmentEntity; import com.epmet.entity.stats.DimGridEntity; +import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import com.epmet.entity.stats.FactArticlePublishedGridDailyEntity; import com.epmet.service.StatsPublicityService; import com.epmet.service.stats.*; import com.epmet.service.voice.ArticlePublishRangeService; +import com.epmet.service.voice.ArticleService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -46,11 +49,17 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { private DimCustomerService dimCustomerService; @Autowired private DimGridService dimGridService; + @Autowired + private DimDepartmentService dimDepartmentService; + @Autowired + private ArticleService articleService; @Autowired private ArticlePublishRangeService articlePublishRangeService; @Autowired private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService; + @Autowired + private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService; @Autowired private ExecutorService executorService; @@ -71,21 +80,78 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { /*executorService.submit(()->{ });*/ - statsPublishedGridDaily(statsDate, dimIdBean, customerId); + //key:所在机关Id + Map agencySummaryMap = new HashMap<>(); + statsPublishedGridDaily(statsDate, dimIdBean, customerId,agencySummaryMap); + statsPublishedDepartmentDaily(statsDate, dimIdBean, customerId,agencySummaryMap); + statsPublishedAgencyDaily(statsDate, dimIdBean, customerId,agencySummaryMap); } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() >= pageSize); return true; } + private void statsPublishedDepartmentDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map agencySummaryMap) { + //获取所有客户 + List departmentDTOList = dimDepartmentService.getDepartmentListByCustomerId(customerId); + if (CollectionUtils.isEmpty(departmentDTOList)) { + log.warn("publicitySummary getDepartmentListByCustomerId return empty,customerId:{}", customerId); + return; + } + //转换为 需要插入的Entity + Map departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); + //获取当天的业务数据 + List publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); + + if (!CollectionUtils.isEmpty(publishedArticleCount)) { + for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { + FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId()); + if (gridDailyEntities == null) { + log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId()); + continue; + } + gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); + gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); + //同一个机关下数据累加 + buildAgencySummaryData(agencySummaryMap, summaryDTO); + } + } + boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); + } + + /** + * desc:同一个机关下的数据进行类型处理 + * @param result + * @param summaryDTO + */ + private void buildAgencySummaryData(Map result, ArticleGridPublishedSummaryDTO summaryDTO) { + //同一个机关下数据累加 + ArticleGridPublishedSummaryDTO publishedSummaryDTO = result.get(summaryDTO.getAgencyId()); + if (publishedSummaryDTO == null) { + ArticleGridPublishedSummaryDTO summary = new ArticleGridPublishedSummaryDTO(); + summary.setCustomerId(summaryDTO.getCustomerId()); + summary.setAgencyId(summaryDTO.getAgencyId()); + summary.setGridId(summaryDTO.getGridId()); + summary.setPublisherId(summaryDTO.getPublisherId()); + summary.setArticleTotalCount(summaryDTO.getArticleTotalCount()); + summary.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); + result.put(summaryDTO.getPublisherId(),summaryDTO); + }else{ + publishedSummaryDTO.setArticlePublishedCount(publishedSummaryDTO.getArticlePublishedCount()+summaryDTO.getArticlePublishedCount()); + publishedSummaryDTO.setArticleTotalCount(publishedSummaryDTO.getArticleTotalCount()+summaryDTO.getArticlePublishedCount()); + } + } + /** * desc:按日统计 网格纬度的 文章总数数据 - * - * @param statsDate + * @param statsDate * @param dimIdBean * @param customerId + * @param agencySummaryMap */ - private void statsPublishedGridDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) { + private void statsPublishedGridDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map agencySummaryMap) { + //key:所在机关Id + Map result = new HashMap<>(); //获取所有网格 List gridDTOList = dimGridService.getGridListByCustomerId(customerId); if (CollectionUtils.isEmpty(gridDTOList)) { @@ -106,11 +172,41 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { } gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); + //同一个机关下数据累加 + buildAgencySummaryData(agencySummaryMap, summaryDTO); } } boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values()); } + private void statsPublishedAgencyDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map agencySummaryMap) { + //获取所有客户 + List departmentDTOList = null;//dimAgencyService.getAgencyListByCustomerId(customerId); + if (CollectionUtils.isEmpty(departmentDTOList)) { + log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); + return; + } + //转换为 需要插入的Entity + Map departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); + //获取当天的业务数据 + List publishedArticleCount = articleService.getAllPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); + + if (!CollectionUtils.isEmpty(publishedArticleCount)) { + for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { + FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId()); + if (gridDailyEntities == null) { + log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId()); + continue; + } + gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); + gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); + //同一个机关下数据累加 + buildAgencySummaryData(agencySummaryMap, summaryDTO); + } + } + boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); + } + /** * desc:将网格对象构建为 gridDaily 对象 * @@ -131,4 +227,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { }); return result; } + + /** + * desc:将网格对象构建为 gridDaily 对象 + * + * @param dimDepartmentEntities + * @param dimIdBean + * @return + */ + private Map convertDepartmentDailyEntity(List dimDepartmentEntities, DimIdGenerator.DimIdBean dimIdBean) { + Map result = new HashMap<>(); + dimDepartmentEntities.forEach(dimGridEntity -> { + FactArticlePublishedDepartmentDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedDepartmentDailyEntity.class); + entity.setCustomerId(dimGridEntity.getCustomerId()); + entity.setAgencyId(dimGridEntity.getAgencyId()); + entity.setDepartmentId(dimGridEntity.getId()); + entity.setArticleTotalCount(0); + entity.setArticlePublishedCount(0); + result.put(dimGridEntity.getId(), entity); + }); + return result; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java index 08f61350b6..729e724267 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java @@ -18,6 +18,7 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import java.util.List; @@ -31,9 +32,9 @@ import java.util.List; public interface ProjectProcessService extends BaseService { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 查询客户项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) **/ - List getProcessList(String customerId); + List getProcessList(ProjectEntity projectEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index d271b95ca3..79342835d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -18,6 +18,7 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.entity.project.ProjectEntity; import java.util.List; @@ -31,9 +32,29 @@ import java.util.List; public interface ProjectService extends BaseService { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 根据客户Id查询客户项目业务表有效数据 **/ - List getProjectList(String customerId); + List getProjectList(ProjectEntity projectEntity); + + /** + * 已结案项目统计 + * @author zhaoqifeng + * @date 2020/6/18 17:04 + * @param customerId + * @param date + * @return java.util.List + */ + List getAgencyClosedProjectTotal(String customerId, String date); + + /** + * 已结案项目增量 + * @author zhaoqifeng + * @date 2020/6/18 17:04 + * @param customerId + * @param date + * @return java.util.List + */ + List getAgencyClosedProjectInc(String customerId, String date); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java index 78eee70af2..bfc402b4b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.project.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.project.ProjectProcessDao; +import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.service.project.ProjectProcessService; import org.springframework.stereotype.Service; @@ -35,12 +36,12 @@ import java.util.List; public class ProjectProcessServiceImpl extends BaseServiceImpl implements ProjectProcessService { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 查询客户项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) **/ @Override - public List getProcessList(String customerId) { - return baseDao.selectProcessList(customerId); + public List getProcessList(ProjectEntity projectEntity) { + return baseDao.selectProcessList(projectEntity); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index b551e62c89..b757a52799 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.project.ProjectDao; +import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.service.project.ProjectService; import org.springframework.beans.factory.annotation.Autowired; @@ -39,13 +40,23 @@ import java.util.List; public class ProjectServiceImpl extends BaseServiceImpl implements ProjectService { /** - * @param customerId + * @param projectEntity * @Author sun * @Description 根据客户Id查询客户项目业务表有效数据 **/ @Override - public List getProjectList(String customerId) { - return baseDao.selectProjectList(customerId); + public List getProjectList(ProjectEntity projectEntity) { + return baseDao.selectProjectList(projectEntity); + } + + @Override + public List getAgencyClosedProjectTotal(String customerId, String date) { + return baseDao.selectAgencyClosedProjectTotal(customerId, date); + } + + @Override + public List getAgencyClosedProjectInc(String customerId, String date) { + return baseDao.selectAgencyClosedProjectInc(customerId, date); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java index 8c376e33e7..02f644be46 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java @@ -93,14 +93,6 @@ public interface DimDateService extends BaseService { */ void delete(String[] ids); - /** - * @param dto - * @return - * @Author sun - * @Description 根据创建时间查询日维度信息 - **/ - List getDimDate(DimDateDTO dto); - void initDimDate(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java index 0055e81fb5..8ae4e1e1bd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java @@ -95,4 +95,14 @@ public interface DimDepartmentService extends BaseService { void delete(String[] ids); void addDepartmentDims(List departments); + + /** + * desc: 根据客户Id获取 部门数据 + * + * @param null + * @return: + * @date: 2020/6/18 17:45 + * @author: jianjun liu + */ + List getDepartmentListByCustomerId(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java index 49a1030a1e..f7df122755 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java @@ -18,8 +18,11 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -28,4 +31,17 @@ import com.epmet.entity.stats.FactAgencyProjectDailyEntity; */ public interface FactAgencyProjectDailyService extends BaseService { + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + List getMonthProjectList(MonthProjectListFormDTO formDTO); + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delDateProject(FactAgencyProjectDailyEntity delEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java index 38f18b9a8c..e1e6ebdc25 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java @@ -28,4 +28,11 @@ import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; */ public interface FactAgencyProjectMonthlyService extends BaseService { + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + void delMonthProject(FactAgencyProjectMonthlyEntity delEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java index 26f2c2089c..40ae1d8002 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java @@ -20,6 +20,8 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; +import java.util.Collection; + /** * 文章发布数量【部门】日统计表 * @@ -28,4 +30,15 @@ import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; */ public interface FactArticlePublishedDepartmentDailyService extends BaseService { + /** + * desc: 删除并插入数据 + * + * @param dateId + * @param values + * @return: + * @date: 2020/6/18 14:54 + * @author: jianjun liu + */ + boolean deleteAndInsertBatch(String customerId, String dateId, Collection values); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyDailyService.java new file mode 100644 index 0000000000..40f9c9e472 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyDailyService.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.FactIssueAgencyDailyDTO; +import com.epmet.entity.stats.FactIssueAgencyDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +public interface FactIssueAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactIssueAgencyDailyDTO + * @author generator + * @date 2020-06-17 + */ + FactIssueAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void save(FactIssueAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void update(FactIssueAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-17 + */ + 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/FactIssueAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java new file mode 100644 index 0000000000..0e96cc1835 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.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.FactIssueAgencyMonthlyDTO; +import com.epmet.entity.stats.FactIssueAgencyMonthlyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 组织机关议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +public interface FactIssueAgencyMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactIssueAgencyMonthlyDTO + * @author generator + * @date 2020-06-17 + */ + FactIssueAgencyMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void save(FactIssueAgencyMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void update(FactIssueAgencyMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-17 + */ + 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/FactIssueGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridDailyService.java new file mode 100644 index 0000000000..58beae9049 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridDailyService.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.FactIssueGridDailyDTO; +import com.epmet.entity.stats.FactIssueGridDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 网格议题数量(按日) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +public interface FactIssueGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactIssueGridDailyDTO + * @author generator + * @date 2020-06-17 + */ + FactIssueGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void save(FactIssueGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void update(FactIssueGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-17 + */ + 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/FactIssueGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java new file mode 100644 index 0000000000..99a9a36769 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.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.FactIssueGridMonthlyDTO; +import com.epmet.entity.stats.FactIssueGridMonthlyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 网格议题数量(按月) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +public interface FactIssueGridMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactIssueGridMonthlyDTO + * @author generator + * @date 2020-06-17 + */ + FactIssueGridMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void save(FactIssueGridMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-17 + */ + void update(FactIssueGridMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-17 + */ + 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/impl/DimDateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java index 9f6281c20b..8462972e2d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java @@ -104,17 +104,6 @@ public class DimDateServiceImpl extends BaseServiceImpl getDimDate(DimDateDTO dto) { - return baseDao.selectDimDate(dto); - } - @Override public void initDimDate() { LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_DATE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java index ac58403913..567b211aa3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java @@ -20,16 +20,16 @@ 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.constant.FieldConstant; 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.DimDepartmentDao; import com.epmet.dto.stats.DimDepartmentDTO; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimDepartmentEntity; import com.epmet.service.stats.DimDepartmentService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +44,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-06-16 */ +@Slf4j @Service public class DimDepartmentServiceImpl extends BaseServiceImpl implements DimDepartmentService { @@ -118,4 +119,12 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl getDepartmentListByCustomerId(String customerId) { + if (StringUtils.isBlank(customerId)){ + log.warn("getDepartmentListByCustomerId param is blank "); + } + return baseDao.getDepartmentListByCustomerId(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java index c523aef2a2..bbb1b39e44 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java @@ -19,10 +19,13 @@ package com.epmet.service.stats.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.stats.FactAgencyProjectDailyDao; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; import com.epmet.service.stats.FactAgencyProjectDailyService; import org.springframework.stereotype.Service; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -33,4 +36,23 @@ import org.springframework.stereotype.Service; public class FactAgencyProjectDailyServiceImpl extends BaseServiceImpl implements FactAgencyProjectDailyService { + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + @Override + public List getMonthProjectList(MonthProjectListFormDTO formDTO) { + return baseDao.selectMonthProjectList(formDTO); + } + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + @Override + public void delDateProject(FactAgencyProjectDailyEntity delEntity) { + baseDao.delDateProject(delEntity); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java index 5ad3f8eeda..df869107f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java @@ -32,5 +32,14 @@ import org.springframework.stereotype.Service; @Service public class FactAgencyProjectMonthlyServiceImpl extends BaseServiceImpl implements FactAgencyProjectMonthlyService { - + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + @Override + public void delMonthProject(FactAgencyProjectMonthlyEntity delEntity) { + baseDao.delMonthProject(delEntity); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java index 47c9667c59..cf40d35c1e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java @@ -21,16 +21,27 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.stats.FactArticlePublishedDepartmentDailyDao; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import com.epmet.service.stats.FactArticlePublishedDepartmentDailyService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.Collection; + /** * 文章发布数量【部门】日统计表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-06-18 */ +@Slf4j @Service public class FactArticlePublishedDepartmentDailyServiceImpl extends BaseServiceImpl implements FactArticlePublishedDepartmentDailyService { + @Override + public boolean deleteAndInsertBatch(String customerId, String dateId, Collection values) { + int i = baseDao.deleteByDateId(customerId, dateId); + log.debug("deleteAndInsertBatch delete customerId:{},rows:{}", customerId,i); + this.insertBatch(values, 100); + return true; + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..b43614cc43 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyDailyServiceImpl.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.FactIssueAgencyDailyDao; +import com.epmet.dto.stats.FactIssueAgencyDailyDTO; +import com.epmet.entity.stats.FactIssueAgencyDailyEntity; +import com.epmet.service.stats.FactIssueAgencyDailyService; +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-17 + */ +@Service +public class FactIssueAgencyDailyServiceImpl extends BaseServiceImpl implements FactIssueAgencyDailyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactIssueAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactIssueAgencyDailyDTO.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 FactIssueAgencyDailyDTO get(String id) { + FactIssueAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactIssueAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactIssueAgencyDailyDTO dto) { + FactIssueAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactIssueAgencyDailyDTO dto) { + FactIssueAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueAgencyDailyEntity.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/FactIssueAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java new file mode 100644 index 0000000000..a4d64c92c4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java @@ -0,0 +1,101 @@ +/** + * 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.FactIssueAgencyMonthlyDao; +import com.epmet.dto.stats.FactIssueAgencyMonthlyDTO; +import com.epmet.entity.stats.FactIssueAgencyMonthlyEntity; +import com.epmet.service.stats.FactIssueAgencyMonthlyService; +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-17 + */ +@Service +public class FactIssueAgencyMonthlyServiceImpl extends BaseServiceImpl implements FactIssueAgencyMonthlyService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactIssueAgencyMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactIssueAgencyMonthlyDTO.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 FactIssueAgencyMonthlyDTO get(String id) { + FactIssueAgencyMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactIssueAgencyMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactIssueAgencyMonthlyDTO dto) { + FactIssueAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueAgencyMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactIssueAgencyMonthlyDTO dto) { + FactIssueAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueAgencyMonthlyEntity.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/FactIssueGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridDailyServiceImpl.java new file mode 100644 index 0000000000..feebc25a82 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridDailyServiceImpl.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.FactIssueGridDailyDao; +import com.epmet.dto.stats.FactIssueGridDailyDTO; +import com.epmet.entity.stats.FactIssueGridDailyEntity; +import com.epmet.service.stats.FactIssueGridDailyService; +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-17 + */ +@Service +public class FactIssueGridDailyServiceImpl extends BaseServiceImpl implements FactIssueGridDailyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactIssueGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactIssueGridDailyDTO.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 FactIssueGridDailyDTO get(String id) { + FactIssueGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactIssueGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactIssueGridDailyDTO dto) { + FactIssueGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactIssueGridDailyDTO dto) { + FactIssueGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueGridDailyEntity.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/FactIssueGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java new file mode 100644 index 0000000000..33b00ffd2e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.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.FactIssueGridMonthlyDao; +import com.epmet.dto.stats.FactIssueGridMonthlyDTO; +import com.epmet.entity.stats.FactIssueGridMonthlyEntity; +import com.epmet.service.stats.FactIssueGridMonthlyService; +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-17 + */ +@Service +public class FactIssueGridMonthlyServiceImpl extends BaseServiceImpl implements FactIssueGridMonthlyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactIssueGridMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactIssueGridMonthlyDTO.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 FactIssueGridMonthlyDTO get(String id) { + FactIssueGridMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactIssueGridMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactIssueGridMonthlyDTO dto) { + FactIssueGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueGridMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactIssueGridMonthlyDTO dto) { + FactIssueGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactIssueGridMonthlyEntity.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/voice/ArticleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java index 366e167ad1..3a1c321c9c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java @@ -18,8 +18,12 @@ package com.epmet.service.voice; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; import com.epmet.entity.voice.ArticleEntity; +import java.util.Date; +import java.util.List; + /** * desc: 数据统计文章service * @@ -30,4 +34,11 @@ import com.epmet.entity.voice.ArticleEntity; */ public interface ArticleService extends BaseService { + /** + * desc:根据客户id、发布时间 获取文章总数 + * @param customerId + * @param publishDate + * @return + */ + List getAllPublishedCount(String customerId, Date publishDate); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java index f1a788fc30..27821e8a41 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java @@ -19,13 +19,20 @@ package com.epmet.service.voice.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.ProjectConstant; import com.epmet.dao.voice.ArticleDao; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; import com.epmet.entity.voice.ArticleEntity; import com.epmet.service.voice.ArticleService; -import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.List; + /** * 项目表 * @@ -35,7 +42,12 @@ import org.springframework.stereotype.Service; @Service @DataSource(DataSourceConstant.GOV_VOICE) public class ArticleServiceImpl extends BaseServiceImpl implements ArticleService { - @Autowired - private ArticleDao articleDao; + @Override + public List getAllPublishedCount(String customerId, Date publishDate) { + if (StringUtils.isBlank(customerId) || publishDate == null){ + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + return baseDao.getAllPublishedCount(customerId,publishDate, ProjectConstant.PUBLISH_TYPE_DEPT); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql index adeeac3769..f188d95e6a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql @@ -56,7 +56,7 @@ CREATE TABLE `fact_article_published_department_daily` ( `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布文章单位所属机关ID 发布文章单位所属机关ID', - `DEPSARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', `ARTICLE_TOTAL_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章累计发文数量 文章数量', `ARTICLE_PUBLISHED_COUNT` int(11) NULL DEFAULT NULL COMMENT '当前发文数量 当前未下线的文章数量', `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 日期ID', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 6a0a0c8e2f..2174226182 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -2,7 +2,70 @@ - + SELECT ORG_ID AS "agencyId", + ORG_ID_PATH AS "pIds", + ISSUE_STATUS AS "status", + COUNT(ID) AS "count" + FROM + issue + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + GROUP BY + ORG_ID, ISSUE_STATUS + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index b64db5c5f7..17972e738b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -13,7 +13,41 @@ AND customer_id = #{customerId} + ORDER BY created_time DESC + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index 01daae5a72..bf2035774d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -16,6 +16,7 @@ pro.del_flag = '0' AND p.del_flag = '0' AND p.customer_id = #{customerId} + ORDER BY pro.project_id 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 94eb88062b..ad531351b0 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 @@ -3,19 +3,6 @@ - - + SELECT + ID, + AGENCY_ID, + CUSTOMER_ID + FROM + dim_department + WHERE + DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml index 1b56baee0a..c9adcc2f29 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml @@ -3,6 +3,30 @@ + + + DELETE + FROM + fact_agency_project_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml index 15e59960ea..846b2c7a26 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml @@ -3,6 +3,13 @@ - + + DELETE + FROM + fact_agency_project_monthly + WHERE + customer_id = #{customerId} + AND month_id = #{monthId} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml index 1dd50f6c6c..abe5fafc0a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml @@ -7,7 +7,7 @@ - + @@ -22,6 +22,9 @@ + + DELETE FROM fact_article_published_department_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyDailyDao.xml new file mode 100644 index 0000000000..59d538fe2f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyDailyDao.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml new file mode 100644 index 0000000000..24e3e22dad --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml new file mode 100644 index 0000000000..c2b1aaf819 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml new file mode 100644 index 0000000000..69538d9534 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml index d411b3513e..69f1ddc5e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml @@ -29,6 +29,23 @@ + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml index 6330c003b8..4b7f1cfc9b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml @@ -23,6 +23,7 @@