|
|
@ -62,40 +62,44 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
IPage<CustomerEntityResponse> customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr); |
|
|
|
IPage<CustomerEntityResponse> customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr); |
|
|
|
List<CustomerEntityResponse> customers = customerEntityIPage.getRecords(); |
|
|
|
List<CustomerEntityResponse> customers = customerEntityIPage.getRecords(); |
|
|
|
// 获取所有的客户经理id
|
|
|
|
// 获取所有的客户经理id
|
|
|
|
Long[] managerIds = customers.stream().map(CustomerEntityResponse::getManager).toArray(Long[]::new); |
|
|
|
Long[] managerIds = new Long[customers.size()]; |
|
|
|
|
|
|
|
for (int i = 0; i < customers.size(); i++) { |
|
|
|
|
|
|
|
if (customers.get(i).getManager() != null) { |
|
|
|
|
|
|
|
managerIds[i] = customers.get(i).getManager(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
managerIds[i] = 0L; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// 获取所有的客户id
|
|
|
|
// 获取所有的客户id
|
|
|
|
Long[] customerIds = customers.stream().map(CustomerEntityResponse::getId).toArray(Long[]::new); |
|
|
|
Long[] customerIds = customers.stream().map(CustomerEntityResponse::getId).toArray(Long[]::new); |
|
|
|
// 返回列表实体类集合
|
|
|
|
// 返回列表实体类集合
|
|
|
|
List<CustomerWorkbenchListVO> customerWorkbenchListVOS = new ArrayList<>(); |
|
|
|
List<CustomerWorkbenchListVO> listResponse = new ArrayList<>(); |
|
|
|
for (int i = 0; i < customers.size(); i++) { |
|
|
|
|
|
|
|
CustomerWorkbenchListVO customerWorkbenchListVO = new CustomerWorkbenchListVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(customers.get(i), customerWorkbenchListVO); |
|
|
|
|
|
|
|
customerWorkbenchListVOS.add(customerWorkbenchListVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
System.out.println(customerWorkbenchListVOS); |
|
|
|
|
|
|
|
if (managerIds.length != 0) { |
|
|
|
|
|
|
|
// 远程调用查询客户对应的客户经理信息
|
|
|
|
// 远程调用查询客户对应的客户经理信息
|
|
|
|
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); |
|
|
|
ResponseResult<List<EmployeeTO>> responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); |
|
|
|
List<EmployeeTO> employeeTOs = (List<EmployeeTO>) responseResult.getData(); |
|
|
|
List<EmployeeTO> employeeTOs = responseResult.getData(); |
|
|
|
if (employeeTOs != null) { |
|
|
|
if (employeeTOs != null) { |
|
|
|
customerWorkbenchListVOS = this.jointCustomerEmployee(customers, employeeTOs); |
|
|
|
listResponse = this.jointCustomerEmployee(customers, employeeTOs); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (CustomerEntityResponse customer : customers) { |
|
|
|
|
|
|
|
CustomerWorkbenchListVO workbenchListVO = new CustomerWorkbenchListVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(customer, workbenchListVO); |
|
|
|
|
|
|
|
listResponse.add(workbenchListVO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (customerIds.length != 0) { |
|
|
|
if (customerIds.length != 0) { |
|
|
|
// TODO:远程调用担保服务查询每个客户的审批状态
|
|
|
|
// TODO:远程调用担保服务查询每个客户的审批状态
|
|
|
|
for (CustomerWorkbenchListVO customerWorkbenchListVO : customerWorkbenchListVOS) { |
|
|
|
for (CustomerWorkbenchListVO customerWorkbenchListVO : listResponse) { |
|
|
|
customerWorkbenchListVO.setStatus(2); |
|
|
|
customerWorkbenchListVO.setStatus(2); |
|
|
|
} |
|
|
|
} |
|
|
|
if (cwr.getStatus() != null && (cwr.getStatus() == 0 || cwr.getStatus() == 1 || cwr.getStatus() == 2)) { |
|
|
|
if (cwr.getStatus() != null && (cwr.getStatus() == 0 || cwr.getStatus() == 1 || cwr.getStatus() == 2)) { |
|
|
|
// 筛选状态
|
|
|
|
// 筛选状态
|
|
|
|
customerWorkbenchListVOS.removeIf(customerWorkbenchListVO -> !Objects.equals(customerWorkbenchListVO.getStatus(), cwr.getStatus())); |
|
|
|
listResponse.removeIf(customerWorkbenchListVO -> !Objects.equals(customerWorkbenchListVO.getStatus(), cwr.getStatus())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println(customerWorkbenchListVOS); |
|
|
|
|
|
|
|
// 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils
|
|
|
|
// 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils
|
|
|
|
IPage<CustomerWorkbenchListVO> iPage = new Page<>(); |
|
|
|
IPage<CustomerWorkbenchListVO> iPage = new Page<>(); |
|
|
|
BeanUtils.copyProperties(customerEntityIPage, iPage); |
|
|
|
BeanUtils.copyProperties(customerEntityIPage, iPage); |
|
|
|
iPage.setRecords(customerWorkbenchListVOS); |
|
|
|
iPage.setRecords(listResponse); |
|
|
|
|
|
|
|
|
|
|
|
return new PageUtils(iPage); |
|
|
|
return new PageUtils(iPage); |
|
|
|
} |
|
|
|
} |
|
|
@ -252,26 +256,22 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
* 拼接客户及其对应的客户经理及部门信息 |
|
|
|
* 拼接客户及其对应的客户经理及部门信息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<CustomerWorkbenchListVO> jointCustomerEmployee(List<CustomerEntityResponse> customers, List<EmployeeTO> employeeTO) { |
|
|
|
private List<CustomerWorkbenchListVO> jointCustomerEmployee(List<CustomerEntityResponse> customers, List<EmployeeTO> employeeTO) { |
|
|
|
List<CustomerWorkbenchListVO> customerWorkbenchListVOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合
|
|
|
|
List<CustomerWorkbenchListVO> listResponse = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合
|
|
|
|
CustomerWorkbenchListVO customerWorkbenchListVO; |
|
|
|
CustomerWorkbenchListVO customerWorkbenchListVO; |
|
|
|
// 将客户信息和客户经理及部门信息拼装起来
|
|
|
|
// 将客户信息和客户经理及部门信息拼装起来
|
|
|
|
for (CustomerEntityResponse customer : customers) { |
|
|
|
for (CustomerEntityResponse customer : customers) { |
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
customerWorkbenchListVO = new CustomerWorkbenchListVO(); |
|
|
|
customerWorkbenchListVO = new CustomerWorkbenchListVO(); |
|
|
|
for (EmployeeTO anEmployeeTO : employeeTO) { |
|
|
|
for (int i = 0; i < employeeTO.size(); i++) { |
|
|
|
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { |
|
|
|
if (customer.getManager() != null && customer.getManager().equals(employeeTO.get(i).getId())) { |
|
|
|
BeanUtils.copyProperties(customer, customerWorkbenchListVO); |
|
|
|
customerWorkbenchListVO.setManager(employeeTO.get(i).getEmpName()); |
|
|
|
customerWorkbenchListVO.setManager(anEmployeeTO.getEmpName()); |
|
|
|
customerWorkbenchListVO.setDepartments(employeeTO.get(i).getDeptNames()); |
|
|
|
customerWorkbenchListVO.setDepartments(anEmployeeTO.getDeptNames()); |
|
|
|
|
|
|
|
customerWorkbenchListVOS.add(customerWorkbenchListVO); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!Objects.equals(customerWorkbenchListVO.getId(), customer.getId())) { |
|
|
|
|
|
|
|
BeanUtils.copyProperties(customer, customerWorkbenchListVO); |
|
|
|
BeanUtils.copyProperties(customer, customerWorkbenchListVO); |
|
|
|
customerWorkbenchListVOS.add(customerWorkbenchListVO); |
|
|
|
listResponse.add(customerWorkbenchListVO); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return customerWorkbenchListVOS; |
|
|
|
return listResponse; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|