소스 검색

客户分页

24282 2 년 전
부모
커밋
267b76ff51

+ 4 - 3
hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerController.java

@@ -8,6 +8,7 @@ import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.fjhx.customer.service.customer.CustomerService;
 import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -40,13 +41,13 @@ public class CustomerController {
         return customerService.getPage(dto);
     }
 
-
     /**
      * 私海客户表分页(添加权限自己看自己)
      */
     @PostMapping("/privateSeaPage")
     public Page<CustomerVo> privateSeaPage(@RequestBody CustomerSelectDto dto) {
-        return customerService.privateSeaPage(dto);
+        dto.setUserId(SecurityUtils.getUserId());
+        return customerService.getPage(dto);
     }
 
     /**
@@ -98,7 +99,6 @@ public class CustomerController {
         customerService.editTag(customerDto);
     }
 
-
     /**
      * 客户来源统计
      */
@@ -106,4 +106,5 @@ public class CustomerController {
     public Map<String,Object> sourceStatistics(@RequestBody  CustomerSelectDto  customerDto){
         return customerService.sourceStatistics(customerDto);
     }
+
 }

+ 4 - 10
hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerService.java

@@ -1,12 +1,12 @@
 package com.fjhx.customer.service.customer;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.fjhx.customer.entity.customer.po.Customer;
-import com.ruoyi.common.core.service.BaseService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.customer.entity.customer.vo.CustomerVo;
-import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
+import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
+import com.fjhx.customer.entity.customer.po.Customer;
+import com.fjhx.customer.entity.customer.vo.CustomerVo;
+import com.ruoyi.common.core.service.BaseService;
 
 import java.util.List;
 import java.util.Map;
@@ -48,12 +48,6 @@ public interface CustomerService extends BaseService<Customer> {
     void delete(Long id);
 
     /**
-     * 私海客户表分页(添加权限自己看自己)
-     */
-    Page<CustomerVo> privateSeaPage(CustomerSelectDto dto);
-
-
-    /**
      * 来源存量(客户分析)
      * @param query
      * @return

+ 3 - 59
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -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