44 changed files with 2545 additions and 5 deletions
@ -0,0 +1,19 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:02 |
|||
*/ |
|||
public interface GroupConstant { |
|||
|
|||
/** |
|||
* eg: 2020W10 = 2020年第10周 |
|||
*/ |
|||
String W = "W"; |
|||
|
|||
/** |
|||
* eg: 2020Q01 = 2020年第一季度 |
|||
*/ |
|||
String Q = "Q"; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:34 |
|||
*/ |
|||
@Data |
|||
public class GridGroupPeopleFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3634745091993094743L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组状态 |
|||
*/ |
|||
private String state = "approved"; |
|||
|
|||
/** |
|||
* 人员状态 |
|||
*/ |
|||
private String status = "removed"; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:34 |
|||
*/ |
|||
@Data |
|||
public class GridGroupPeopleTotalFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6415141711878464704L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组状态 |
|||
*/ |
|||
private String state = "approved"; |
|||
|
|||
/** |
|||
* 人员状态 |
|||
*/ |
|||
private String status = "removed"; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:34 |
|||
*/ |
|||
@Data |
|||
public class GridGroupTotalFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4605386326533905365L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组状态 |
|||
*/ |
|||
private String state = "approved"; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/17 16:45 |
|||
*/ |
|||
@Data |
|||
public class GroupIncrFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4498126701378094617L; |
|||
|
|||
/** |
|||
* 小组状态 只算 state = “approved” |
|||
*/ |
|||
private String state = "approved"; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 日期(昨日) |
|||
*/ |
|||
private String yesterday; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 14:48 |
|||
*/ |
|||
@Data |
|||
public class CustomerGridInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6635092874863425910L; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格所属机关ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/17 19:16 |
|||
*/ |
|||
public class DimTimeResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2863598069938303232L; |
|||
|
|||
/** |
|||
* 日期ID |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月Id |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:31 |
|||
*/ |
|||
@Data |
|||
public class GridGroupPeopleResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -7251423227553175946L; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 小组ID |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 网格下-每个小组内成员的数量【人员状态 不为 removed】 |
|||
*/ |
|||
private Integer groupCount; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:31 |
|||
*/ |
|||
@Data |
|||
public class GridGroupPeopleTotalResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6131166787256682153L; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格下的小组成员总数量 |
|||
*/ |
|||
private Integer gridGroupPeopleTotal; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 16:31 |
|||
*/ |
|||
@Data |
|||
public class GridGroupTotalResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1099735509481708988L; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格下的小组数量 |
|||
*/ |
|||
private Integer gridGroupTotal; |
|||
} |
@ -0,0 +1,125 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 17:25 |
|||
*/ |
|||
@Data |
|||
public class GroupGridDailyResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 3206418216410331158L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 机构ID 关联机关dim表 |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月份ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 网格数 当前网格下的网格数 |
|||
*/ |
|||
private Integer gridTotal = 0; |
|||
|
|||
/** |
|||
* 小组数 |
|||
*/ |
|||
private Integer groupTotal = 0; |
|||
|
|||
/** |
|||
* 网格下所有组内总人数 不去重 |
|||
*/ |
|||
private Integer groupMemberTotal; |
|||
|
|||
/** |
|||
* 小组平均人数 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 小组增量 |
|||
*/ |
|||
private Integer groupIncr = 0; |
|||
|
|||
/** |
|||
* 小组成员最大数 |
|||
*/ |
|||
private Integer groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 最多成员小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组成员最小数 |
|||
*/ |
|||
private Integer groupMemberMinCount = 1; |
|||
|
|||
/** |
|||
* 最少成员小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
/** |
|||
* 删除标识 未删除:0,已删除:1 |
|||
*/ |
|||
private String delFlag = "0"; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision = 0; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy = "APP_USER"; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy = "APP_USER"; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/17 16:48 |
|||
*/ |
|||
@Data |
|||
public class GroupIncrResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 5536872354876581582L; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 小组日增数 |
|||
*/ |
|||
private Integer groupIncr = 0; |
|||
} |
@ -0,0 +1,156 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.stats; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 组-机关日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
public class FactGroupAgencyDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 机构ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 父级机关ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 季ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格总数 截至统计日期 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 网格小组数(包含所有下级机关的网格小组) 截至统计日期 |
|||
*/ |
|||
private Integer groupTotalCount; |
|||
|
|||
/** |
|||
* 机关下网格小组人数总计 不去重 |
|||
*/ |
|||
private Integer groupMemberTotalCount; |
|||
|
|||
/** |
|||
* 小组平均人数 截至统计日期 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 当天小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组最大成员数 |
|||
*/ |
|||
private String groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 最多成员小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组最小成员数 |
|||
*/ |
|||
private String groupMemberMinCount; |
|||
|
|||
/** |
|||
* 最少成员小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
/** |
|||
* 删除标识 未删除:0,已删除:1 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,146 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.stats; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 组-机关月统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
public class FactGroupAgencyMonthlyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 机关ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 父级机关ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 统计月份ID 关联月份dim表 |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 统计季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 统计年份ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格数 截至到月末的机关下网格数 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 小组数 截止到月末的新增数(该月内所有的新增数字之和) |
|||
*/ |
|||
private Integer groupTotal; |
|||
|
|||
/** |
|||
* 机关下网格组内总人数 不去重 |
|||
*/ |
|||
private Integer groupMemberTotal; |
|||
|
|||
/** |
|||
* 小组平均人数 月末一天的平均数 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 月末一天的中位数(人) |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组成员最大数 |
|||
*/ |
|||
private Integer groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 成员最多小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组成员最小数 |
|||
*/ |
|||
private Integer groupMemberMinCount; |
|||
|
|||
/** |
|||
* 成员最少小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
/** |
|||
* 删除标识 未删除:0,已删除:1 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,156 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.stats; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 组-网格日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
public class FactGroupGridDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 机构ID 关联机关dim表 |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月份ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 网格数 当前网格下的网格数 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 小组数 |
|||
*/ |
|||
private Integer groupTotal; |
|||
|
|||
/** |
|||
* 网格下所有组内总人数 不去重 |
|||
*/ |
|||
private Integer groupMemberTotal; |
|||
|
|||
/** |
|||
* 小组平均人数 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组成员最大数 |
|||
*/ |
|||
private Integer groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 最多成员小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组成员最小数 |
|||
*/ |
|||
private Integer groupMemberMinCount; |
|||
|
|||
/** |
|||
* 最少成员小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
/** |
|||
* 删除标识 未删除:0,已删除:1 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.service.StatsGroupService; |
|||
import com.epmet.service.group.GroupDataService; |
|||
import com.epmet.service.stats.FactGroupGridDailyService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 13:21 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("statsgroup") |
|||
public class StatsGroupController { |
|||
|
|||
@Autowired |
|||
private StatsGroupService statsGroupService; |
|||
|
|||
/** |
|||
* @Description 统计 “小组” 有关数据, dim:【网格-日】 |
|||
* 网格数、小组数、网格下所有组内人数(不去重) |
|||
* 小组平均人数、小组人数中位数、小组增量 |
|||
* 小组成员最大数、最多成员小组ID |
|||
* 小组成员最小数、最少成员小组ID |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("groupgriddaily") |
|||
public void groupGridDaily(){ |
|||
statsGroupService.groupGridDaily(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.dao.group; |
|||
|
|||
import com.epmet.dto.group.form.GridGroupPeopleFormDTO; |
|||
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; |
|||
import com.epmet.dto.group.form.GridGroupTotalFormDTO; |
|||
import com.epmet.dto.group.form.GroupIncrFormDTO; |
|||
import com.epmet.dto.group.result.GridGroupPeopleResultDTO; |
|||
import com.epmet.dto.group.result.GridGroupPeopleTotalResultDTO; |
|||
import com.epmet.dto.group.result.GridGroupTotalResultDTO; |
|||
import com.epmet.dto.group.result.GroupIncrResultDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 13:22 |
|||
*/ |
|||
@Mapper |
|||
public interface GroupDataDao { |
|||
|
|||
/** |
|||
* @Description 查询网格下的小组总数,状态为 “approved” |
|||
* @param formDTO |
|||
* @author zxc |
|||
*/ |
|||
List<GridGroupTotalResultDTO> selectGridGroupTotal(GridGroupTotalFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 查询网格下的小组成员总数 , 人员状态不为 “removed” |
|||
* @param formDTO |
|||
* @author zxc |
|||
*/ |
|||
List<GridGroupPeopleTotalResultDTO> selectGridGroupPeopleTotal(GridGroupPeopleTotalFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 查询每个小组的人数 |
|||
* @param formDTO |
|||
* @author zxc |
|||
*/ |
|||
List<GridGroupPeopleResultDTO> selectEveryGroupPeopleCount(GridGroupPeopleFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 查询网格下的小组日增数 |
|||
* @param formDTO |
|||
* @author zxc |
|||
*/ |
|||
List<GroupIncrResultDTO> selectGroupIncr(GroupIncrFormDTO formDTO); |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.stats.FactGroupAgencyDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 组-机关日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGroupAgencyDailyDao extends BaseDao<FactGroupAgencyDailyEntity> { |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 组-机关月统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGroupAgencyMonthlyDao extends BaseDao<FactGroupAgencyMonthlyEntity> { |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.group.result.GroupGridDailyResultDTO; |
|||
import com.epmet.entity.stats.FactGroupGridDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 组-网格日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGroupGridDailyDao extends BaseDao<FactGroupGridDailyEntity> { |
|||
|
|||
/** |
|||
* @Description 插入小组【网格-日】 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
void insertGroupGridDaily(@Param("formDto") List<GroupGridDailyResultDTO> formDto); |
|||
|
|||
} |
@ -0,0 +1,126 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组-机关日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_group_agency_daily") |
|||
public class FactGroupAgencyDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 机构ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 父级机关ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 季ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格总数 截至统计日期 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 网格小组数(包含所有下级机关的网格小组) 截至统计日期 |
|||
*/ |
|||
private Integer groupTotalCount; |
|||
|
|||
/** |
|||
* 机关下网格小组人数总计 不去重 |
|||
*/ |
|||
private Integer groupMemberTotalCount; |
|||
|
|||
/** |
|||
* 小组平均人数 截至统计日期 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 当天小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组最大成员数 |
|||
*/ |
|||
private String groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 最多成员小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组最小成员数 |
|||
*/ |
|||
private String groupMemberMinCount; |
|||
|
|||
/** |
|||
* 最少成员小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组-机关月统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_group_agency_monthly") |
|||
public class FactGroupAgencyMonthlyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 机关ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 父级机关ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 统计月份ID 关联月份dim表 |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 统计季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 统计年份ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格数 截至到月末的机关下网格数 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 小组数 截止到月末的新增数(该月内所有的新增数字之和) |
|||
*/ |
|||
private Integer groupTotal; |
|||
|
|||
/** |
|||
* 机关下网格组内总人数 不去重 |
|||
*/ |
|||
private Integer groupMemberTotal; |
|||
|
|||
/** |
|||
* 小组平均人数 月末一天的平均数 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 月末一天的中位数(人) |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组成员最大数 |
|||
*/ |
|||
private Integer groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 成员最多小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组成员最小数 |
|||
*/ |
|||
private Integer groupMemberMinCount; |
|||
|
|||
/** |
|||
* 成员最少小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
} |
@ -0,0 +1,126 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组-网格日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_group_grid_daily") |
|||
public class FactGroupGridDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 机构ID 关联机关dim表 |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月份ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 季度ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 网格数 当前网格下的网格数 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 小组数 |
|||
*/ |
|||
private Integer groupTotal; |
|||
|
|||
/** |
|||
* 网格下所有组内总人数 不去重 |
|||
*/ |
|||
private Integer groupMemberTotal; |
|||
|
|||
/** |
|||
* 小组平均人数 |
|||
*/ |
|||
private Integer groupMemberAvgCount; |
|||
|
|||
/** |
|||
* 小组中位数 截至统计日期,小组人数依次由小到大排开取中位数 |
|||
*/ |
|||
private Integer groupMedian; |
|||
|
|||
/** |
|||
* 小组增量 |
|||
*/ |
|||
private Integer groupIncr; |
|||
|
|||
/** |
|||
* 小组成员最大数 |
|||
*/ |
|||
private Integer groupMemberMaxCount; |
|||
|
|||
/** |
|||
* 最多成员小组ID |
|||
*/ |
|||
private String maxMemberGroupId; |
|||
|
|||
/** |
|||
* 小组成员最小数 |
|||
*/ |
|||
private Integer groupMemberMinCount; |
|||
|
|||
/** |
|||
* 最少成员小组ID |
|||
*/ |
|||
private String minMemberGroupId; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.service; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 14:14 |
|||
*/ |
|||
public interface StatsGroupService { |
|||
|
|||
/** |
|||
* @Description 统计 “小组” 有关数据, dim:【网格-日】 |
|||
* @author zxc |
|||
*/ |
|||
void groupGridDaily(); |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.epmet.service.group; |
|||
|
|||
import com.epmet.dto.group.result.CustomerGridInfoResultDTO; |
|||
import com.epmet.dto.group.result.GroupGridDailyResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 13:22 |
|||
*/ |
|||
public interface GroupDataService { |
|||
|
|||
/** |
|||
* @Description 统计 “小组” 有关数据, dim:【网格-日】 |
|||
* @param customerId |
|||
* @param gridsInfo |
|||
* @author zxc |
|||
*/ |
|||
List<GroupGridDailyResultDTO> groupGridDaily(String customerId, List<CustomerGridInfoResultDTO> gridsInfo); |
|||
|
|||
} |
@ -0,0 +1,118 @@ |
|||
package com.epmet.service.group.impl; |
|||
|
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.dao.group.GroupDataDao; |
|||
import com.epmet.dao.stats.DimDateDao; |
|||
import com.epmet.dto.group.form.GridGroupPeopleFormDTO; |
|||
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; |
|||
import com.epmet.dto.group.form.GridGroupTotalFormDTO; |
|||
import com.epmet.dto.group.form.GroupIncrFormDTO; |
|||
import com.epmet.dto.group.result.*; |
|||
import com.epmet.service.group.GroupDataService; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 13:23 |
|||
*/ |
|||
@Service |
|||
@DataSource(DataSourceConstant.RESI_GROUP) |
|||
public class GroupDataServiceImpl implements GroupDataService { |
|||
|
|||
@Autowired |
|||
private GroupDataDao groupDataDao; |
|||
@Autowired |
|||
private DimDateDao dimDateDao; |
|||
|
|||
/** |
|||
* @Description 统计 “小组” 有关数据, dim:【网格-日】 |
|||
* @param customerId |
|||
* @param gridsInfo |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public List<GroupGridDailyResultDTO> groupGridDaily(String customerId, List<CustomerGridInfoResultDTO> gridsInfo) { |
|||
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); |
|||
DimTimeResultDTO dimTime = dimDateDao.selectDimTime(dateId); |
|||
List<GroupGridDailyResultDTO> result = new ArrayList<>(); |
|||
|
|||
// 1. 网格下有多少小组,只算 state = ‘approved’
|
|||
GridGroupTotalFormDTO formDTO = new GridGroupTotalFormDTO(); |
|||
formDTO.setCustomerId(customerId); |
|||
List<GridGroupTotalResultDTO> gridGroupTotalResultDTOS = groupDataDao.selectGridGroupTotal(formDTO); |
|||
gridsInfo.forEach(grid -> { |
|||
GroupGridDailyResultDTO dailyResult = new GroupGridDailyResultDTO(); |
|||
BeanUtils.copyProperties(dimTime,dailyResult); |
|||
dailyResult.setAgencyId(grid.getAgencyId()); |
|||
gridGroupTotalResultDTOS.forEach(groupTotal -> { |
|||
if (grid.getGridId().equals(groupTotal.getGridId())){ |
|||
dailyResult.setGroupTotal(groupTotal.getGridGroupTotal()); |
|||
dailyResult.setGridId(grid.getGridId()); |
|||
} |
|||
}); |
|||
result.add(dailyResult); |
|||
}); |
|||
// 2. 网格下所有组内人数和(不需要去重) 人员状态 != "removed"
|
|||
GridGroupPeopleTotalFormDTO peopleTotalFormDTO = new GridGroupPeopleTotalFormDTO(); |
|||
peopleTotalFormDTO.setCustomerId(customerId); |
|||
List<GridGroupPeopleTotalResultDTO> gridGroupPeopleTotalResultDTOS = groupDataDao.selectGridGroupPeopleTotal(peopleTotalFormDTO); |
|||
result.forEach(grid -> { |
|||
gridGroupPeopleTotalResultDTOS.forEach(groupPeopleTotal -> { |
|||
if (grid.getGridId().equals(groupPeopleTotal.getGridId())){ |
|||
grid.setGroupMemberTotal(groupPeopleTotal.getGridGroupPeopleTotal()); |
|||
} |
|||
}); |
|||
}); |
|||
// 3. 网格下小组平均人数
|
|||
result.forEach(grid -> { |
|||
grid.setGroupMemberAvgCount(grid.getGroupMemberTotal()/grid.getGroupTotal()); |
|||
}); |
|||
// 4. 网格下小组人数中位数
|
|||
GridGroupPeopleFormDTO everyGroupPeople = new GridGroupPeopleFormDTO(); |
|||
everyGroupPeople.setCustomerId(customerId); |
|||
List<GridGroupPeopleResultDTO> everyGroupPeopleCount = groupDataDao.selectEveryGroupPeopleCount(everyGroupPeople); |
|||
Map<String, List<GridGroupPeopleResultDTO>> collect = everyGroupPeopleCount.stream().collect(Collectors.groupingBy(every -> every.getGridId())); |
|||
Set<Map.Entry<String, List<GridGroupPeopleResultDTO>>> entries = collect.entrySet(); |
|||
entries.forEach(everyGroup -> { |
|||
List<GridGroupPeopleResultDTO> value = everyGroup.getValue(); |
|||
List<GridGroupPeopleResultDTO> groupPeopleSorted = value.stream().sorted(Comparator.comparing(GridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList()); |
|||
Integer groupPeopleMedian = groupPeopleSorted.size() % 2 == 0 ? |
|||
(groupPeopleSorted.get(groupPeopleSorted.size() / 2 - 1).getGroupCount() + groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount()) / 2 : |
|||
groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount(); |
|||
result.forEach(grid -> { |
|||
if (groupPeopleSorted.get(0).getGridId().equals(grid.getGridId())){ |
|||
grid.setGroupMedian(groupPeopleMedian);//中位数
|
|||
//网格下小组成员最大数
|
|||
grid.setGroupMemberMaxCount(groupPeopleSorted.get(NumConstant.ZERO).getGroupCount()); |
|||
//最多成员小组ID
|
|||
grid.setMaxMemberGroupId(groupPeopleSorted.get(NumConstant.ZERO).getGroupId()); |
|||
//网格下小组成员最小数
|
|||
grid.setGroupMemberMinCount(groupPeopleSorted.get(groupPeopleSorted.size()-NumConstant.ONE).getGroupCount()); |
|||
//最少成员小组ID
|
|||
grid.setMinMemberGroupId(groupPeopleSorted.get(groupPeopleSorted.size()-NumConstant.ONE).getGroupId()); |
|||
} |
|||
}); |
|||
}); |
|||
//TODO 网格下小组增量
|
|||
GroupIncrFormDTO groupIncr = new GroupIncrFormDTO(); |
|||
groupIncr.setCustomerId(customerId); |
|||
groupIncr.setYesterday(dateId); |
|||
List<GroupIncrResultDTO> groupIncrResult = groupDataDao.selectGroupIncr(groupIncr); |
|||
result.forEach(grid -> { |
|||
groupIncrResult.forEach(gridIncr -> { |
|||
if (grid.getGridId().equals(gridIncr.getGridId())){ |
|||
grid.setGroupIncr(gridIncr.getGroupIncr()); |
|||
} |
|||
}); |
|||
}); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.dao.stats.DimGridDao; |
|||
import com.epmet.dao.stats.FactGroupGridDailyDao; |
|||
import com.epmet.dto.group.result.CustomerGridInfoResultDTO; |
|||
import com.epmet.dto.group.result.GroupGridDailyResultDTO; |
|||
import com.epmet.service.StatsGroupService; |
|||
import com.epmet.service.group.GroupDataService; |
|||
import com.epmet.service.stats.FactGroupGridDailyService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/16 14:14 |
|||
*/ |
|||
@Service |
|||
public class StatsGroupServiceImpl implements StatsGroupService { |
|||
|
|||
@Autowired |
|||
private DimGridDao dimGridDao; |
|||
@Autowired |
|||
private GroupDataService groupDataService; |
|||
@Autowired |
|||
private FactGroupGridDailyService factGroupGridDailyService; |
|||
|
|||
/** |
|||
* @Description 统计【网格-日】 |
|||
* @param |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public void groupGridDaily() { |
|||
|
|||
//每个客户下的网格信息
|
|||
List<CustomerGridInfoResultDTO> customerGridInfos = dimGridDao.selectCustomerGrid(); |
|||
if (customerGridInfos.size() == NumConstant.ZERO){ |
|||
return; |
|||
} |
|||
//根据customerId分组
|
|||
Map<String, List<CustomerGridInfoResultDTO>> collect = customerGridInfos.stream().collect(Collectors.groupingBy(gridInfo -> gridInfo.getCustomerId())); |
|||
Set<Map.Entry<String, List<CustomerGridInfoResultDTO>>> entries = collect.entrySet(); |
|||
entries.forEach(customerGridInfo -> { |
|||
String customerId = customerGridInfo.getKey(); |
|||
List<CustomerGridInfoResultDTO> gridsInfo = customerGridInfo.getValue(); |
|||
if (gridsInfo.size() != NumConstant.ZERO){ |
|||
List<GroupGridDailyResultDTO> resultDTOS = groupDataService.groupGridDaily(customerId, gridsInfo); |
|||
//执行插入 fact_group_grid_daily
|
|||
factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.stats.FactGroupAgencyDailyDTO; |
|||
import com.epmet.entity.stats.FactGroupAgencyDailyEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-机关日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
public interface FactGroupAgencyDailyService extends BaseService<FactGroupAgencyDailyEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<FactGroupAgencyDailyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
PageData<FactGroupAgencyDailyDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<FactGroupAgencyDailyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
List<FactGroupAgencyDailyDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return FactGroupAgencyDailyDTO |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
FactGroupAgencyDailyDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void save(FactGroupAgencyDailyDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void update(FactGroupAgencyDailyDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.stats.FactGroupAgencyMonthlyDTO; |
|||
import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-机关月统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
public interface FactGroupAgencyMonthlyService extends BaseService<FactGroupAgencyMonthlyEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<FactGroupAgencyMonthlyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
PageData<FactGroupAgencyMonthlyDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<FactGroupAgencyMonthlyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
List<FactGroupAgencyMonthlyDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return FactGroupAgencyMonthlyDTO |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
FactGroupAgencyMonthlyDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void save(FactGroupAgencyMonthlyDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void update(FactGroupAgencyMonthlyDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,103 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.group.result.GroupGridDailyResultDTO; |
|||
import com.epmet.dto.stats.FactGroupGridDailyDTO; |
|||
import com.epmet.entity.stats.FactGroupGridDailyEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-网格日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
public interface FactGroupGridDailyService extends BaseService<FactGroupGridDailyEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<FactGroupGridDailyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
PageData<FactGroupGridDailyDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<FactGroupGridDailyDTO> |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
List<FactGroupGridDailyDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return FactGroupGridDailyDTO |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
FactGroupGridDailyDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void save(FactGroupGridDailyDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void update(FactGroupGridDailyDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-06-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @Description 统计小组【网格-日】 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto); |
|||
} |
@ -0,0 +1,100 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.dao.stats.FactGroupAgencyDailyDao; |
|||
import com.epmet.dto.stats.FactGroupAgencyDailyDTO; |
|||
import com.epmet.entity.stats.FactGroupAgencyDailyEntity; |
|||
import com.epmet.service.stats.FactGroupAgencyDailyService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-机关日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Service |
|||
public class FactGroupAgencyDailyServiceImpl extends BaseServiceImpl<FactGroupAgencyDailyDao, FactGroupAgencyDailyEntity> implements FactGroupAgencyDailyService { |
|||
|
|||
@Override |
|||
public PageData<FactGroupAgencyDailyDTO> page(Map<String, Object> params) { |
|||
IPage<FactGroupAgencyDailyEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, FactGroupAgencyDailyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<FactGroupAgencyDailyDTO> list(Map<String, Object> params) { |
|||
List<FactGroupAgencyDailyEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, FactGroupAgencyDailyDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<FactGroupAgencyDailyEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<FactGroupAgencyDailyEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public FactGroupAgencyDailyDTO get(String id) { |
|||
FactGroupAgencyDailyEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, FactGroupAgencyDailyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(FactGroupAgencyDailyDTO dto) { |
|||
FactGroupAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyDailyEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(FactGroupAgencyDailyDTO dto) { |
|||
FactGroupAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyDailyEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,99 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.dao.stats.FactGroupAgencyMonthlyDao; |
|||
import com.epmet.dto.stats.FactGroupAgencyMonthlyDTO; |
|||
import com.epmet.entity.stats.FactGroupAgencyMonthlyEntity; |
|||
import com.epmet.service.stats.FactGroupAgencyMonthlyService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-机关月统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Service |
|||
public class FactGroupAgencyMonthlyServiceImpl extends BaseServiceImpl<FactGroupAgencyMonthlyDao, FactGroupAgencyMonthlyEntity> implements FactGroupAgencyMonthlyService { |
|||
|
|||
@Override |
|||
public PageData<FactGroupAgencyMonthlyDTO> page(Map<String, Object> params) { |
|||
IPage<FactGroupAgencyMonthlyEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, FactGroupAgencyMonthlyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<FactGroupAgencyMonthlyDTO> list(Map<String, Object> params) { |
|||
List<FactGroupAgencyMonthlyEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, FactGroupAgencyMonthlyDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<FactGroupAgencyMonthlyEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<FactGroupAgencyMonthlyEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public FactGroupAgencyMonthlyDTO get(String id) { |
|||
FactGroupAgencyMonthlyEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, FactGroupAgencyMonthlyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(FactGroupAgencyMonthlyDTO dto) { |
|||
FactGroupAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyMonthlyEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(FactGroupAgencyMonthlyDTO dto) { |
|||
FactGroupAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupAgencyMonthlyEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.stats.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.group.result.GroupGridDailyResultDTO; |
|||
import com.epmet.dto.stats.FactGroupGridDailyDTO; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.dao.stats.FactGroupGridDailyDao; |
|||
import com.epmet.entity.stats.FactGroupGridDailyEntity; |
|||
import com.epmet.service.StatsGroupService; |
|||
import com.epmet.service.group.GroupDataService; |
|||
import com.epmet.service.stats.FactGroupGridDailyService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组-网格日统计数据 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-06-16 |
|||
*/ |
|||
@Service |
|||
public class FactGroupGridDailyServiceImpl extends BaseServiceImpl<FactGroupGridDailyDao, FactGroupGridDailyEntity> implements FactGroupGridDailyService { |
|||
|
|||
@Autowired |
|||
private StatsGroupService statsGroupService; |
|||
|
|||
@Override |
|||
public PageData<FactGroupGridDailyDTO> page(Map<String, Object> params) { |
|||
IPage<FactGroupGridDailyEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, FactGroupGridDailyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<FactGroupGridDailyDTO> list(Map<String, Object> params) { |
|||
List<FactGroupGridDailyEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, FactGroupGridDailyDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<FactGroupGridDailyEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<FactGroupGridDailyEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public FactGroupGridDailyDTO get(String id) { |
|||
FactGroupGridDailyEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, FactGroupGridDailyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(FactGroupGridDailyDTO dto) { |
|||
FactGroupGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupGridDailyEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(FactGroupGridDailyDTO dto) { |
|||
FactGroupGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupGridDailyEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 统计小组【网格-日】 |
|||
* @param |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto) { |
|||
baseDao.insertGroupGridDaily(formDto); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.group.GroupDataDao"> |
|||
|
|||
<!-- 查询网格下的小组总数,状态为 “approved” --> |
|||
<select id="selectGridGroupTotal" resultType="com.epmet.dto.group.result.GridGroupTotalResultDTO" parameterType="com.epmet.dto.group.form.GridGroupTotalFormDTO"> |
|||
SELECT |
|||
grid_id AS gridId, |
|||
COUNT(*) AS gridGroupTotal |
|||
FROM |
|||
resi_group |
|||
WHERE |
|||
DEL_FLAG = 0 |
|||
AND state = #{state} |
|||
AND customer_id = #{customerId} |
|||
GROUP BY |
|||
grid_id |
|||
</select> |
|||
|
|||
<!-- 查询网格下的小组成员总数 , 人员状态不为 “removed” --> |
|||
<select id="selectGridGroupPeopleTotal" parameterType="com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO" resultType="com.epmet.dto.group.result.GridGroupPeopleTotalResultDTO"> |
|||
SELECT |
|||
rg.grid_id AS gridId, |
|||
COUNT(rgm.id) AS gridGroupPeopleTotal |
|||
FROM |
|||
resi_group rg |
|||
LEFT JOIN resi_group_member rgm ON rgm.resi_group_id = rg.id |
|||
WHERE |
|||
rg.DEL_FLAG = 0 |
|||
AND rg.state = #{state} |
|||
AND rg.customer_id = #{customerId} |
|||
AND rgm.status != #{status} |
|||
GROUP BY rg.grid_id |
|||
</select> |
|||
|
|||
<!-- 查询每个小组的人数 --> |
|||
<select id="selectEveryGroupPeopleCount" parameterType="com.epmet.dto.group.form.GridGroupPeopleFormDTO" resultType="com.epmet.dto.group.result.GridGroupPeopleResultDTO"> |
|||
SELECT |
|||
rg.grid_id AS gridId, |
|||
rg.id AS groupId, |
|||
rg.group_name AS groupName, |
|||
COUNT( rgm.id ) AS groupCount |
|||
FROM |
|||
resi_group rg |
|||
LEFT JOIN resi_group_member rgm ON rgm.resi_group_id = rg.id |
|||
WHERE |
|||
rg.DEL_FLAG = 0 |
|||
AND rg.state = #{state} |
|||
AND rg.customer_id = #{customerId} |
|||
AND rgm.STATUS != #{status} |
|||
GROUP BY |
|||
rgm.resi_group_id |
|||
</select> |
|||
|
|||
<!-- 查询网格下的小组日增数 --> |
|||
<select id="selectGroupIncr" resultType="com.epmet.dto.group.result.GroupIncrResultDTO" parameterType="com.epmet.dto.group.form.GroupIncrFormDTO"> |
|||
SELECT |
|||
COUNT(*) AS groupIncr, |
|||
grid_id AS gridId |
|||
FROM |
|||
resi_group |
|||
WHERE |
|||
state = #{state} |
|||
AND customer_id = #{customerId} |
|||
AND DATE_FORMAT( CREATED_TIME, '%Y-%m-%d' ) = #{yesterday} |
|||
GROUP BY |
|||
grid_id |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,34 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.stats.FactGroupAgencyDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.stats.FactGroupAgencyDailyEntity" id="factGroupAgencyDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="weekId" column="WEEK_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="quarterId" column="QUARTER_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="gridTotal" column="GRID_TOTAL"/> |
|||
<result property="groupTotalCount" column="GROUP_TOTAL_COUNT"/> |
|||
<result property="groupMemberTotalCount" column="GROUP_MEMBER_TOTAL_COUNT"/> |
|||
<result property="groupMemberAvgCount" column="GROUP_MEMBER_AVG_COUNT"/> |
|||
<result property="groupMedian" column="GROUP_MEDIAN"/> |
|||
<result property="groupIncr" column="GROUP_INCR"/> |
|||
<result property="groupMemberMaxCount" column="GROUP_MEMBER_MAX_COUNT"/> |
|||
<result property="maxMemberGroupId" column="MAX_MEMBER_GROUP_ID"/> |
|||
<result property="groupMemberMinCount" column="GROUP_MEMBER_MIN_COUNT"/> |
|||
<result property="minMemberGroupId" column="MIN_MEMBER_GROUP_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.stats.FactGroupAgencyMonthlyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.stats.FactGroupAgencyMonthlyEntity" id="factGroupAgencyMonthlyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="quarterId" column="QUARTER_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="gridTotal" column="GRID_TOTAL"/> |
|||
<result property="groupTotal" column="GROUP_TOTAL"/> |
|||
<result property="groupMemberTotal" column="GROUP_MEMBER_TOTAL"/> |
|||
<result property="groupMemberAvgCount" column="GROUP_MEMBER_AVG_COUNT"/> |
|||
<result property="groupMedian" column="GROUP_MEDIAN"/> |
|||
<result property="groupIncr" column="GROUP_INCR"/> |
|||
<result property="groupMemberMaxCount" column="GROUP_MEMBER_MAX_COUNT"/> |
|||
<result property="maxMemberGroupId" column="MAX_MEMBER_GROUP_ID"/> |
|||
<result property="groupMemberMinCount" column="GROUP_MEMBER_MIN_COUNT"/> |
|||
<result property="minMemberGroupId" column="MIN_MEMBER_GROUP_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,68 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.stats.FactGroupGridDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.stats.FactGroupGridDailyEntity" id="factGroupGridDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="weekId" column="WEEK_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="quarterId" column="QUARTER_ID"/> |
|||
<result property="gridTotal" column="GRID_TOTAL"/> |
|||
<result property="groupTotal" column="GROUP_TOTAL"/> |
|||
<result property="groupMemberTotal" column="GROUP_MEMBER_TOTAL"/> |
|||
<result property="groupMemberAvgCount" column="GROUP_MEMBER_AVG_COUNT"/> |
|||
<result property="groupMedian" column="GROUP_MEDIAN"/> |
|||
<result property="groupIncr" column="GROUP_INCR"/> |
|||
<result property="groupMemberMaxCount" column="GROUP_MEMBER_MAX_COUNT"/> |
|||
<result property="maxMemberGroupId" column="MAX_MEMBER_GROUP_ID"/> |
|||
<result property="groupMemberMinCount" column="GROUP_MEMBER_MIN_COUNT"/> |
|||
<result property="minMemberGroupId" column="MIN_MEMBER_GROUP_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<insert id="insertGroupGridDaily"> |
|||
INSERT INTO fact_group_grid_daily (ID, AGENCY_ID, GRID_ID, DATE_ID, WEEK_ID, MONTH_ID, YEAR_ID, QUARTER_ID, GRID_TOTAL, |
|||
GROUP_TOTAL, GROUP_MEMBER_TOTAL, GROUP_MEMBER_AVG_COUNT, GROUP_MEDIAN, GROUP_INCR, GROUP_MEMBER_MAX_COUNT, MAX_MEMBER_GROUP_ID, |
|||
GROUP_MEMBER_MIN_COUNT, MIN_MEMBER_GROUP_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) |
|||
VALUES |
|||
<foreach collection="formDto" item="grid" separator=","> |
|||
( |
|||
REPLACE(UUID(),'-',''), |
|||
#{grid.agencyId}, |
|||
#{grid.gridId}, |
|||
#{grid.dateId}, |
|||
#{grid.weekId}, |
|||
#{grid.monthId}, |
|||
#{grid.yearId}, |
|||
#{grid.quarterId}, |
|||
#{grid.gridTotal}, |
|||
#{grid.groupTotal}, |
|||
#{grid.groupMemberTotal}, |
|||
#{grid.groupMemberAvgCount}, |
|||
#{grid.groupMedian}, |
|||
#{grid.groupIncr}, |
|||
#{grid.groupMemberMaxCount}, |
|||
#{grid.maxMemberGroupId}, |
|||
#{grid.groupMemberMinCount}, |
|||
#{grid.minMemberGroupId}, |
|||
#{grid.delFlag}, |
|||
#{grid.revision}, |
|||
#{grid.createdBy}, |
|||
NOW(), |
|||
#{grid.updatedBy}, |
|||
NOW() |
|||
) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue