From ba8a8d25c8ff902668b9a6a484c075bcaf2424e5 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 18 Aug 2022 16:03:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E4=B8=8A=E6=8A=A5=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E4=BF=A1=E6=81=AF=E4=BB=8Ecustomer=5Fgrid=E8=A1=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DataReportingServiceImpl.java | 6 ++--- .../service/org/CustomerGridService.java | 6 +++++ .../org/impl/CustomerGridServiceImpl.java | 25 ++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java index d6a11f8c81..1ac0f1ab53 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java @@ -244,7 +244,7 @@ public class DataReportingServiceImpl implements DataReportingService { if (CollectionUtils.isNotEmpty(formDTO.getProjectId())) { list = projectList.stream().map(project -> { EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); - ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId()); + CustomerGridDTO grid = customerGridService.getGridById(project.getOrgId()); dto.setOrgId(project.getOrgId()); if (null != grid) { dto.setOrgCode(grid.getCode()); @@ -255,10 +255,10 @@ public class DataReportingServiceImpl implements DataReportingService { } else { //项目ID不为空时,提前取出客户下的组织和网格 Map agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId()); - Map gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId()); + Map gridMap = customerGridService.getGridMap(PingYinConstant.PROD_PING_YIN_CUSTOMER_ID); list = projectList.stream().map(project -> { EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); - ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId()); + CustomerGridDTO grid = gridMap.get(project.getOrgId()); dto.setOrgId(project.getOrgId()); if (null != grid) { dto.setOrgCode(grid.getCode()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 13f641fa98..4e840fd674 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -15,6 +15,7 @@ import com.epmet.entity.org.CustomerGridEntity; import java.util.Date; import java.util.List; +import java.util.Map; public interface CustomerGridService extends BaseService { /** @@ -106,4 +107,9 @@ public interface CustomerGridService extends BaseService { * @Description 查询客户下有效网格列表 **/ List gridListByCustomerId(String customerId); + + CustomerGridDTO getGridById(String gridId); + + Map getGridMap(String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index 10bfbc4fd5..8c2c6740e5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -1,8 +1,10 @@ package com.epmet.service.org.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; @@ -18,12 +20,13 @@ import com.epmet.dto.user.result.GridUserInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.Issue.IssueService; import com.epmet.service.org.CustomerGridService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; @Service @DataSource(DataSourceConstant.GOV_ORG) @@ -157,4 +160,20 @@ public class CustomerGridServiceImpl extends BaseServiceImpl getGridMap(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CustomerGridEntity::getCustomerId, customerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return ConvertUtils.sourceToTarget(list, CustomerGridDTO.class).stream().collect(Collectors.toMap(CustomerGridDTO::getId, Function.identity())); + } + }