|
|
@ -69,6 +69,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 机关单位信息 |
|
|
@ -924,12 +926,14 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
@Override |
|
|
|
public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { |
|
|
|
List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null); |
|
|
|
List<CustomerTreeDTO> treeList = new ArrayList<>(); |
|
|
|
Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); |
|
|
|
if (!rootList.isEmpty()) { |
|
|
|
// 获取已有客户的所有组织架构,并转换成map,保证唯一
|
|
|
|
rootList.forEach(item -> { |
|
|
|
customerHandle(item, treeMap); |
|
|
|
customerHandle(item, treeList); |
|
|
|
}); |
|
|
|
treeMap = treeList.stream().collect(Collectors.toMap(CustomerTreeDTO::getAreaCode, Function.identity())); |
|
|
|
// 组合成组织树
|
|
|
|
rootList = getCustomerTree(treeMap); |
|
|
|
// 回显客户名称
|
|
|
@ -1008,11 +1012,11 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
* @author zhy |
|
|
|
* @date 2022/7/6 13:54 |
|
|
|
*/ |
|
|
|
private void customerHandle(CustomerTreeDTO customer, Map<String, CustomerTreeDTO> treeMap) { |
|
|
|
private void customerHandle(CustomerTreeDTO customer, List<CustomerTreeDTO> treeList) { |
|
|
|
Result<List<CustomerTreeDTO>> area = epmetCommonServiceOpenFeignClient.areaCodeTree(customer); |
|
|
|
if (area.success()) { |
|
|
|
if (area.getData() != null) { |
|
|
|
area.getData().forEach(item -> treeMap.put(item.getAreaCode(), item)); |
|
|
|
treeList.addAll(area.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|