Commit ba7a8458 authored by liuzeheng's avatar liuzeheng

我的客户列表支持多选

parent f43a292e
...@@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.customer.dal.mysql.customer; ...@@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.customer.dal.mysql.customer;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO; 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.CustomerOrderQueryDTO; import cn.iocoder.yudao.module.customer.dto.CustomerOrderQueryDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerDetailRespVO; import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerDetailRespVO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerSelectReqVO; import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerSelectReqVO;
import cn.iocoder.yudao.module.customer.vo.customerDetail.CustomerOrderBackPageVO; import cn.iocoder.yudao.module.customer.vo.customerDetail.CustomerOrderBackPageVO;
...@@ -25,8 +27,14 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> { ...@@ -25,8 +27,14 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
IPage<CustomerDO> getPage(IPage<CustomerDO> page, IPage<CustomerDO> getPage(IPage<CustomerDO> page,
@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper); @Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> getMyPage(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
long getMyPageCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getCustomerExcelVoList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper); List<CustomerDO> getCustomerExcelVoList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> getMyCustomerExcelVoList( @Param("query") CustomerExportReqDTO pageReqVO);
List<CustomerDO> getList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper); List<CustomerDO> getList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> searchCustomer(@Param("reqVO") CustomerSelectReqVO customerSelectReqVO); List<CustomerDO> searchCustomer(@Param("reqVO") CustomerSelectReqVO customerSelectReqVO);
...@@ -182,4 +190,5 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> { ...@@ -182,4 +190,5 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
List<CustomerOrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") CustomerOrderQueryDTO query); List<CustomerOrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") CustomerOrderQueryDTO query);
} }
package cn.iocoder.yudao.module.customer.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
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
public class CustomerExportReqDTO {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户等级")
private List<Integer> level;
@ApiModelProperty(value = "客户来源")
private List<Integer> source;
@ApiModelProperty(value = "客户类别")
private List<String> type;
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典")
private String transportType;
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType;
@ApiModelProperty(value = "跟进客服")
private Long customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
@ApiModelProperty(value = "部门")
private String department;
@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> creditLevel;
@ApiModelProperty(value = "国家")
private List<Integer> country;
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential;
//api不显示此3个字段
//是否接收,后台使用
@JsonIgnore
private Boolean isCustomerServiceConfirmed;
//因接口公用方法新增:24小时内数据查询条件标识
private String flag4QueryCondition;
private List<Integer> marketType;
}
package cn.iocoder.yudao.module.customer.dto;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
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;
@ApiModel("管理后台 - 客户分页 Request DTO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户等级")
private List<Integer> level;
@ApiModelProperty(value = "客户来源")
private List<Integer> source;
@ApiModelProperty(value = "客户类别")
private List<String> type;
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典")
private String transportType;
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType;
@ApiModelProperty(value = "市场获客", notes = "参见customer_market_type数据字典")
private List<Integer> marketType;
@ApiModelProperty(value = "跟进客服")
private Long customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
@ApiModelProperty(value = "部门")
private String department;
@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> creditLevel;
@ApiModelProperty(value = "国家")
private List<Integer> country;
//api不显示此3个字段
//是否接收,后台使用
@JsonIgnore
private Boolean isCustomerServiceConfirmed;
//因接口公用方法新增:24小时内数据查询条件标识
private String flag4QueryCondition;
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential;
}
...@@ -2,10 +2,13 @@ package cn.iocoder.yudao.module.customer.service.customer; ...@@ -2,10 +2,13 @@ package cn.iocoder.yudao.module.customer.service.customer;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService; import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto; import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto; import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.*; import cn.iocoder.yudao.module.customer.vo.customer.vo.*;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum; import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum; import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum;
...@@ -96,6 +99,8 @@ public interface CustomerService extends IService<CustomerDO> { ...@@ -96,6 +99,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/ */
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO); PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
PageResult<CustomerDO> getMyCustomerPage(CustomerPageReqDTO pageReqVO, PageVO page);
/** /**
* 获得部门客户分页 * 获得部门客户分页
* *
...@@ -170,6 +175,8 @@ public interface CustomerService extends IService<CustomerDO> { ...@@ -170,6 +175,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/ */
List<CustomerDO> getCustomerExcelVoList(CustomerExportReqVO exportReqVO); List<CustomerDO> getCustomerExcelVoList(CustomerExportReqVO exportReqVO);
List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO exportReqVO);
/** /**
* 获得客户列表, 用于 Excel 导出 * 获得客户列表, 用于 Excel 导出
* *
......
...@@ -25,6 +25,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; ...@@ -25,6 +25,7 @@ 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.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; 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.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
...@@ -47,10 +48,7 @@ import cn.iocoder.yudao.module.customer.dal.mysql.customerAirLog.CustomerAirLogM ...@@ -47,10 +48,7 @@ import cn.iocoder.yudao.module.customer.dal.mysql.customerAirLog.CustomerAirLogM
import cn.iocoder.yudao.module.customer.dal.mysql.customerBank.CustomerBankMapper; import cn.iocoder.yudao.module.customer.dal.mysql.customerBank.CustomerBankMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper; import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerPublicCatchLog.CustomerPublicCatchLogMapper; import cn.iocoder.yudao.module.customer.dal.mysql.customerPublicCatchLog.CustomerPublicCatchLogMapper;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto; import cn.iocoder.yudao.module.customer.dto.*;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverDetailDto;
import cn.iocoder.yudao.module.customer.dto.CustomerOrderQueryDTO;
import cn.iocoder.yudao.module.customer.service.customerApproval.CustomerApprovalService; import cn.iocoder.yudao.module.customer.service.customerApproval.CustomerApprovalService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService; import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService; import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
...@@ -1118,6 +1116,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -1118,6 +1116,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
} }
@Override
public PageResult<CustomerDO> getMyCustomerPage(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();
List<CustomerDO> list = customerMapper.getMyPage(start,size,pageReqVO);
long total = customerMapper.getMyPageCount(pageReqVO) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override @Override
public PageResult<CustomerDO> getDeptCustomerPage(CustomerPageReqVO reqVO) { public PageResult<CustomerDO> getDeptCustomerPage(CustomerPageReqVO reqVO) {
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(reqVO); IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(reqVO);
...@@ -1572,6 +1582,11 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -1572,6 +1582,11 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX); return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX);
} }
@Override
public List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO reqVO) {
return customerMapper.getMyCustomerExcelVoList(reqVO);
}
@Override @Override
public PageResult<CustomerDO> searchCustomer(CustomerSelectReqVO customerSelectReqVO) { public PageResult<CustomerDO> searchCustomer(CustomerSelectReqVO customerSelectReqVO) {
......
...@@ -61,8 +61,273 @@ ...@@ -61,8 +61,273 @@
where a.customer_service = #{loginUserId} where a.customer_service = #{loginUserId}
</select> </select>
<select id="getMyPage" 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
<include refid="myCustomerQuery"/>
GROUP BY contact.id
order by contact.id desc
limit #{start}, #{size}
</select>
<select id="getMyCustomerExcelVoList"
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
<include refid="myCustomerQuery"/>
GROUP BY contact.id
order by contact.id desc
</select>
<select id="getMyPageCount" resultType="java.lang.Long">
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
<include refid="myCustomerQuery"/>
</select>
<sql id="myCustomerQuery">
<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.isInOpenSea != null and query.isInOpenSea != '' ">
AND contact.is_in_open_sea = #{query.isInOpenSea}
</if>
<if test="query.isPotential != null and query.isPotential != '' ">
AND contact.is_potential = #{query.isPotential}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != '' ">
AND contact.create_time BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime}
</if>
<!--跟进客服 -->
<if test="query.customerService != null and query.customerService != '' ">
AND contact.customer_service = #{query.customerService}
</if>
<!--是否接收 -->
<if test="query.isCustomerServiceConfirmed != null and query.isCustomerServiceConfirmed != '' ">
AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed}
</if>
<if test="query.department != null and query.department != '' ">
AND contact.department = #{query.department}
</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.creditLevel != null and query.creditLevel.size()>0">
<if test="query.creditLevel != null and query.creditLevel != '' and query.creditLevel.size()==1 ">
AND contact.credit_level =
<foreach item='creditLevel' index="index" collection='query.creditLevel' >
#{creditLevel}
</foreach>
</if>
<if test="query.creditLevel != null and query.creditLevel != '' and query.creditLevel.size()>1 ">
AND contact.credit_level in
<foreach item='creditLevel' index="index" collection='query.creditLevel' open='(' separator=',' close=')'>
#{creditLevel}
</foreach>
</if>
</if>
<!--客户类别 -->
<if test="query.type != null and query.type.size()>0">
<if test="query.type != null and query.type != '' and query.type.size()==1 ">
AND contact.type =
<foreach item='type' index="index" collection='query.type' >
#{type}
</foreach>
</if>
<if test="query.type != null and query.type != '' and query.type.size()>1 ">
AND contact.type in
<foreach item='type' index="index" collection='query.type' open='(' separator=',' close=')'>
#{type}
</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>
<!--国家 -->
<if test="query.country != null and query.country.size()>0">
<if test="query.country != null and query.country != '' and query.country.size()==1 ">
AND contact.country =
<foreach item='country' index="index" collection='query.country' >
#{country}
</foreach>
</if>
<if test="query.country != null and query.country != '' and query.country.size()>1 ">
AND contact.country in
<foreach item='country' index="index" collection='query.country' open='(' separator=',' close=')'>
#{country}
</foreach>
</if>
</if>
<!--客户状态 -->
<if test="query.status != null and query.status.size()>0">
<if test="query.status != null and query.status != '' and query.status.size()==1 ">
AND contact.status =
<foreach item='status' index="index" collection='query.status' >
#{status}
</foreach>
</if>
<if test="query.status != null and query.status != '' and query.status.size()>1 ">
AND contact.status in
<foreach item='status' index="index" collection='query.status' open='(' separator=',' close=')'>
#{status}
</foreach>
</if>
</if>
</sql>
<select id="searchCustomer" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> <select id="searchCustomer" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
select contact.*, select contact.*,
level.name_zh as vip_level_name_zh, level.name_zh as vip_level_name_zh,
...@@ -766,4 +1031,5 @@ ...@@ -766,4 +1031,5 @@
limit #{start}, #{size} limit #{start}, #{size}
</select> </select>
</mapper> </mapper>
...@@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage; ...@@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent; import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 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.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; 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.customer.CustomerConvert;
...@@ -21,6 +22,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBank ...@@ -21,6 +22,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBank
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto; import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto; import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService; import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customer.commission.CustomerCommissionService; import cn.iocoder.yudao.module.customer.service.customer.commission.CustomerCommissionService;
import cn.iocoder.yudao.module.customer.service.customerBank.CustomerBankService; import cn.iocoder.yudao.module.customer.service.customerBank.CustomerBankService;
...@@ -493,7 +495,7 @@ public class CustomerController { ...@@ -493,7 +495,7 @@ public class CustomerController {
@GetMapping("/get-mine") @GetMapping("/get-mine")
@ApiOperation("获得我的客户列表") @ApiOperation("获得我的客户列表")
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')") // @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getMine(@Valid CustomerPageReqVO customerPageReqVO) { public CommonResult<PageResult<CustomerRespVO>> getMine(@Valid CustomerPageReqDTO customerPageReqVO, PageVO page ) {
customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId()); customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
...@@ -502,7 +504,7 @@ public class CustomerController { ...@@ -502,7 +504,7 @@ public class CustomerController {
// customerPageReqVO.setFlag4QueryCondition("Y"); // customerPageReqVO.setFlag4QueryCondition("Y");
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(customerPageReqVO); PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(customerPageReqVO ,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult)); return success(CustomerConvert.INSTANCE.convertPage(pageResult));
} }
......
...@@ -195,6 +195,79 @@ public interface ProductMapper extends BaseMapperX<ProductDO> { ...@@ -195,6 +195,79 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
; ;
} }
@ResultType(ProductDO.class)
@Select({
"<script>",
"select t.*, c.nickname as creator_name, u.nickname as updater_name ",
"from ecw_product t ",
"left join system_user c on t.creator = c.id ",
"left join system_user u on t.updater = u.id ",
"where t.deleted = 0 ",
"<when test = 'query.productCode != null and query.productCode != \"\"'>",
"AND t.`product_code` like concat('%',concat(#{query.productCode},'%'))",
"</when>",
"<when test = 'query.customsCode != null and query.customsCode != \"\"'>",
"AND t.`customs_code` like concat('%',concat(#{query.customsCode},'%'))",
"</when>",
/* "<when test = 'query.typeId != null'>",
"AND t.`type_id` = #{query.typeId}",
"</when>",*/
"<when test=\"query.typeId != null and query.typeId.size()>0\">" +
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()==1 \">" +
" AND t.`type_id` =\n" +
" <foreach item='typeId' index='index' collection='query.typeId' >\n" +
" #{typeId}" +
" </foreach>" +
" </when>" +
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()>1 \">" +
" AND t.`type_id` in " +
" <foreach item='typeId' index='index' collection='query.typeId' open='(' separator=',' close=')'>" +
" #{typeId}" +
" </foreach>" +
" </when>" +
"</when>",
"<when test = 'query.status != null'>",
"AND t.`status` = #{query.status}",
"</when>",
"<when test = 'query.auditStatus != null'>",
"AND t.`audit_status` = #{query.auditStatus}",
"</when>",
"<when test = 'query.titleZh != null and query.titleZh != \"\"'>",
"AND (t.`title_zh` like concat('%',concat(#{query.titleZh},'%')) or t.`title_en` like concat('%',concat(#{query.titleZh},'%')))",
"</when>",
// "<when test = 'query.attrId != null and query.attrId != \"\" '>",
"<when test=\"query.attrId != null and query.attrId.size()>0\">" ,
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()==1 \">" +
"<foreach item='attrId' index=\"index\" collection='query.attrId' >" +
"AND t.`attr_id` = #{attrId}" +
"</foreach>" +
"</when>",
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()>1 \">" +
"AND (1!=1 " +
" <foreach item='attrId' index='index' collection='query.attrId'>" +
" OR FIND_IN_SET(t.`attr_id`, #{attrId})"+
"</foreach>" +
" )" +
"</when>",
// "AND FIND_IN_SET(t.`attr_id`, #{query.attrId})",
"</when>",
"order by t.id desc",
"</script>"
})
List<ProductDO> selectListReq(@Param("query") ProductReqDTO reqVO) ;
default List<ProductDO> selectIdList(ProductPageReqVO reqVO) { default List<ProductDO> selectIdList(ProductPageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ProductDO>() return selectList(new LambdaQueryWrapperX<ProductDO>()
.likeIfPresent(ProductDO::getProductCode, reqVO.getProductCode()) .likeIfPresent(ProductDO::getProductCode, reqVO.getProductCode())
...@@ -240,6 +313,7 @@ public interface ProductMapper extends BaseMapperX<ProductDO> { ...@@ -240,6 +313,7 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
} }
List<ProductTypeNumVO> getProductTypeNumList(List<Long> list); List<ProductTypeNumVO> getProductTypeNumList(List<Long> list);
......
...@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.product.convert.product.ProductConvert; ...@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.product.convert.product.ProductConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO; import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO; import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductTypeDO; import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductTypeDO;
import cn.iocoder.yudao.module.product.dto.ProductReqDTO;
import cn.iocoder.yudao.module.product.enums.AuditEnum; import cn.iocoder.yudao.module.product.enums.AuditEnum;
import cn.iocoder.yudao.module.product.service.product.ProductAttrService; import cn.iocoder.yudao.module.product.service.product.ProductAttrService;
import cn.iocoder.yudao.module.product.service.product.ProductService; import cn.iocoder.yudao.module.product.service.product.ProductService;
...@@ -81,10 +82,11 @@ public class ProductExcelExportListener { ...@@ -81,10 +82,11 @@ public class ProductExcelExportListener {
} }
String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("product.xlsx"); String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("product.xlsx");
ProductExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductExportReqVO.class); //ProductExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductExportReqVO.class);
ProductReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductReqDTO.class);
exportReqVO.setFilter(false); exportReqVO.setFilter(false);
List<ProductDO> list = productService.getProductList(exportReqVO); //List<ProductDO> list = productService.getProductList(exportReqVO);
List<ProductDO> list = productService.getProductListResp(exportReqVO);
if(CollectionUtil.isEmpty(list)) return; if(CollectionUtil.isEmpty(list)) return;
List<ProductAttrDO> attrList = productAttrService.getProductAttrList(new ProductAttrExportReqVO()); List<ProductAttrDO> attrList = productAttrService.getProductAttrList(new ProductAttrExportReqVO());
......
...@@ -70,6 +70,7 @@ public interface ProductService { ...@@ -70,6 +70,7 @@ public interface ProductService {
*/ */
List<ProductDO> getProductList(); List<ProductDO> getProductList();
/** /**
* 获得产品分页 * 获得产品分页
* *
...@@ -82,6 +83,7 @@ public interface ProductService { ...@@ -82,6 +83,7 @@ public interface ProductService {
List<ProductDO> getProductList(ProductPageReqVO pageReqVO); List<ProductDO> getProductList(ProductPageReqVO pageReqVO);
List<ProductDO> getProductListResp(ProductReqDTO pageReqVO);
/** /**
* 获得产品列表, 用于 Excel 导出 * 获得产品列表, 用于 Excel 导出
* *
......
...@@ -352,6 +352,8 @@ public class ProductServiceImpl implements ProductService { ...@@ -352,6 +352,8 @@ public class ProductServiceImpl implements ProductService {
); );
} }
@Override @Override
public List<ProductDO> getProductList(List<Long> idList) { public List<ProductDO> getProductList(List<Long> idList) {
return productMapper.selectList( return productMapper.selectList(
...@@ -427,6 +429,14 @@ public class ProductServiceImpl implements ProductService { ...@@ -427,6 +429,14 @@ public class ProductServiceImpl implements ProductService {
return productMapper.selectList(pageReqVO); return productMapper.selectList(pageReqVO);
} }
@Override
public List<ProductDO> getProductListResp(ProductReqDTO pageReqVO) {
if (pageReqVO.isFilter()) {
pageReqVO.setAuditStatus(2);
}
return productMapper.selectListReq(pageReqVO);
}
@Override @Override
public List<ProductDO> getProductList(ProductExportReqVO exportReqVO) { public List<ProductDO> getProductList(ProductExportReqVO exportReqVO) {
if (exportReqVO.isFilter()) { if (exportReqVO.isFilter()) {
......
...@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.apollo.core.event.export.base.CustomerExportEv ...@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.apollo.core.event.export.base.CustomerExportEv
import cn.iocoder.yudao.framework.excel.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert; 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.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService; import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService; 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.CustomerExcelVO;
...@@ -67,8 +68,8 @@ public class CustomerExcelExportListener { ...@@ -67,8 +68,8 @@ public class CustomerExcelExportListener {
*/ */
@EventListener(CustomerMineExcelExportPushEvent.class) @EventListener(CustomerMineExcelExportPushEvent.class)
public void customerMineExcelExportPushEvent(CustomerMineExcelExportPushEvent event) { public void customerMineExcelExportPushEvent(CustomerMineExcelExportPushEvent event) {
CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class); CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
List<CustomerDO> list = customerService.getCustomerExcelVoList(exportReqVO); List<CustomerDO> list = customerService.getMyCustomerExcelVoList(exportReqVO);
makeExcelUpload(event, list); 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