diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java index 1dec273299..8edc31e7e2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java @@ -11,10 +11,24 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum BizTypeEnum { - //枚举类型 + //枚举类型 user,group,topic,issue,project,article + USER("user", "用户"), GROUP("group", "小组"), - ACTIVITY("activity", "活动"), - AGENCY("agency", "组织"); + TOPIC("topic", "话题"), + ISSUE("issue", "议题"), + PROJECT("project", "项目"), + ARTICLE("article", "文章(党建声音)"), + ; + + public static BizTypeEnum getEnum(String code) { + BizTypeEnum[] values = BizTypeEnum.values(); + for (BizTypeEnum value : values) { + if (value.getType().equals(code)) { + return value; + } + } + return null; + } /** * 类型 @@ -23,6 +37,6 @@ public enum BizTypeEnum { /** * 描述 */ - private String typeDesc; + private String desc; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java index d709731f77..77bcd7cc34 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java @@ -151,6 +151,15 @@ public class FactAgencyGovernDailyEntity extends BaseEpmetEntity { */ private Integer inGroupTopicUnResolvedCount; + /** + * 11、当前组织内:来源于事件的项目:结案已解决数 + */ + private Integer eventResolvedCount; + /** + * 12、当前组织内:来源于事件的项目:结案无需解决数 + */ + private Integer eventUnResolvedCount; + /** * 未出当前网格的,结案项目数 */ @@ -171,4 +180,5 @@ public class FactAgencyGovernDailyEntity extends BaseEpmetEntity { */ private Integer districtDeptClosedCount; + } 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 31cf2174d6..ac426b81d7 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 @@ -1188,13 +1188,20 @@ public class DataStatsServiceImpl implements DataStatsService { Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getStreetClosedCount).sum(); //由区直部门结案的项目总数 Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getDistrictDeptClosedCount).sum(); - - resultDTO.setProblemResolvedCount(problemResolvedCount); + Integer issueResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getIssueProjectResolvedCount).sum(); + Integer issueUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getIssueProjectUnResolvedCount).sum(); + Integer projectResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getApprovalProjectResolvedCount).sum(); + Integer projectUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getApprovalProjectUnResolvedCount).sum(); + Integer eventResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getEventResolvedCount).sum(); + Integer eventUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getEventUnResolvedCount).sum(); + Integer closedProjectTotal = issueResolvedCount + issueUnResolvedCount+projectResolvedCount + + projectUnResolvedCount + eventResolvedCount + eventUnResolvedCount; + resultDTO.setProblemResolvedCount(closedProjectTotal); resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); - resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); - resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); - resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); - resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); + resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, closedProjectTotal)); + resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, closedProjectTotal)); + resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, closedProjectTotal)); + resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, closedProjectTotal)); return resultDTO; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index ac6ee4a24e..f2ecba7e68 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -604,6 +604,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { log.error("getStaffInfo have any agency staffId:{}",staffId); return null; } + result.setStaffId(staffEntity.getUserId()); result.setAgencyId(agencyDTO.getId()); result.setAgencyName(agencyDTO.getOrganizationName()); result.setAgencyPIds(agencyDTO.getPids()); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml index 4943a96776..681c057922 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml @@ -221,7 +221,7 @@ agency_id AS agencyId, issue_total AS shiftedIssueTotal FROM - fact_issue_agency_daily + fact_topic_issue_agency_daily WHERE del_flag = '0' AND date_id = #{dateId} @@ -266,7 +266,7 @@ grid_id AS gridId, issue_total AS shiftedIssueTotal FROM - fact_issue_grid_daily + fact_topic_issue_grid_daily WHERE del_flag = '0' AND date_id = #{dateId} @@ -624,7 +624,9 @@ SELECT agency_id AS agencyId, `level` AS level, - problem_resolved_count AS problemResolvedCount, + ISSUE_PROJECT_RESOLVED_COUNT+ISSUE_PROJECT_UN_RESOLVED_COUNT + +APPROVAL_PROJECT_RESOLVED_COUNT+APPROVAL_PROJECT_UN_RESOLVED_COUNT + +EVENT_RESOLVED_COUNT+EVENT_UN_RESOLVED_COUNT AS problemResolvedCount, concat(ROUND(group_self_govern_ratio*100, 1),'%') AS groupSelfGovernRatio, concat(ROUND(grid_self_govern_ratio*100, 1),'%') AS gridSelfGovernRatio, concat(ROUND(community_closed_ratio*100, 1),'%') AS communityResolvedRatio, @@ -638,13 +640,15 @@ agency_id = #{agencyId} - ORDER BY problem_resolved_count DESC + ORDER BY problemResolvedCount DESC @@ -41,7 +41,7 @@ left join screen_customer_agency pa on(agency.PARENT_AREA_CODE=pa.AREA_CODE and pa.DEL_FLAG='0') - left join screen_govern_rank_data rankData + left join screen_govern_rank_data_daily rankData ON (agency.AGENCY_ID =rankData.org_id AND rankData.DEL_FLAG = '0' and rankData.org_type='agency') @@ -51,7 +51,7 @@ #{orgId} - AND rankData.MONTH_ID =#{monthId} + AND rankData.DATE_ID =#{monthId} ) union ( @@ -67,7 +67,7 @@ FROM screen_customer_grid grid left join screen_customer_agency ca on (ca.agency_id = grid.parent_agency_id) - left join screen_govern_rank_data rankData + left join screen_govern_rank_data_daily rankData ON (grid.grid_id=rankData.org_id AND grid.DEL_FLAG = 0 and rankData.org_type='grid') @@ -76,7 +76,7 @@ #{orgId} - AND rankData.MONTH_ID =#{monthId} + AND rankData.DATE_ID =#{monthId} ) ORDER BY RESPONSE_RATIO DESC diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java index 3f9c614f8a..a550775779 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java @@ -129,6 +129,15 @@ public class FactAgencyGovernDailyDTO implements Serializable { */ private Integer inGroupTopicUnResolvedCount; + /** + * 11、当前组织内:来源于事件的项目:结案已解决数 + */ + private Integer eventResolvedCount; + /** + * 12、当前组织内:来源于事件的项目:结案无需解决数 + */ + private Integer eventUnResolvedCount; + /** * 未出当前网格的,结案项目数 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java index 778ffcb9a4..b8d585f00f 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java @@ -140,6 +140,15 @@ public class FactGridGovernDailyDTO implements Serializable { */ private Integer fromAgencyUnResolvedInGridCount; + /** + * 15、当前组织内:来源于事件的项目:结案已解决数 + */ + private Integer eventResolvedCount; + /** + * 16、当前组织内:来源于事件的项目:结案无需解决数 + */ + private Integer eventUnResolvedCount; + /** * 15、未出当前网格的,结案项目数=11+12+13+14 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AggregationExtractFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AggregationExtractFormDTO.java index e307587313..1dd051f139 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AggregationExtractFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AggregationExtractFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.extract.form; import lombok.Data; import java.io.Serializable; +import java.util.Set; /** * desc: 从业务数据抽取到统计库Form DTO @@ -30,4 +31,10 @@ public class AggregationExtractFormDTO implements Serializable { * 抽取类型 monthly,daily */ private String type; + + /** + * 要抽取的具体业务类型 不传默认所有 + * @see com.epmet.commons.tools.enums.BizTypeEnum + */ + private Set bizType; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java index 1b6697f1ec..6e8c7b153e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java @@ -24,4 +24,6 @@ public interface DimObjectActionConstant { // perfect 非常满意 // created 立项 String PROJECT_RETURN="return"; + + String PROJECT_CLOSE="close"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactAggregationExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactAggregationExtractController.java index c0618c9250..c05e3d4b7b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactAggregationExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactAggregationExtractController.java @@ -1,6 +1,12 @@ package com.epmet.controller; +import cn.hutool.core.thread.ThreadUtil; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; @@ -14,8 +20,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.Date; import java.util.List; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; /** * @author liujianjun @@ -49,42 +57,101 @@ public class FactAggregationExtractController { * @date 2020/11/10 3:14 下午 */ @RequestMapping("extractDailyOrMonthly") - public Result extractDaily(@RequestBody AggregationExtractFormDTO formDTO) { + public Result extractDailyOrMonthly(@RequestBody AggregationExtractFormDTO formDTO) { if (StringUtils.isBlank(formDTO.getStartDate()) && StringUtils.isBlank(formDTO.getEndDate())) { log.error("抽取日期范围不能为空"); return new Result().error(); } - if (formDTO.getStartDate().indexOf(StrConstant.HYPHEN) < 0 || formDTO.getEndDate().indexOf(StrConstant.HYPHEN) < 0) { + if (!formDTO.getStartDate().contains(StrConstant.HYPHEN) || !formDTO.getEndDate().contains(StrConstant.HYPHEN)) { log.error("抽取日期范围格式不正确,yyyy-MM-dd"); return new Result().error(); } + + BizTypeEnum bizTypeEnum = null; + + Set bizType = formDTO.getBizType(); + for (String item : bizType) { + bizTypeEnum = BizTypeEnum.getEnum(item); + if (bizTypeEnum == null) { + log.error("抽取业务类型不正确,BizTypeEnum"); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + } + + List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate(), DateUtils.DATE_PATTERN, DateUtils.DATE_PATTERN); - daysBetween.forEach(dateId -> { - Date date = DateUtils.parse(dateId, DateUtils.DATE_PATTERN); + for (String dateId : daysBetween) { StatsFormDTO param = new StatsFormDTO(); param.setCustomerId(formDTO.getCustomerId()); param.setDate(dateId); - switch (formDTO.getType()) { - case "monthly": + if ("monthly".equals(formDTO.getType())) { + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.GROUP.getType())) { extractGroupDataMonthly(param); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.ARTICLE.getType())) { extractArticleDataMonthlyAndQuarterly(param); + } + } else { + //todo 如果要加方法 记得这个枚举里要加 + int threadCount = bizType.isEmpty() ? BizTypeEnum.values().length : bizType.size(); + System.out.println(threadCount); + CountDownLatch countDownLatch = ThreadUtil.newCountDownLatch(threadCount); + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.USER.getType())) { + ThreadUtil.execute(() -> { + extractUserDataDaily(param); + countDownLatch.countDown(); + }); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.GROUP.getType())) { + ThreadUtil.execute(() -> { + extractGroupDataDaily(param); + countDownLatch.countDown(); + }); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.TOPIC.getType())) { + ThreadUtil.execute(() -> { + extractTopicDataDaily(param); + countDownLatch.countDown(); + }); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.ISSUE.getType())) { + ThreadUtil.execute(() -> { + extractIssueDataDaily(param); + countDownLatch.countDown(); + }); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.PROJECT.getType())) { + ThreadUtil.execute(() -> { + extractProjectDataDaily(param); + countDownLatch.countDown(); + }); + } + if (bizType.isEmpty() || bizType.contains(BizTypeEnum.ARTICLE.getType())) { + ThreadUtil.execute(() -> { + extractAtricleDataDaily(param); + countDownLatch.countDown(); + }); + } + try { + //如果半小时还没执行完 则中断 说明执行方法有问题 要优化 + countDownLatch.await(NumConstant.THIRTY, TimeUnit.MINUTES); + } catch (InterruptedException e) { + log.error("extractDailyOrMonthly dateId:{} 始终没有结束 中断操作 InterruptedException", dateId); break; - default: - extractUserDataDaily(param); - extractGroupDataDaily(param); - extractTopicDataDaily(param); - extractIssueDataDaily(param); - extractProjectDataDaily(param); - extractAtricleDataDaily(param); + } } - }); + + log.info("extractDailyOrMonthly dateId:{} run end", dateId); + } + return new Result(); } private void extractUserDataDaily(StatsFormDTO formDTO) { try { statsUserService.partition(formDTO); + log.info("extractUserDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【用户】数据失败", e); } @@ -93,6 +160,7 @@ public class FactAggregationExtractController { private void extractTopicDataDaily(StatsFormDTO formDTO) { try { statsTopicService.partition(formDTO); + log.info("extractTopicDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【话题】数据失败", e); } @@ -101,6 +169,7 @@ public class FactAggregationExtractController { private void extractIssueDataDaily(StatsFormDTO formDTO) { try { statsIssueService.agencyGridIssueStats(formDTO); + log.info("extractIssueDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【议题】数据失败", e); } @@ -110,6 +179,7 @@ public class FactAggregationExtractController { try { statsProjectService.gridProjectStats(formDTO); statsProjectService.agencyProjectStats(formDTO); + log.info("extractProjectDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【项目】数据失败", e); } @@ -120,6 +190,7 @@ public class FactAggregationExtractController { statsPublicityService.articleSummaryDailyStatsjob(formDTO); statsPublicityService.tagUsedDailyStatsjob(formDTO); statsPublicityService.tagViewedDailyStatsjob(formDTO); + log.info("extractAtricleDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【文章】数据失败", e); } @@ -133,6 +204,7 @@ public class FactAggregationExtractController { statsGroupService.groupGridDaily(groupStatsFormDTO); statsGroupService.groupAgencyDaily(groupStatsFormDTO); + log.info("extractGroupDataDaily end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【小组】数据失败", e); } @@ -145,6 +217,7 @@ public class FactAggregationExtractController { groupStatsFormDTO.setCustomerId(formDTO.getCustomerId()); statsGroupService.groupAgencyMonthly(groupStatsFormDTO); + log.info("extractGroupDataMonthly end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【小组】数据失败", e); } @@ -156,6 +229,7 @@ public class FactAggregationExtractController { statsPublicityService.tagUsedQuarterlyStatsjob(formDTO); statsPublicityService.tagViewedMonthlyStatsjob(formDTO); statsPublicityService.tagViewedQuarterlyStatsjob(formDTO); + log.info("extractArticleDataMonthlyAndQuarterly end param:{}", JSON.toJSONString(formDTO)); } catch (Exception e) { log.error("抽取【文章】数据失败", e); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index ac3043d843..b57cbc0320 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -3,7 +3,6 @@ package com.epmet.dao.issue; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; -import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.*; import com.epmet.entity.issue.IssueEntity; @@ -173,22 +172,8 @@ public interface StatsIssueDao extends BaseDao { */ List selectIssueVoteInfo(@Param("customerId") String customerId, @Param("dateId") String dateId); - /** - * desc: 根据客户id 获取当前议题的情况 - * - * @param customerId - * @param dateId - * @return java.util.List - * @author LiuJanJun - * @date 2020/9/27 1:22 下午 - */ - List selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId); - List selectCategory(@Param("customerId") String customerId, @Param("ids") Set set); - - List getIssueTotalList(@Param("customerId") String customerId, @Param("date") String date); - /** * @Author sun * @Description 查询议题库已删除网格下可能存在的项目Id集合 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactAgencyGovernDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactAgencyGovernDailyEntity.java index 2f37f9a113..95f48fdeee 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactAgencyGovernDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactAgencyGovernDailyEntity.java @@ -150,7 +150,14 @@ public class FactAgencyGovernDailyEntity extends BaseEpmetEntity { * 10、当前组织内,未出小组即未转议题的:话题关闭无需解决数 */ private Integer inGroupTopicUnResolvedCount; - + /** + * 11、当前组织内:来源于事件的项目:结案已解决数 + */ + private Integer eventResolvedCount; + /** + * 12、当前组织内:来源于事件的项目:结案无需解决数 + */ + private Integer eventUnResolvedCount; /** * 未出当前网格的,结案项目数 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java index 22fa2b2b67..827a6fdf75 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridGovernDailyEntity.java @@ -169,6 +169,15 @@ public class FactGridGovernDailyEntity extends BaseEpmetEntity { */ private Integer gridSelfGovernProjectTotal; + /** + * 15、当前组织内:来源于事件的项目:结案已解决数 + */ + private Integer eventResolvedCount; + /** + * 16、当前组织内:来源于事件的项目:结案无需解决数 + */ + private Integer eventUnResolvedCount; + /** * 当前网格内出来的项目:由社区结案(已解决+未解决)的项目总数 @@ -208,6 +217,8 @@ public class FactGridGovernDailyEntity extends BaseEpmetEntity { this.issueProjectUnResolvedCount=NumConstant.ZERO; this.approvalProjectResolvedCount=NumConstant.ZERO; this.approvalProjectUnResolvedCount=NumConstant.ZERO; + this.eventResolvedCount=NumConstant.ZERO; + this.eventUnResolvedCount=NumConstant.ZERO; this.inGroupTopicResolvedCount=NumConstant.ZERO; this.inGroupTopicUnResolvedCount=NumConstant.ZERO; this.fromIssueResolvedInGridCount=NumConstant.ZERO; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridClosedTotalCommonDTO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridClosedTotalCommonDTO.java index fcc4193885..d38e74cabb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridClosedTotalCommonDTO.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/GovernGridClosedTotalCommonDTO.java @@ -51,6 +51,8 @@ public class GovernGridClosedTotalCommonDTO implements Serializable { */ private Integer districtDeptClosedCount; + private Integer gridSelfGovernProjectTotal; + public GovernGridClosedTotalCommonDTO(){ this.gridId = StrConstant.EPMETY_STR; this.fromIssueResolvedInGridCount=NumConstant.ZERO; @@ -60,5 +62,6 @@ public class GovernGridClosedTotalCommonDTO implements Serializable { this.communityClosedCount=NumConstant.ZERO; this.streetClosedCount=NumConstant.ZERO; this.districtDeptClosedCount=NumConstant.ZERO; + this.gridSelfGovernProjectTotal=NumConstant.ZERO; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index 445894bd66..9c02795140 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -2,7 +2,6 @@ package com.epmet.service.Issue; import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; -import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueDTO; @@ -163,18 +162,6 @@ public interface IssueService { */ List selectIssueVoteInfo(String customerId, String dateId); - /** - * desc: 【月】查询议题支持反对及应表决人数 - * 数据由两部分组成 1:本月内已经关闭的话题的支持和反对数据 来自issue,issue_vote_statistical - * - * @param customerId - * @param monthId - * @return java.util.List - * @author LiuJanJun - * @date 2020/9/27 11:20 上午 - */ - List selectIssueVoteStatis(String customerId, String monthId); - /** * @Description 查找项目的分类名称 以-相连,以,分隔, * @param param @@ -184,27 +171,6 @@ public interface IssueService { */ Map> getIntegratedProjectCategory(Map> param,String customerId); - /** - * 获取议题总数 - * @author zhaoqifeng - * @date 2021/7/20 16:20 - * @param customerId - * @param date - * @return java.util.List - */ - List getIssueTotalList(String customerId, String date); - - - /** - * 获取议题增量 - * @author zhaoqifeng - * @date 2021/7/20 16:20 - * @param customerId - * @param date - * @return java.util.List - */ - List getIssueIncrList(String customerId, String date); - /** * @Author sun * @Description 查询议题库已删除网格下可能存在的项目Id集合 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index b86b6daa40..3122b0a1d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -7,7 +7,6 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.dao.issue.StatsIssueDao; import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; -import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; import com.epmet.dto.issue.*; import com.epmet.entity.issue.IssueEntity; @@ -141,11 +140,6 @@ public class IssueServiceImpl implements IssueService { return statsIssueDao.selectIssueVoteInfo(customerId, dateId); } - @Override - public List selectIssueVoteStatis(String customerId, String dateId) { - return statsIssueDao.selectIssueVoteStatis(customerId, dateId); - } - /** * @Description 查找项目的分类名称 以-相连,以,分隔, * @param param @@ -177,34 +171,6 @@ public class IssueServiceImpl implements IssueService { return map; } - /** - * 获取议题总数 - * - * @param customerId - * @param date - * @return java.util.List - * @author zhaoqifeng - * @date 2021/7/20 16:20 - */ - @Override - public List getIssueTotalList(String customerId, String date) { - return null; - } - - /** - * 获取议题增量 - * - * @param customerId - * @param date - * @return java.util.List - * @author zhaoqifeng - * @date 2021/7/20 16:20 - */ - @Override - public List getIssueIncrList(String customerId, String date) { - return null; - } - /** * @Author sun * @Description 查询议题库已删除网格下可能存在的项目Id集合 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java index 52b1cdfc11..6bc96d1006 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java @@ -88,7 +88,7 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService threadPool.submit(() -> { try { long startCpc = System.currentTimeMillis(); - //calCpcIndexService.calCpcPartyAbility(customerId, monthId); + calCpcIndexService.calCpcPartyAbility(customerId, monthId); log.error("党员相关-党建能力执行完毕======总耗时:{}ms,customerId:{}",System.currentTimeMillis()-startCpc, param.getCustomerId()); } catch (Exception e) { log.error("抽取【党员相关数据】发生异常,参数:" + JSON.toJSONString(param), e); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java index f766873cea..52b6310caf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java @@ -29,7 +29,6 @@ import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.stats.DimAgencyService; -import com.epmet.util.DimIdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; @@ -202,13 +201,11 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl projectResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, dateId, ProjectConstant.RESOLVED, OrgTypeConstant.AGENCY); - Map eventProjectResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, - dateId, ProjectConstant.RESOLVED, - ProjectConstant.PROJECT_ORIGIN_EVENT); + if (!projectResolvedTotal.isEmpty()) { agencyGovernDailyList.forEach(item -> { OrgStatisticsResultDTO dto = projectResolvedTotal.get(item.getAgencyId()); @@ -219,23 +216,12 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl { - OrgStatisticsResultDTO dto = eventProjectResolvedTotal.get(item.getAgencyId()); - int sum = item.getApprovalProjectResolvedCount(); - if (null != dto) { - sum = sum + dto.getSum(); - } - item.setApprovalProjectResolvedCount(sum); - }); - } - // 当前组织内:来源于议题的项目:结案无需解决数 + + // 当前组织内:项目立项:结案无需解决数 Map projectUnResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, dateId, ProjectConstant.UNRESOLVED, OrgTypeConstant.AGENCY); - Map eventProjectUnResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, - dateId, ProjectConstant.UNRESOLVED, - ProjectConstant.PROJECT_ORIGIN_EVENT); + if (!projectUnResolvedTotal.isEmpty()) { agencyGovernDailyList.forEach(item -> { OrgStatisticsResultDTO dto = projectUnResolvedTotal.get(item.getAgencyId()); @@ -246,17 +232,34 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl { - OrgStatisticsResultDTO dto = eventProjectUnResolvedTotal.get(item.getAgencyId()); - int sum = item.getApprovalProjectUnResolvedCount(); - if (null != dto) { - sum = sum + dto.getSum(); - } - item.setApprovalProjectUnResolvedCount(sum); - }); - } + + } + + //2021.12.15 当前组织内:来源于事件的项目:结案已解决数 + Map eventProjectResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, + dateId, ProjectConstant.RESOLVED, + ProjectConstant.PROJECT_ORIGIN_EVENT); + if (!eventProjectResolvedTotal.isEmpty()) { + agencyGovernDailyList.forEach(item -> { + OrgStatisticsResultDTO dto = eventProjectResolvedTotal.get(item.getAgencyId()); + if (null != dto) { + item.setEventResolvedCount(dto.getSum()); + } + }); } + //2021.12.15 当前组织内:来源于事件的项目:结案无需解决数 + Map eventProjectUnResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, + dateId, ProjectConstant.UNRESOLVED, + ProjectConstant.PROJECT_ORIGIN_EVENT); + if (!eventProjectUnResolvedTotal.isEmpty()) { + agencyGovernDailyList.forEach(item -> { + OrgStatisticsResultDTO dto = eventProjectUnResolvedTotal.get(item.getAgencyId()); + if (null != dto) { + item.setEventUnResolvedCount(dto.getSum()); + } + }); + } + // 2.党群自治占比:当前组织下,所有小组内关闭(已解决+无需解决)的话题数与问题解决总数之比(未出小组:未转议题的) agencyGovernDailyList.forEach(item -> { int count = item.getInGroupTopicResolvedCount() + item.getInGroupTopicUnResolvedCount(); @@ -267,14 +270,16 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl gridSelfCount = factOriginProjectLogDailyService.getAgencyGridSelfDaily(customerId, dateId); if (!gridSelfCount.isEmpty()) { agencyGovernDailyList.forEach(item -> { OrgStatisticsResultDTO dto = gridSelfCount.get(item.getAgencyId()); if (null != dto) { int count = dto.getCount(); - int sum = item.getProblemResolvedCount(); + //已结案项目数 = 来源议题的项目结案已解决数+来源议题的项目结案无需解决数+项目立项结案已解决数+项目立项结案无需解决数+来源事件的项目结案已解决数+来源事件的项目结案已解决数 + int sum = item.getIssueProjectResolvedCount() + item.getIssueProjectUnResolvedCount() + item.getApprovalProjectResolvedCount() + + item.getApprovalProjectUnResolvedCount() + item.getEventResolvedCount() + item.getEventUnResolvedCount(); if (sum != NumConstant.ZERO) { BigDecimal resolveCount = new BigDecimal(sum); BigDecimal selfCount = new BigDecimal(count); @@ -284,9 +289,9 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl> projectCount = factOriginProjectMainDailyService.getAgencyClosedProjectStatic(customerId, dateId); if (!gridSelfCount.isEmpty()) { agencyGovernDailyList.forEach(item -> { @@ -294,7 +299,9 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl map = list.stream().collect(Collectors.toMap(OrgStatisticsResultDTO::getLevel, Function.identity())); - int sum = item.getProblemResolvedCount(); + //已结案项目数 = 来源议题的项目结案已解决数+来源议题的项目结案无需解决数+项目立项结案已解决数+项目立项结案无需解决数+来源事件的项目结案已解决数+来源事件的项目结案已解决数 + int sum = item.getIssueProjectResolvedCount() + item.getIssueProjectUnResolvedCount() + item.getApprovalProjectResolvedCount() + + item.getApprovalProjectUnResolvedCount() + item.getEventResolvedCount() + item.getEventUnResolvedCount(); BigDecimal resolveCount = new BigDecimal(sum); if (sum != NumConstant.ZERO) { // 社区解决占比 @@ -316,7 +323,7 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl currentGridClosedProjectList = factOriginProjectMainDailyService.getGridClosedProjectList(customerId, gridId, ProjectConstant.CLOSED,null,null); @@ -339,6 +349,7 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl projectLogDTOList) { List handleLevelList=new ArrayList<>(); for (FactOriginProjectLogDailyDTO logDailyDTO : projectLogDTOList) { - if(logDailyDTO.getActionCode().equals(DimObjectActionConstant.PROJECT_RETURN)||NumConstant.ZERO==logDailyDTO.getIsActive()){ + if(!logDailyDTO.getActionCode().equals(DimObjectActionConstant.PROJECT_CLOSE)||NumConstant.ZERO==logDailyDTO.getIsActive()){ //当前操作如果是退回,不参与比较 continue; } @@ -395,32 +409,42 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl topicImgList = topicInfo.getTopicImgList(); + if (!CollectionUtils.isEmpty(topicImgList)){ + diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); + topicImgList.forEach(img -> { + ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); + imgData.setEventId(project.getId()); + imgData.setEventImgUrl(img.getAttachmentUrl()); + imgData.setSort(img.getSort()); + imgDataEntities.add(imgData); + imgData.setCustomerId(param.getCustomerId()); + }); + } diffEntity.setEventContent(topicInfo.getTopicContent()); - topicInfo.getTopicImgList().forEach(img -> { - ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); - imgData.setEventId(project.getId()); - imgData.setEventImgUrl(img.getAttachmentUrl()); - imgData.setSort(img.getSort()); - imgDataEntities.add(imgData); - imgData.setCustomerId(param.getCustomerId()); - }); + log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index fc1ed7cb21..62ebe841fb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -142,8 +142,6 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr log.info("开始执行组织项目分类统计"); long start = System.currentTimeMillis(); List relationInfo = relationService.selectSubCustomer(customerId); - List customerIds = new ArrayList<>(); - customerIds.add(customerId); List result = new ArrayList<>(); if (CollectionUtils.isEmpty(relationInfo)){ // one customer @@ -169,12 +167,13 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) { if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){ - customerIds.remove(i); + subCustomerIds.remove(i); continue; } } subCustomerIds.add(customerId); List allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); + log.info("父子客户所有的组织{}",JSON.toJSONString(allAgencies)); List> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); List allOrgCategoryList = result; partition.forEach(p -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java index 4c587f9694..47d5045c01 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java @@ -103,14 +103,14 @@ public class StatsIssueServiceImpl implements StatsIssueService { */ private void customerStats(String customerId, Date date) { Date lastDate = DateUtils.getLastDayOfMonth(date); - //机关议题日统计 - saveIssueAgencyDaily(customerId, date); - //机关议题月统计 - saveIssueAgencyMonthly(customerId, lastDate); //网格议题日统计 saveIssueGridDaily(customerId, date); //网格议题月统计 saveIssueGridMonthly(customerId, lastDate); + //机关议题日统计 + saveIssueAgencyDaily(customerId, date); + //机关议题月统计 + saveIssueAgencyMonthly(customerId, lastDate); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index ca28b9fd3e..3b1d1c45c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -77,7 +77,6 @@ public class StatsProjectServiceImpl implements StatsProjectService { } //入参有客户Id的则按客户Id执行,没有的则全部客户都执行 if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { - log.info("单独统计客户机关-项目-日月数据,当前统计的客户Id:" + formDTO.getCustomerId()); customerAgencyStats(formDTO.getCustomerId(), date); } else { int pageNo = 1; @@ -88,7 +87,6 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { try { - log.info("for循环统计机关-项目-日月数据,当前统计的客户Id:" + customerId); //遍历统计每一个客户数据 customerAgencyStats(customerId, date); } catch (Exception e) { @@ -110,13 +108,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //2:根据客户Id查询机关维度表数据 - log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询机关维度数据,对应客户Id:" + customerId); DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); dimAgencyDTO.setCustomerId(customerId); List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //3:根据客户Id查询项目业务表已结案数据(查询传入日期及之前的数据) - log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目业务表已结案数据,对应客户Id:" + customerId); ProjectEntity projectEntity = new ProjectEntity(); projectEntity.setCustomerId(customerId); projectEntity.setCreatedTime(date); @@ -124,7 +120,6 @@ public class StatsProjectServiceImpl implements StatsProjectService { List projectList = projectService.getProjectList(projectEntity); //4:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询传入日期及之前的数据) - log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); List processList = projectProcessService.getProcessList(projectEntity); //20210721 sun 业务逻辑调整,网格删除,组织没有删除情况,相应的组织层级数据统计应舍弃以删除网格数据 start @@ -134,21 +129,9 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (list.size() > NumConstant.ZERO) { Map map = list.stream().collect(Collectors.toMap(String::toString, v -> v, (c1, c2) -> c1)); //4-2.遍历删除项目主表查询的无效数据 - Iterator proiter = projectList.iterator(); - while (proiter.hasNext()) { - ProjectEntity next = proiter.next(); - if (map.containsKey(next.getId())) { - proiter.remove(); - } - } + projectList.removeIf(next -> map.containsKey(next.getId())); //4-3.遍历删除项目节点表查询的无效数据 - Iterator iterator = processList.iterator(); - while (iterator.hasNext()) { - ProjectProcessEntity next = iterator.next(); - if (map.containsKey(next.getProjectId())) { - iterator.remove(); - } - } + processList.removeIf(next -> map.containsKey(next.getProjectId())); } //20210721 sun end @@ -156,21 +139,17 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { //5.1:执行机关日数据统计 try { - log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关日统计方法,方法名:agencyDateProjectStats,客户Id:" + customerId); agencyDateProjectStats(customerId, dimId, date, dimAgencyList, projectList, processList); } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyDateProjectStats", customerId, dimId.getDateId()), e); } //5.2:执行机关月数据统计 - //if (Calendar.getInstance().get(Calendar.DATE) == 1) { try { - log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关月统计方法,方法名:agencyMonthProjectStats,客户Id:" + customerId); agencyMonthProjectStats(customerId, dimId, dimAgencyList); } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyMonthProjectStats", customerId, dimId.getMonthId()), e); } - //} } } @@ -404,7 +383,6 @@ public class StatsProjectServiceImpl implements StatsProjectService { } //入参有客户Id的则按客户Id执行,没有的则全部客户都执行 if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { - log.info("单独统计客户网格-项目-日月数据,当前统计的客户Id:" + formDTO.getCustomerId()); customerGridStats(formDTO.getCustomerId(), date); } else { int pageNo = 1; @@ -415,11 +393,9 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { try { - log.info("for循环统计网格-项目-日月数据,当前统计的客户Id:" + customerId); //遍历统计每一个客户数据 customerGridStats(customerId, date); } catch (Exception e) { - log.error("项目-网格-数据统计程序错误,对应客户Id:" + customerId, e); log.error("Error creating model JSON", e); } } @@ -437,11 +413,9 @@ public class StatsProjectServiceImpl implements StatsProjectService { DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //2:根据客户Id查询网格维度表数据 - log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询网格维度数据,对应客户Id:" + customerId); List dimGridList = dimGridService.getGridListByCustomerId(customerId); //3:根据客户Id查询项目业务表已结案数据(查询传入日期及之前的数据) - log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询项目业务表已结案数据,对应客户Id:" + customerId); ProjectEntity projectEntity = new ProjectEntity(); projectEntity.setCustomerId(customerId); projectEntity.setCreatedTime(date); @@ -449,14 +423,12 @@ public class StatsProjectServiceImpl implements StatsProjectService { List projectList = projectService.getProjectList(projectEntity); //4:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询传入日期及之前的数据) - log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); List processList = projectProcessService.getProcessList(projectEntity); //5:网格层级日月统计 if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) { //5.1:执行网格日数据统计 try { - log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关日统计方法,方法名:gridDateProjectStats,客户Id:" + customerId); gridDateProjectStats(customerId, dimId, date, dimGridList, projectList, processList); } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridDateProjectStats", customerId, dimId.getDateId()), e); @@ -464,7 +436,6 @@ public class StatsProjectServiceImpl implements StatsProjectService { //5.2:执行网格月数据统计 try { - log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关月统计方法,方法名:gridMonthProjectStats,客户Id:" + customerId); gridMonthProjectStats(customerId, dimId, dimGridList); } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridMonthProjectStats", customerId, dimId.getMonthId()), e); @@ -711,4 +682,4 @@ public class StatsProjectServiceImpl implements StatsProjectService { return date; } -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index 397fcefa7a..2d77962df5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -404,7 +404,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { FactArticlePublishedDepartmentDailyEntity gridDailyEntities = departmentDailyEntityMap.get(summaryDTO.getPublisherId()); if (gridDailyEntities == null) { - log.error("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId()); + log.warn("publicitySummary bizData departmentId:{} not exist in dimDepartment", summaryDTO.getGridId()); continue; } gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index a47baa85bd..4aa8d924a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.service.topic.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.topic.TopicDao; import com.epmet.dto.AgencySubTreeDto; @@ -75,8 +76,12 @@ public class TopicServiceImpl implements TopicService { agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); }); - //计算网格-组-话题映射关系 - List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); + //计算网格-组-话题映射关系 如果时间为空则 默认取维度里的时间(也是默认t-1天) + Date breforeDate = targetDate; + if (targetDate == null){ + breforeDate = DateUtils.parse(timeDimension.getDateId(),DateUtils.DATE_PATTERN_YYYYMMDD); + } + List topics = topicDao.selectGroupOrderByGrid(breforeDate,customerId); topics.forEach(groupTopic -> { if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ groupTopic.setTopics(new ArrayList<>()); @@ -287,7 +292,8 @@ public class TopicServiceImpl implements TopicService { * @author wangc * @date 2020.06.22 13:13 **/ - TopicStatisticalData calculateAndSummarizeTopicStatisticalData(Map> subGridOfAgency, List agencies, Map> gridGroupMap, Date targetDate,List statusDimension ,DimIdGenerator.DimIdBean timeDimension ,String customerId){ + TopicStatisticalData calculateAndSummarizeTopicStatisticalData(Map> subGridOfAgency, List agencies, Map> gridGroupMap, + Date targetDate,List statusDimension ,DimIdGenerator.DimIdBean timeDimension ,String customerId){ if(null == subGridOfAgency || subGridOfAgency.size() <= NumConstant.ZERO){ return null; } @@ -306,8 +312,7 @@ public class TopicServiceImpl implements TopicService { //参数:gridGroupMap 所有网格的组以及组内话题 //[所有]话题当日的操作记录 - List operations = - topicDao.selectTopicOperationRecord(targetDate); + List operations = topicDao.selectTopicOperationRecord(targetDate); //key:话题Id value:这个话题在当日的操作记录 //操作类型有: ①discussing(发布) ②hidden(屏蔽) ③hidden_cancelled(取消屏蔽) ④closed(关闭) ⑤shift_issue(转议题) //注意不要把【发布】和【取消屏蔽】混淆!!! 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 94ed20f557..4e28cbb74b 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 @@ -843,54 +843,35 @@ AND m.PROJECT_ID = #{projectId} SELECT a.ID AS AGENCY_ID, - a.`LEVEL`, + b.`LEVEL`, COUNT( b.PROJECT_ID ) AS "sum", - SUM(IF( b.ORG_TYPE = 'department', 1, 0 )) AS "count" + SUM(IF( b.ORG_TYPE = 'department', 1, 0 )) AS "count" FROM dim_agency a INNER JOIN ( SELECT - PROJECT_ID, - PIDS, - ORG_TYPE + PROJECT_ID, + main.PIDS, + ORG_TYPE, + da.`LEVEL` FROM - fact_origin_project_log_daily - WHERE - CUSTOMER_ID = #{customerId} - AND DATE_ID <= #{dateId} + fact_origin_project_main_daily main + INNER JOIN fact_origin_project_log_daily log ON main.ID = log.PROJECT_ID AND ACTION_CODE = 'close' + AND (ORG_TYPE = 'agency' OR ORG_TYPE = 'department') + AND log.DEL_FLAG = '0' + AND log.CUSTOMER_ID = #{customerId} + INNER JOIN dim_agency da ON log.AGENCY_ID = da.ID AND da.CUSTOMER_ID = #{customerId} + WHERE + main.CUSTOMER_ID = #{customerId} + AND main.DATE_ID <= #{dateId} ) b ON b.PIDS LIKE CONCAT( '%', a.ID, '%' ) WHERE a.CUSTOMER_ID = #{customerId} GROUP BY a.ID, - a.`LEVEL` + b.`LEVEL` 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 514f743353..bedcb3e353 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 @@ -12,7 +12,7 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - AND DATE(UPDATED_TIME) #{date} + AND DATE(CREATED_TIME) #{date} AND GRID_ID != #{gridId} @@ -322,20 +322,6 @@ order by a.category_type,a.sort - - \ 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 85e8316cd3..9a2ec5b096 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 @@ -200,7 +200,7 @@ + s.PERFECT_COUNT * 100 )/s.SHOULD_EVALUATE_COUNT , - 0 + 80 ) AS score FROM project_satisfaction_statistics s diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml index ae18ea2b7c..3bda2d3cc5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml @@ -35,25 +35,14 @@ topic.ID AS topicID, topic.STATUS, - topic.SHIFT_ISSUE, - - - (CASE WHEN - - topic.CREATED_TIME =]]> #{targetDate} AND topic.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) - THEN '1' - ELSE '0' END ) AS incrFlag - - - - (CASE WHEN - topic.CREATED_TIME CURDATE( ) AND topic.CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) - THEN '1' - ELSE '0' END ) AS incrFlag - - - - FROM RESI_GROUP groupp LEFT JOIN RESI_TOPIC topic ON groupp.ID = topic.GROUP_ID AND topic.DEL_FLAG = '0' + CASE WHEN log.CREATED_TIME IS NULL THEN 0 ELSE 1 END AS 'SHIFT_ISSUE', + (CASE WHEN + topic.CREATED_TIME =]]> #{targetDate} AND topic.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + THEN '1' ELSE '0' END ) AS incrFlag + FROM + RESI_GROUP groupp + LEFT JOIN RESI_TOPIC topic ON groupp.ID = topic.GROUP_ID AND topic.DEL_FLAG = '0' + LEFT JOIN resi_topic_operation log ON log.TOPIC_ID = topic.ID AND log.DEL_FLAG = '0' AND log.OPERATION_TYPE = 'shift_issue' AND log.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) WHERE groupp.DEL_FLAG = '0' AND groupp.CUSTOMER_ID = #{customerId} @@ -301,11 +290,10 @@ a.ATTACHMENT_URL, a.SORT from resi_topic t - LEFT JOIN resi_topic_attachment a ON t.ID = a.TOPIC_ID + LEFT JOIN resi_topic_attachment a ON t.ID = a.TOPIC_ID AND ATTACHMENT_TYPE = 'image' WHERE t.del_flag = '0' - AND ATTACHMENT_TYPE = 'image' - and TOPIC_ID = #{topicId} + and t.ID = #{topicId}