|
|
@ -1,6 +1,7 @@ |
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
import com.epmet.constant.RobotConstant; |
|
|
import com.epmet.constant.RobotConstant; |
|
|
|
|
|
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; |
|
|
import com.epmet.entity.crm.CustomerEntity; |
|
|
import com.epmet.entity.crm.CustomerEntity; |
|
|
import com.epmet.entity.org.CustomerAgencyEntity; |
|
|
import com.epmet.entity.org.CustomerAgencyEntity; |
|
|
import com.epmet.entity.org.CustomerDepartmentEntity; |
|
|
import com.epmet.entity.org.CustomerDepartmentEntity; |
|
|
@ -199,6 +200,14 @@ public class StatsDimServiceImpl implements StatsDimService { |
|
|
|
|
|
|
|
|
List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime); |
|
|
List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime); |
|
|
|
|
|
|
|
|
|
|
|
// 添加 areaCode
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(customers)){ |
|
|
|
|
|
List<String> customerIds = customers.stream().map(m -> m.getId()).collect(Collectors.toList()); |
|
|
|
|
|
List<CustomerAreaCodeResultDTO> areaCodes = customerAgencyService.selectCustomerAreaCodeById(customerIds); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(areaCodes)){ |
|
|
|
|
|
customers.forEach(c -> areaCodes.stream().filter(a -> c.getId().equals(a.getCustomerId())).forEach(a -> c.setAreaCode(a.getAreaCode()))); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
return customers; |
|
|
return customers; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -212,6 +221,14 @@ public class StatsDimServiceImpl implements StatsDimService { |
|
|
if (lastCreatedDim != null) { |
|
|
if (lastCreatedDim != null) { |
|
|
// 说明不是首次初始化
|
|
|
// 说明不是首次初始化
|
|
|
List<CustomerEntity> customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime); |
|
|
List<CustomerEntity> customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime); |
|
|
|
|
|
// 添加 areaCode
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(customers)){ |
|
|
|
|
|
List<String> customerIds = customers.stream().map(m -> m.getId()).collect(Collectors.toList()); |
|
|
|
|
|
List<CustomerAreaCodeResultDTO> areaCodes = customerAgencyService.selectCustomerAreaCodeById(customerIds); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(areaCodes)){ |
|
|
|
|
|
customers.forEach(c -> areaCodes.stream().filter(a -> c.getId().equals(a.getCustomerId())).forEach(a -> c.setAreaCode(a.getAreaCode()))); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
return customers; |
|
|
return customers; |
|
|
} |
|
|
} |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
|