Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
4529299b
Commit
4529299b
authored
May 28, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的客户列表支持多选
parent
bdef71b4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
495 additions
and
69 deletions
+495
-69
CustomerMapper.java
...ao/module/customer/dal/mysql/customer/CustomerMapper.java
+15
-0
CustomerExportReqDTO.java
...coder/yudao/module/customer/dto/CustomerExportReqDTO.java
+1
-1
CustomerPageReqDTO.java
...iocoder/yudao/module/customer/dto/CustomerPageReqDTO.java
+1
-1
CustomerService.java
...dao/module/customer/service/customer/CustomerService.java
+18
-0
CustomerServiceImpl.java
...module/customer/service/customer/CustomerServiceImpl.java
+24
-0
CustomerMapper.xml
...ore/src/main/resources/mapper/customer/CustomerMapper.xml
+336
-7
CustomerController.java
...ustomer/controller/admin/customer/CustomerController.java
+45
-13
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+47
-43
CustomerExcelExportListener.java
...dao/module/sale/listener/CustomerExcelExportListener.java
+8
-4
No files found.
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/dal/mysql/customer/CustomerMapper.java
View file @
4529299b
...
...
@@ -29,6 +29,21 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
List
<
CustomerDO
>
getMyPage
(
@Param
(
"start"
)
int
start
,
@Param
(
"size"
)
int
size
,
@Param
(
"query"
)
CustomerPageReqDTO
customerPageReqDTO
);
List
<
CustomerDO
>
getWaitToAssignedCustomerPageReq
(
@Param
(
"start"
)
int
start
,
@Param
(
"size"
)
int
size
,
@Param
(
"query"
)
CustomerPageReqDTO
customerPageReqDTO
);
/**
* 分页列表统计total
* @param pageReqVO
* @return
*/
long
getWaitToAssignedCustomerPageReqCount
(
@Param
(
"query"
)
CustomerPageReqDTO
pageReqVO
);
/**
* 待分配客户列表导出, 用于 Excel 导出 支持多筛选
* @param
* @return
*/
List
<
CustomerDO
>
getWaitToAssignedCustomerListReq
(
@Param
(
"query"
)
CustomerExportReqDTO
customerPageReqDTO
);
long
getMyPageCount
(
@Param
(
"query"
)
CustomerPageReqDTO
pageReqVO
);
List
<
CustomerDO
>
getCustomerExcelVoList
(
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
CustomerDO
>
queryWrapper
);
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/dto/CustomerExportReqDTO.java
View file @
4529299b
...
...
@@ -37,7 +37,7 @@ public class CustomerExportReqDTO {
private
List
<
Integer
>
resourceType
;
@ApiModelProperty
(
value
=
"跟进客服"
)
private
L
ong
customerService
;
private
L
ist
<
Long
>
customerService
;
@ApiModelProperty
(
value
=
"客户状态"
)
private
List
<
Integer
>
status
;
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/dto/CustomerPageReqDTO.java
View file @
4529299b
...
...
@@ -46,7 +46,7 @@ public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty
(
value
=
"跟进客服"
)
private
L
ong
customerService
;
private
L
ist
<
Long
>
customerService
;
@ApiModelProperty
(
value
=
"客户状态"
)
private
List
<
Integer
>
status
;
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customer/CustomerService.java
View file @
4529299b
...
...
@@ -99,6 +99,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult
<
CustomerDO
>
getCustomerPage
(
CustomerPageReqVO
pageReqVO
);
/**
* 获取我的客户分页 ,入参支持多选
* @param pageReqVO
* @param page
* @return
*/
PageResult
<
CustomerDO
>
getMyCustomerPage
(
CustomerPageReqDTO
pageReqVO
,
PageVO
page
);
/**
...
...
@@ -142,6 +148,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult
<
CustomerDO
>
getWaitToAssignedCustomerPage
(
CustomerPageReqVO
pageReqVO
);
/**
* 获得待分配客户分页 支持多选
* @param pageReqVO
* @return
*/
PageResult
<
CustomerDO
>
getWaitToAssignedCustomerPageReq
(
CustomerPageReqDTO
pageReqVO
,
PageVO
page
);
/**
* 待分配客户列表导出, 用于 Excel 导出
...
...
@@ -151,6 +163,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
List
<
CustomerDO
>
getWaitToAssignedCustomerExcelVoList
(
CustomerExportReqVO
exportReqVO
);
/**
* 待分配客户列表导出, 用于 Excel 导出 支持多筛选
* @param exportReqVO
* @return
*/
List
<
CustomerDO
>
getWaitToAssignedCustomerExcelVoListReq
(
CustomerExportReqDTO
exportReqVO
);
/**
* 获得公海池客户分页
*
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customer/CustomerServiceImpl.java
View file @
4529299b
...
...
@@ -1286,6 +1286,26 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return
new
PageResult
<>(
mpPage
.
getRecords
(),
mpPage
.
getTotal
());
}
/**
* 获得待分配客户列表 支持多个筛选
* @param pageReqVO
* @param page
* @return
*/
@Override
public
PageResult
<
CustomerDO
>
getWaitToAssignedCustomerPageReq
(
CustomerPageReqDTO
pageReqVO
,
PageVO
page
)
{
pageReqVO
.
setIsInOpenSea
(
false
)
;
pageReqVO
.
setIsCustomerServiceConfirmed
(
false
)
;
pageReqVO
.
setCustomerService
(
null
)
;
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
.
getWaitToAssignedCustomerPageReq
(
start
,
size
,
pageReqVO
);
long
total
=
customerMapper
.
getWaitToAssignedCustomerPageReqCount
(
pageReqVO
)
;
return
new
PageResult
<>(
list
,
total
,
mpPage
.
getSize
(),
page
.
getPage
(),
(
total
+
mpPage
.
getSize
()
-
1
)
/
mpPage
.
getSize
());
}
@Override
public
List
<
CustomerDO
>
getWaitToAssignedCustomerExcelVoList
(
CustomerExportReqVO
exportReqVO
)
{
LambdaQueryWrapper
<
CustomerDO
>
customerDOLambdaQueryWrapperX
=
new
LambdaQueryWrapperX
<
CustomerDO
>()
...
...
@@ -1333,6 +1353,10 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return
customerMapper
.
getCustomerExcelVoList
(
customerDOLambdaQueryWrapperX
);
}
@Override
public
List
<
CustomerDO
>
getWaitToAssignedCustomerExcelVoListReq
(
CustomerExportReqDTO
exportReqVO
)
{
return
customerMapper
.
getWaitToAssignedCustomerListReq
(
exportReqVO
)
;
}
@Override
public
PageResult
<
CustomerDO
>
getWaitToConfirmCustomerPage
(
CustomerPageReqVO
pageReqVO
)
{
...
...
yudao-module-customer/yudao-module-customer-core/src/main/resources/mapper/customer/CustomerMapper.xml
View file @
4529299b
...
...
@@ -99,7 +99,301 @@
limit #{start}, #{size}
</select>
<select
id=
"getWaitToAssignedCustomerPageReq"
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=
"WaitToAssignedCustomerPageReqQuery"
/>
GROUP BY contact.id
order by contact.id desc
limit #{start}, #{size}
</select>
<select
id=
"getWaitToAssignedCustomerListReq"
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=
"WaitToAssignedCustomerPageReqQuery"
/>
GROUP BY contact.id
order by contact.id desc
</select>
<select
id=
"getWaitToAssignedCustomerPageReqCount"
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
<include
refid=
"WaitToAssignedCustomerPageReqQuery"
/>
</select>
<sql
id=
"WaitToAssignedCustomerPageReqQuery"
>
<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 != null "
>
AND contact. `create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</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.customerService == null"
>
AND contact.customer_service is NULL
</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>
<!--客户等级 -->
<if
test=
"query.level != null and query.level.size()>0"
>
<if
test=
"query.level != null and query.level != '' and query.level.size()==1 "
>
AND contact.level =
<foreach
item=
'level'
index=
"index"
collection=
'query.level'
>
#{level}
</foreach>
</if>
<if
test=
"query.level != null and query.level != '' and query.level.size()>1 "
>
AND contact.level in
<foreach
item=
'level'
index=
"index"
collection=
'query.level'
open=
'('
separator=
','
close=
')'
>
#{level}
</foreach>
</if>
</if>
</sql>
<select
id=
"getMyCustomerExcelVoList"
resultType=
"cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"
>
select contact.*,
...
...
@@ -186,14 +480,11 @@
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
test=
"query.beginCreateTime != null and query.endCreateTime != null "
>
AND contact. `create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<!--是否接收 -->
<if
test=
"query.isCustomerServiceConfirmed != null and query.isCustomerServiceConfirmed != '' "
>
AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed}
...
...
@@ -203,7 +494,26 @@
AND contact.department = #{query.department}
</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.marketType != null and query.marketType.size()>0"
>
<if
test=
"query.marketType != null and query.marketType != '' and query.marketType.size()==1 "
>
...
...
@@ -327,6 +637,23 @@
</if>
</if>
<!--客户等级 -->
<if
test=
"query.level != null and query.level.size()>0"
>
<if
test=
"query.level != null and query.level != '' and query.level.size()==1 "
>
AND contact.level =
<foreach
item=
'level'
index=
"index"
collection=
'query.level'
>
#{level}
</foreach>
</if>
<if
test=
"query.level != null and query.level != '' and query.level.size()>1 "
>
AND contact.level in
<foreach
item=
'level'
index=
"index"
collection=
'query.level'
open=
'('
separator=
','
close=
')'
>
#{level}
</foreach>
</if>
</if>
</sql>
<select
id=
"searchCustomer"
resultType=
"cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"
>
select contact.*,
...
...
@@ -1032,4 +1359,6 @@
</select>
</mapper>
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customer/CustomerController.java
View file @
4529299b
...
...
@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.Custo
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.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.CustomerPageReqDTO
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
...
...
@@ -379,7 +380,7 @@ public class CustomerController {
@GetMapping
(
"/get-potential"
)
@ApiOperation
(
"获得潜在客户列表"
)
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getPotentialList
(
@Valid
CustomerPageReq
VO
pageVO
)
{
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getPotentialList
(
@Valid
CustomerPageReq
DTO
pageVO
,
PageVO
page
)
{
// 20230331 全部客户列表,当客户经理不是空时,排除公海客户
if
(
pageVO
.
getCustomerService
()
!=
null
)
{
...
...
@@ -389,16 +390,17 @@ public class CustomerController {
//设置潜在客户标识
pageVO
.
setIsPotential
(
true
);
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getCustomerPage
(
pageVO
);
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getMyCustomerPage
(
pageVO
,
page
);
return
success
(
CustomerConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
@GetMapping
(
"/get-wait-for-distribution"
)
@ApiOperation
(
"获得待分配客户列表"
)
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getWaitForDistributionList
(
@Valid
CustomerPageReq
VO
customerPageReqVO
)
{
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getWaitForDistributionList
(
@Valid
CustomerPageReq
DTO
customerPageReqVO
,
PageVO
page
)
{
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getWaitToAssignedCustomerPage
(
customerPageReqVO
);
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getWaitToAssignedCustomerPage
Req
(
customerPageReqVO
,
page
);
return
success
(
CustomerConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
...
...
@@ -497,7 +499,10 @@ public class CustomerController {
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getMine
(
@Valid
CustomerPageReqDTO
customerPageReqVO
,
PageVO
page
)
{
customerPageReqVO
.
setCustomerService
(
WebFrameworkUtils
.
getLoginUserId
());
//customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
List
<
Long
>
setCustomerService
=
new
ArrayList
<>();
setCustomerService
.
add
(
WebFrameworkUtils
.
getLoginUserId
())
;
customerPageReqVO
.
setCustomerService
(
setCustomerService
)
;
//未被接收
customerPageReqVO
.
setIsCustomerServiceConfirmed
(
true
);
...
...
@@ -576,13 +581,14 @@ public class CustomerController {
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得客户分页"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:customer:query')"
)
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getCustomerPage
(
@Valid
CustomerPageReq
VO
pageVO
)
{
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getCustomerPage
(
@Valid
CustomerPageReq
DTO
pageVO
,
PageVO
page
)
{
// 20230331 全部客户列表,当客户经理不是空时,排除公海客户
if
(
pageVO
.
getCustomerService
()
!=
null
)
{
pageVO
.
setIsInOpenSea
(
false
);
}
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getCustomerPage
(
pageVO
);
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult
<
CustomerDO
>
pageResult
=
customerService
.
getMyCustomerPage
(
pageVO
,
page
);
return
success
(
CustomerConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
...
...
@@ -603,7 +609,30 @@ public class CustomerController {
return
success
(
CustomerConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
/**
* 支持多选
* @param exportReqVO
* @param downloadTypeEnum
* @param fileName
*/
private
void
sendFileMake
(
CustomerExportReqDTO
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
);
}
/**
* 单选
* @param exportReqVO
* @param downloadTypeEnum
* @param fileName
*/
private
void
sendFileMake
(
CustomerExportReqVO
exportReqVO
,
DownloadTypeEnum
downloadTypeEnum
,
String
fileName
)
{
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
reqDTO
.
setType
(
downloadTypeEnum
.
getType
());
...
...
@@ -619,7 +648,7 @@ public class CustomerController {
@GetMapping
(
"/export-excel"
)
@ApiOperation
(
"全部客户导出"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportCustomerExcel
(
@Valid
CustomerExportReq
V
O
exportReqVO
,
public
CommonResult
<
Boolean
>
exportCustomerExcel
(
@Valid
CustomerExportReq
DT
O
exportReqVO
,
HttpServletResponse
response
)
throws
IOException
{
sendFileMake
(
exportReqVO
,
DownloadTypeEnum
.
CUSTOMER_EXCEL_EXPORT
,
"客户导出Excel"
);
return
success
(
true
);
...
...
@@ -628,13 +657,16 @@ public class CustomerController {
@GetMapping
(
"/mine-export-excel"
)
@ApiOperation
(
"我的客户列表导出"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportMyCustomerExcel
(
@Valid
CustomerExportReq
V
O
exportReqVO
,
public
CommonResult
<
Boolean
>
exportMyCustomerExcel
(
@Valid
CustomerExportReq
DT
O
exportReqVO
,
HttpServletResponse
response
)
throws
IOException
{
exportReqVO
.
setCustomerService
(
WebFrameworkUtils
.
getLoginUserId
());
//
exportReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
//未被接收
exportReqVO
.
setIsCustomerServiceConfirmed
(
true
);
// customerPageReqVO.setFlag4QueryCondition("Y");
List
<
Long
>
setCustomerService
=
new
ArrayList
<>();
setCustomerService
.
add
(
WebFrameworkUtils
.
getLoginUserId
())
;
exportReqVO
.
setCustomerService
(
setCustomerService
)
;
sendFileMake
(
exportReqVO
,
DownloadTypeEnum
.
CUSTOMER_MINE_EXCEL_EXPORT
,
"我的客户导出Excel"
);
return
success
(
true
);
...
...
@@ -663,7 +695,7 @@ public class CustomerController {
@GetMapping
(
"/wait-distribution-export-excel"
)
@ApiOperation
(
"待分配客户列表导出"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportWaitDistributionCustomerExcel
(
@Valid
CustomerExportReq
V
O
exportReqVO
,
public
CommonResult
<
Boolean
>
exportWaitDistributionCustomerExcel
(
@Valid
CustomerExportReq
DT
O
exportReqVO
,
HttpServletResponse
response
)
throws
IOException
{
sendFileMake
(
exportReqVO
,
DownloadTypeEnum
.
CUSTOMER_WAIT_DISTRIBUTION_PUBLIC_EXCEL_EXPORT
,
"待分配客户导出Excel"
);
return
success
(
true
);
...
...
@@ -672,9 +704,9 @@ public class CustomerController {
@GetMapping
(
"/potential-export-excel"
)
@ApiOperation
(
"潜在客户列表导出"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportPotentialCustomerExcel
(
@Valid
CustomerExportReq
V
O
exportReqVO
,
public
CommonResult
<
Boolean
>
exportPotentialCustomerExcel
(
@Valid
CustomerExportReq
DT
O
exportReqVO
,
HttpServletResponse
response
)
throws
IOException
{
if
(
exportReqVO
.
getCustomerService
()
!=
null
)
{
if
(
CollectionUtil
.
isNotEmpty
(
exportReqVO
.
getCustomerService
())
)
{
exportReqVO
.
setIsInOpenSea
(
false
);
}
//设置潜在客户标识
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderServiceImpl.java
View file @
4529299b
...
...
@@ -912,58 +912,62 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
{
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if
(
order
.
getDrawee
()
==
1
)
{
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
{
customerType
=
2
;
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
}
}
// if (order.getDrawee() == 1) {
// order.setCustomerId(orderConsignorDO.getCustomerId());
// } else {
// customerType = 2;
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// }
// 补充业绩规则判断
if
(!
consignorDO
.
getNoConsignee
()
&&
!
order
.
getHasConsignee
())
{
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
&&
createReqVO
.
getOfferId
()
!=
null
)
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
order
.
getDrawee
()
==
1
&&
consignorDO
.
getDefaultPay
())
{
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
// 补充业绩规则判断
if
(!
consignorDO
.
getNoConsignee
()
&&
!
order
.
getHasConsignee
())
{
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
}
else
if
(
order
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
order
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
}
else
{
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
&&
createReqVO
.
getOfferId
()
!=
null
)
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
order
.
getDrawee
()
==
1
&&
consignorDO
.
getDefaultPay
())
{
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
}
else
if
(
order
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
order
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)).
collect
(
Collectors
.
toList
());
List
<
CustomDraweeVO
>
clearanceFeeList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"clearanceFee"
)).
collect
(
Collectors
.
toList
());
int
freight
=
freightList
.
get
(
0
).
getValue
();
//运费
int
clearanceFee
=
clearanceFeeList
.
get
(
0
).
getValue
();
//清关费
if
(
createReqVO
.
getOfferId
()
!=
null
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
createReqVO
.
getOfferId
()
!=
null
&&
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(!
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
2
)
||
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
2
))
{
//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
order
.
setSalesmanId
(
orderConsigneeDO
.
getCustomerId
());
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)).
collect
(
Collectors
.
toList
());
List
<
CustomDraweeVO
>
clearanceFeeList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"clearanceFee"
)).
collect
(
Collectors
.
toList
());
int
freight
=
freightList
.
get
(
0
).
getValue
();
//运费
int
clearanceFee
=
clearanceFeeList
.
get
(
0
).
getValue
();
//清关费
}
if
(
createReqVO
.
getOfferId
()
!=
null
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
createReqVO
.
getOfferId
()
!=
null
&&
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
}
else
if
(!
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()
==
3
&&
freight
==
2
)
||
(
order
.
getDrawee
()
==
3
&&
clearanceFee
==
2
))
{
//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
order
.
setSalesmanId
(
orderConsigneeDO
.
getCustomerId
());
}
}
else
{
//业绩归属公司
order
.
setCustomerId
(
0L
);
order
.
setSalesmanId
(
0L
);
}
}
}
else
{
//业绩归属公司
order
.
setCustomerId
(
0L
);
order
.
setSalesmanId
(
0L
);
//end
}
//end
// if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
...
...
yudao-module-sale/yudao-module-sale-core/src/main/java/cn/iocoder/yudao/module/sale/listener/CustomerExcelExportListener.java
View file @
4529299b
...
...
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
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
;
...
...
@@ -56,8 +57,8 @@ public class CustomerExcelExportListener {
@EventListener
(
CustomerExcelExportPushEvent
.
class
)
public
void
customerExcelExportPushEvent
(
CustomerExcelExportPushEvent
event
)
{
CustomerExportReq
VO
exportReqVO
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
CustomerExportReqV
O
.
class
);
List
<
CustomerDO
>
list
=
customerService
.
getCustomerExcelVoList
(
exportReqVO
);
CustomerExportReq
DTO
exportReqVO
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
CustomerExportReqDT
O
.
class
);
List
<
CustomerDO
>
list
=
customerService
.
get
My
CustomerExcelVoList
(
exportReqVO
);
makeExcelUpload
(
event
,
list
);
}
...
...
@@ -108,8 +109,11 @@ public class CustomerExcelExportListener {
*/
@EventListener
(
CustomerWaitDistributionExcelExportPushEvent
.
class
)
public
void
customerWaitDistributionExcelExportPushEvent
(
CustomerWaitDistributionExcelExportPushEvent
event
)
{
CustomerExportReqVO
exportReqVO
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
CustomerExportReqVO
.
class
);
List
<
CustomerDO
>
list
=
customerService
.
getWaitToAssignedCustomerExcelVoList
(
exportReqVO
);
CustomerExportReqDTO
exportReqVO
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
CustomerExportReqDTO
.
class
);
exportReqVO
.
setIsInOpenSea
(
false
)
;
exportReqVO
.
setIsCustomerServiceConfirmed
(
false
)
;
exportReqVO
.
setCustomerService
(
null
)
;
List
<
CustomerDO
>
list
=
customerService
.
getWaitToAssignedCustomerExcelVoListReq
(
exportReqVO
);
makeExcelUpload
(
event
,
list
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment