Commit 46102e37 authored by liuzeheng's avatar liuzeheng

优化

parent ace9f0a4
......@@ -217,4 +217,12 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
long getOpenSeaCustomerPageReqCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO);
List<CustomerDO> getDeptCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query") CustomerPageReqDTO pageReqVO,@Param("deptId") Long deptId);
long getDeptCustomerPageReqCount(@Param("query") CustomerPageReqDTO pageReqVO,@Param("deptId") Long deptId);
List<CustomerDO> getDeptCustomerExcelVoListReq(@Param("query") CustomerExportReqDTO exportReqVO,@Param("deptId") Long deptId);
}
package cn.iocoder.yudao.module.customer.dal.mysql.indirectCustomer;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.customer.vo.indirectCustomer.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 间接客户 Mapper
* @author yanghao
......@@ -26,4 +23,10 @@ public interface IndirectCustomerMapper extends AbstractMapper<IndirectCustomerD
@Param(Constants.WRAPPER) Wrapper<IndirectCustomerDO> queryWrapper);
List<IndirectCustomerDO> getList(@Param(Constants.WRAPPER) Wrapper<IndirectCustomerDO> queryWrapper);
List<IndirectCustomerDO> getIndirectCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query") IndirectCustomerPageReqDTO pageReqVO);
long getOpenSeaCustomerPageReqCount(@Param("query") IndirectCustomerPageReqDTO pageReqVO);
List<IndirectCustomerDO> getIndirectCustomerListReq(@Param("query") IndirectCustomerPageReqDTO reqVO);
}
......@@ -87,4 +87,5 @@ public class CustomerExportReqDTO {
private List<Integer> marketType;
private int deptId ;
}
package cn.iocoder.yudao.module.customer.dto.indirectCustomer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 间接客户导出 DTO")
public class IndirectCustomerExportReqDTO {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户来源id")
private Long agentId;
@ApiModelProperty(value = "客户经理")
private List<Long> customerService;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "主联系人")
private String defaultContactName;
@ApiModelProperty(value = "主联系电话")
private String defaultContactPhone;
@ApiModelProperty(value = "市场获客")
private List<Integer> marketType;
/**
* 客户来源
*/
private List<Integer> source;
}
package cn.iocoder.yudao.module.customer.dto.indirectCustomer;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 间接客户查询 DTO")
public class IndirectCustomerPageReqDTO {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户来源id")
private Long agentId;
@ApiModelProperty(value = "客户经理")
private List<Long> customerService;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "主联系人")
private String defaultContactName;
@ApiModelProperty(value = "主联系电话")
private String defaultContactPhone;
@ApiModelProperty(value = "市场获客")
private List<Integer> marketType;
/**
* 客户来源
*/
private List<Integer> source;
}
......@@ -115,6 +115,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult<CustomerDO> getDeptCustomerPage(CustomerPageReqVO pageReqVO);
PageResult<CustomerDO> getDeptCustomerPageReq(CustomerPageReqDTO pageReqVO ,PageVO page);
/**
* 获得部门客户分页
*
......@@ -123,6 +125,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
List<CustomerDO> getDeptCustomerExcelVoList(CustomerExportReqVO exportReqVO);
List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO);
/**
* 获得待接收客户分页
*
......
......@@ -1183,6 +1183,34 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
@Override
public PageResult<CustomerDO> getDeptCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page){
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long deptId =null;
if (null != loginUser && null != loginUser.getDeptId()) {
deptId = loginUser.getDeptId() ;
}
List<CustomerDO> list = customerMapper.getDeptCustomerPageReq(start,size,pageReqVO,deptId);
long total = customerMapper.getDeptCustomerPageReqCount(pageReqVO,deptId) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long deptId =null;
if (null != loginUser && null != loginUser.getDeptId()) {
deptId = loginUser.getDeptId() ;
}
return customerMapper.getDeptCustomerExcelVoListReq(exportReqVO,deptId) ;
}
@Override
public List<CustomerDO> getDeptCustomerExcelVoList(CustomerExportReqVO reqVO) {
......
......@@ -5,6 +5,9 @@ import javax.validation.*;
import cn.iocoder.yudao.framework.apollo.core.event.AdminClientCreateEvent;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.indirectCustomer.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO;
......@@ -66,10 +69,15 @@ public interface IndirectCustomerService extends IService<IndirectCustomerDO> {
*/
PageResult<IndirectCustomerDO> getIndirectCustomerPage(IndirectCustomerPageReqVO pageReqVO);
PageResult<IndirectCustomerDO> getIndirectCustomerPageReq(IndirectCustomerPageReqDTO pageReqVO, PageVO page);
List<IndirectCustomerDO> getIndirectCustomerListReq(IndirectCustomerPageReqDTO reqVO);
/**
* 获得间接客户列表, 用于 Excel 导出
* @param reqVO 查询
* @return 间接客户列表
*/
List<IndirectCustomerDO> getIndirectCustomerList(IndirectCustomerExportReqVO reqVO);
}
......@@ -6,10 +6,12 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.framework.apollo.core.event.AdminClientCreateEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.indirectCustomer.IndirectCustomerConvert;
import cn.iocoder.yudao.module.customer.convert.indirectCustomerContacts.IndirectCustomerContactsConvert;
......@@ -19,6 +21,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.Indirect
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomerContacts.IndirectCustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.mysql.indirectCustomer.IndirectCustomerMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.indirectCustomerContacts.IndirectCustomerContactsMapper;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.vo.indirectCustomer.IndirectCustomerCreateReqVO;
......@@ -384,6 +387,22 @@ public class IndirectCustomerServiceImpl extends AbstractService<IndirectCustome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
@Override
public PageResult<IndirectCustomerDO> getIndirectCustomerPageReq(IndirectCustomerPageReqDTO pageReqVO, PageVO page){
IPage<IndirectCustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<IndirectCustomerDO> list = indirectCustomerMapper.getIndirectCustomerPageReq(start,size,pageReqVO);
long total = indirectCustomerMapper.getOpenSeaCustomerPageReqCount(pageReqVO) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public List<IndirectCustomerDO> getIndirectCustomerListReq(IndirectCustomerPageReqDTO reqVO) {
return indirectCustomerMapper.getIndirectCustomerListReq(reqVO) ;
}
@Override
public List<IndirectCustomerDO> getIndirectCustomerList(IndirectCustomerExportReqVO reqVO) {
LambdaQueryWrapper<IndirectCustomerDO> customerDOLambdaQueryWrapperX = new LambdaQueryWrapperX<IndirectCustomerDO>()
......
......@@ -1562,6 +1562,116 @@
<include refid="myCustomerQuery"/>
</select>
<select id="getDeptCustomerPageReq"
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
<if test="deptId != null and deptId>0">
AND contact.dept_id = #{deptId}
</if>
<include refid="myCustomerQuery"/>
GROUP BY contact.id
order by contact.id desc
limit #{start}, #{size}
</select>
<select id="getDeptCustomerPageReqCount" 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
<if test="deptId != null and deptId>0">
AND contact.dept_id = #{deptId}
</if>
<include refid="myCustomerQuery"/>
</select>
<select id="getDeptCustomerExcelVoListReq"
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
<if test="deptId != null and deptId>0">
AND contact.dept_id = #{deptId}
</if>
<include refid="myCustomerQuery"/>
GROUP BY contact.id
order by contact.id desc
</select>
</mapper>
......@@ -37,9 +37,172 @@
) as t
${ew.customSqlSegment}
</select>
<select id="getIndirectCustomerPageReq"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO">
SELECT
*
FROM
(
SELECT
a.*,
c.NAME AS default_contact_name,
concat( c.area_code, c.phone_new, '' ) AS default_contact_phone,
c.email AS default_email,
agent.NAME AS agent_customer_name,
su.nickname AS customer_service_name
FROM
ecw_indirect_customer a
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id
WHERE
c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0
) AS contact
where 1=1
<include refid="indirectCustomerPageReq"/>
GROUP BY contact.id
order by contact.id desc
limit #{start}, #{size}
</select>
<sql id="indirectCustomerPageReq">
<if test="query.number != null and query.number != '' ">
AND contact.number LIKE concat('%', concat( #{query.number}, '%' ))
</if>
<if test="query.name != null and query.name != '' ">
AND contact.name LIKE concat('%', concat( #{query.name}, '%' ))
</if>
<if test="query.defaultContactPhone != null and query.defaultContactPhone != '' ">
AND contact.default_contact_phone LIKE concat('%', concat( #{query.defaultContactPhone}, '%' ))
</if>
<if test="query.defaultContactName != null and query.defaultContactName != '' ">
AND contact.all_contact_phone LIKE concat('%', concat( #{query.defaultContactName}, '%' ))
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND contact. `create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<!--市场获客 -->
<if test="query.marketType != null and query.marketType.size()>0">
<if test="query.marketType != null and query.marketType != '' and query.marketType.size()==1 ">
<foreach item='marketType' index="index" collection='query.marketType' >
<choose>
<when test="marketType == 1">
AND contact.customer_service is not null
</when>
<when test="marketType == 2">
AND contact.customer_service is null
</when>
</choose>
</foreach>
</if>
<if test="query.marketType != null and query.marketType != '' and query.marketType.size()>1 ">
AND (1!=1
<foreach item='marketType' index="index" collection='query.marketType' >
<choose>
<when test="marketType == 1">
OR contact.customer_service is not null
</when>
<when test="marketType == 2">
OR contact.customer_service is null
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.customerService != null and query.customerService.size()>0">
<if test="query.customerService != null and query.customerService != '' and query.customerService.size()==1 ">
AND contact.customer_service =
<foreach item='customerService' index="index" collection='query.customerService' >
#{customerService}
</foreach>
</if>
<if test="query.customerService != null and query.customerService != '' and query.customerService.size()>1 ">
AND contact.customer_service in
<foreach item='customerService' index="index" collection='query.customerService' open='(' separator=',' close=')'>
#{customerService}
</foreach>
</if>
</if>
<!--客户来源 -->
<if test="query.source != null and query.source.size()>0">
<if test="query.source != null and query.source != '' and query.source.size()==1 ">
AND contact.source =
<foreach item='source' index="index" collection='query.source' >
#{source}
</foreach>
</if>
<if test="query.source != null and query.source != '' and query.source.size()>1 ">
AND contact.source in
<foreach item='source' index="index" collection='query.source' open='(' separator=',' close=')'>
#{source}
</foreach>
</if>
</if>
</sql>
<select id="getOpenSeaCustomerPageReqCount" resultType="java.lang.Long"
parameterType="cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO">
SELECT
count(1)
FROM
(
SELECT
a.*,
c.NAME AS default_contact_name,
concat( c.area_code, c.phone_new, '' ) AS default_contact_phone,
c.email AS default_email,
agent.NAME AS agent_customer_name,
su.nickname AS customer_service_name
FROM
ecw_indirect_customer a
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id
WHERE
c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0
) AS contact
where 1=1
<include refid="indirectCustomerPageReq"/>
</select>
<select id="getIndirectCustomerListReq"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO"
parameterType="cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO">
SELECT
*
FROM
(
SELECT
a.*,
c.NAME AS default_contact_name,
concat( c.area_code, c.phone_new, '' ) AS default_contact_phone,
c.email AS default_email,
agent.NAME AS agent_customer_name,
su.nickname AS customer_service_name
FROM
ecw_indirect_customer a
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id
WHERE
c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0
) AS contact
where 1=1
<include refid="indirectCustomerPageReq"/>
</select>
</mapper>
......@@ -600,8 +600,8 @@ public class CustomerController {
@GetMapping("/deptPage")
@ApiOperation("获得部门客户")
@PreAuthorize("@ss.hasAnyPermissions('ecw:customer:query', 'ecw:customer:dep-query')")
public CommonResult<PageResult<CustomerRespVO>> getDeptCustomerPage(@Valid CustomerPageReqVO pageVO) {
PageResult<CustomerDO> pageResult = customerService.getDeptCustomerPage(pageVO);
public CommonResult<PageResult<CustomerRespVO>> getDeptCustomerPage(@Valid CustomerPageReqDTO pageVO,PageVO page) {
PageResult<CustomerDO> pageResult = customerService.getDeptCustomerPageReq(pageVO,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
......@@ -724,7 +724,7 @@ public class CustomerController {
@GetMapping("/dept-export-excel")
@ApiOperation("部门客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportDeptCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportDeptCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_DEPT_EXCEL_EXPORT, "部门客户导出Excel");
return success(true);
......
......@@ -5,10 +5,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.customer.convert.indirectCustomer.IndirectCustomerConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomerContacts.IndirectCustomerContactsDO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService;
import cn.iocoder.yudao.module.customer.service.indirectCustomerContacts.IndirectCustomerContactsService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerExportReqVO;
......@@ -110,8 +112,8 @@ public class IndirectCustomerController {
@GetMapping("/page")
@ApiOperation("获得间接客户分页")
// @PreAuthorize("@ss.hasPermission('customer:indirect-customer:query')")
public CommonResult<PageResult<IndirectCustomerBackVO>> getIndirectCustomerPage(@Valid IndirectCustomerPageReqVO pageVO) {
PageResult<IndirectCustomerDO> pageResult = indirectCustomerService.getIndirectCustomerPage(pageVO);
public CommonResult<PageResult<IndirectCustomerBackVO>> getIndirectCustomerPage(@Valid IndirectCustomerPageReqDTO pageVO, PageVO page) {
PageResult<IndirectCustomerDO> pageResult = indirectCustomerService.getIndirectCustomerPageReq(pageVO,page);
return success(IndirectCustomerConvert.INSTANCE.convertPage(pageResult));
}
......@@ -120,7 +122,7 @@ public class IndirectCustomerController {
@ApiOperation("间接客户导出")
// @PreAuthorize("@ss.hasPermission('customer:indirect-customer:export')")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportIndirectCustomerExcel(@Valid IndirectCustomerExportReqVO query,
public CommonResult<Boolean> exportIndirectCustomerExcel(@Valid IndirectCustomerPageReqDTO query,
HttpServletResponse response) throws IOException {
// List<IndirectCustomerDO> list = indirectCustomerService.getIndirectCustomerList(query);
// // 导出 Excel
......@@ -131,6 +133,23 @@ public class IndirectCustomerController {
return success(true);
}
/**
* 多选
* @param exportReqVO
* @param downloadTypeEnum
* @param fileName
*/
private void sendFileMake(IndirectCustomerPageReqDTO exportReqVO, DownloadTypeEnum downloadTypeEnum, String fileName) {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
reqDTO.setType(downloadTypeEnum.getType());
reqDTO.setName(fileName);
reqDTO.setFileSuffix("xlsx");
reqDTO.setTemporaryFile(true);
reqDTO.setUserType(2);
reqDTO.setLang(I18nMessage.getLang());
reqDTO.setRequestParams(JSONObject.toJSONString(exportReqVO));
fileMakeApi.sendFileMake(reqDTO);
}
private void sendFileMake(IndirectCustomerExportReqVO exportReqVO, DownloadTypeEnum downloadTypeEnum, String fileName) {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
......
......@@ -5,15 +5,11 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.export.*;
import cn.iocoder.yudao.framework.apollo.core.event.export.base.CustomerExportEvent;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerExcelVO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerExportReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.system.framework.ue.UeProperties;
......@@ -65,6 +61,7 @@ public class CustomerExcelExportListener {
makeExcelUpload(event, list);
}
/**
* 我的客户导出监听
*
......@@ -74,13 +71,12 @@ public class CustomerExcelExportListener {
public void customerMineExcelExportPushEvent(CustomerMineExcelExportPushEvent event) {
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
List<Long> setCustomerService = new ArrayList<>();
if(getLoginUserId()!=null){
setCustomerService.add(getLoginUserId()) ;
exportReqVO.setCustomerService(setCustomerService) ;
if (getLoginUserId() != null) {
setCustomerService.add(getLoginUserId());
exportReqVO.setCustomerService(setCustomerService);
}
//未被接收
exportReqVO.setIsCustomerServiceConfirmed(true);
List<CustomerDO> list = customerService.getMyCustomerExcelVoList(exportReqVO);
......@@ -124,9 +120,9 @@ public class CustomerExcelExportListener {
@EventListener(CustomerWaitDistributionExcelExportPushEvent.class)
public void customerWaitDistributionExcelExportPushEvent(CustomerWaitDistributionExcelExportPushEvent event) {
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
exportReqVO.setIsInOpenSea(false) ;
exportReqVO.setIsCustomerServiceConfirmed(false) ;
exportReqVO.setCustomerService(null) ;
exportReqVO.setIsInOpenSea(false);
exportReqVO.setIsCustomerServiceConfirmed(false);
exportReqVO.setCustomerService(null);
List<CustomerDO> list = customerService.getWaitToAssignedCustomerExcelVoListReq(exportReqVO);
makeExcelUpload(event, list);
......@@ -141,7 +137,7 @@ public class CustomerExcelExportListener {
@EventListener(CustomerPotentialExcelExportPushEvent.class)
public void customerPotentialExcelExportPushEvent(CustomerPotentialExcelExportPushEvent event) {
//CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
if (exportReqVO.getCustomerService() != null) {
exportReqVO.setIsInOpenSea(false);
}
......@@ -161,19 +157,18 @@ public class CustomerExcelExportListener {
*/
@EventListener(CustomerDeptExcelExportPushEvent.class)
public void customerDeptExcelExportPushEvent(CustomerDeptExcelExportPushEvent event) {
CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
List<CustomerDO> list = customerService.getDeptCustomerExcelVoList(exportReqVO);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
// CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
// List<CustomerDO> list = customerService.getDeptCustomerExcelVoList(exportReqVO);
List<CustomerDO> list = customerService.getDeptCustomerExcelVoListReq(exportReqVO);
makeExcelUpload(event, list);
}
public void makeExcelUpload(CustomerExportEvent event, List<CustomerDO> customerDOList) {
if (StringUtils.isNotBlank(event.getRequestParams())) {
try {
if(CollectionUtil.isEmpty(customerDOList)) return;
if (CollectionUtil.isEmpty(customerDOList)) return;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT);
......@@ -215,6 +210,4 @@ public class CustomerExcelExportListener {
}
}
......@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.apollo.core.event.export.IndirectCustomerExcel
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.customer.convert.indirectCustomer.IndirectCustomerConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.indirectCustomer.IndirectCustomerDO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService;
import cn.iocoder.yudao.module.customer.vo.indirectCustomer.IndirectCustomerExcelVO;
import cn.iocoder.yudao.module.customer.vo.indirectCustomer.IndirectCustomerExportReqVO;
......@@ -53,8 +55,9 @@ public class IndirectCustomerExcelExportListener {
*/
@EventListener(IndirectCustomerExcelExportPushEvent.class)
public void customerIndirectExcelExportPushEvent(IndirectCustomerExcelExportPushEvent event) {
IndirectCustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), IndirectCustomerExportReqVO.class);
List<IndirectCustomerDO> list = indirectCustomerService.getIndirectCustomerList(exportReqVO);
//IndirectCustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), IndirectCustomerExportReqVO.class);
IndirectCustomerPageReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), IndirectCustomerPageReqDTO.class);
List<IndirectCustomerDO> list = indirectCustomerService.getIndirectCustomerListReq(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