Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
8395e03e
Commit
8395e03e
authored
Jul 13, 2021
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
续年佣金计算-已退保10
parent
65642149
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
139 additions
and
57 deletions
+139
-57
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
+107
-57
yd-api/src/main/java/com/yd/dal/mapper/commission/AgPoOrderCommissionMapper.java
+3
-0
yd-api/src/main/java/com/yd/dal/mapper/customer/AclCustomerFortuneMapper.java
+2
-0
yd-api/src/main/java/com/yd/dal/service/customer/AclCustomerFortuneDALService.java
+2
-0
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclCustomerFortuneDALServiceImpl.java
+5
-0
yd-api/src/main/resources/mapper/commission/AgPoOrderCommissionMapper.xml
+8
-0
yd-api/src/main/resources/mapper/customer/AclCustomerFortuneMapper.xml
+12
-0
No files found.
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
View file @
8395e03e
...
@@ -107,7 +107,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -107,7 +107,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
private
void
validateContinuePremium
(
List
<
ComeCommissionParams
>
paramsList
)
throws
Exception
{
private
void
validateContinuePremium
(
List
<
ComeCommissionParams
>
paramsList
)
throws
Exception
{
// 提示信息
// 提示信息
StringBuffer
stringBuffer
=
new
StringBuffer
(
"以下来佣
的往期来佣
未检核: "
);
StringBuffer
stringBuffer
=
new
StringBuffer
(
"以下来佣未检核: "
);
List
<
String
>
commissionNos
=
new
ArrayList
<>();
List
<
String
>
commissionNos
=
new
ArrayList
<>();
for
(
ComeCommissionParams
params:
paramsList
)
{
for
(
ComeCommissionParams
params:
paramsList
)
{
...
@@ -146,39 +146,19 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -146,39 +146,19 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
private
void
processOrderAndFortune
(
List
<
ComeCommissionParams
>
paramsList
,
String
status
,
String
loginId
,
String
checkBatch
)
{
private
void
processOrderAndFortune
(
List
<
ComeCommissionParams
>
paramsList
,
String
status
,
String
loginId
,
String
checkBatch
)
{
// 获取首年度佣金的orderId, 只有首年佣金才更新order记录和fortune记录
// 获取首年度佣金的orderId, 只有首年佣金才更新order记录和fortune记录
List
<
Long
>
orderIds
=
new
ArrayList
<>();
List
<
Long
>
orderIds
=
new
ArrayList
<>();
Long
orderId
;
for
(
ComeCommissionParams
params:
paramsList
)
{
for
(
ComeCommissionParams
params:
paramsList
)
{
if
(
"1"
.
equals
(
params
.
getCommissionPeriod
()))
{
if
(
"1"
.
equals
(
params
.
getCommissionPeriod
()))
{
orderIds
.
add
(
params
.
getOrderId
());
orderId
=
params
.
getOrderId
();
}
orderIds
.
add
(
orderId
);
}
if
(
orderIds
.
size
()
==
0
)
{
return
;
}
// 操作前先检查是否已关账
// 查询对应订单记录
List
<
PoOrder
>
orders
=
poOrderDALService
.
findByIds
(
orderIds
);
// 查询保单下的所有寿险经纪人的fortune记录
List
<
AclCustomerFortune
>
fortuneList
=
customerFortuneDalService
.
queryLifeFortuneListByOrderIds
(
orderIds
);
// 已关帐的订单,则该笔订单来佣比对状态不能改为待来佣和已比对,但能改为已退保
// 处理历史记录,暂时关闭
// this.validateClosed(orders, fortuneList, status);
String
fortuneCommissionPayoutStatus
;
if
(
"2"
.
equals
(
status
))
{
//已比对
fortuneCommissionPayoutStatus
=
"2"
;
}
else
if
(
"3"
.
equals
(
status
))
{
//已退保
this
.
updateOrderAndFortune
(
orderId
,
status
,
loginId
,
checkBatch
);
fortuneCommissionPayoutStatus
=
"1"
;
}
}
else
{
//待来佣
fortuneCommissionPayoutStatus
=
"1"
;
}
}
this
.
updateOrderAndFortune
(
orderIds
,
fortuneList
,
status
,
fortuneCommissionPayoutStatus
,
loginId
,
checkBatch
);
// 订单已退保后发送邮件通知运营
if
(
orderIds
.
size
()
!=
0
&&
"3"
.
equals
(
status
))
{
if
(
"3"
.
equals
(
status
))
{
//已比对
// 订单已退保后发送邮件通知运营
List
<
PoOrder
>
orders
=
poOrderDALService
.
findByIds
(
orderIds
);
this
.
orderCommissionCheckCancelSendMail
(
orders
);
this
.
orderCommissionCheckCancelSendMail
(
orders
);
}
}
...
@@ -196,17 +176,54 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -196,17 +176,54 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
// 获取批次号(如2020-11的字符串)
// 获取批次号(如2020-11的字符串)
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
Set
<
Long
>
commissionCancelorderIdSet
=
new
HashSet
<>();
// 更新检核状态
// 更新检核状态
for
(
String
commissionNo:
commissionNos
)
{
for
(
String
commissionNo:
commissionNos
)
{
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
if
(
"3"
.
equals
(
status
))
{
orderCommission
.
setCommissionNo
(
commissionNo
);
// 来佣比对进行“已退保”操作时,当前状态为待来佣时才修改
orderCommission
.
setCommissionCheckId
(
checkBatchId
);
AgPoOrderCommission
agPoOrderCommission
=
orderCommissionMapper
.
selectByCommissionNo
(
commissionNo
);
orderCommission
.
setCommissionStatus
(
status
);
if
(
"1"
.
equals
(
agPoOrderCommission
.
getCommissionStatus
()))
{
orderCommission
.
setCommissionTime
(
checkBatch
);
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
orderCommission
.
setUpdatedBy
(
Long
.
valueOf
(
loginId
));
orderCommission
.
setCommissionNo
(
commissionNo
);
orderCommission
.
setUpdatedAt
(
new
Date
());
orderCommission
.
setCommissionCheckId
(
checkBatchId
);
orderCommission
.
setCommissionStatus
(
status
);
orderCommissionMapper
.
updateBycommissionNo
(
orderCommission
);
orderCommission
.
setCommissionTime
(
checkBatch
);
orderCommission
.
setUpdatedBy
(
Long
.
valueOf
(
loginId
));
orderCommission
.
setUpdatedAt
(
new
Date
());
orderCommissionMapper
.
updateBycommissionNo
(
orderCommission
);
// 退保的orderId
commissionCancelorderIdSet
.
add
(
agPoOrderCommission
.
getOrderId
());
}
}
else
{
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
orderCommission
.
setCommissionNo
(
commissionNo
);
orderCommission
.
setCommissionCheckId
(
checkBatchId
);
orderCommission
.
setCommissionStatus
(
status
);
orderCommission
.
setCommissionTime
(
checkBatch
);
orderCommission
.
setUpdatedBy
(
Long
.
valueOf
(
loginId
));
orderCommission
.
setUpdatedAt
(
new
Date
());
orderCommissionMapper
.
updateBycommissionNo
(
orderCommission
);
}
}
// 如果是已退保,将后续期数的待来佣记录都改为已退保
for
(
Long
orderId
:
commissionCancelorderIdSet
)
{
List
<
AgPoOrderCommission
>
list
=
orderCommissionMapper
.
selectByOrderId
(
orderId
);
for
(
AgPoOrderCommission
item
:
list
)
{
if
(
"1"
.
equals
(
item
.
getCommissionStatus
()))
{
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
orderCommission
.
setCommissionNo
(
item
.
getCommissionNo
());
orderCommission
.
setCommissionCheckId
(
checkBatchId
);
orderCommission
.
setCommissionStatus
(
"3"
);
orderCommission
.
setCommissionTime
(
checkBatch
);
orderCommission
.
setUpdatedBy
(
Long
.
valueOf
(
loginId
));
orderCommission
.
setUpdatedAt
(
new
Date
());
orderCommissionMapper
.
updateBycommissionNo
(
orderCommission
);
}
}
}
}
}
}
...
@@ -266,25 +283,51 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -266,25 +283,51 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
sendService
.
sendEmailOrSMS
(
"email"
,
email
,
"3"
,
messageText
.
toString
(),
null
,
subject
,
ccAddresses
,
"来佣比对已退保"
,
99
,
null
);
sendService
.
sendEmailOrSMS
(
"email"
,
email
,
"3"
,
messageText
.
toString
(),
null
,
subject
,
ccAddresses
,
"来佣比对已退保"
,
99
,
null
);
}
}
private
void
updateOrderAndFortune
(
List
<
Long
>
orderIds
,
List
<
AclCustomerFortune
>
fortuneList
,
String
status
,
String
fortuneCommissionPayoutStatus
,
private
void
updateOrderAndFortune
(
Long
orderId
,
String
status
,
String
loginId
,
String
checkBatch
)
{
String
loginId
,
String
checkBatch
)
{
// 查询对应订单记录
PoOrder
order
=
poOrderDALService
.
findByOrderId
(
orderId
);
// 查询保单下的所有寿险经纪人的fortune记录
List
<
AclCustomerFortune
>
fortuneList
=
customerFortuneDalService
.
queryLifeFortuneListByOrderId
(
orderId
);
// 更新fortune记录是否可发放
String
fortuneCommissionPayoutStatus
=
"2"
.
equals
(
status
)
?
"2"
:
"1"
;
// 获取批次号(如2020-11的字符串)
// 获取批次号(如2020-11的字符串)
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
// 设置order记录的CommissionCheckId
// 设置order记录的CommissionCheckId
this
.
setOrderCommissionCheckId
(
orderIds
,
status
,
checkBatchId
,
loginId
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"checkId"
,
checkBatchId
);
paramMap
.
put
(
"status"
,
status
);
paramMap
.
put
(
"checkAt"
,
new
Date
());
paramMap
.
put
(
"checkBy"
,
loginId
);
if
(
fortuneList
.
size
()
==
0
)
{
/**检核选择退保时先查看原来的来佣状态,若原来的是”已比对“则不改成已退保,若是”待来佣“就改成”已退保“*/
return
;
if
(
"3"
.
equals
(
status
))
{
}
if
(
"1"
.
equals
(
order
.
getCommissionCheckStatus
()))
{
// 批量设置fortune为可发佣
lifeCommissionMapper
.
setOrderCommissionCheckId
(
Arrays
.
asList
(
orderId
),
paramMap
);
fortuneList
.
forEach
(
f
->
{
if
(
fortuneList
.
size
()
>
0
)
{
f
.
setCommissionPayoutStatus
(
fortuneCommissionPayoutStatus
);
// 批量设置fortune为可发佣
f
.
setCommissionPayoutAt
(
new
Date
());
fortuneList
.
forEach
(
f
->
{
f
.
setCommissionPayoutBy
(
Long
.
valueOf
(
loginId
));
f
.
setCommissionPayoutStatus
(
fortuneCommissionPayoutStatus
);
});
f
.
setCommissionPayoutAt
(
new
Date
());
if
(
fortuneList
.
size
()
>
0
)
{
f
.
setCommissionPayoutBy
(
Long
.
valueOf
(
loginId
));
customerFortuneDalService
.
updateBatch
(
fortuneList
);
});
customerFortuneDalService
.
updateBatch
(
fortuneList
);
}
}
}
else
{
lifeCommissionMapper
.
setOrderCommissionCheckId
(
Arrays
.
asList
(
orderId
),
paramMap
);
if
(
fortuneList
.
size
()
>
0
)
{
// 批量设置fortune为可发佣
fortuneList
.
forEach
(
f
->
{
f
.
setCommissionPayoutStatus
(
fortuneCommissionPayoutStatus
);
f
.
setCommissionPayoutAt
(
new
Date
());
f
.
setCommissionPayoutBy
(
Long
.
valueOf
(
loginId
));
});
customerFortuneDalService
.
updateBatch
(
fortuneList
);
}
}
}
}
}
private
void
validateClosed
(
List
<
PoOrder
>
orders
,
List
<
AclCustomerFortune
>
fortuneList
,
String
status
)
throws
Exception
{
private
void
validateClosed
(
List
<
PoOrder
>
orders
,
List
<
AclCustomerFortune
>
fortuneList
,
String
status
)
throws
Exception
{
...
@@ -320,16 +363,23 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -320,16 +363,23 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
return
pageInfo
;
return
pageInfo
;
}
}
private
void
setOrderCommissionCheckId
(
List
<
Long
>
orderIds
,
String
status
,
Long
checkBatchId
,
String
loginId
)
{
private
void
setOrderCommissionCheckId
(
Long
orderId
,
String
status
,
Long
checkBatchId
,
String
loginId
)
{
// 更新参数
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"checkId"
,
checkBatchId
);
paramMap
.
put
(
"checkId"
,
checkBatchId
);
paramMap
.
put
(
"status"
,
status
);
paramMap
.
put
(
"status"
,
status
);
// 获取当前时间
paramMap
.
put
(
"checkAt"
,
new
Date
());
Date
curDate
=
new
Date
();
paramMap
.
put
(
"checkAt"
,
curDate
);
paramMap
.
put
(
"checkBy"
,
loginId
);
paramMap
.
put
(
"checkBy"
,
loginId
);
lifeCommissionMapper
.
setOrderCommissionCheckId
(
orderIds
,
paramMap
);
/**检核选择退保时先查看原来的来佣状态,若原来的是”已比对“则不改成已退保,若是”待来佣“就改成”已退保“*/
if
(
"3"
.
equals
(
status
))
{
PoOrder
order
=
poOrderDALService
.
findByOrderId
(
orderId
);
if
(
"1"
.
equals
(
order
.
getCommissionCheckStatus
()))
{
lifeCommissionMapper
.
setOrderCommissionCheckId
(
Arrays
.
asList
(
orderId
),
paramMap
);
}
}
else
{
lifeCommissionMapper
.
setOrderCommissionCheckId
(
Arrays
.
asList
(
orderId
),
paramMap
);
}
}
}
private
Long
getOrderCommissionCheckBatch
(
String
OrderCommissionCheckBatch
,
String
loginId
)
{
private
Long
getOrderCommissionCheckBatch
(
String
OrderCommissionCheckBatch
,
String
loginId
)
{
...
...
yd-api/src/main/java/com/yd/dal/mapper/commission/AgPoOrderCommissionMapper.java
View file @
8395e03e
...
@@ -21,4 +21,6 @@ public interface AgPoOrderCommissionMapper {
...
@@ -21,4 +21,6 @@ public interface AgPoOrderCommissionMapper {
void
updateBycommissionNo
(
AgPoOrderCommission
orderCommission
);
void
updateBycommissionNo
(
AgPoOrderCommission
orderCommission
);
AgPoOrderCommission
selectByCommissionNo
(
String
commissionNo
);
AgPoOrderCommission
selectByCommissionNo
(
String
commissionNo
);
List
<
AgPoOrderCommission
>
selectByOrderId
(
Long
orderId
);
}
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/mapper/customer/AclCustomerFortuneMapper.java
View file @
8395e03e
...
@@ -36,4 +36,5 @@ public interface AclCustomerFortuneMapper {
...
@@ -36,4 +36,5 @@ public interface AclCustomerFortuneMapper {
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
@Param
(
"list"
)
List
<
Long
>
practitionerIds
,
@Param
(
"time"
)
Integer
time
);
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
@Param
(
"list"
)
List
<
Long
>
practitionerIds
,
@Param
(
"time"
)
Integer
time
);
List
<
AclCustomerFortune
>
queryLifeFortuneListByOrderId
(
Long
orderId
);
}
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/service/customer/AclCustomerFortuneDALService.java
View file @
8395e03e
...
@@ -27,4 +27,6 @@ public interface AclCustomerFortuneDALService {
...
@@ -27,4 +27,6 @@ public interface AclCustomerFortuneDALService {
List
<
AclCustomerFortune
>
findByOrderId
(
Long
orderId
);
List
<
AclCustomerFortune
>
findByOrderId
(
Long
orderId
);
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
List
<
Long
>
practitionerIds
,
Integer
time
);
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
List
<
Long
>
practitionerIds
,
Integer
time
);
List
<
AclCustomerFortune
>
queryLifeFortuneListByOrderId
(
Long
orderId
);
}
}
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclCustomerFortuneDALServiceImpl.java
View file @
8395e03e
...
@@ -54,4 +54,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
...
@@ -54,4 +54,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
public
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
List
<
Long
>
practitionerIds
,
Integer
time
)
{
public
List
<
AclCustomerFortuneStatistics
>
findBypractitionerIds
(
List
<
Long
>
practitionerIds
,
Integer
time
)
{
return
aclCustomerFortuneMapper
.
findBypractitionerIds
(
practitionerIds
,
time
);
return
aclCustomerFortuneMapper
.
findBypractitionerIds
(
practitionerIds
,
time
);
}
}
@Override
public
List
<
AclCustomerFortune
>
queryLifeFortuneListByOrderId
(
Long
orderId
)
{
return
aclCustomerFortuneMapper
.
queryLifeFortuneListByOrderId
(
orderId
);
}
}
}
yd-api/src/main/resources/mapper/commission/AgPoOrderCommissionMapper.xml
View file @
8395e03e
...
@@ -350,4 +350,11 @@
...
@@ -350,4 +350,11 @@
from ag_po_order_commission
from ag_po_order_commission
where commission_no = #{commissionNo,jdbcType=VARCHAR}
where commission_no = #{commissionNo,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"selectByOrderId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_po_order_commission
where order_id = #{orderId,jdbcType=VARCHAR}
</select>
</mapper>
</mapper>
\ No newline at end of file
yd-api/src/main/resources/mapper/customer/AclCustomerFortuneMapper.xml
View file @
8395e03e
...
@@ -938,4 +938,15 @@
...
@@ -938,4 +938,15 @@
GROUP BY f.customer_id
GROUP BY f.customer_id
</select>
</select>
<select
id=
"queryLifeFortuneListByOrderId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_acl_customer_fortune f
left join (select p.customer_id p_customer_id, s.practitioner_type_id from ag_acl_practitioner p left join ag_acl_practitioner_setting s on p.id = s.practitioner_id) p
on f.customer_id = p.p_customer_id
where 1=1
and p.practitioner_type_id = 28
and f.order_id = #{orderId,jdbcType=BIGINT}
</select>
</mapper>
</mapper>
\ No newline at end of file
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