|
|
|
@ -50,12 +50,12 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
|
@Override |
|
|
|
|
public PageUtils list(Integer page, Integer size, CustomerWorkbenchRequest cwr) { |
|
|
|
|
// 分页参数
|
|
|
|
|
if (page == null || size == null){ |
|
|
|
|
if (page == null || size == null) { |
|
|
|
|
page = 1; |
|
|
|
|
size = 10; |
|
|
|
|
} |
|
|
|
|
// 校验时间参数
|
|
|
|
|
this.timeCheckout(cwr.getCreateTime(),cwr.getStartTime(),cwr.getEndTime(),cwr); |
|
|
|
|
this.timeCheckout(cwr.getCreateTime(), cwr.getStartTime(), cwr.getEndTime(), cwr); |
|
|
|
|
IPage<CustomerEntity> customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr); |
|
|
|
|
List<CustomerEntity> customers = customerEntityIPage.getRecords(); |
|
|
|
|
// 获取所有的客户经理id
|
|
|
|
@ -64,28 +64,34 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
|
Long[] customerIds = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new); |
|
|
|
|
// 返回列表实体类集合
|
|
|
|
|
List<CustomerWorkbenchListVO> customerWorkbenchListVOS = new ArrayList<>(); |
|
|
|
|
BeanUtils.copyProperties(customers,customerWorkbenchListVOS); |
|
|
|
|
if (managerIds.length != 0){ |
|
|
|
|
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); |
|
|
|
|
List<EmployeeTO> employeeTOs = (List<EmployeeTO>) responseResult.getData(); |
|
|
|
|
if (employeeTOs != null){ |
|
|
|
|
if (employeeTOs != null) { |
|
|
|
|
customerWorkbenchListVOS = this.jointCustomerEmployee(customers, employeeTOs); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (customerIds.length != 0){ |
|
|
|
|
if (customerIds.length != 0) { |
|
|
|
|
// TODO:远程调用担保服务查询每个客户的审批状态
|
|
|
|
|
for (CustomerWorkbenchListVO customerWorkbenchListVO : customerWorkbenchListVOS) { |
|
|
|
|
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())); |
|
|
|
|
customerWorkbenchListVOS.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); |
|
|
|
|
BeanUtils.copyProperties(customerEntityIPage, iPage); |
|
|
|
|
iPage.setRecords(customerWorkbenchListVOS); |
|
|
|
|
|
|
|
|
|
return new PageUtils(iPage); |
|
|
|
@ -170,21 +176,23 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过审核 |
|
|
|
|
* @param id 当前客户id |
|
|
|
|
* |
|
|
|
|
* @param id 当前客户id |
|
|
|
|
* @param manager 客户经理id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Boolean pass(Long id, Long manager) { |
|
|
|
|
if (id == null || manager == null){ |
|
|
|
|
if (id == null || manager == null) { |
|
|
|
|
ExceptionCast.cast(CommonCode.INVALID_PARAM); |
|
|
|
|
} |
|
|
|
|
return this.getBaseMapper().passById(id,manager); |
|
|
|
|
return this.getBaseMapper().passById(id, manager); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 不通过审核 |
|
|
|
|
* @param id 当前客户id |
|
|
|
|
* |
|
|
|
|
* @param id 当前客户id |
|
|
|
|
* @param cause 原因 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
@ -249,14 +257,14 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
|
customerWorkbenchListVO = new CustomerWorkbenchListVO(); |
|
|
|
|
for (EmployeeTO anEmployeeTO : employeeTO) { |
|
|
|
|
if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { |
|
|
|
|
BeanUtils.copyProperties(customer,customerWorkbenchListVO); |
|
|
|
|
BeanUtils.copyProperties(customer, customerWorkbenchListVO); |
|
|
|
|
customerWorkbenchListVO.setManager(anEmployeeTO.getEmpName()); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -266,10 +274,10 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl<CustomerWorkbenchD |
|
|
|
|
/** |
|
|
|
|
* 获取当前登录用户信息 |
|
|
|
|
*/ |
|
|
|
|
private String getUserId(){ |
|
|
|
|
private String getUserId() { |
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
|
|
|
|
String token = request.getHeader("token"); |
|
|
|
|
return RedisUtil.get("dq:token:"+token); |
|
|
|
|
return RedisUtil.get("dq:token:" + token); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|