Browse Source

新增:

1.同步漏掉的历史grid,agency,department维度到维度表,查漏补缺
dev_shibei_match
wangxianzhang 4 years ago
parent
commit
ccb95c5c5c
  1. 57
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
  2. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  4. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  5. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java
  6. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java
  7. 62
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  8. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  9. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  11. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  12. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java
  13. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  14. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java
  15. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java
  16. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java
  17. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  18. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java
  19. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java
  20. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml
  21. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  22. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

57
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java

@ -1,18 +1,26 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.AgencySubDeptTreeDto;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.service.StatsDimService;
import com.epmet.service.stats.*;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("dim")
public class DimController {
@ -272,4 +280,53 @@ public class DimController {
return new Result().ok(partyMemberService.statsPartyMember(customerIdAndDateIdFormDTO));
}
/**
* 同步客户相关的维度agency,department,grid
* 用来补充其他系统传递过来的旧有的数据
* @param customerId
* @return
*/
@PostMapping("/customer-related-dims/sync")
public Result syncCustomerRelatedDims(@RequestParam("customer-id") String customerId) {
if (StringUtils.isBlank(customerId)) {
String errorMsg = "【同步客户相关的维度】请传递客户ID";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg);
}
boolean syncAgencySuccess = true;
boolean syncGridSuccess = true;
boolean syncDepartmentSuccess = true;
// 一.同步agency
try {
statsDimService.syncCustomerAgencyDims(customerId);
} catch (Exception e) {
syncAgencySuccess = false;
log.error("【同步客户相关维度】同步agency失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 二.同步grid
try {
statsDimService.syncCustomerGridDims(customerId);
} catch (Exception e) {
syncGridSuccess = false;
log.error("【同步客户相关维度】同步grid失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 三.同步department
try {
statsDimService.syncCustomerDepartmentDims(customerId);
} catch (Exception e) {
syncDepartmentSuccess = false;
log.error("【同步客户相关维度】同步department失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
// 构造结果
HashMap<String, Boolean> r = new HashMap<>();
r.put("syncAgencySuccess", syncAgencySuccess);
r.put("syncGridSuccess", syncGridSuccess);
r.put("syncDepartmentSuccess", syncDepartmentSuccess);
return new Result().ok(r);
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java

@ -35,6 +35,7 @@ import java.util.List;
public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(
@Param("customerId") String customerId,
@Param("createdTimeFrom") Date createdTimeFrom,
@Param("createdTimeTo") Date createdTimeTo);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -49,7 +49,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @param end
* @return
*/
List<CustomerGridEntity> listGridsByCreateTime(@Param("start") Date start, @Param("end") Date end);
List<CustomerGridEntity> listGridsByCreateTime(@Param("customerId") String customerId, @Param("start") Date start, @Param("end") Date end);
/**
* @Description 查询机关下的网格总数

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -19,6 +19,7 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAgencyEntity> listAllEntities();
List<CustomerAgencyEntity> listAgenciesByCreateTime(
@Param("customerId") String customerId,
@Param("statsStartTime") Date statsStartTime,
@Param("statsEndTime") Date statsEndTime);
List<AgencySubTreeDto> selectAllAgency();

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java

@ -12,4 +12,22 @@ public interface StatsDimService {
void initDepartmentDim();
void customerInitProjectCategory();
/**
* 同步客户的组织维度
* @param customerId
*/
void syncCustomerAgencyDims(String customerId);
/**
* 同步客户的网格维度
* @param customerId
*/
void syncCustomerGridDims(String customerId);
/**
* 同步客户的部门维度
* @param customerId
*/
void syncCustomerDepartmentDims(String customerId);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java

@ -83,7 +83,7 @@ public class EIDimServiceImpl implements EIDimService {
startTime = e.getCreatedTime();
}
return originCustomerAgencyService.listAgenciesByCreateTime(startTime, endTime);
return originCustomerAgencyService.listAgenciesByCreateTime(null, startTime, endTime);
}
@Override
@ -125,7 +125,7 @@ public class EIDimServiceImpl implements EIDimService {
startTime = lastAddDept.getCreatedTime();
}
return originCustomerDepartmentService.listDepartmentsByCreatedTime(startTime, endTime);
return originCustomerDepartmentService.listDepartmentsByCreatedTime(null, startTime, endTime);
}
@Override
@ -179,6 +179,6 @@ public class EIDimServiceImpl implements EIDimService {
startTime = lastAddGrid.getCreatedTime();
}
return customerGridService.listGridsByCreateTime(startTime, endTime);
return customerGridService.listGridsByCreateTime(null, startTime, endTime);
}
}

62
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.RobotConstant;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.entity.crm.CustomerEntity;
@ -78,10 +79,10 @@ public class StatsDimServiceImpl implements StatsDimService {
Date now = new Date();
if (lastDimEntity == null) {
// 首次初始化
grids = customerGridService.listGridsByCreateTime(null, now);
grids = customerGridService.listGridsByCreateTime(null, null, now);
} else {
Date lastInitTime = lastDimEntity.getCreatedTime();
grids = customerGridService.listGridsByCreateTime(lastInitTime, now);
grids = customerGridService.listGridsByCreateTime(null, lastInitTime, now);
}
return convertCustomerGrid2GridDim(grids, now);
@ -127,7 +128,7 @@ public class StatsDimServiceImpl implements StatsDimService {
* @param initTime 创建时间会用来作为下一次查询的输入条件因此必须和本次初始化查询的endTime一致
* @return
*/
private List<DimGridEntity> convertCustomerGrid2GridDim(List<CustomerGridEntity> grids, Date initTime) {
public List<DimGridEntity> convertCustomerGrid2GridDim(List<CustomerGridEntity> grids, Date initTime) {
return grids.stream().map(grid -> {
DimGridEntity dimGrid = new DimGridEntity();
dimGrid.setAgencyId(grid.getPid());
@ -168,7 +169,7 @@ public class StatsDimServiceImpl implements StatsDimService {
lastInitTime = latestCreatedAgencyDim.getCreatedTime();
}
return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate);
return customerAgencyService.listAgenciesByCreateTime(null, lastInitTime, endDate);
}
/**
@ -268,7 +269,7 @@ public class StatsDimServiceImpl implements StatsDimService {
if (lastCreatedDeptDim != null) {
lastInitTime = lastCreatedDeptDim.getCreatedTime();
}
return departmentService.listDepartmentsByCreatedTime(lastInitTime, now);
return departmentService.listDepartmentsByCreatedTime(null, lastInitTime, now);
}
public List<CustomerDepartmentEntity> listUpdatedDepartments(Date initTime) {
@ -321,4 +322,55 @@ public class StatsDimServiceImpl implements StatsDimService {
}
return new ArrayList<>();
}
@Override
public void syncCustomerAgencyDims(String customerId) {
// 1.列出现有的agency 维度id列表
List<String> dimAgencyIds = dimAgencyService.listAgencyIds(customerId);
// 2.查询业务表的agency列表
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerAgencyEntity> bizAgencies = customerAgencyService.listAgenciesByCreateTime(customerId, null, endDate);
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
for (CustomerAgencyEntity bizAgency : bizAgencies) {
if (!dimAgencyIds.contains(bizAgency.getId())) {
dimAgencyService.initAgencyAllDim(bizAgency, endDate);
dimAgencyService.initAgencySelfDim(bizAgency, endDate);
}
}
}
@Override
public void syncCustomerGridDims(String customerId) {
// 1.列出现有的grid维度id列表
List<String> dimGridIds = dimGridService.listGridIds(customerId);
// 2.查询业务表的grid列表
// 时间截止到今天凌晨,防止把今天的数据同步过来,影响定时任务查询,漏掉其他客户的数据
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerGridEntity> bizGrids = customerGridService.listGridsByCreateTime(customerId, null, endDate);
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
List<CustomerGridEntity> grids2insert = bizGrids.stream().filter(bg -> !dimGridIds.contains(bg.getId())).collect(Collectors.toList());
List<DimGridEntity> dimGridEntities = convertCustomerGrid2GridDim(grids2insert, endDate);
dimGridEntities.forEach(g -> dimGridService.insert(g));
}
@Override
public void syncCustomerDepartmentDims(String customerId) {
// 1.列出现有的grid维度id列表
List<String> dimDeptIds = dimDepartmentService.listDepartmentIds(customerId);
// 2.查询业务表的grid列表
// 时间截止到今天凌晨,防止把今天的数据同步过来,影响定时任务查询,漏掉其他客户的数据
Date endDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN);
List<CustomerDepartmentEntity> bizDepts = departmentService.listDepartmentsByCreatedTime(customerId, null, endDate);
List<CustomerDepartmentEntity> depts2insert = bizDepts.stream().filter(bd -> !dimDeptIds.contains(bd.getId())).collect(Collectors.toList());
// 3.将没有同步过来的插入到dim表。创建和更新时间存为今天凌晨
dimDepartmentService.initDepartmentDims(depts2insert, new ArrayList<>(), endDate);
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -10,7 +10,7 @@ import java.util.Date;
import java.util.List;
public interface CustomerAgencyService {
List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByCreateTime(String customerId, Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date updatedTime, Date now);
@ -66,4 +66,11 @@ public interface CustomerAgencyService {
* @Description 批量查询客户组织基础信息
**/
List<CustomerAgencyDTO> getAgencyBaseInfo(GridBaseInfoFormDTO formDTO);
/**
* 列出agencyId列表
* @param customerId
* @return
*/
List<String> listAgencyIds(String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java

@ -7,7 +7,7 @@ import java.util.List;
public interface CustomerDepartmentService {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(String customerId, Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date startTime, Date endTime);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -23,7 +23,7 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @return
* @Param("start") Date start, @Param("end") Date end
*/
List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end);
List<CustomerGridEntity> listGridsByCreateTime(String customerId, Date start, Date end);
/**
* @Description 查询机关下有多少网格

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -1,5 +1,6 @@
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.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -25,6 +26,7 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
@DataSource(DataSourceConstant.GOV_ORG)
@ -40,8 +42,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
private CustomerGridService customerGridService;
@Override
public List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime);
public List<CustomerAgencyEntity> listAgenciesByCreateTime(String customerId, Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(customerId, statsStartTime, statsEndTime);
}
@Override
@ -283,4 +285,15 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
return customerAgencyDao.getAgencyBaseInfo(formDTO);
}
@Override
public List<String> listAgencyIds(String customerId) {
LambdaQueryWrapper<CustomerAgencyEntity> query = new LambdaQueryWrapper<>();
query.eq(CustomerAgencyEntity::getCustomerId, customerId);
query.select(CustomerAgencyEntity::getId);
return customerAgencyDao.selectObjs(query)
.stream()
.map(o -> o.toString())
.collect(Collectors.toList());
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java

@ -25,8 +25,8 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService
* @return
*/
@Override
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo);
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(String customerId, Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(customerId, createdTimeFrom, createdTimeTo);
}
@Override

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -34,8 +34,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
private IssueService issueService;
@Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
return baseDao.listGridsByCreateTime(start, end);
public List<CustomerGridEntity> listGridsByCreateTime(String customerId, Date start, Date end) {
return baseDao.listGridsByCreateTime(customerId, start, end);
}
/**

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java

@ -187,4 +187,25 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
* @return java.util.List<com.epmet.dto.stats.DimAgencyDTO>
*/
List<DimAgencyDTO> getAgencyByLevel(String customerId, String level);
/**
* 查询agency维度已存在的id列表
* @param customerId
* @return
*/
List<String> listAgencyIds(String customerId);
/**
* 初始化agency all 维度(all区分于self)
* @param agency
* @param initTime
*/
void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime);
/**
* 初始化agency self 维度(self区分于all)
* @param agency
* @param initTime
*/
void initAgencySelfDim(CustomerAgencyEntity agency, Date initTime);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java

@ -120,4 +120,11 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
*/
List<DimDepartmentDTO> getDistrictDepByCustomer(String customerId);
/**
* 查询部门维度id列表
* @param customerId
* @return
*/
List<String> listDepartmentIds(String customerId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java

@ -148,4 +148,12 @@ public interface DimGridService extends BaseService<DimGridEntity> {
* @date 2020.09.20 13:01
**/
List<GridAttributesResultDTO> getGridAttributes(String customerId,List<String> gridIds);
/**
* 查询网格维度ID列表
* @param customerId
* @return
*/
List<String> listGridIds(String customerId);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -47,6 +48,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 机关维度
@ -158,6 +160,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY);
}
@Override
public void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setCode(agency.getCode());
@ -180,6 +183,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
* 初始化机关单位本身的维度(不包含本身)
* @param agency
*/
@Override
public void initAgencySelfDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setAgencyName(agency.getOrganizationName());
@ -293,4 +297,12 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
return baseDao.selectDimAgencyByLevel(customerId, level);
}
@Override
public List<String> listAgencyIds(String customerId) {
LambdaQueryWrapper<DimAgencyEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DimAgencyEntity::getCustomerId, customerId);
queryWrapper.select(DimAgencyEntity::getId);
return baseDao.selectObjs(queryWrapper).stream().map(o -> o.toString()).collect(Collectors.toList());
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -43,6 +44,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 客户部门维度
@ -169,4 +171,13 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
public List<DimDepartmentDTO> getDistrictDepByCustomer(String customerId) {
return baseDao.getDistrictDepByCustomer(customerId);
}
@Override
public List<String> listDepartmentIds(String customerId) {
LambdaQueryWrapper<DimDepartmentEntity> query = new LambdaQueryWrapper<>();
query.eq(DimDepartmentEntity::getCustomerId, customerId);
query.select(DimDepartmentEntity::getId);
return baseDao.selectObjs(query).stream().map(d -> d.toString()).collect(Collectors.toList());
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 客户网格维度
@ -193,4 +195,14 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
return baseDao.selectGridAttributes(customerId,gridIds);
}
@Override
public List<String> listGridIds(String customerId) {
LambdaQueryWrapper<DimGridEntity> query = new LambdaQueryWrapper<>();
query.eq(DimGridEntity::getCustomerId, customerId);
query.select(DimGridEntity::getId);
return baseDao.selectObjs(query).stream().map(o -> o.toString()).collect(Collectors.toList());
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml

@ -13,6 +13,9 @@
dept.AGENCY_ID = ca.id and ca.DEL_FLAG='0')
<where>
dept.DEL_FLAG = 0
<if test="customerId != null and customerId != ''">
AND dept.CUSTOMER_ID = #{customerId}
</if>
<if test="createdTimeFrom != null">
AND dept.CREATED_TIME >= #{createdTimeFrom}
</if>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -10,6 +10,9 @@
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="customerId != null and customerId != ''">
AND CUSTOMER_ID = #{customerId}
</if>
<if test="start != null">
AND CREATED_TIME >= #{start}
</if>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -17,6 +17,9 @@
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="customerId != null and customerId !=''">
AND CUSTOMER_ID = #{customerId}
</if>
<if test="statsStartTime != null">
AND CREATED_TIME >= #{statsStartTime}
</if>

Loading…
Cancel
Save