Commit be186ce8 authored by liuzeheng's avatar liuzeheng

公海池客户列表导出优化

parent cb8ddf1e
......@@ -211,4 +211,10 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
long getWaitToConfirmCustomerPageReqCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getWaitToConfirmCustomerExcelVoListReq(@Param("query") CustomerExportReqDTO reqVO);
//公海客户列表
List<CustomerDO> getOpenSeaCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query") CustomerPageReqDTO pageReqVO);
//公海客户列表统计total
long getOpenSeaCustomerPageReqCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO);
}
......@@ -184,6 +184,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult<CustomerDO> getOpenSeaCustomerPage(CustomerPageReqVO pageReqVO);
PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page);
/**
* 获得公海池客户列表, 用于 Excel 导出
*
......@@ -192,6 +194,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
List<CustomerDO> getPublicCustomerExcelVoList(CustomerExportReqVO exportReqVO);
List<CustomerDO> getPublicCustomerExcelVoReqList(CustomerExportReqDTO exportReqVO);
/**
* 获得客户列表, 用于 Excel 导出
*
......
......@@ -82,6 +82,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.context.ApplicationContext;
......@@ -1544,6 +1545,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
@Override
public PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page){
pageReqVO.setIsInOpenSea(true);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<CustomerDO> list = customerMapper.getOpenSeaCustomerPageReq(start,size,pageReqVO);
long total = customerMapper.getOpenSeaCustomerPageReqCount(pageReqVO) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public List<CustomerDO> getPublicCustomerExcelVoList(CustomerExportReqVO reqVO) {
LambdaQueryWrapper<CustomerDO> customerDOLambdaQueryWrapperX = new LambdaQueryWrapperX<CustomerDO>()
......@@ -1591,6 +1605,12 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX);
}
@Override
public List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO){
reqVO.setIsInOpenSea(true) ;
return customerMapper.getPublicCustomerExcelVoReqList(reqVO) ;
}
@Override
public List<CustomerDO> getCustomerExcelVoList(CustomerExportReqVO reqVO) {
LambdaQueryWrapper<CustomerDO> customerDOLambdaQueryWrapperX = new LambdaQueryWrapperX<CustomerDO>()
......
......@@ -1461,6 +1461,107 @@
<include refid="myCustomerQuery"/>
</select>
<select id="getOpenSeaCustomerPageReq"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
select contact.*,
level.name_zh as vip_level_name_zh,
level.name_en as vip_level_name_en,
credit.name_zh as credit_level_name_zh,
credit.name_en as credit_level_name_en,
ec.name_zh as country_name,
(select GROUP_CONCAT(s.phone_new) from ecw_customer_contacts s where s.deleted = 0 and s.customer_id=contact.id) as all_contact_phone
from (select a.*,
c.name as default_contact_name,
concat(c.area_code, c.phone_new, '') as default_contact_phone,
c.phone_new as contactPhone,
c.id as defaultContactId,
c.social as default_social,
c.email as default_email,
c.social_number as default_social_number,
su.nickname as customer_service_name,
su.dept_id as dept_id
from ecw_customer a
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join system_user su on a.customer_service = su.id
where a.deleted = 0) contact
left join ecw_customer_level level
on contact.level = level.id
left join ecw_customer_credit credit
on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id
WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL
<include refid="myCustomerQuery"/>
GROUP BY contact.id
order by contact.id desc
limit #{start}, #{size}
</select>
<select id="getOpenSeaCustomerPageReqCount" resultType="java.lang.Long"
parameterType="cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO">
select count(1)
from (select a.*,
c.name as default_contact_name,
concat(c.area_code, c.phone_new, '') as default_contact_phone,
c.phone_new as contactPhone,
c.id as defaultContactId,
c.social as default_social,
c.email as default_email,
c.social_number as default_social_number,
su.nickname as customer_service_name,
su.dept_id as dept_id
from ecw_customer a
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join system_user su on a.customer_service = su.id
where a.deleted = 0) contact
left join ecw_customer_level level
on contact.level = level.id
left join ecw_customer_credit credit
on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id
WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL
<include refid="myCustomerQuery"/>
</select>
<select id="getPublicCustomerExcelVoReqList"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"
parameterType="cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO">
select contact.*,
level.name_zh as vip_level_name_zh,
level.name_en as vip_level_name_en,
credit.name_zh as credit_level_name_zh,
credit.name_en as credit_level_name_en,
ec.name_zh as country_name,
(select GROUP_CONCAT(s.phone_new) from ecw_customer_contacts s where s.deleted = 0 and s.customer_id=contact.id) as all_contact_phone
from (select a.*,
c.name as default_contact_name,
concat(c.area_code, c.phone_new, '') as default_contact_phone,
c.phone_new as contactPhone,
c.id as defaultContactId,
c.social as default_social,
c.email as default_email,
c.social_number as default_social_number,
su.nickname as customer_service_name,
su.dept_id as dept_id
from ecw_customer a
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join system_user su on a.customer_service = su.id
where a.deleted = 0) contact
left join ecw_customer_level level
on contact.level = level.id
left join ecw_customer_credit credit
on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id
WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL
<include refid="myCustomerQuery"/>
</select>
</mapper>
......@@ -412,9 +412,9 @@ public class CustomerController {
@GetMapping("/get-public")
@ApiOperation("获得公海池客户列表")
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getPublicCustomerList(@Valid CustomerPageReqVO customerPageReqVO) {
public CommonResult<PageResult<CustomerRespVO>> getPublicCustomerList(@Valid CustomerPageReqDTO customerPageReqVO,PageVO page) {
PageResult<CustomerDO> pageResult = customerService.getOpenSeaCustomerPage(customerPageReqVO);
PageResult<CustomerDO> pageResult = customerService.getOpenSeaCustomerPageReq(customerPageReqVO,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
......@@ -681,7 +681,7 @@ public class CustomerController {
@GetMapping("/waite-confirm-export-excel")
@ApiOperation("我的待接收客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportWaiteConfirmCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportWaiteConfirmCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_CONFIRM_PUBLIC_EXCEL_EXPORT, "我的待接收客户导出Excel");
return success(true);
......@@ -690,7 +690,7 @@ public class CustomerController {
@GetMapping("/public-export-excel")
@ApiOperation("公海池客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportPublicCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportPublicCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_PUBLIC_EXCEL_EXPORT, "公海池客户导出Excel");
return success(true);
......
......@@ -109,8 +109,9 @@ public class CustomerExcelExportListener {
*/
@EventListener(CustomerPublicExcelExportPushEvent.class)
public void customerPublicExcelExportPushEvent(CustomerPublicExcelExportPushEvent event) {
CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
List<CustomerDO> list = customerService.getPublicCustomerExcelVoList(exportReqVO);
//CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
List<CustomerDO> list = customerService.getPublicCustomerExcelVoReqList(exportReqVO);
makeExcelUpload(event, list);
}
......
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