From 6ad06926ef0a48520aac48b949e23d8a9e365ff7 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 7 Sep 2020 09:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E8=A1=A8-=E6=9C=88=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=95=B0=E6=8D=AE=E5=BA=93=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/ScreenCustomerAgencyDao.java | 21 ++++---- .../screen/ScreenCustomerDeptDao.java | 19 ++++--- .../screen/ScreenCustomerGridDao.java | 19 ++++--- .../impl/FactIndexCollectServiceImpl.java | 54 ++++++++++++++----- .../screen/ScreenCustomerAgencyDao.xml | 22 ++++---- .../screen/ScreenCustomerDeptDao.xml | 23 ++++---- .../screen/ScreenCustomerGridDao.xml | 24 ++++----- 7 files changed, 105 insertions(+), 77 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index ea9e977207..4912171860 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -56,17 +56,6 @@ public interface ScreenCustomerAgencyDao extends BaseDao list, @Param("customerId")String customerId); - /** - * 根据客户id、组织id,查询区/街道 组织名称 - * - * @param customerId 客户id - * @param agencyId 组织id - * @return java.util.String - * @Author zhangyong - * @Date 16:57 2020-09-03 - **/ - String selectParentAgencyInfo(@Param("customerId")String customerId, @Param("agencyId")String agencyId); - /** * 返回当前客户下,未匹配到的组织信息 * @param customerId 客户id @@ -76,4 +65,14 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListMismatcAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds); + + /** + * 根据客户id,查询区/街道 组织名称、id + * + * @param customerId 客户id + * @return java.util.List + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + List selectListAgencyInfo(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java index a6f251251a..53a5fcf042 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java @@ -57,16 +57,6 @@ public interface ScreenCustomerDeptDao extends BaseDao **/ void batchInsertCustomerDept(@Param("list") List list, @Param("customerId")String customerId); - /** - * 根据客户id、部门id,查询部门父级 信息 - * @param customerId 客户id - * @param deptId 部门id - * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity - * @Author zhangyong - * @Date 16:57 2020-09-03 - **/ - ScreenCustomerDeptEntity selectParentDeptInfo(@Param("customerId")String customerId, @Param("deptId")String deptId); - /** * @param customerId * @param deptId @@ -88,4 +78,13 @@ public interface ScreenCustomerDeptDao extends BaseDao **/ List selectListMismatchDeptInfo(@Param("customerId") String customerId, @Param("deptIds") String[] deptIds); + + /** + * 根据客户id 查询部门 信息 + * @param customerId 客户id + * @return java.util.List + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + List selectListDeptInfo(@Param("customerId")String customerId); } 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 d07d9aff46..005f69289b 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 @@ -95,16 +95,6 @@ public interface ScreenCustomerGridDao extends BaseDao **/ ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId); - /** - * 根据客户id、网格id,查询网格(党支部)父级信息 - * @param customerId - * @param gridId - * @return com.epmet.dto.screen.FactIndexGridScoreDTO - * @Author zhangyong - * @Date 16:57 2020-09-03 - **/ - ScreenCustomerGridDTO selectParentGridInfo(@Param("customerId")String customerId, @Param("gridId")String gridId); - /** * 返回当前客户下,未匹配到的网格信息 * @@ -116,4 +106,13 @@ public interface ScreenCustomerGridDao extends BaseDao **/ List selectListMismatchGridInfo(@Param("customerId") String customerId, @Param("gridIds") String[] gridIds); + + /** + * 根据客户id 查询网格(党支部)详细信息 + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + List selectListGridInfo(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index f1068d23b8..e8d04fea45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -281,6 +281,8 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { List monthlyFormDTOList = new ArrayList<>(); // 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据 Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId)); + // 查询网格的 上级组织id 和 组织名称 + List parentGridList = screenCustomerGridDao.selectListGridInfo(customerId); String[] orgIds = new String[collect.size()]; int j = 0; for(Map.Entry> gridScore : collect.entrySet()){ @@ -304,14 +306,21 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { monthlyFormDTO); } } - // 查询网格的 上级组织id 和 组织名称 - ScreenCustomerGridDTO parentGridInfo = screenCustomerGridDao.selectParentGridInfo(customerId, gridScore.getKey()); - if (null == parentGridInfo){ + // 匹配网格的 上级组织id 和 组织名称 + String parentAgencyId = ""; + String gridName = ""; + for (ScreenCustomerGridDTO gridDTO : parentGridList){ + if (gridScore.getKey().equals(gridDTO.getGridId())){ + parentAgencyId = gridDTO.getParentAgencyId(); + gridName = gridDTO.getGridName(); + } + } + if ("".equals(parentAgencyId)){ throw new RuntimeException("在screen_customer_grid表中未查询到该客户下的网格信息:customerId =" + customerId + ", gridId = " + gridScore.getKey()); } // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScore.getKey(), - parentGridInfo.getParentAgencyId(), parentGridInfo.getGridName(), monthlyFormDTO); + parentAgencyId, gridName, monthlyFormDTO); monthlyFormDTOList.add(monthlyFormDTO); } if (monthlyFormDTOList.size() > NumConstant.ZERO){ @@ -371,6 +380,8 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); + // 根据客户id,查询区/街道 组织名称、id + List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); String[] orgIds = new String[collect.size()]; int j = 0; for(Map.Entry> communityScore : collect.entrySet()){ @@ -397,9 +408,14 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 当前组织 的上级组织id String parentAgencyId = communityScore.getValue().get(NumConstant.ZERO).getParentAgencyId(); - // 查询 组织名称 - String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, communityScore.getKey()); - if (null == agencyName){ + // 获取 组织名称 + String agencyName = ""; + for (ScreenCustomerAgencyEntity agencyScoreDTO : parentAgencyList) { + if (communityScore.getKey().equals(agencyScoreDTO.getAgencyId())) { + agencyName = agencyScoreDTO.getAgencyName(); + } + } + if ("".equals(agencyName)){ throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey()); } // 补充表中其他字段 @@ -461,6 +477,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { List monthlyFormDTOList = new ArrayList<>(); // 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据 Map> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId)); + List parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId); String[] orgIds = new String[collect.size()]; int j = 0; for(Map.Entry> deptScore : collect.entrySet()){ @@ -479,13 +496,20 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { monthlyFormDTO); } // 查询网格的 上级组织id 和 组织名称 - ScreenCustomerDeptEntity parentDeptInfo = screenCustomerDeptDao.selectParentDeptInfo(customerId, deptScore.getKey()); - if (null == parentDeptInfo){ + String parentAgencyId = ""; + String deptName = ""; + for (ScreenCustomerDeptEntity deptEntity : parentDeptList) { + if (deptScore.getKey().equals(deptEntity.getDeptId())) { + parentAgencyId = deptEntity.getParentAgencyId(); + deptName = deptEntity.getDeptName(); + } + } + if ("".equals(parentAgencyId)){ throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey()); } // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, deptScore.getKey(), - parentDeptInfo.getParentAgencyId(), parentDeptInfo.getDeptName(), monthlyFormDTO); + parentAgencyId, deptName, monthlyFormDTO); monthlyFormDTOList.add(monthlyFormDTO); } if (monthlyFormDTOList.size() > NumConstant.ZERO){ @@ -539,6 +563,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); + List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); String[] orgIds = new String[collect.size()]; int j = 0; for(Map.Entry> agencyScore : collect.entrySet()){ @@ -562,8 +587,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 当前组织 的上级组织id String parentAgencyId = agencyScore.getValue().get(NumConstant.ZERO).getParentAgencyId(); // 查询 组织名称 - String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, agencyScore.getKey()); - if (null == agencyName){ + String agencyName = ""; + for (ScreenCustomerAgencyEntity agencyScoreDTO : parentAgencyList) { + if (agencyScore.getKey().equals(agencyScoreDTO.getAgencyId())) { + agencyName = agencyScoreDTO.getAgencyName(); + } + } + if ("".equals(agencyName)){ throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); } // 补充表中其他字段 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index c1479694d4..36ac049262 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -60,17 +60,6 @@ - - + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml index 47ab3d400d..31717d6dd2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml @@ -64,17 +64,6 @@ AND m.CUSTOMER_ID =#{customerId} AND m.DEPT_ID =#{deptId} - + + 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 a86ec3bec2..c85dc0af60 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 @@ -106,18 +106,6 @@ AND m.GRID_ID = #{gridId} - - + +