|
|
@ -1,6 +1,5 @@ |
|
|
|
package com.daqing.financial.crms.service.impl; |
|
|
|
package com.daqing.financial.crms.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
@ -20,6 +19,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service("customerService") |
|
|
|
@Service("customerService") |
|
|
@ -43,7 +43,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
* @param page 当前页 |
|
|
|
* @param page 当前页 |
|
|
|
* @param size 每页条数 |
|
|
|
* @param size 每页条数 |
|
|
|
* @param customerRequest 请求参数 |
|
|
|
* @param customerRequest 请求参数 |
|
|
|
* @return 所有客户以及信息集合 |
|
|
|
* @return 所有客户以及关联信息并完成分页的集合 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) { |
|
|
|
public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) { |
|
|
@ -55,6 +55,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
customerRequest.setStartTime(pastTime); |
|
|
|
customerRequest.setStartTime(pastTime); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 选择了自定义时间且选择了固定时间则固定时间无效
|
|
|
|
// 选择了自定义时间且选择了固定时间则固定时间无效
|
|
|
|
if (customerRequest.getCreateTime() != null && (customerRequest.getStartTime() != null || customerRequest.getEndTime() != null)) { |
|
|
|
if (customerRequest.getCreateTime() != null && (customerRequest.getStartTime() != null || customerRequest.getEndTime() != null)) { |
|
|
|
customerRequest.setCreateTime(null); |
|
|
|
customerRequest.setCreateTime(null); |
|
|
@ -65,20 +66,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
// 获取所有的客户基本信息
|
|
|
|
// 获取所有的客户基本信息
|
|
|
|
List<CustomerEntity> customers = customerEntityIPage.getRecords(); |
|
|
|
List<CustomerEntity> customers = customerEntityIPage.getRecords(); |
|
|
|
// 获取所有的客户经理id
|
|
|
|
// 获取所有的客户经理id
|
|
|
|
List<Long> ids = customers.stream().map(CustomerEntity::getId).collect(Collectors.toList()); |
|
|
|
Long[] ids = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new); |
|
|
|
|
|
|
|
|
|
|
|
// 用于拼装客户信息和员工及部门信息的集合
|
|
|
|
// 用于拼装客户信息和员工及部门信息的集合
|
|
|
|
List<CustomerTO> customerTOS = new ArrayList<>(); |
|
|
|
List<CustomerTO> customerTOS = new ArrayList<>(); |
|
|
|
CustomerTO customerTO = new CustomerTO(); |
|
|
|
CustomerTO customerTO; |
|
|
|
//TODO 远程调用查询客户经理信息的接口
|
|
|
|
//TODO 远程调用查询客户经理信息的接口
|
|
|
|
ResponseResult result = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
List<EmployeeTO> employeeTO = (List<EmployeeTO>) result.getData(); |
|
|
|
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData(); |
|
|
|
|
|
|
|
|
|
|
|
/*String data = (String) responseResult.getData(); |
|
|
|
|
|
|
|
List<EmployeeTO> employeeTO = JSON.parseArray(data, EmployeeTO.class);*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将客户信息和客户经理及部门信息拼装起来
|
|
|
|
// 将客户信息和客户经理及部门信息拼装起来
|
|
|
|
for (CustomerEntity customer : customers) { |
|
|
|
for (CustomerEntity customer : customers) { |
|
|
|
|
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
|
|
|
|
customerTO = new CustomerTO(); |
|
|
|
for (EmployeeTO anEmployeeTO : employeeTO) { |
|
|
|
for (EmployeeTO anEmployeeTO : employeeTO) { |
|
|
|
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { |
|
|
|
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { |
|
|
|
customerTO.setId(customer.getId()); |
|
|
|
customerTO.setId(customer.getId()); |
|
|
@ -91,7 +91,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
customerTOS.add(customerTO); |
|
|
|
customerTOS.add(customerTO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!Objects.equals(customerTO.getId(), customer.getId())){ |
|
|
|
if (!Objects.equals(customerTO.getId(), customer.getId())) { |
|
|
|
customerTO.setId(customer.getId()); |
|
|
|
customerTO.setId(customer.getId()); |
|
|
|
customerTO.setCode(customer.getCode()); |
|
|
|
customerTO.setCode(customer.getCode()); |
|
|
|
customerTO.setName(customer.getName()); |
|
|
|
customerTO.setName(customer.getName()); |
|
|
|