|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.customer.service.impl;
|
|
package org.dromara.customer.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.crypto.digest.BCrypt;
|
|
import cn.hutool.crypto.digest.BCrypt;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -9,7 +10,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
-import org.dromara.common.core.enums.IsDefault;
|
|
|
|
|
import org.dromara.common.core.enums.SysPlatformYesNo;
|
|
import org.dromara.common.core.enums.SysPlatformYesNo;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
@@ -19,12 +19,10 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.redis.utils.SequenceUtils;
|
|
import org.dromara.common.redis.utils.SequenceUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.customer.domain.CustomerContact;
|
|
import org.dromara.customer.domain.CustomerContact;
|
|
|
-import org.dromara.customer.domain.CustomerShippingAddress;
|
|
|
|
|
|
|
+import org.dromara.customer.domain.CustomerInfo;
|
|
|
import org.dromara.customer.domain.bo.CustomerContactBo;
|
|
import org.dromara.customer.domain.bo.CustomerContactBo;
|
|
|
-import org.dromara.customer.domain.bo.CustomerShippingAddressBo;
|
|
|
|
|
import org.dromara.customer.domain.vo.CustomerContactVo;
|
|
import org.dromara.customer.domain.vo.CustomerContactVo;
|
|
|
import org.dromara.customer.domain.vo.CustomerInfoVo;
|
|
import org.dromara.customer.domain.vo.CustomerInfoVo;
|
|
|
-import org.dromara.customer.domain.vo.CustomerShippingAddressVo;
|
|
|
|
|
import org.dromara.customer.mapper.CustomerContactMapper;
|
|
import org.dromara.customer.mapper.CustomerContactMapper;
|
|
|
import org.dromara.customer.mapper.CustomerInfoMapper;
|
|
import org.dromara.customer.mapper.CustomerInfoMapper;
|
|
|
import org.dromara.customer.service.ICustomerContactService;
|
|
import org.dromara.customer.service.ICustomerContactService;
|
|
@@ -35,10 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
import java.time.Duration;
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -85,7 +80,16 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
|
|
|
public TableDataInfo<CustomerContactVo> queryPageList(CustomerContactBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<CustomerContactVo> queryPageList(CustomerContactBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<CustomerContact> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<CustomerContact> lqw = buildQueryWrapper(bo);
|
|
|
Page<CustomerContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<CustomerContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
-
|
|
|
|
|
|
|
+ List<CustomerContactVo> records = result.getRecords();
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(records)) {
|
|
|
|
|
+ Set<Long> customerIds = records.stream().map(CustomerContactVo::getCustomerId).collect(Collectors.toSet());
|
|
|
|
|
+ List<CustomerInfo> customerInfos = customerInfoMapper.selectByIds(customerIds);
|
|
|
|
|
+ Map<Long, String> customerNameMap = customerInfos.stream().collect(Collectors.toMap(CustomerInfo::getId, CustomerInfo::getCustomerName));
|
|
|
|
|
+
|
|
|
|
|
+ records.forEach(item -> {
|
|
|
|
|
+ item.setCustomerName(customerNameMap.get(item.getCustomerId()));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
}
|
|
|
|
|
|