|
@@ -11,6 +11,7 @@ import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.customer.service.customer.CustomerUserService;
|
|
|
import com.fjhx.customer.utils.code.CodeEnum;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -20,6 +21,7 @@ import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.fjhx.customer.entity.customer.dto.CustomerDto;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
+import java.security.Security;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -48,8 +50,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()),Customer::getStatus,dto.getStatus());
|
|
|
//客户状态(0:公海客户 1:私海客户)(业务员ID为null为公海客户,业务员ID不为null为私海客户)
|
|
|
if (ObjectUtil.isNotEmpty(dto.getType())){
|
|
|
- wrapper.isNotNull(dto.getType().equals("1"),Customer::getUserId);
|
|
|
- wrapper.isNull(dto.getType().equals("0"),Customer::getUserId);
|
|
|
+ //私海客户查询
|
|
|
+ if (dto.getType().equals("1")){
|
|
|
+ wrapper.isNotNull(Customer::getUserId);
|
|
|
+ }else if (dto.getType().equals("0")){
|
|
|
+ wrapper.isNull(Customer::getUserId);
|
|
|
+ }
|
|
|
}
|
|
|
wrapper.orderByDesc(Customer::getCreateTime);
|
|
|
Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
@@ -81,6 +87,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
public void add(CustomerDto customerDto) {
|
|
|
customerDto.setCode(CodeEnum.CUSTOMER.getCode());
|
|
|
this.save(customerDto);
|
|
|
+ //添加库户-联系人表的信息
|
|
|
saveCustomerUse(customerDto);
|
|
|
}
|
|
|
|
|
@@ -94,7 +101,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
this.updateById(customerDto);
|
|
|
//删除客户-用户表的信息
|
|
|
customerUserService.remove(Wrappers.<CustomerUser>lambdaQuery().eq(CustomerUser::getCustomerId,customerDto.getId()));
|
|
|
-
|
|
|
+ //添加库户-联系人表的信息
|
|
|
+ saveCustomerUse(customerDto);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -109,6 +117,21 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
customerUserService.remove(Wrappers.<CustomerUser>lambdaQuery().eq(CustomerUser::getCustomerId,id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 私海客户表分页(添加权限自己看自己)
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<CustomerVo> privateSeaPage(CustomerSelectDto dto) {
|
|
|
+ LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(dto.getSource()),Customer::getSource,dto.getSource());
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()),Customer::getStatus,dto.getStatus());
|
|
|
+ //添加权限(自己看自己)
|
|
|
+ wrapper.eq(Customer::getUserId, SecurityUtils.getUserId());
|
|
|
+ wrapper.orderByDesc(Customer::getCreateTime);
|
|
|
+ Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
//添加客户用户表的信息
|
|
|
private void saveCustomerUse(CustomerDto customerDto){
|
|
|
List<CustomerUser> customerUserDtoList = customerDto.getCustomerUserList();
|