From 96589363695a6aaf4baa8658331da1380e27eb2a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 21 May 2021 17:03:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=A0=E9=99=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScreenProjectCategoryOrgDailyDao.java | 10 +++++++ ...eenProjectCategoryOrgDailyServiceImpl.java | 27 ++++++++++++++----- .../ScreenProjectCategoryOrgDailyDao.xml | 13 +++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java index 9f55340594..df66aca920 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java @@ -65,4 +65,14 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List customerIds, @Param("dateId") String dateId, @Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus); + + /** + * @Description 根据客户ID,天ID,组织ID删除旧数据 + * @Param customerId + * @Param dateId + * @Param orgIds + * @author zxc + * @date 2021/5/21 3:26 下午 + */ + int deleteAppointData(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("orgIds")List orgIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index e46b85f91d..c8b12730d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -179,6 +179,12 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); List categoryProjectResultDTOS1 = groupByStatus.get(false); - if (!CollectionUtils.isEmpty(categoryProjectResultDTOS1)) categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + if (!CollectionUtils.isEmpty(categoryProjectResultDTOS1)) { + categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + } } } result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); } // 组织项目分类 项目数 + List orgIds = new ArrayList<>(); Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); List levelAgencyInfo = groupByLevel.get(level); if (!CollectionUtils.isEmpty(levelAgencyInfo)){ - List orgIds = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + orgIds = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds,customerId); if (!CollectionUtils.isEmpty(result)){ if (!CollectionUtils.isEmpty(screenProjectCategory)){ @@ -291,7 +300,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl {r.setOrgType(level);r.setDateId(dateId);}); } } - deleteAndInsert(customerId,dateId,result); + deleteAndInsert(customerId,dateId,result,orgIds); } /** @@ -400,10 +409,11 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl orgIds = new ArrayList<>(); Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); List levelAgencyInfo = groupByLevel.get(level); if (!CollectionUtils.isEmpty(levelAgencyInfo)) { - List orgIds = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + orgIds = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId); if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(screenProjectCategory)) { @@ -434,7 +444,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl needInsert){ + public void deleteAndInsert(String customerId, String dateId, List needInsert,List orgIds){ if (CollectionUtils.isEmpty(needInsert)){ return; } + if (CollectionUtils.isEmpty(orgIds)){ + return; + } Integer row = NumConstant.ZERO; do { - row = baseDao.deleteByDateIdAndCustomerId(customerId, dateId); + row = baseDao.deleteAppointData(customerId, dateId,orgIds); }while (row > NumConstant.ZERO && row == NumConstant.ONE_THOUSAND); List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); partition.forEach(p -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml index 07b8d2f5b8..9a4718aca8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -9,6 +9,19 @@ limit 1000 + + + delete from screen_project_category_org_daily + where customer_id = #{customerId} + and date_id = #{dateId} + and ( + + ORG_ID = #{orgId} + + ) + limit 1000 + + + + + From 55f3fb84381d7dd2ec3c644009043582b157b044 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 24 May 2021 14:55:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index ddb063806a..266b3da2dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -412,6 +412,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl Date: Mon, 24 May 2021 16:10:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ScreenProjectCategoryOrgDailyServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index 266b3da2dc..432e71f2b7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -359,15 +359,18 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); if (!CollectionUtils.isEmpty(belongGridInfos)){ // 存在直属网格 List gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + // 根据网格ID查询分类标签 List categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds); if (!CollectionUtils.isEmpty(categoryProjectGrid)){ categoryProjectResultDTOS.forEach(agency -> { categoryProjectGrid.forEach(grid -> { + // 组织ID 和 分类标签code一样时,项目数累加 if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){ agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal()); grid.setStatus(true); @@ -375,6 +378,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + // 取出分类标签code不一样的数据 List categoryProjectResultDTOS1 = groupByStatus.get(false); categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); } @@ -385,6 +389,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); @@ -392,6 +397,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); // 父客户不存在的分类 List categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); + // 子级客户的分类标签数据 List sonResult = new ArrayList<>(); if (!CollectionUtils.isEmpty(categoryProjectExists)){ categoryProjectResultDTOS.addAll(categoryProjectExists); @@ -412,6 +418,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl