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())); + } + }