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

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

@ -62,40 +62,44 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD
IPage<CustomerEntityResponse> customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr);
List<CustomerEntityResponse> customers = customerEntityIPage.getRecords();
// 获取所有的客户经理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
Long[] customerIds = customers.stream().map(CustomerEntityResponse::getId).toArray(Long[]::new);
// 返回列表实体类集合
List<CustomerWorkbenchListVO> customerWorkbenchListVOS = 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) {
List<CustomerWorkbenchListVO> listResponse = new ArrayList<>();
// 远程调用查询客户对应的客户经理信息
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds);
List<EmployeeTO> employeeTOs = (List<EmployeeTO>) responseResult.getData();
ResponseResult<List<EmployeeTO>> responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds);
List<EmployeeTO> employeeTOs = responseResult.getData();
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) {
// TODO:远程调用担保服务查询每个客户的审批状态
for (CustomerWorkbenchListVO customerWorkbenchListVO : customerWorkbenchListVOS) {
for (CustomerWorkbenchListVO customerWorkbenchListVO : listResponse) {
customerWorkbenchListVO.setStatus(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
IPage<CustomerWorkbenchListVO> iPage = new Page<>();
BeanUtils.copyProperties(customerEntityIPage, iPage);
iPage.setRecords(customerWorkbenchListVOS);
iPage.setRecords(listResponse);
return new PageUtils(iPage);
}
@ -252,26 +256,22 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD
* 拼接客户及其对应的客户经理及部门信息
*/
private List<CustomerWorkbenchListVO> jointCustomerEmployee(List<CustomerEntityResponse> customers, List<EmployeeTO> employeeTO) {
List<CustomerWorkbenchListVO> customerWorkbenchListVOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合
List<CustomerWorkbenchListVO> listResponse = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合
CustomerWorkbenchListVO customerWorkbenchListVO;
// 将客户信息和客户经理及部门信息拼装起来
for (CustomerEntityResponse customer : customers) {
// 每一个客户对应一个不同的对象
customerWorkbenchListVO = new CustomerWorkbenchListVO();
for (EmployeeTO anEmployeeTO : employeeTO) {
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) {
BeanUtils.copyProperties(customer, customerWorkbenchListVO);
customerWorkbenchListVO.setManager(anEmployeeTO.getEmpName());
customerWorkbenchListVO.setDepartments(anEmployeeTO.getDeptNames());
customerWorkbenchListVOS.add(customerWorkbenchListVO);
for (int i = 0; i < employeeTO.size(); i++) {
if (customer.getManager() != null && customer.getManager().equals(employeeTO.get(i).getId())) {
customerWorkbenchListVO.setManager(employeeTO.get(i).getEmpName());
customerWorkbenchListVO.setDepartments(employeeTO.get(i).getDeptNames());
}
}
if (!Objects.equals(customerWorkbenchListVO.getId(), customer.getId())) {
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获取对应的员工姓名
ResponseResult<List<EmployeeVO>> responseResult = hrmsFeignService.listEmpNameByUserId(userIds);
System.out.println(responseResult.getData());
List<DgWorkConferenceResponse> workConferenceResponses = new ArrayList<>();
List<DgWorkConferenceResponse> listResponse = new ArrayList<>();
if (responseResult.getData() != null) {
// 将对应的userId转换为name
workConferenceResponses = this.transitionUserName(dgWorkConferencePOS, responseResult.getData());
listResponse = this.transitionUserName(dgWorkConferencePOS, responseResult.getData());
} else {
for (int i = 0; i < dgWorkConferencePOS.size(); i++) {
DgWorkConferenceResponse workConferenceResponse = new DgWorkConferenceResponse();
BeanUtils.copyProperties(dgWorkConferencePOS.get(i), workConferenceResponse);
workConferenceResponses.add(workConferenceResponse);
for (DgWorkConferencePO workConferencePO : dgWorkConferencePOS) {
DgWorkConferenceResponse workConference = new DgWorkConferenceResponse();
BeanUtils.copyProperties(workConferencePO, workConference);
listResponse.add(workConference);
}
}
// 分页属性复制并返回
IPage<DgWorkConferenceResponse> iPage = new Page<>();
BeanUtils.copyProperties(list, iPage);
iPage.setRecords(workConferenceResponses);
iPage.setRecords(listResponse);
return new PageUtils(iPage);
}

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

Loading…
Cancel
Save