Commit c9f8bdc8 authored by zhengyi's avatar zhengyi

客户列表相关查询返回客户最新跟进记录

parent 1ac03b4d
......@@ -118,9 +118,6 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
@Resource
private CustomerMapper customerMapper;
@Resource
private CustomerFollowupService customerFollowupService;
@Resource
private ParamValidatorService paramValidatorService;
......@@ -1183,17 +1180,6 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<CustomerDO> list = customerMapper.getMyPage(start, size, pageReqVO);
if (CollectionUtil.isNotEmpty(list)) {
for (CustomerDO customerDO : list) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, customerDO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
customerDO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
long total = customerMapper.getMyPageCount(pageReqVO);
return new PageResult<>(list, total,
mpPage.getSize(), page.getPage(),
......
......@@ -20,12 +20,14 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
import cn.iocoder.yudao.module.customer.convert.customerBank.CustomerBankConvert;
import cn.iocoder.yudao.module.customer.convert.customerContacts.CustomerContactsConvert;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.CustomerCommissionDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.follow.CustomerFollowDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBankDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.dal.mysql.customerDetail.CustomerDetailMapper;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
......@@ -38,6 +40,7 @@ import cn.iocoder.yudao.module.customer.service.customer.complaint.follow.Custom
import cn.iocoder.yudao.module.customer.service.customerBank.CustomerBankService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.service.customerCredit.CustomerCreditService;
import cn.iocoder.yudao.module.customer.service.customerFollowup.CustomerFollowupService;
import cn.iocoder.yudao.module.customer.service.customerLevel.CustomerLevelService;
import cn.iocoder.yudao.module.customer.service.customerLevelLog.CustomerLevelLogServiceImpl;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
......@@ -117,7 +120,8 @@ public class CustomerController {
@Resource
private CustomerService customerService;
@Resource
private CustomerFollowupService customerFollowupService;
@Resource
private CustomerMergeService customerMergeService;
......@@ -528,7 +532,19 @@ public class CustomerController {
PageResult<CustomerDO> pageResult =
customerService.getWaitToConfirmCustomerPageReq(customerPageReqVO,
page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
private Integer getCustomerTime(String customers_to_be_assigned, int i) {
......@@ -552,7 +568,19 @@ public class CustomerController {
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(pageVO, page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
@GetMapping("/get-wait-for-distribution")
......@@ -562,7 +590,19 @@ public class CustomerController {
//
PageResult<CustomerDO> pageResult =
customerService.getWaitToAssignedCustomerPageReq(customerPageReqVO, page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
@GetMapping("/get-public")
......@@ -572,7 +612,19 @@ public class CustomerController {
PageResult<CustomerDO> pageResult =
customerService.getOpenSeaCustomerPageReq(customerPageReqVO, page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
@GetMapping("/delay/approval/info")
......@@ -673,7 +725,19 @@ public class CustomerController {
// customerPageReqVO.setFlag4QueryCondition("Y");
PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(customerPageReqVO, page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
@PutMapping("/confirm")
......@@ -752,7 +816,19 @@ public class CustomerController {
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult<CustomerDO> pageResult =
customerService.getMyCustomerPage(pageVO, page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
PageResult<CustomerRespVO> respVOPageResult = CustomerConvert.INSTANCE.convertPage(pageResult);
if (CollectionUtil.isNotEmpty(respVOPageResult.getList())) {
for (CustomerRespVO respVO : respVOPageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getCustomerId, respVO.getId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(respVOPageResult);
}
@GetMapping("/deptPage")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment