|
@@ -31,10 +31,12 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
|
+import org.apache.poi.util.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -70,8 +72,30 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
public Page<CustomerVo> getPage(CustomerSelectDto dto) {
|
|
|
// LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
|
|
|
IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
+ //客户来源查询
|
|
|
wrapper.eq("c", Customer::getSource, dto.getSource());
|
|
|
+ //客户类型查询
|
|
|
wrapper.eq(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));
|
|
|
+ }
|
|
|
+
|
|
|
//客户状态(0:公海客户 1:私海客户)(业务员ID为null为公海客户,业务员ID不为null为私海客户)
|
|
|
if (ObjectUtil.isNotEmpty(dto.getType())) {
|
|
|
//私海客户查询
|
|
@@ -81,10 +105,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
wrapper.and(wrapper1 -> wrapper1.isNull("c.user_id").or().eq(Customer::getUserId, ""));
|
|
|
}
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
- //查询客户名称或者客户编码
|
|
|
- wrapper.and(wrapper1 -> wrapper1.like(Customer::getName, dto.getKeyword()).or().eq(Customer::getCode, dto.getKeyword()));
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//置顶条件
|
|
|
List<Long> customerIds = customerTopService.listObject(CustomerTop::getCustomerId, q -> q.eq(CustomerTop::getUserId,
|
|
@@ -198,9 +219,22 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
wrapper.eq("c", Customer::getSource, dto.getSource());
|
|
|
wrapper.eq("c", Customer::getStatus, dto.getStatus());
|
|
|
- if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
- //查询客户名称或者客户编码
|
|
|
- wrapper.and(wrapper1 -> wrapper1.like(Customer::getName, dto.getKeyword()).or().eq(Customer::getCode, dto.getKeyword()));
|
|
|
+ //国家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());
|