diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index ff5e18b091..92d29521e2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -171,6 +171,7 @@ public enum RequirePermissionEnum { */ MORE_PATROL_RECORD_LIST("more_patrol_record_list","更多:日志记录:巡查记录:列表","巡查记录列表"), MORE_SYSTEM_LOG_LIST("MORE_SYSTEM_LOG_LIST","更多:日志记录:系统日志:列表","系统日志列表"), + MORE_GRID_MEMBER_STATS_ANALYSIS("more_grid_member_stats_analysis", "更多:网格员数据分析", "更多:网格员数据分析"), /** diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java new file mode 100644 index 0000000000..45ad8c8d62 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 网格员相关统计formdto + * @author wxz + * @date 2021.07.05 15:46:23 +*/ +@Data +public class GridMemberStatsFormDTO { + + public interface IssueProjectStats {} + + @NotBlank(message = "网格ID不能为空", groups = {IssueProjectStats.class}) + private String gridId; + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java new file mode 100644 index 0000000000..1803db4c96 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class GridMemberDataAnalysisFromDTO { + + public interface listGridMemberDatas {} + + private List gridIds; + + // 搜索的人员姓名 + private String searchedStaffName; + private String month; + @NotBlank(message = "排序规则不能为空", groups = { listGridMemberDatas.class }) + private String sort; + private Integer pageNo = 1; + private Integer pageSize = 10; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java new file mode 100644 index 0000000000..b431cfafab --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.govorg.result; + +import lombok.Data; + +@Data +public class GridMemberDataAnalysisResultDTO { + + private String gridId; + private String staffId; + private String staffName; + private String orgName; + + private Integer projectCount; + private Integer issueToProjectCount; + private Integer closedIssueCount; + private Integer projectResponseCount; + private Integer projectTransferCount; + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java new file mode 100644 index 0000000000..2dfc6a5c1b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java @@ -0,0 +1,39 @@ +package com.epmet.dataaggre.enums; + +import java.util.ArrayList; +import java.util.List; + +public enum GridMemberDataAnalysisEnums { + + SORT_SORT_PROJECT_COUNT("projectCount", "project_count"), + SORT_ISSUE_TO_PROJECT_COUNT("issueToProjectCount", "issue_to_project_count"), + SORT_CLOSED_ISSUE_COUNT("closedIssueCount", "closed_issue_count"), + SORT_PROJECT_RESPONSE_COUNT("projectResponseCount", "project_response_count"), + SORT_PROJECT_TRANSFER_COUNT("projectTransferCount", "project_transfer_count"), + SORT_PROJECT_CLOSED_COUNT("projectClosedCount", "project_closed_count"); + + private String key; + private String value; + + GridMemberDataAnalysisEnums(String key, String value) { + this.key = key; + this.value = value; + } + + public static GridMemberDataAnalysisEnums get(String key) { + for (GridMemberDataAnalysisEnums gm : GridMemberDataAnalysisEnums.values()) { + if (gm.key.equals(key)) { + return gm; + } + } + return null; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index c8a34d86e8..f63ccdcc2c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; @@ -14,6 +15,8 @@ import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PersonalPatrolListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -21,7 +24,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Author zxc @@ -34,6 +40,9 @@ public class EpmetUserController { @Autowired private EpmetUserService epmetUserService; + @Autowired + private DataStatsService dataStatsService; + /** * @Param formDTO @@ -109,4 +118,73 @@ public class EpmetUserController { return new Result>().ok(epmetUserService.personalPatrolList(tokenDto.getUserId())); } + /** + * @Description 网格员项目议题统计数据 + * @return + * @author wxz + * @date 2021.07.05 15:49 + */ + @PostMapping("/gridmember/issueprojectstats") + public Result>> getGridMemberIssueProjectStats(@LoginUser TokenDto loginUser) { + String userId = loginUser.getUserId(); + + GridMemberDataAnalysisResultDTO data = dataStatsService.getGridMemberIssueProjectStats(userId); + List> result = convertToMapList(data); + return new Result>>().ok(result); + } + + /** + * @Description 将议题项目统计数据转为前端需要的格式 + * @return + * @author wxz + * @date 2021.07.05 16:35 + */ + private List> convertToMapList(GridMemberDataAnalysisResultDTO data) { + Integer projectCount = data == null ? 0 : data.getProjectCount(); + Integer closedIssueCount = data == null ? 0 : data.getClosedIssueCount(); + Integer issueToProjectCount = data == null ? 0 : data.getIssueToProjectCount(); + Integer projectClosedCount = data == null ? 0 : data.getProjectClosedCount(); + Integer projectResponseCount = data == null ? 0 : data.getProjectResponseCount(); + Integer projectTransferCount = data == null ? 0 : data.getProjectTransferCount(); + + HashMap projectCountMap = new HashMap<>(); + projectCountMap.put("key", "直接立项数"); + projectCountMap.put("value", projectCount); + projectCountMap.put("type", "project"); + + HashMap closedIssueCountMap = new HashMap<>(); + closedIssueCountMap.put("key", "议题转项目数"); + closedIssueCountMap.put("value", issueToProjectCount); + closedIssueCountMap.put("type", "project"); + + HashMap issueClosedCountMap = new HashMap<>(); + issueClosedCountMap.put("key", "议题关闭数"); + issueClosedCountMap.put("value", closedIssueCount); + issueClosedCountMap.put("type", "issue"); + + HashMap projectResponseCountMap = new HashMap<>(); + projectResponseCountMap.put("key", "项目响应数"); + projectResponseCountMap.put("value", projectResponseCount); + projectResponseCountMap.put("type", "project"); + + HashMap projectTransferCountMap = new HashMap<>(); + projectTransferCountMap.put("key", "项目吹哨数"); + projectTransferCountMap.put("value", projectTransferCount); + projectTransferCountMap.put("type", "project"); + + HashMap projectClosedCountMap = new HashMap<>(); + projectClosedCountMap.put("key", "项目结案数"); + projectClosedCountMap.put("value", projectClosedCount); + projectClosedCountMap.put("type", "project"); + + ArrayList> maps = new ArrayList<>(6); + maps.add(projectCountMap); + maps.add(closedIssueCountMap); + maps.add(issueClosedCountMap); + maps.add(projectResponseCountMap); + maps.add(projectTransferCountMap); + maps.add(projectClosedCountMap); + return maps; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 262aff38c3..6f52f37e7c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -1,20 +1,35 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.govorg.form.GridMemberDataAnalysisFromDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; +import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; +import com.epmet.dataaggre.service.AggreGridService; import com.epmet.dataaggre.service.govorg.GovOrgService; +import com.epmet.dto.result.PublicAndInternalFileResultDTO; +import org.apache.commons.lang3.StringUtils; +import org.apache.xmlbeans.impl.xb.xsdschema.Public; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; +import java.util.PriorityQueue; /** * @Author zxc @@ -27,6 +42,12 @@ public class GovOrgController { @Autowired private GovOrgService govOrgService; + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private AggreGridService aggreGridService; + /** * @param tokenDTO @@ -51,4 +72,51 @@ public class GovOrgController { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(govOrgService.queryNextLevelAreaCodeList(formDTO)); } + + /** + * @Description 网格员统计,列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:14 + */ + @PostMapping("gridmemberdataanalysis") + //@RequirePermission(requirePermission = RequirePermissionEnum.MORE_GRID_MEMBER_STATS_ANALYSIS) + public Result getGridMemberDataAnalysis(@RequestBody GridMemberDataAnalysisFromDTO input) { + ValidatorUtils.validateEntity(input, GridMemberDataAnalysisFromDTO.listGridMemberDatas.class); + + List gridIds = input.getGridIds(); + String month = input.getMonth(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + String sort = input.getSort(); + String searchedStaffName = input.getSearchedStaffName(); + String loginUserId = loginUserUtil.getLoginUserId(); + + // 排序字段检验 + GridMemberDataAnalysisEnums sortType; + if ((sortType = GridMemberDataAnalysisEnums.get(sort)) == null ) { + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(), "未知的排序方式"); + } + + // 用户登录状态判断 + if (StringUtils.isBlank(loginUserId)) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格员统计数据失败"); + } + + // 月份格式判断 + if (StringUtils.isNotBlank(month)) { + if (!month.matches("\\d{4}/\\d{2}")) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "月份格式错误:" + month); + } else { + month = month.replace("/", ""); + } + } + + // 网格id为空处理 + if (CollectionUtils.isEmpty(gridIds)) { + gridIds = new ArrayList<>(); + } + List resultList = aggreGridService.getGridMemberDataAnalysis(gridIds, searchedStaffName, loginUserId, month, sortType.getValue(), pageNo, pageSize); + return new Result().ok(resultList); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..a8ea0bcc94 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dao.datastats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; +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 2021-07-05 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + + /** + * @Description 查询网格员统计数据 + * @return + * @author wxz + * @date 2021.07.05 13:19 + */ + List listGridMemberDataStats(@Param("gridIds") List gridIds, + @Param("searchedStaffName") String searchedStaffName, + @Param("month") String month, + @Param("sort") String sort); + + /** + * @Description 查询网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:17 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(@Param("staffId") String staffId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..63214c950a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.datastats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java new file mode 100644 index 0000000000..3702bbb319 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.service; + +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; + +import java.util.List; + +/** + * @Description 聚合的网格相关service,不指定具体的数据源,它调用其他子service,子service中指定具体数据源 + * @author wxz + * @date 2021.07.05 13:06:35 +*/ +public interface AggreGridService { + /** + * @Description 网格员数据统计列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:17 + */ + List getGridMemberDataAnalysis(List gridIds, String searchedStaffName, String currStaffId, String month, String sort, Integer pageNo, Integer pageSize); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index 8b08a765d2..36ec2943db 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -3,9 +3,11 @@ package com.epmet.dataaggre.service.datastats; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; +import java.security.PrivateKey; import java.util.List; /** @@ -159,4 +161,25 @@ public interface DataStatsService { * @author sun */ GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); + + /** + * @Description 查询网格员统计数据列表 + * @return + * @author wxz + * @date 2021.07.05 13:13 + */ + List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize); + + /** + * @Description 单个网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:05 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index b61338b163..e290386e71 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -1,20 +1,25 @@ package com.epmet.dataaggre.service.datastats.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; +import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -43,6 +48,9 @@ public class DataStatsServiceImpl implements DataStatsService { @Autowired private EvaluationIndexService indexService; + @Autowired + private FactGridMemberStatisticsDailyDao factGridMemberStatisticsDailyDao; + /** * @Param formDTO @@ -1302,4 +1310,20 @@ public class DataStatsServiceImpl implements DataStatsService { return resultDTO; } + @Override + public List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + PageHelper.startPage(pageNo, pageSize); + return factGridMemberStatisticsDailyDao.listGridMemberDataStats(gridIds, searchedStaffName, month, sort); + } + + @Override + public GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId) { + return factGridMemberStatisticsDailyDao.getGridMemberIssueProjectStats( staffId); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java new file mode 100644 index 0000000000..d2fc60ad35 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.dataaggre.service.impl; + +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.service.AggreGridService; +import com.epmet.dataaggre.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.govorg.GovOrgService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class AggreGridServiceImpl implements AggreGridService { + + @Autowired + private GovOrgService govOrgService; + + @Autowired + private DataStatsService dataStatsService; + + @Override + public List getGridMemberDataAnalysis( + List gridIds, + String searchedStaffName, + String currStaffId, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + //1.得到网格id列表 + Map gridIdAndName = new HashMap<>(); + List grids = govOrgService.getGridInfoList(gridIds, currStaffId); + grids.forEach(g -> { + gridIds.add(g.getId()); + gridIdAndName.put(g.getId(), g.getGridName()); + }); + + //2.查询列表,并且填充内容 + List records = dataStatsService.listGridMemberDataStats(gridIds, searchedStaffName, month, sort, pageNo, pageSize); + records.forEach(r -> r.setOrgName(gridIdAndName.get(r.getGridId()))); + return records; + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..6795b4cd23 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + member.id, + member.date_id, + member.month_id, + member.year_id, + member.customer_id, + member.agency_id, + member.grid_id, + member.pid, + member.pids, + member.staff_id, + member.staff_name, + member.project_count, + member.issue_to_project_count, + member.closed_issue_count, + member.project_response_count, + member.project_transfer_count, + member.project_closed_count, + member.project_incr, + member.issue_to_project_incr, + member.closed_issue_incr, + member.project_response_incr, + member.project_transfer_incr, + member.project_closed_incr, + member.del_flag, + member.revision, + member.created_by, + member.created_time, + member.updated_by, + member.updated_time + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java index f57927f65d..16a972293e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java @@ -15,6 +15,7 @@ public class OrgStatisticsResultDTO implements Serializable { private static final long serialVersionUID = 9221060553279124719L; private String customerId; private String agencyId; + private String staffId; private String level; private String orgId; private Integer count; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java new file mode 100644 index 0000000000..b792e6ea15 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java @@ -0,0 +1,62 @@ +/** + * 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.org; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +public class CustomerStaffGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + /** + * 组织ID + */ + private String agencyId; + /** + * 网格ID + */ + private String gridId; + /** + * 上级组织ID + */ + private String pid; + /** + * 所有上级组织ID + */ + private String pids; + /** + * 用户id, user.id + */ + private String staffId; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java new file mode 100644 index 0000000000..071d00753c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java @@ -0,0 +1,181 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectCountIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java new file mode 100644 index 0000000000..c5d1e237a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java new file mode 100644 index 0000000000..ba18432357 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/7/5 9:49 + */ +@Data +public class StaffRoleInfoDTO implements Serializable { + private static final long serialVersionUID = 5005209786187370928L; + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 用户ID + */ + private String staffId; + + /** + * 用户名 + */ + private String staffName; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index a5317f5ba2..202dac9013 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -121,6 +121,8 @@ public class DemoController { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; @GetMapping("testAlarm") public void testAlarm() { @@ -936,4 +938,10 @@ public class DemoController { return new Result(); } + @PostMapping("extractFactGridMemberDaily") + public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId()); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 2cce1d4a19..49d462eaa0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.*; +import com.epmet.service.stats.DimCustomerService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -35,6 +36,8 @@ public class FactOriginExtractController { private ProjectExtractService projectExtractService; @Autowired private GroupExtractService groupExtractService; + @Autowired + private DimCustomerService dimCustomerService; /** * desc:抽取业务数据到统计库 @@ -92,7 +95,12 @@ public class FactOriginExtractController { @PostMapping("project") public Result projectData(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { - projectExtractService.saveOriginProjectDaily(extractOriginFormDTO); + List customerIds = dimCustomerService.selectCustomerIdPage(1, 100); + customerIds.forEach(customerId -> { + ExtractOriginFormDTO dto = new ExtractOriginFormDTO(); + dto.setCustomerId(customerId); + projectExtractService.saveOriginProjectDaily(dto); + }); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..111f4d923a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,34 @@ +/** + * 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.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + int deleteDataByCustomer(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("deleteSize") Integer deleteSize); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java new file mode 100644 index 0000000000..9d15a1cab5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.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.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 7154f5997e..5e9177adf7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.IssueLogDailyFormDTO; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -130,4 +131,43 @@ public interface FactOriginIssueLogDailyDao extends BaseDao + */ + List getIssueToProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 议题转项目增量 + * @author zhaoqifeng + * @date 2021/7/5 15:55 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getIssueToProjectIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数总量 + * @author zhaoqifeng + * @date 2021/7/5 16:37 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数增量 + * @author zhaoqifeng + * @date 2021/7/5 16:38 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueIncr(@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/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 3bdbc200bd..45f3ba2350 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -326,4 +326,59 @@ public interface FactOriginProjectLogDailyDao extends BaseDao + */ + List getProjectResponseCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目响应增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectResponseIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 1c4aa60c18..32178e4da7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -506,4 +506,24 @@ public interface FactOriginProjectMainDailyDao extends BaseDao + */ + List getMemberProjectCountIncr(@Param("customerId")String customerId, @Param("dateId") String dateId); + + /** + * 获取项目立项数 + * @author zhaoqifeng + * @date 2021/7/5 14:49 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getMemberProjectCount(@Param("customerId")String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index b8d9093631..93b72c077a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -77,4 +78,13 @@ public interface CustomerGridDao extends BaseDao { * @Date 2020/9/16 14:03 **/ List selectListGridInfo(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:25 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(@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/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index 3c278bc523..9ad54a48e6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -5,6 +5,7 @@ import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; import com.epmet.dto.user.result.CustomerStaffDTO; import com.epmet.dto.user.result.StaffPatrolRecordResult; import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; @@ -164,6 +165,8 @@ public interface UserDao { */ List selectStaffInfo(@Param("list") List staffUserIdList); + List getStaffByRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey); + /** * desc: 根据角色key条件获取所有的人 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..76ff908449 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,151 @@ +/** + * 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.evaluationindex.extract; + +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 2021-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java new file mode 100644 index 0000000000..86f5fa647c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +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 2021-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_monthly") +public class FactGridMemberStatisticsMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java index be69a89f3d..aa3f6e3ca2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java @@ -148,4 +148,9 @@ public class FactOriginProjectMainDailyEntity extends BaseEpmetEntity { */ private String finishOrgIds; + /** + * 项目创建人(议题转项目或立项人) + */ + private String projectCreator; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java new file mode 100644 index 0000000000..da2f35ce6f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java @@ -0,0 +1,41 @@ +/** + * 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.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsDailyService extends BaseService { + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + void extractGridMemberStatisticsDaily(String customerId, String dateId); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java new file mode 100644 index 0000000000..a8e08fc1f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java @@ -0,0 +1,31 @@ +/** + * 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.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsMonthlyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 5bb46392f6..755b53adb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -19,9 +19,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import java.util.List; +import java.util.Map; /** * 议题记录附表 @@ -77,4 +79,26 @@ public interface FactOriginIssueLogDailyService extends BaseService> + */ + Map> getIssueToProjectCount(String customerId, String dateId, Integer type); + + /** + * 工作人员关闭议题数 + * @author zhaoqifeng + * @date 2021/7/5 16:40 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getClosedIssueCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java index b925cc31e4..2d95509fca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java @@ -330,4 +330,37 @@ public interface FactOriginProjectLogDailyService extends BaseService */ Map getAgencyGridSelfDaily(String customerId, String dateId); + + /** + * 项目响应数 + * @author zhaoqifeng + * @date 2021/7/5 16:56 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectResponseCount(String customerId, String dateId, Integer type); + + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectTransferCount(String customerId, String dateId, Integer type); + + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectClosedCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 0f55775b23..ac0389164d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -475,4 +475,16 @@ public interface FactOriginProjectMainDailyService extends BaseService> + */ + Map> getMemberProjectCount(String customerId, String dateId, Integer type); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java new file mode 100644 index 0000000000..e7f436de06 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java @@ -0,0 +1,407 @@ +/** + * 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.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.IndexCalConstant; +import com.epmet.constant.RoleKeyConstants; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; +import com.epmet.service.org.CustomerGridService; +import com.epmet.service.user.UserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +@Slf4j +public class FactGridMemberStatisticsDailyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsDailyService { + + @Resource + private UserService userService; + @Resource + private CustomerGridService customerGridService; + @Resource + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Resource + private FactOriginIssueLogDailyService factOriginIssueLogDailyService; + @Resource + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + + + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + @Override + public void extractGridMemberStatisticsDaily(String customerId, String dateId) { + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计开始"); + List staffGridList = customerGridService.getCustomerStaffGridList(customerId); + List staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { + return; + } + Map staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, + Function.identity())); + List list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> { + StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId()); + return initEntity(customerId, dateId, item, staffInfo); + }).collect(Collectors.toList()); + + //数据统计 + GetGridMemberData getGridMemberData = new GetGridMemberData(customerId, dateId).invoke(); + Map> projectCountMap = getGridMemberData.getProjectCountMap(); + Map> projectIncrMap = getGridMemberData.getProjectIncrMap(); + Map> issueToProjectCountMap = getGridMemberData.getIssueToProjectCountMap(); + Map> issueToProjectIncrMap = getGridMemberData.getIssueToProjectIncrMap(); + Map> closedIssueCountMap = getGridMemberData.getClosedIssueCountMap(); + Map> closedIssueIncrMap = getGridMemberData.getClosedIssueIncrMap(); + Map> projectResponseCountMap = getGridMemberData.getProjectResponseCountMap(); + Map> projectResponseIncrMap = getGridMemberData.getProjectResponseIncrMap(); + Map> projectTransferCountMap = getGridMemberData.getProjectTransferCountMap(); + Map> projectTransferIncrMap = getGridMemberData.getProjectTransferIncrMap(); + Map> projectClosedCountMap = getGridMemberData.getProjectClosedCountMap(); + Map> projectClosedIncrMap = getGridMemberData.getProjectClosedIncrMap(); + + list.forEach(item -> { + //赋值 + setEntityData(projectCountMap, projectIncrMap, issueToProjectCountMap, issueToProjectIncrMap, closedIssueCountMap, closedIssueIncrMap, + projectResponseCountMap, projectResponseIncrMap, projectTransferCountMap, projectTransferIncrMap, projectClosedCountMap, + projectClosedIncrMap, item); + + }); + + if (CollectionUtils.isNotEmpty(list)) { + int deleteNum; + do { + deleteNum = baseDao.deleteDataByCustomer(customerId, dateId, IndexCalConstant.DELETE_SIZE); + } while (deleteNum != NumConstant.ZERO); + //删除旧数据 + insertBatch(list); + } + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计结束"); + } + + /** + * 数据赋值 + * @author zhaoqifeng + * @date 2021/7/7 10:57 + * @param projectCountMap + * @param projectIncrMap + * @param issueToProjectCountMap + * @param issueToProjectIncrMap + * @param closedIssueCountMap + * @param closedIssueIncrMap + * @param projectResponseCountMap + * @param projectResponseIncrMap + * @param projectTransferCountMap + * @param projectTransferIncrMap + * @param projectClosedCountMap + * @param projectClosedIncrMap + * @param item + * @return void + */ + private void setEntityData(Map> projectCountMap, Map> projectIncrMap, + Map> issueToProjectCountMap, Map> issueToProjectIncrMap, + Map> closedIssueCountMap, Map> closedIssueIncrMap, + Map> projectResponseCountMap, Map> projectResponseIncrMap, + Map> projectTransferCountMap, Map> projectTransferIncrMap, + Map> projectClosedCountMap, Map> projectClosedIncrMap, + FactGridMemberStatisticsDailyEntity item) { + //项目立项数 + List projectCount = projectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectCount)) { + projectCount.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectCount(dto.getCount()); + } + }); + } + //项目立项日增量 + List projectIncr = projectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectIncr)) { + projectIncr.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectIncr(dto.getCount()); + } + }); + } + //议题转项目数 + List issueToProjectCount = issueToProjectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectCount)) { + issueToProjectCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectCount(dto.getCount()); + } + }); + } + //议题转项目日增量 + List issueToProjectIncr = issueToProjectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectIncr)) { + issueToProjectIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectIncr(dto.getCount()); + } + }); + } + //议题关闭数 + List closedIssueCount = closedIssueCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueCount)) { + closedIssueCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueCount(dto.getCount()); + } + }); + } + //议题关闭数日增量 + List closedIssueIncr = closedIssueIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueIncr)) { + closedIssueIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectResponseCount = projectResponseCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseCount)) { + projectResponseCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectResponseIncr = projectResponseIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseIncr)) { + projectResponseIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseIncr(dto.getCount()); + } + }); + } + //项目吹哨数 + List projectTransferCount = projectTransferCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferCount)) { + projectTransferCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferCount(dto.getCount()); + } + }); + } + //项目吹哨数日增量 + List projectTransferIncr = projectTransferIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferIncr)) { + projectTransferIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectClosedCount = projectClosedCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedCount)) { + projectClosedCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectClosedIncr = projectClosedIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedIncr)) { + projectClosedIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedIncr(dto.getCount()); + } + }); + } + } + + /** + * 初始化Entity + * @author zhaoqifeng + * @date 2021/7/7 10:55 + * @param customerId + * @param dateId + * @param item + * @param staffInfo + * @return com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity + */ + private FactGridMemberStatisticsDailyEntity initEntity(String customerId, String dateId, CustomerStaffGridDTO item, StaffRoleInfoDTO staffInfo) { + FactGridMemberStatisticsDailyEntity entity = new FactGridMemberStatisticsDailyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(item.getAgencyId()); + entity.setGridId(item.getGridId()); + entity.setPid(item.getPid()); + entity.setPids(item.getPids()); + entity.setGridId(item.getGridId()); + entity.setYearId(dateId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(dateId.substring(NumConstant.ZERO, NumConstant.SIX)); + entity.setDateId(dateId); + entity.setStaffId(item.getStaffId()); + entity.setStaffName(staffInfo.getStaffName()); + entity.setProjectCount(NumConstant.ZERO); + entity.setProjectIncr(NumConstant.ZERO); + entity.setIssueToProjectCount(NumConstant.ZERO); + entity.setIssueToProjectIncr(NumConstant.ZERO); + entity.setClosedIssueCount(NumConstant.ZERO); + entity.setClosedIssueIncr(NumConstant.ZERO); + entity.setProjectClosedCount(NumConstant.ZERO); + entity.setProjectClosedIncr(NumConstant.ZERO); + entity.setProjectResponseCount(NumConstant.ZERO); + entity.setProjectResponseIncr(NumConstant.ZERO); + entity.setProjectTransferCount(NumConstant.ZERO); + entity.setProjectTransferIncr(NumConstant.ZERO); + return entity; + } + + /** + * 网格员数据统计 + * @author zhaoqifeng + * @date 2021/7/7 10:55 + */ + private class GetGridMemberData { + private String customerId; + private String dateId; + private Map> projectCountMap; + private Map> projectIncrMap; + private Map> issueToProjectCountMap; + private Map> issueToProjectIncrMap; + private Map> closedIssueCountMap; + private Map> closedIssueIncrMap; + private Map> projectResponseCountMap; + private Map> projectResponseIncrMap; + private Map> projectTransferCountMap; + private Map> projectTransferIncrMap; + private Map> projectClosedCountMap; + private Map> projectClosedIncrMap; + + GetGridMemberData(String customerId, String dateId) { + this.customerId = customerId; + this.dateId = dateId; + } + + Map> getProjectCountMap() { + return projectCountMap; + } + + Map> getProjectIncrMap() { + return projectIncrMap; + } + + Map> getIssueToProjectCountMap() { + return issueToProjectCountMap; + } + + Map> getIssueToProjectIncrMap() { + return issueToProjectIncrMap; + } + + Map> getClosedIssueCountMap() { + return closedIssueCountMap; + } + + Map> getClosedIssueIncrMap() { + return closedIssueIncrMap; + } + + Map> getProjectResponseCountMap() { + return projectResponseCountMap; + } + + Map> getProjectResponseIncrMap() { + return projectResponseIncrMap; + } + + Map> getProjectTransferCountMap() { + return projectTransferCountMap; + } + + Map> getProjectTransferIncrMap() { + return projectTransferIncrMap; + } + + Map> getProjectClosedCountMap() { + return projectClosedCountMap; + } + + Map> getProjectClosedIncrMap() { + return projectClosedIncrMap; + } + + GetGridMemberData invoke() { + //项目立项数 + projectCountMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ZERO); + projectIncrMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ONE); + //议题转项目数 + issueToProjectCountMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ZERO); + issueToProjectIncrMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ONE); + //议题关闭数 + closedIssueCountMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ZERO); + closedIssueIncrMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ONE); + //项目响应数 + projectResponseCountMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, + dateId, NumConstant.ZERO); + projectResponseIncrMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, dateId + , NumConstant.ONE); + //项目吹哨数 + projectTransferCountMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, + dateId, NumConstant.ZERO); + projectTransferIncrMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, dateId + , NumConstant.ONE); + //项目结案数 + projectClosedCountMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, + dateId, NumConstant.ZERO); + projectClosedIncrMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, dateId + , NumConstant.ONE); + return this; + } + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java new file mode 100644 index 0000000000..19f4e54698 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * 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.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsMonthlyDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +public class FactGridMemberStatisticsMonthlyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsMonthlyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index 9bde7a5a94..e05775938e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; @@ -32,8 +33,12 @@ import com.epmet.service.stats.DimAgencyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 议题记录附表 @@ -115,4 +120,52 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 15:52 + */ + @Override + public Map> getIssueToProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getIssueToProjectCount(customerId, dateId); + } else { + list = baseDao.getIssueToProjectIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 工作人员关闭议题数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:40 + */ + @Override + public Map> getClosedIssueCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getClosedIssueCount(customerId, dateId); + } else { + list = baseDao.getClosedIssueIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index 73de4eb905..311da04715 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -433,5 +433,77 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 16:56 + */ + @Override + public Map> getProjectResponseCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectResponseCount(customerId, dateId); + } else { + list = baseDao.getProjectResponseIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目吹哨数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectTransferCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectTransferCount(customerId, dateId); + } else { + list = baseDao.getProjectTransferIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目结案数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectClosedCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectClosedCount(customerId, dateId); + } else { + list = baseDao.getProjectClosedIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 3e8b210781..65980d157a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -711,5 +711,29 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 14:48 + */ + @Override + public Map> getMemberProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getMemberProjectCount(customerId, dateId); + } else { + list = baseDao.getMemberProjectCountIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 0ec9de39bb..d5dcfc50ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -89,38 +89,39 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { List pendingList = factOriginProjectMainDailyService.getPendingList(customerId); List finishOrgList = projectProcessService.getFinishOrg(customerId, dateString); if (!CollectionUtils.isEmpty(closedList)) { - List closeProjects = - pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { - FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); - entity.setId(process.getProjectId()); - entity.setProjectStatus(ProjectConstant.CLOSED); - entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); - entity.setUpdatedTime(process.getUpdatedTime()); - entity.setIsResolved(process.getIsResolved()); - return entity; - })).collect(Collectors.toList()); - - if (!CollectionUtils.isEmpty(finishOrgList)) { - closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { - String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); - String org = ""; - //取最短的ordIds中最后一个 则为最高级的那个orgIds - if (orgIds.length > NumConstant.ONE) { - org = orgIds[orgIds.length - 1]; - } else { - org = orgIds[0]; - } - if (StringUtils.isNotEmpty(dto.getGridId())) { - org = org + StrConstant.COLON + dto.getGridId(); - } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { - org = org + StrConstant.COLON + dto.getDepartmentId(); - } - close.setFinishOrgIds(org); - })); - } - //更新状态 - if (!closeProjects.isEmpty()) { - factOriginProjectMainDailyService.updateBatchById(closeProjects); + if(!CollectionUtils.isEmpty(pendingList)) { + List closeProjects = + pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { + FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); + entity.setId(process.getProjectId()); + entity.setProjectStatus(ProjectConstant.CLOSED); + entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); + entity.setUpdatedTime(process.getUpdatedTime()); + entity.setIsResolved(process.getIsResolved()); + return entity; + })).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(finishOrgList)) { + closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { + String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); + String org = ""; + //取最短的ordIds中最后一个 则为最高级的那个orgIds + if (orgIds.length > NumConstant.ONE) { + org = orgIds[orgIds.length - 1]; + } else { + org = orgIds[0]; + } + if (StringUtils.isNotEmpty(dto.getGridId())) { + org = org + StrConstant.COLON + dto.getGridId(); + } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { + org = org + StrConstant.COLON + dto.getDepartmentId(); + } + close.setFinishOrgIds(org); + })); + } + //更新状态 + if (!closeProjects.isEmpty()) { + factOriginProjectMainDailyService.updateBatchById(closeProjects); + } } } //获取项目信息 @@ -177,6 +178,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } entity.setIsParty(NumConstant.ZERO_STR); entity.setIsOverdue(NumConstant.ZERO_STR); + entity.setProjectCreator(project.getCreatedBy()); return entity; }).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(issueList)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index d2d37a4693..73f801ef3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.service.evaluationindex.screen.*; @@ -76,6 +77,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; /** * @param extractOriginFormDTO @@ -264,6 +267,12 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { }catch(Exception e){ log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); } + + try{ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + }catch(Exception e){ + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } extractPartData(customerId, dateId); log.info("===== extractDaily method end ======"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 2cdee8ccad..b25ff45b5f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -3,6 +3,7 @@ package com.epmet.service.org; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; @@ -50,4 +51,13 @@ public interface CustomerGridService { * @Date 2020/9/16 14:02 **/ List queryGridInfoList(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:21 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index fa8018e1e1..b3474f5574 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.org.CustomerGridService; @@ -64,4 +65,17 @@ public class CustomerGridServiceImpl implements CustomerGridService { public List queryGridInfoList(String customerId) { return customerGridDao.selectListGridInfo(customerId); } + + /** + * 查询工作人员网格关系 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 10:21 + */ + @Override + public List getCustomerStaffGridList(String customerId) { + return customerGridDao.getCustomerStaffGridList(customerId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 55e3b5f4fb..f53f544575 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -6,6 +6,7 @@ import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.dto.user.result.StaffRoleInfoDTO; import com.epmet.dto.user.result.CustomerStaffDTO; import com.epmet.dto.user.result.StaffPatrolRecordResult; import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; @@ -99,6 +100,17 @@ public interface UserService { */ Map queryOrgGridManager(String customerId,List orgStaffDTOList); + /** + * 根据角色key查找工作人员 + * + * @author zhaoqifeng + * @date 2021/7/5 9:52 + * @param customerId + * @param roleKey + * @return java.util.List + */ + List getStaffByRoleKey(String customerId, String roleKey); + /** * desc: 请描述类的业务用途 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 725c11d8f4..22a454fcb2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; import com.epmet.dto.user.result.CustomerStaffDTO; import com.epmet.dto.user.result.StaffPatrolRecordResult; import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; @@ -802,6 +803,20 @@ public class UserServiceImpl implements UserService { return resultMap; } + /** + * 根据角色key查找工作人员 + * + * @param customerId + * @param roleKey + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 9:52 + */ + @Override + public List getStaffByRoleKey(String customerId, String roleKey) { + return userDao.getStaffByRoleKey(customerId, roleKey); + } + @Override public List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO) { formDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_GRID_MEMBER); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql new file mode 100644 index 0000000000..c8c90b5370 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql @@ -0,0 +1,41 @@ +#网格员数据分析需求 脚本 2021-07-06 +CREATE TABLE `fact_grid_member_statistics_daily` +( + `ID` varchar(64) NOT NULL COMMENT '主键(t-1)', + `DATE_ID` varchar(32) NOT NULL COMMENT 'yyyyMMdd', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月份ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年度ID', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(32) NOT NULL COMMENT '组织ID', + `GRID_ID` varchar(32) NOT NULL COMMENT '网格I', + `PID` varchar(32) NOT NULL COMMENT '上级ID(网格所属Agency的上级组织Id)', + `PIDS` varchar(512) NOT NULL COMMENT '所有agencyId的上级组织ID(包含agencyId)', + `STAFF_ID` varchar(32) NOT NULL COMMENT '工作人员ID', + `STAFF_NAME` varchar(32) DEFAULT NULL COMMENT '工作人员姓名', + `PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数', + `ISSUE_TO_PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数', + `CLOSED_ISSUE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数', + `PROJECT_RESPONSE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数', + `PROJECT_TRANSFER_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数', + `PROJECT_CLOSED_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数', + `PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数日增量', + `ISSUE_TO_PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数日增量', + `CLOSED_ISSUE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数日增量', + `PROJECT_RESPONSE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数日增量', + `PROJECT_TRANSFER_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数日增量', + `PROJECT_CLOSED_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数日增量', + `DEL_FLAG` int(11) DEFAULT NULL COMMENT '删除状态,0:正常,1:删除', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='网格员数据统计_日统计'; +#添加唯一索引 +ALTER TABLE `epmet_data_statistical`.`fact_grid_member_statistics_daily` + ADD UNIQUE INDEX `unx_staff`(`DATE_ID`, `STAFF_ID`, `GRID_ID`) USING BTREE; + +ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily` + ADD COLUMN `PROJECT_CREATOR` varchar(32) NULL COMMENT '项目创建人(议题转项目或立项人)' AFTER `IS_SATISFIED`; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..8a43152a4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from fact_grid_member_statistics_daily + where CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + limit #{deleteSize} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml new file mode 100644 index 0000000000..dc8760fab8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 521ef174e4..995c6cebad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -177,4 +177,64 @@ and M.IS_PARTY=#{isParty} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index b5a2fe362f..a5c0960f9c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -737,4 +737,106 @@ GROUP BY da.ID + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index e55e3b5076..8dd740bf05 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -1069,4 +1069,39 @@ AND m.IS_RESOLVED=#{isResolved} + + + 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 ce72f989f2..59219341a1 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 @@ -241,7 +241,7 @@ i.DEL_FLAG = '0' AND ip.DEL_FLAG = '0' AND i.CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(i.CREATED_TIME,'%Y%m%d') = #{dateId} + AND DATE_FORMAT(ip.CREATED_TIME,'%Y%m%d') = #{dateId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 7aa2bf3422..c80de35a85 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -86,4 +86,22 @@ CG.CUSTOMER_ID =#{customerId} and cg.del_flag='0' + \ 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 18ba4d2a0f..f73f12eb5f 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 @@ -86,6 +86,7 @@ STATUS, CLOSED_STATUS, ORG_ID_PATH, + CREATED_BY, CREATED_TIME, UPDATED_TIME FROM project diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index c21c5c9c40..e04a6931bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -570,6 +570,23 @@ user_id = #{userId} +