修复前后台客户列表客户经理名称和部门显示问题

master
river 4 years ago
parent c471f516c1
commit a03f2e92ff
  1. 50
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  2. 54
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java
  3. 15
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java
  4. 3
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java

@ -82,26 +82,33 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
// 获取所有的客户基本信息 // 获取所有的客户基本信息
List<CustomerEntity> customers = customerEntityIPage.getRecords(); List<CustomerEntity> customers = customerEntityIPage.getRecords();
// 获取所有的客户经理id // 获取所有的客户经理id
Long[] managerIds = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new); Long[] managerIds = new Long[customers.size()];
for (int i = 0; i < customers.size(); i++) {
if (managerIds.length != 0) { if (customers.get(i).getManager() != null) {
//TODO 远程调用查询客户经理信息的接口 managerIds[i] = customers.get(i).getManager();
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); } else {
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData(); managerIds[i] = 0L;
if (employeeTO != null){ }
// 将客户信息和客户经理及部门信息拼装起来 }
List<CustomerTO> customerTOS = this.jointCustomerEmployee(customers, employeeTO);
// 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils
IPage<CustomerTO> iPage = new Page<>(); IPage<CustomerTO> iPage = new Page<>();
BeanUtils.copyProperties(customerEntityIPage, iPage); BeanUtils.copyProperties(customerEntityIPage, iPage);
iPage.setRecords(customerTOS); List<CustomerTO> listResponse = new ArrayList<>();
return new PageUtils(iPage); // 获取所有的客户经理名称和部门名称
ResponseResult<List<EmployeeTO>> responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds);
List<EmployeeTO> employeeTO = responseResult.getData();
if (employeeTO != null) {
// 将客户信息和客户经理及部门信息拼装起来
listResponse = this.jointCustomerEmployee(customers, employeeTO);
} else { } else {
return new PageUtils(customerEntityIPage); for (CustomerEntity customer : customers) {
CustomerTO customerTO = new CustomerTO();
BeanUtils.copyProperties(customer, customerTO);
listResponse.add(customerTO);
} }
} else {
return new PageUtils(customerEntityIPage);
} }
iPage.setRecords(listResponse);
return new PageUtils(iPage);
} }
/** /**
@ -285,6 +292,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
/** /**
* 导出数据到excel * 导出数据到excel
*
* @param response 响应 * @param response 响应
*/ */
@Transactional @Transactional
@ -331,6 +339,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
/** /**
* 导入excel数据 * 导入excel数据
*
* @param excel * @param excel
*/ */
@Transactional @Transactional
@ -467,24 +476,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
for (CustomerEntity customer : customers) { for (CustomerEntity customer : customers) {
// 每一个客户对应一个不同的对象 // 每一个客户对应一个不同的对象
customerTO = new CustomerTO(); customerTO = new CustomerTO();
for (EmployeeTO anEmployeeTO : employeeTO) { for (EmployeeTO employee : employeeTO) {
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { if (Objects.equals(customer.getManager(), employee.getId())) {
BeanUtils.copyProperties(customer,customerTO); customerTO.setManager(employee.getEmpName());
customerTO.setManager(anEmployeeTO.getEmpName()); customerTO.setDepartments(employee.getDeptNames());
customerTO.setDepartments(anEmployeeTO.getDeptNames());
customerTOS.add(customerTO);
} }
} }
if (!Objects.equals(customerTO.getId(), customer.getId())) {
BeanUtils.copyProperties(customer, customerTO); BeanUtils.copyProperties(customer, customerTO);
customerTOS.add(customerTO); customerTOS.add(customerTO);
} }
}
return customerTOS; return customerTOS;
} }
/** /**
* 封装个人类型的客户信息 * 封装个人类型的客户信息
* *

@ -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;
} }
/** /**

@ -107,20 +107,21 @@ public class DgWorkConferenceConsiderServiceImpl extends ServiceImpl<DgWorkConfe
// 根据userId获取对应的员工姓名 // 根据userId获取对应的员工姓名
ResponseResult<List<EmployeeVO>> responseResult = hrmsFeignService.listEmpNameByUserId(userIds); ResponseResult<List<EmployeeVO>> responseResult = hrmsFeignService.listEmpNameByUserId(userIds);
System.out.println(responseResult.getData()); System.out.println(responseResult.getData());
List<DgWorkConferenceResponse> workConferenceResponses = new ArrayList<>(); List<DgWorkConferenceResponse> listResponse = new ArrayList<>();
if (responseResult.getData() != null) { if (responseResult.getData() != null) {
// 将对应的userId转换为name // 将对应的userId转换为name
workConferenceResponses = this.transitionUserName(dgWorkConferencePOS, responseResult.getData()); listResponse = this.transitionUserName(dgWorkConferencePOS, responseResult.getData());
} else { } else {
for (int i = 0; i < dgWorkConferencePOS.size(); i++) { for (DgWorkConferencePO workConferencePO : dgWorkConferencePOS) {
DgWorkConferenceResponse workConferenceResponse = new DgWorkConferenceResponse(); DgWorkConferenceResponse workConference = new DgWorkConferenceResponse();
BeanUtils.copyProperties(dgWorkConferencePOS.get(i), workConferenceResponse); BeanUtils.copyProperties(workConferencePO, workConference);
workConferenceResponses.add(workConferenceResponse); listResponse.add(workConference);
} }
} }
// 分页属性复制并返回
IPage<DgWorkConferenceResponse> iPage = new Page<>(); IPage<DgWorkConferenceResponse> iPage = new Page<>();
BeanUtils.copyProperties(list, iPage); BeanUtils.copyProperties(list, iPage);
iPage.setRecords(workConferenceResponses); iPage.setRecords(listResponse);
return new PageUtils(iPage); return new PageUtils(iPage);
} }

@ -580,11 +580,13 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
*/ */
@Override @Override
public List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids) { public List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids) {
return this.getBaseMapper().getEmployeeAndDeptById(ids); return this.getBaseMapper().getEmployeeAndDeptById(ids);
} }
/** /**
* 根据userId查询员工的头像 * 根据userId查询员工的头像
*
* @return * @return
*/ */
@Override @Override
@ -603,7 +605,6 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
} }
@Override @Override
public boolean insertUsrRole(List<DgGuaranteePO> list) { public boolean insertUsrRole(List<DgGuaranteePO> list) {
return this.getBaseMapper().insertUsrRole(list); return this.getBaseMapper().insertUsrRole(list);

Loading…
Cancel
Save