diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java index 3db0986065..bd156d2aaf 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java @@ -4,6 +4,8 @@ import lombok.Data; import javax.validation.constraints.Min; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; /** * 分页查询网格列表 @@ -36,13 +38,25 @@ public class PageQueryGridFormDTO implements Serializable { private Integer pageIndex; + /** + * 当前客户所属的地区编码 add 01.14 + */ + private String customerAreaCode = ""; + + /** + * 当前客户下的需要汇聚的子客户列表 add 01.14 + * 暂不使用 + */ + private List subCustomerIds = new ArrayList<>(); - public PageQueryGridFormDTO(String customerId,String monthId,int pageIndex,int pageNo,int pageSize){ + public PageQueryGridFormDTO(String customerId,String monthId,int pageIndex,int pageNo,int pageSize,String customerAreaCode,List subCustomerIds){ this.customerId=customerId; this.monthId=monthId; this.pageIndex=pageIndex; this.pageNo=pageNo; this.pageSize=pageSize; + this.customerAreaCode=customerAreaCode; + this.subCustomerIds=subCustomerIds; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java index 2e047268de..a47ebdc88d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java @@ -19,7 +19,6 @@ package com.epmet.dao.evaluationindex.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; -import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcollect.form.GridGovrnAbilityFormDTO; @@ -44,11 +43,7 @@ public interface FactIndexGovrnAblityGridMonthlyDao extends BaseDao - * @param customerId - * @param monthId * @author yinzuomei * @description 查询治理能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 13:10 **/ - Map selectGovrnAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + Map selectGovrnAblityGridMinAndMax(CalculateCommonFormDTO formDTO); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.java index e15e5cc90b..ec9404e36b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.java @@ -73,13 +73,12 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao - * @param customerId - * @param monthId + * @param formDTO * @author yinzuomei * @description 查询党建能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 12:51 **/ - Map selectPartyAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + Map selectPartyAblityGridMinAndMax(CalculateCommonFormDTO formDTO); /** * @return java.lang.Integer diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java index 10cabe11f1..ebb543d4b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java @@ -71,13 +71,11 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao - * @param customerId - * @param monthId * @author yinzuomei * @description 查询 服务能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 13:15 **/ - Map selectServiceAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + Map selectServiceAblityGridMinAndMax(CalculateCommonFormDTO formDTO); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index b0e405eace..ab0bc1e653 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -88,14 +88,13 @@ public interface ScreenCustomerGridDao extends BaseDao List pageListByCustomerId(PageQueryGridFormDTO formDTO); /** - * @param customerId 客户id * @param gridId 网格id * @return java.lang.String * @author yinzuomei * @description 查询网格所属的组织id * @Date 2020/8/31 12:35 **/ - ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId); + ScreenCustomerGridDTO selectParentAgencyId(@Param("gridId") String gridId); /** * 返回当前客户下,未匹配到的网格信息 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index 231db8eaae..b785d78b4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -202,7 +202,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); //每一组指标的最大值,key:code_MIN/MAX - Map minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); + Map minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO); if (CollectionUtils.isEmpty(minAndMaxMap)) { log.warn("calculateGridDangJian queryPartyAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); return; @@ -218,7 +218,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { formDTO.getMonthId(), pageIndex, pageNo, - IndexCalConstant.PAGE_SIZE)); + IndexCalConstant.PAGE_SIZE, + formDTO.getCustomerAreaCode(), + formDTO.getSubCustomerIds())); //遍历每一个网格的记录 recordList.forEach(recordMap -> { //遍历所有的指标 @@ -430,11 +432,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { for (HashMap resultMap : resultMapList) { resultMap.forEach((gridId, calculateResult) -> { GridScoreEntity gridScoreEntity = new GridScoreEntity(); + //一定要赋值当前正在计算的客户id gridScoreEntity.setCustomerId(formDTO.getCustomerId()); gridScoreEntity.setGridId(gridId); gridScoreEntity.setIsTotal(isTotal); gridScoreEntity.setIndexCode(indexCode); - ScreenCustomerGridDTO screenCustomerGridDTO = screenCustomerGridDao.selectParentAgencyId(formDTO.getCustomerId(), gridId); + ScreenCustomerGridDTO screenCustomerGridDTO = screenCustomerGridDao.selectParentAgencyId(gridId); if (null != screenCustomerGridDTO) { if(StringUtils.isNotBlank(screenCustomerGridDTO.getParentAgencyId())){ gridScoreEntity.setAgencyId(screenCustomerGridDTO.getParentAgencyId()); @@ -610,7 +613,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); //每一组指标的最大值,key:code_MIN/MAX - Map minAndMaxMap = queryGovrnAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); + Map minAndMaxMap = queryGovrnAblityGridMinAndMax(formDTO); if (CollectionUtils.isEmpty(minAndMaxMap)) { log.warn("calculateGridZhiLi queryGovrnAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); return; @@ -626,7 +629,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { formDTO.getMonthId(), pageIndex, pageNo, - IndexCalConstant.PAGE_SIZE)); + IndexCalConstant.PAGE_SIZE, + formDTO.getCustomerAreaCode(), + formDTO.getSubCustomerIds())); //遍历每一个网格的记录 recordList.forEach(recordMap -> { //遍历所有的指标 @@ -683,7 +688,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); //每一组指标的最大值,key:code_MIN/MAX - Map minAndMaxMap = queryServiceAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); + Map minAndMaxMap = queryServiceAblityGridMinAndMax(formDTO); if (CollectionUtils.isEmpty(minAndMaxMap)) { log.warn("calculateGridFuWu queryServiceAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); return; @@ -699,7 +704,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { formDTO.getMonthId(), pageIndex, pageNo, - IndexCalConstant.PAGE_SIZE)); + IndexCalConstant.PAGE_SIZE, + formDTO.getCustomerAreaCode(), + formDTO.getSubCustomerIds())); //遍历每一个网格的记录 recordList.forEach(recordMap -> { //遍历所有的指标 @@ -838,15 +845,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { 党员参加“三会一课”人次*/ /** - * @param customerId - * @param monthId + * @param formDTO * @return java.util.Map * @author yinzuomei * @description 查询党建能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 12:47 **/ - public Map queryPartyAblityGridMinAndMax(String customerId, String monthId) { - return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(customerId, monthId); + public Map queryPartyAblityGridMinAndMax(CalculateCommonFormDTO formDTO) { + return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(formDTO); } @@ -863,15 +869,13 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { /** - * @param customerId - * @param monthId * @return java.util.Map * @author yinzuomei * @description 查询治理能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 12:48 **/ - public Map queryGovrnAblityGridMinAndMax(String customerId, String monthId) { - return factIndexGovrnAblityGridMonthlyDao.selectGovrnAblityGridMinAndMax(customerId, monthId); + public Map queryGovrnAblityGridMinAndMax(CalculateCommonFormDTO formDTO) { + return factIndexGovrnAblityGridMonthlyDao.selectGovrnAblityGridMinAndMax(formDTO); } /** @@ -886,15 +890,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { } /** - * @param customerId - * @param monthId + * @param formDTO * @return java.util.Map * @author yinzuomei * @description 查询 服务能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 12:50 **/ - public Map queryServiceAblityGridMinAndMax(String customerId, String monthId) { - return factIndexServiceAblityGridMonthlyDao.selectServiceAblityGridMinAndMax(customerId, monthId); + public Map queryServiceAblityGridMinAndMax(CalculateCommonFormDTO formDTO) { + return factIndexServiceAblityGridMonthlyDao.selectServiceAblityGridMinAndMax(formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml index 1a8d1d7aa1..755e3aab60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml @@ -113,16 +113,30 @@ m.SATISFACTION_RATIO FROM fact_index_govrn_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + and m.CUSTOMER_ID=#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + order by m.GRID_ID asc LIMIT #{pageIndex}, #{pageSize} - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -145,10 +159,24 @@ MAX(m.SATISFACTION_RATIO) AS SATISFACTION_RATIO_MAX FROM fact_index_govrn_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + and m.CUSTOMER_ID=#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml index 2ea92ebb5d..a1d0e85e45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml @@ -126,16 +126,30 @@ m.JOIN_THREE_MEETS_COUNT FROM fact_index_party_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} - order by m.GRID_ID asc + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND m.CUSTOMER_ID =#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + + order by m.GRID_ID asc LIMIT #{pageIndex}, #{pageSize} - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -168,10 +182,24 @@ MAX(m.JOIN_THREE_MEETS_COUNT) AS JOIN_THREE_MEETS_COUNT_MAX FROM fact_index_party_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND m.CUSTOMER_ID =#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + @@ -180,10 +208,24 @@ count(1) as total FROM fact_index_party_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND m.CUSTOMER_ID =#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml index be06e22b1a..fa6f11e4a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml @@ -98,7 +98,7 @@ - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -111,10 +111,24 @@ MAX(m.PARTY_VOLUNTEER_RATIO) AS PARTY_VOLUNTEER_RATIO_MAX FROM fact_index_service_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + and m.CUSTOMER_ID=#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + @@ -123,10 +137,24 @@ count(1) as total FROM fact_index_service_ablity_grid_monthly m + inner join screen_customer_grid scg + on( + m.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND m.CUSTOMER_ID =#{customerId} + and scg.CUSTOMER_ID=#{customerId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 147941c2d1..8fcea4e572 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -101,7 +101,6 @@ screen_customer_grid m WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.GRID_ID = #{gridId}