Commit 1d32faf2 by jianan

Fna接口53

parent 9d6dd326
......@@ -36,13 +36,6 @@ public class ApiCustomerController {
@Resource
private CustomerService customerService;
@Resource
private CustomerExpandService customerExpandService;
@Resource
private ApiSysUserFeignClient apiSysUserFeignClient;
/**
* 创建客户
*
......
......@@ -109,16 +109,20 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
List<CustomerVO> customerVOList = customerList.stream().map(CustomerVO::objToVo).collect(Collectors.toList());
// 1. 关联查询扩展信息
Set<String> customerIdSet = customerList.stream().map(Customer::getCustomerBizId).collect(Collectors.toSet());
Map<String, List<CustomerExpand>> customerBizIdCustomerExpandListMap = customerExpandService.listByIds(customerIdSet).stream()
.collect(Collectors.groupingBy(CustomerExpand::getCustomerBizId));
Set<String> customerBizIdSet = customerList.stream().map(Customer::getCustomerBizId).collect(Collectors.toSet());
QueryWrapper<CustomerExpand> queryWrapper = new QueryWrapper<>();
queryWrapper.in("customer_biz_id", customerBizIdSet);
List<CustomerExpand> customerExpandList = customerExpandService.list(queryWrapper);
Map<String, CustomerExpand> customerBizIdCustomerExpandListMap = customerExpandList.stream()
.collect(Collectors.toMap(CustomerExpand::getCustomerBizId, customerExpand -> customerExpand));
// 填充信息
customerVOList.forEach(customerVO -> {
for (CustomerVO customerVO : customerVOList) {
String customerBizId = customerVO.getCustomerBizId();
CustomerExpand customerExpand = null;
if (customerBizIdCustomerExpandListMap.containsKey(customerBizId)) {
customerExpand = customerBizIdCustomerExpandListMap.get(customerBizId).get(0);
customerExpand = customerBizIdCustomerExpandListMap.get(customerBizId);
}
if (customerExpand != null) {
BeanUtils.copyProperties(customerExpand, customerVO);
......@@ -129,8 +133,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
customerVO.setAddressList(addressList);
}
}
});
// endregion
}
customerVOPage.setRecords(customerVOList);
return customerVOPage;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment