|
@@ -51,17 +51,19 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService, CodingRuleCustomerService {
|
|
|
+
|
|
|
@Autowired
|
|
|
private CustomerUserService customerUserService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CustomerFollowRecordsService customerFollowRecordsService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CustomerTopService customerTopService;
|
|
|
|
|
|
@Autowired
|
|
|
private DictTenantDataService dictTenantDataService;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询客户的列表
|
|
|
*
|
|
@@ -215,64 +217,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 私海客户表分页(添加权限自己看自己)
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<CustomerVo> privateSeaPage(CustomerSelectDto dto) {
|
|
|
-// LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
|
|
|
- IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
- wrapper.eq("c", Customer::getSource, dto.getSource());
|
|
|
- wrapper.eq("c", Customer::getStatus, dto.getStatus());
|
|
|
- //国家ID查询
|
|
|
- wrapper.eq(Customer::getCountryId, dto.getCountryId());
|
|
|
- //省份ID查询
|
|
|
- wrapper.eq(Customer::getProvinceId,dto.getProvinceId());
|
|
|
- //城市ID查询
|
|
|
- wrapper.eq(Customer::getCityId,dto.getCityId());
|
|
|
- //客户代码
|
|
|
- wrapper.like(Customer::getCustomerCode,dto.getCustomerCode());
|
|
|
- //客户名称
|
|
|
- wrapper.like(Customer::getName,dto.getName());
|
|
|
- //业务员查询
|
|
|
- wrapper.eq(Customer::getUserId,dto.getName());
|
|
|
- //客户标签查询(多个标签用逗号隔开)
|
|
|
- if(StringUtils.isNotEmpty(dto.getTag())){
|
|
|
- List<String> tagList = Arrays.asList(dto.getTag().split(","));
|
|
|
- tagList.forEach(tag->wrapper.like(Customer::getTag,tag));
|
|
|
- }
|
|
|
- //添加权限(自己看自己)
|
|
|
- wrapper.eq(Customer::getUserId, SecurityUtils.getUserId());
|
|
|
-
|
|
|
- //置顶条件
|
|
|
- List<Long> customerIds = customerTopService.listObject(CustomerTop::getCustomerId, q -> q.eq(CustomerTop::getUserId,
|
|
|
- SecurityUtils.getUserId()));
|
|
|
- if (ObjectUtil.isNotEmpty(customerIds)) {
|
|
|
- String join = StringUtils.join(customerIds, ",");
|
|
|
- wrapper.orderByDesc("id IN ( " + join + " )");
|
|
|
- }
|
|
|
-
|
|
|
- wrapper.orderByDesc(Customer::getCreateTime);
|
|
|
- Page<CustomerVo> page = baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
- //复制城市信息
|
|
|
- List<CustomerVo> records = page.getRecords();
|
|
|
- CustomizeAreaUtil.setAreaName(records);
|
|
|
- //赋值客户跟进记录
|
|
|
- for (CustomerVo record : records) {
|
|
|
- List<CustomerFollowRecords> customerFollowRecordsList = customerFollowRecordsService.list(q ->
|
|
|
- q.eq(CustomerFollowRecords::getCustomerId, record.getId())
|
|
|
- .orderByDesc(CustomerFollowRecords::getDate).last("limit 3"));
|
|
|
- record.setCustomerFollowRecordsList(customerFollowRecordsList);
|
|
|
- }
|
|
|
-
|
|
|
- //赋值是否置顶
|
|
|
- for (CustomerVo record : records) {
|
|
|
- record.setIsTop(customerIds.contains(record.getId()) ? 1 : 0);
|
|
|
- }
|
|
|
-
|
|
|
- return page;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 来源存量(客户分析)
|
|
|
*
|
|
|
* @param query
|