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
1e8d8540
Commit
1e8d8540
authored
May 23, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充业绩规则
parent
16545a54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
53 deletions
+157
-53
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+157
-53
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderServiceImpl.java
View file @
1e8d8540
...
...
@@ -889,65 +889,115 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(!
consignorDO
.
getNoConsignee
()
&&
!
order
.
getHasConsignee
()){
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
())
;
}
if
(
createReqVO
.
getOfferId
()!=
null
&&
order
.
getDrawee
()==
1
){
//订单关联报价单 && 发货人付款
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
())
;
}
if
(
createReqVO
.
getOfferId
()!=
null
&&
order
.
getDrawee
()==
3
){
//订单关联报价单 && 自定义付款
}
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
)){
//订单关联报价单 && 自定义付款 且发货人付运费
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
())
;
}
if
(
createReqVO
.
getOfferId
()!=
null
&&
(
order
.
getDrawee
()==
3
&&
clearanceFee
==
1
)){
//订单关联报价单 && 自定义付款 且发货人付清关费
}
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
());
}
if
(
consignorDO
.
getDefaultPay
()
&&
(
order
.
getDrawee
()==
2
||
order
.
getDrawee
()==
3
)
){
//发货人档案设置默认付运费 --层级4
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
(
order
.
getDrawee
()==
1
||
(
order
.
getDrawee
()==
3
&&
freight
==
1
)
||
(
order
.
getDrawee
()==
3
&&
clearanceFee
==
1
)){
//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
())
;
}
}
}
else
if
(!
consignorDO
.
getDefaultPay
()
&&
order
.
getDrawee
()==
1
&&
createReqVO
.
getOfferId
()!=
null
){
//发货人没有设置默认付款且发货人付款且没有关联报价单 -- 层级6
}
else
{
//业绩归属公司
order
.
setCustomerId
(
0L
)
;
order
.
setSalesmanId
(
0L
);
}
if
(
order
.
getDrawee
()==
2
||
order
.
getDrawee
()==
3
){
//如果是收货人付款或是自定义付款 --层级5
if
(
order
.
getDrawee
()==
2
){
//订单收货人付款,业绩归属收货人
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
((
order
.
getDrawee
()==
3
&&
freight
==
2
)
||
(
order
.
getDrawee
()==
3
&&
clearanceFee
==
2
)){
//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
}
}
//end
}
}
// if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }
//
// if(createReqVO.getOfferId()!=null && 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 )){//订单关联报价单 && 自定义付款 且发货人付运费
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }
// if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }
// }
//
// }
//
// if(consignorDO.getDefaultPay() && (order.getDrawee()==2 || order.getDrawee()==3) ){//发货人档案设置默认付运费 --层级4
// 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(order.getDrawee()==1 || ( order.getDrawee()==3 && freight==1 ) || ( order.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
//
// }
// }
//
//
// }else if(!consignorDO.getDefaultPay() && order.getDrawee()==1 && createReqVO.getOfferId()!=null){//发货人没有设置默认付款且发货人付款且没有关联报价单 -- 层级6
// //业绩归属公司
// order.setCustomerId(0L) ;
// order.setSalesmanId(0L);
// }
// if(order.getDrawee()==2 || order.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
// if(order.getDrawee()==2){//订单收货人付款,业绩归属收货人
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// order.setSalesmanId(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((order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// order.setSalesmanId(orderConsigneeDO.getCustomerId());
// }
// }
//
// }
//
// }
// if(order.getDrawee()==1 && createReqVO.getOfferId()==null){//如果是发货人付款且没有关联报价单 ,归属公司业绩,无客户经理
// //业绩归属公司
// order.setCustomerId(0L);
// order.setSalesmanId(0L) ;
// }
}
// 更新所属客户经理(业务员)
...
...
@@ -1026,6 +1076,52 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private
void
setOrderCustomerServiceCustomerId
(
OrderCreateReqVO
createReqVO
,
OrderDO
order
,
CustomerDO
consignorDO
,
OrderConsignorDO
orderConsignorDO
,
OrderConsigneeDO
orderConsigneeDO
){
// 补充业绩规则判断
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 第一个
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
());
}
}
}
else
{
//业绩归属公司
order
.
setCustomerId
(
0L
)
;
order
.
setSalesmanId
(
0L
);
}
}
private
void
compareOrderCustomerService
(
OrderBackVO
vo
,
List
<
ApplyInfoVO
>
applyInfoList
,
int
customerType
)
{
// TODO 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List
<
OrderExceptionDO
>
orderExceptionDOList
=
orderExceptionService
.
getOrderExceptionByCustomerId
(
vo
.
getCustomerId
());
...
...
@@ -3211,6 +3307,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
if
(
consignorDO
.
getDefaultPay
()
&&
(
updateObj
.
getDrawee
()==
2
||
updateObj
.
getDrawee
()==
3
)){
//发货人档案设置默认付运费 --层级4
if
(
consignorDO
.
getDefaultPay
()
&&
updateObj
.
getDrawee
()==
2
){
updateObj
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
())
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
updateObj
.
getDrawee
()==
3
){
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
updateObj
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)
).
collect
(
Collectors
.
toList
());
...
...
@@ -3221,9 +3320,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
updateObj
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
())
;
}
}
}
}
else
if
(!
consignorDO
.
getDefaultPay
()
&&
updateObj
.
getDrawee
()==
1
&&
updateReqVO
.
getOfferId
()!=
null
){
//发货人没有设置默认付款且发货人付款且没有关联报价单 -- 层级6
//业绩归属公司
updateObj
.
setCustomerId
(
0L
)
;
updateObj
.
setSalesmanId
(
0L
);
}
if
(
updateObj
.
getDrawee
()==
2
||
updateObj
.
getDrawee
()==
3
){
//如果是收货人付款或是自定义付款 --层级5
if
(
updateObj
.
getDrawee
()==
2
){
//订单收货人付款,业绩归属收货人
updateObj
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
...
...
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