From b5d45c4365e003cd6259f284cc16aa938e7ec078 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 2 Dec 2021 16:33:51 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=BA=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginProjectOrgPeriodDailyDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index 0790001c64..a6bdde851d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -53,7 +53,7 @@ f.ORG_ID AS "agencyId", SUM( TIMESTAMPDIFF( MINUTE, ( DATE_FORMAT( f.INFORMED_DATE, '%Y-%m-%d %H:%i' )), ( DATE_FORMAT( f.PERIOD_TILL_REPLY_FIRSTLY, '%Y-%m-%d %H:%i' )) ) ) AS "sum", - COUNT( f.ID ) AS "count" + COUNT(DISTINCT f.PROJECT_ID) AS "count" FROM fact_origin_project_org_period_daily f INNER JOIN dim_agency da ON f.ORG_ID = da.ID From 436bd8f19a77266d2c102bb391a2336dd747d07c Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 2 Dec 2021 16:34:40 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=BA=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginProjectOrgPeriodDailyDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index a6bdde851d..063ec1acc8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -128,7 +128,7 @@ fp.ORG_ID, SUM( TIMESTAMPDIFF( MINUTE, ( DATE_FORMAT( fp.INFORMED_DATE, '%Y-%m-%d %H:%i' )), ( DATE_FORMAT( fp.PERIOD_TILL_REPLY_FIRSTLY, '%Y-%m-%d %H:%i' )) ) ) AS "sum", - COUNT( fp.ID ) AS "count" + COUNT( DISTINCT fp.PROJECT_ID ) AS "count" FROM fact_origin_project_org_period_daily fp INNER JOIN fact_origin_project_main_daily fm ON fp.PROJECT_ID = fm.ID From 7e80588f3eb8c3d34d0b8a9a3b7ae8fbcc36c455 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 2 Dec 2021 16:34:40 +0800 Subject: [PATCH 3/6] =?UTF-8?q?sql=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=88=AA?= =?UTF-8?q?=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml index 217417dd29..93f2f0ff37 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml @@ -4,7 +4,7 @@ - - SELECT - COUNT( ID ) AS issueTotal, - GRID_ID - FROM - fact_origin_issue_main_daily - WHERE - DEL_FLAG = 0 - AND CUSTOMER_ID = #{customerId} - AND (MONTH_ID = #{monthId} OR MONTH_ID = #{minusMonthId}) - GROUP BY GRID_ID + GRID_ID, + COUNT(ISSUE_ID) AS issueTotal + FROM fact_origin_issue_log_daily + WHERE DEL_FLAG = '0' + AND MONTH_ID = #{monthId} + AND CUSTOMER_ID = #{customerId} + AND ACTION_CODE = 'shift_project' + GROUP BY GRID_ID From 539bfca9875d9da3d532c1c76bfcf43ef6619436 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 2 Dec 2021 17:07:26 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=94=B9=E4=B8=8B=E6=9F=A5=E8=AF=A2=20?= =?UTF-8?q?=E8=AF=95=E8=AF=95=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/PatrolDailySumResult.java | 2 +- .../StatsStaffPatrolRecordDailyDao.java | 4 +- .../datastats/impl/DataStatsServiceImpl.java | 110 +++++++++--------- .../StatsStaffPatrolRecordDailyService.java | 4 +- ...tatsStaffPatrolRecordDailyServiceImpl.java | 6 +- .../StatsStaffPatrolRecordDailyDao.xml | 8 +- 6 files changed, 66 insertions(+), 68 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java index 5400a1247f..c7fbe6b7ef 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java @@ -15,7 +15,7 @@ import java.io.Serializable; public class PatrolDailySumResult implements Serializable { private static final long serialVersionUID = 310405655189243944L; - private String fullAgencyId; + private String orgId; private Integer patrolTotal; private Integer totalTime; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java index 11ed072080..8be4c4c34e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java @@ -39,12 +39,12 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao getPatrolSumList(@Param("agencyFullIdList") List agencyFullIdList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); + List getPatrolSumList(@Param("orgIdList") List orgIdList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); /** * @Description 直属组织或网格下巡查数据 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 bc27897beb..8f35934227 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,55 +1,54 @@ package com.epmet.dataaggre.service.datastats.impl; import com.alibaba.fastjson.JSON; - import com.epmet.commons.dynamic.datasource.annotation.DataSource; - import com.epmet.commons.tools.constant.NumConstant; - import com.epmet.commons.tools.constant.StrConstant; - import com.epmet.commons.tools.enums.OrgLevelEnum; - import com.epmet.commons.tools.exception.RenException; - import com.epmet.commons.tools.utils.ConvertUtils; - import com.epmet.commons.tools.utils.DateUtils; - import com.epmet.commons.tools.utils.ExcelUtils; - 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.epmetuser.form.GridMemberPatrolListFormDTO; - import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; - import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; - import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; - 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.FactAgencyGovernDailyEntity; - import com.epmet.dataaggre.excel.CustomerDataManageExcel; - import com.epmet.dataaggre.service.datastats.DataStatsService; - import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; - import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; - import com.epmet.dataaggre.service.opercrm.CustomerRelation; - import com.github.pagehelper.PageHelper; - import lombok.extern.slf4j.Slf4j; - import org.apache.commons.collections4.CollectionUtils; - import org.apache.commons.lang3.StringUtils; - import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.stereotype.Service; - - import javax.servlet.http.HttpServletResponse; - import java.math.BigDecimal; - import java.math.RoundingMode; - import java.text.NumberFormat; - import java.text.ParseException; - import java.text.SimpleDateFormat; - import java.util.*; - import java.util.concurrent.atomic.AtomicInteger; - import java.util.concurrent.atomic.AtomicReference; - import java.util.stream.Collectors; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.enums.OrgLevelEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +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.epmetuser.form.GridMemberPatrolListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; +import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; +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.FactAgencyGovernDailyEntity; +import com.epmet.dataaggre.excel.CustomerDataManageExcel; +import com.epmet.dataaggre.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; +import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; +import com.github.pagehelper.PageHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * @Author sun @@ -1556,7 +1555,7 @@ public class DataStatsServiceImpl implements DataStatsService { Map closeProjectEndMap = toProjectEnd.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); //巡查次数和时间 List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(gridIdList,formDTO.getStartDateId(),formDTO.getEndDateId()); - Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1)); + Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getOrgId, o -> o, (o1, o2) -> o1)); subAgencyList.forEach(agency->{ String gridId = agency.getGridId(); @@ -1567,7 +1566,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,gridId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,gridId)); - PatrolDailySumResult patrolRecordDTO = patrolListMap.get(agency.getAllParentIds()); + PatrolDailySumResult patrolRecordDTO = patrolListMap.get(gridId); setPatrolAttr(resultDTO, patrolRecordDTO); result.add(resultDTO); }); @@ -1595,9 +1594,9 @@ public class DataStatsServiceImpl implements DataStatsService { Map closeProjectStartMap = toProjectStart.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map closeProjectEndMap = toProjectEnd.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); //巡查次数和时间 - List agencyFullIds = subAgencyList.stream().map(o -> o.getPids().concat(StrConstant.COLON).concat(o.getAgencyId())).collect(Collectors.toList()); - List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyFullIds,formDTO.getStartDateId(),formDTO.getEndDateId()); - Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1)); + List agencyIdList = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); + List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyIdList,formDTO.getStartDateId(),formDTO.getEndDateId()); + Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getOrgId, o -> o, (o1, o2) -> o1)); subAgencyList.forEach(agency->{ String agencyId = agency.getAgencyId(); @@ -1607,8 +1606,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,agencyId)); resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,agencyId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,agencyId)); - String fullAgencyId = agency.getPids().concat(StrConstant.COLON).concat(agencyId); - PatrolDailySumResult patrolRecordDTO = patrolListMap.get(fullAgencyId); + PatrolDailySumResult patrolRecordDTO = patrolListMap.get(agencyId); setPatrolAttr(resultDTO,patrolRecordDTO); result.add(resultDTO); }); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java index ce49c18f73..70afc1e944 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java @@ -35,12 +35,12 @@ public interface StatsStaffPatrolRecordDailyService extends BaseService getPatrolSumList(List agencyList, String startDateId, String endDateId); + List getPatrolSumList(List orgIdList, String startDateId, String endDateId); /** * @Description 直属组织或网格下巡查数据 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java index d24dcbe10c..ccfe71e399 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java @@ -28,14 +28,14 @@ public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl getPatrolSumList(List agencyFullIdList, String startDateId, String endDateId) { - return baseDao.getPatrolSumList(agencyFullIdList,startDateId,endDateId); + public List getPatrolSumList(List orgIdList, String startDateId, String endDateId) { + return baseDao.getPatrolSumList(orgIdList,startDateId,endDateId); } /** diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml index 93f2f0ff37..e77b01af94 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml @@ -2,17 +2,17 @@