|
@@ -21,7 +21,6 @@ import com.fjhx.customer.entity.customer.po.CustomerUser;
|
|
import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
|
|
import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
|
|
import com.fjhx.customer.entity.customer.vo.CustomerVo;
|
|
import com.fjhx.customer.entity.customer.vo.CustomerVo;
|
|
import com.fjhx.customer.mapper.customer.CustomerMapper;
|
|
import com.fjhx.customer.mapper.customer.CustomerMapper;
|
|
-import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
|
|
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
import com.fjhx.customer.service.customer.CustomerTopService;
|
|
import com.fjhx.customer.service.customer.CustomerTopService;
|
|
import com.fjhx.customer.service.customer.CustomerUserService;
|
|
import com.fjhx.customer.service.customer.CustomerUserService;
|
|
@@ -33,7 +32,6 @@ import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
-import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -60,9 +58,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
private CustomerUserService customerUserService;
|
|
private CustomerUserService customerUserService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private CustomerFollowRecordsService customerFollowRecordsService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
private CustomerTopService customerTopService;
|
|
private CustomerTopService customerTopService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -77,7 +72,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
wrapper.like(Customer::getName, dto.getKeyword());
|
|
wrapper.like(Customer::getName, dto.getKeyword());
|
|
wrapper.eq("c", Customer::getUserId, dto.getUserId());
|
|
wrapper.eq("c", Customer::getUserId, dto.getUserId());
|
|
- wrapper.groupBy("c.id");
|
|
|
|
Page<CustomerVo> page = baseMapper.getPage(dto.getPage(), wrapper);
|
|
Page<CustomerVo> page = baseMapper.getPage(dto.getPage(), wrapper);
|
|
CustomizeAreaUtil.setAreaName(page.getRecords());
|
|
CustomizeAreaUtil.setAreaName(page.getRecords());
|
|
return page;
|
|
return page;
|
|
@@ -111,16 +105,36 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
// 业务员查询
|
|
// 业务员查询
|
|
wrapper.eq("c", Customer::getUserId, dto.getUserId());
|
|
wrapper.eq("c", Customer::getUserId, dto.getUserId());
|
|
// 关键字
|
|
// 关键字
|
|
- wrapper.keyword(dto.getKeyword(),
|
|
|
|
- new SqlField("c", Customer::getName),
|
|
|
|
- new SqlField("c", Customer::getCode),
|
|
|
|
- new SqlField("cu", CustomerUser::getName),
|
|
|
|
- new SqlField("cu", CustomerUser::getEmail)
|
|
|
|
- );
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
|
+ List<Long> cuIds = customerUserService.listObject(CustomerUser::getCustomerId, q -> q
|
|
|
|
+ .like(CustomerUser::getName, dto.getKeyword()).or()
|
|
|
|
+ .like(CustomerUser::getEmail, dto.getKeyword())
|
|
|
|
+ .groupBy(CustomerUser::getCustomerId)
|
|
|
|
+ );
|
|
|
|
+ wrapper.and(q -> q
|
|
|
|
+ .like("c", Customer::getName, dto.getKeyword()).or()
|
|
|
|
+ .like(Customer::getCode, dto.getKeyword()).or()
|
|
|
|
+ .in(Customer::getId, cuIds)
|
|
|
|
+ );
|
|
|
|
+ }
|
|
//客户联系人过滤
|
|
//客户联系人过滤
|
|
- wrapper.eq("cu", CustomerUser::getName, dto.getContactName());
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getContactName())) {
|
|
|
|
+ List<Long> cuIds = customerUserService.listObject(CustomerUser::getCustomerId, q -> q
|
|
|
|
+ .like(CustomerUser::getName, dto.getContactName())
|
|
|
|
+ .groupBy(CustomerUser::getCustomerId)
|
|
|
|
+ );
|
|
|
|
+ cuIds.add(null);
|
|
|
|
+ wrapper.in("c", Customer::getId, cuIds);
|
|
|
|
+ }
|
|
//客户联系人邮箱
|
|
//客户联系人邮箱
|
|
- wrapper.eq("cu", CustomerUser::getEmail, dto.getContactEmail());
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getContactEmail())) {
|
|
|
|
+ List<Long> cuIds = customerUserService.listObject(CustomerUser::getCustomerId, q -> q
|
|
|
|
+ .like(CustomerUser::getEmail, dto.getContactEmail())
|
|
|
|
+ .groupBy(CustomerUser::getCustomerId)
|
|
|
|
+ );
|
|
|
|
+ cuIds.add(null);
|
|
|
|
+ wrapper.in("c", Customer::getId, cuIds);
|
|
|
|
+ }
|
|
|
|
|
|
// 客户标签查询(多个标签用逗号隔开)
|
|
// 客户标签查询(多个标签用逗号隔开)
|
|
if (StrUtil.isNotBlank(dto.getTag())) {
|
|
if (StrUtil.isNotBlank(dto.getTag())) {
|
|
@@ -150,7 +164,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
wrapper.orderByDesc("c", Customer::getUpdateTime);
|
|
wrapper.orderByDesc("c", Customer::getUpdateTime);
|
|
wrapper.orderByDesc("c", Customer::getCreateTime);
|
|
wrapper.orderByDesc("c", Customer::getCreateTime);
|
|
|
|
|
|
- wrapper.groupBy("c.id");
|
|
|
|
Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
|
// 复制城市信息
|
|
// 复制城市信息
|