Browse Source

事件上报网格信息从customer_grid表获取

dev
zhaoqifeng 3 years ago
parent
commit
ba8a8d25c8
  1. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
  2. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  3. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

6
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())) { if (CollectionUtils.isNotEmpty(formDTO.getProjectId())) {
list = projectList.stream().map(project -> { list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap);
ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId()); CustomerGridDTO grid = customerGridService.getGridById(project.getOrgId());
dto.setOrgId(project.getOrgId()); dto.setOrgId(project.getOrgId());
if (null != grid) { if (null != grid) {
dto.setOrgCode(grid.getCode()); dto.setOrgCode(grid.getCode());
@ -255,10 +255,10 @@ public class DataReportingServiceImpl implements DataReportingService {
} else { } else {
//项目ID不为空时,提前取出客户下的组织和网格 //项目ID不为空时,提前取出客户下的组织和网格
Map<String, ScreenCustomerAgencyEntity> agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId()); Map<String, ScreenCustomerAgencyEntity> agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId());
Map<String, ScreenCustomerGridDTO> gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId()); Map<String, CustomerGridDTO> gridMap = customerGridService.getGridMap(PingYinConstant.PROD_PING_YIN_CUSTOMER_ID);
list = projectList.stream().map(project -> { list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap);
ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId()); CustomerGridDTO grid = gridMap.get(project.getOrgId());
dto.setOrgId(project.getOrgId()); dto.setOrgId(project.getOrgId());
if (null != grid) { if (null != grid) {
dto.setOrgCode(grid.getCode()); dto.setOrgCode(grid.getCode());

6
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.Date;
import java.util.List; import java.util.List;
import java.util.Map;
public interface CustomerGridService extends BaseService<CustomerGridEntity> { public interface CustomerGridService extends BaseService<CustomerGridEntity> {
/** /**
@ -106,4 +107,9 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @Description 查询客户下有效网格列表 * @Description 查询客户下有效网格列表
**/ **/
List<DimGridDTO> gridListByCustomerId(String customerId); List<DimGridDTO> gridListByCustomerId(String customerId);
CustomerGridDTO getGridById(String gridId);
Map<String, CustomerGridDTO> getGridMap(String customerId);
} }

25
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; 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.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.org.CustomerGridDao; import com.epmet.dao.org.CustomerGridDao;
import com.epmet.dto.group.AgencyDTO; 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.entity.org.CustomerGridEntity;
import com.epmet.service.Issue.IssueService; import com.epmet.service.Issue.IssueService;
import com.epmet.service.org.CustomerGridService; import com.epmet.service.org.CustomerGridService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.function.Function;
import java.util.List; import java.util.stream.Collectors;
@Service @Service
@DataSource(DataSourceConstant.GOV_ORG) @DataSource(DataSourceConstant.GOV_ORG)
@ -157,4 +160,20 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return customerGridDao.gridListByCustomerId(customerId); return customerGridDao.gridListByCustomerId(customerId);
} }
@Override
public CustomerGridDTO getGridById(String gridId) {
return ConvertUtils.sourceToTarget(baseDao.selectById(gridId), CustomerGridDTO.class);
}
@Override
public Map<String, CustomerGridDTO> getGridMap(String customerId) {
LambdaQueryWrapper<CustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CustomerGridEntity::getCustomerId, customerId);
List<CustomerGridEntity> 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()));
}
} }

Loading…
Cancel
Save