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
c125ff6d
Commit
c125ff6d
authored
Nov 25, 2020
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
来佣比对状态修改接口逻辑
parent
a2cacf3d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
62 deletions
+42
-62
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
+38
-58
yd-api/src/main/java/com/yd/dal/mapper/transaction/TransSendlistMapper.java
+1
-1
yd-api/src/main/java/com/yd/dal/service/transaction/Impl/TransSendListServiceImpl.java
+2
-2
yd-api/src/main/java/com/yd/dal/service/transaction/TransSendListService.java
+1
-1
No files found.
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
View file @
c125ff6d
...
...
@@ -3,8 +3,6 @@ package com.yd.api.commission.service.impl;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.yd.api.agms.service.AgmsFortuneService
;
import
com.yd.api.order.vo.SurrenderFortuneRequestVO
;
import
com.yd.api.commission.service.LifeCommissionService
;
import
com.yd.api.commission.vo.lifecommission.*
;
import
com.yd.api.result.CommonResult
;
...
...
@@ -31,8 +29,6 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
@Autowired
private
AclCustomerFortuneDALService
customerFortuneDalService
;
@Autowired
private
AgmsFortuneService
agmsFortuneService
;
@Autowired
private
PoOrderDALService
poOrderDALService
;
...
...
@@ -70,19 +66,34 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
String
loginId
=
requestVO
.
getLoginId
();
String
checkBatch
=
requestVO
.
getCheckBatch
();
try
{
// 寿险经纪人的财富需要初始化withdraw和pay
// 操作前先检查是否已关账
// 查询对应订单记录
List
<
PoOrder
>
orders
=
poOrderDALService
.
findByIds
(
orderIds
);
// 查询保单下的所有寿险经纪人的fortune记录
List
<
AclCustomerFortune
>
fortuneList
=
customerFortuneDalService
.
queryLifeFortuneListByOrderIds
(
orderIds
);
// 已退保的订单不能修改状态
for
(
PoOrder
o:
orders
)
{
// 已退保的订单不能改状态
if
(
"4"
.
equals
(
o
.
getStatus
())
||
"3"
.
equals
(
o
.
getCommissionCheckStatus
()))
{
resp
.
setCommonResult
(
new
CommonResult
(
false
,
"已退保的订单不能改状态"
));
return
resp
;
}
}
// 已关帐的订单,则该笔订单来佣比对状态不能改为待来佣和已比对,但能改为已退保
this
.
validateClosed
(
orders
,
fortuneList
,
status
);
String
fortuneCommissionPayoutStatus
=
null
;
if
(
"2"
.
equals
(
status
))
{
//已比对
this
.
checkPass
(
orderIds
,
status
,
loginId
,
checkBatch
)
;
fortuneCommissionPayoutStatus
=
"2"
;
}
else
if
(
"3"
.
equals
(
status
))
{
//已退保
SurrenderFortuneRequestVO
surrenderFortuneRequest
=
new
SurrenderFortuneRequestVO
();
for
(
Long
orderId:
orderIds
)
{
surrenderFortuneRequest
.
setOrderId
(
orderId
);
agmsFortuneService
.
surrenderFortune
(
surrenderFortuneRequest
);
}
fortuneCommissionPayoutStatus
=
"1"
;
}
else
{
//待来佣
this
.
checkRollBack
(
orderIds
,
loginId
)
;
fortuneCommissionPayoutStatus
=
"1"
;
}
this
.
updateOrderAndFortune
(
orderIds
,
fortuneList
,
fortuneCommissionPayoutStatus
,
status
,
loginId
,
checkBatch
);
resp
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
}
catch
(
Exception
e
)
{
...
...
@@ -92,26 +103,19 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
return
resp
;
}
private
void
checkRollBack
(
List
<
Long
>
orderIds
,
String
loginId
)
throws
Exception
{
// 查询对应订单记录
List
<
PoOrder
>
orders
=
poOrderDALService
.
findByIds
(
orderIds
);
// 查询保单下的所有寿险经纪人的fortune记录
List
<
AclCustomerFortune
>
fortuneList
=
customerFortuneDalService
.
queryLifeFortuneListByOrderIds
(
orderIds
);
// 校验数据,若订单下存在已发放的财富记录,则该笔订单来佣比对状态不能改为待来佣
this
.
validateRollBackOrders
(
orders
,
fortuneList
);
private
void
updateOrderAndFortune
(
List
<
Long
>
orderIds
,
List
<
AclCustomerFortune
>
fortuneList
,
String
status
,
String
fortuneCommissionPayoutStatus
,
String
loginId
,
String
checkBatch
)
{
// 获取批次号(如2020-11的字符串)
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
// 设置order记录的CommissionCheckId
this
.
setOrderCommissionCheckId
(
orderIds
,
status
,
checkBatchId
,
loginId
);
// 设置order记录为待来佣
for
(
PoOrder
o:
orders
)
{
o
.
setCommissionCheckId
(
null
);
o
.
setCommissionCheckStatus
(
"1"
);
o
.
setCommissionCheckAt
(
new
Date
());
o
.
setCommissionCheckBy
(
Long
.
valueOf
(
loginId
));
poOrderDALService
.
update
(
o
);
if
(
fortuneList
.
size
()
==
0
)
{
return
;
}
// 批量设置fortune为
不
可发佣
// 批量设置fortune为可发佣
fortuneList
.
forEach
(
f
->
{
f
.
setCommissionPayoutStatus
(
"1"
);
f
.
setCommissionPayoutStatus
(
fortuneCommissionPayoutStatus
);
f
.
setCommissionPayoutAt
(
new
Date
());
f
.
setCommissionPayoutBy
(
Long
.
valueOf
(
loginId
));
});
...
...
@@ -120,18 +124,11 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
}
}
private
void
validate
RollBackOrders
(
List
<
PoOrder
>
orders
,
List
<
AclCustomerFortune
>
fortuneList
)
throws
Exception
{
private
void
validate
Closed
(
List
<
PoOrder
>
orders
,
List
<
AclCustomerFortune
>
fortuneList
,
String
status
)
throws
Exception
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
Map
<
Long
,
String
>
orderIdPolicyNoMap
=
new
HashMap
<>();
for
(
PoOrder
o:
orders
)
{
orderIdPolicyNoMap
.
put
(
o
.
getId
(),
o
.
getPolicyNo
());
if
(
"1"
.
equals
(
o
.
getCommissionCheckStatus
())
||
"3"
.
equals
(
o
.
getCommissionCheckStatus
()))
{
stringBuilder
.
append
(
o
.
getPolicyNo
()+
" "
);
}
}
if
(
StringUtils
.
isNotEmpty
(
stringBuilder
.
toString
()))
{
stringBuilder
.
append
(
"待来佣和已退保的订单不能改为待来佣"
);
throw
new
Exception
(
stringBuilder
.
toString
());
}
for
(
AclCustomerFortune
f:
fortuneList
)
{
if
(
"4"
.
equals
(
f
.
getCommissionPayoutStatus
()))
{
...
...
@@ -139,28 +136,11 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
}
}
if
(
StringUtils
.
isNotEmpty
(
stringBuilder
.
toString
()))
{
stringBuilder
.
append
(
"订单下存在已发放的财富记录,不能改为待来佣"
);
throw
new
Exception
(
stringBuilder
.
toString
());
}
}
private
void
checkPass
(
List
<
Long
>
orderIds
,
String
status
,
String
loginId
,
String
checkBatch
)
{
// 获取批次号(如2020-11的字符串)
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
// 设置order记录的CommissionCheckId
this
.
setOrderCommissionCheckId
(
orderIds
,
status
,
checkBatchId
,
loginId
);
// 查询保单下的所有寿险经纪人的fortune记录
List
<
AclCustomerFortune
>
fortuneList
=
customerFortuneDalService
.
queryLifeFortuneListByOrderIds
(
orderIds
);
if
(
fortuneList
.
size
()
==
0
)
{
return
;
stringBuilder
.
append
(
"订单下存在已发放的财富记录,不能改状态"
);
if
(!
"3"
.
equals
(
status
))
{
throw
new
Exception
(
stringBuilder
.
toString
());
}
}
// 批量设置fortune为可发佣
fortuneList
.
forEach
(
f
->
{
f
.
setCommissionPayoutStatus
(
"2"
);
f
.
setCommissionPayoutAt
(
new
Date
());
f
.
setCommissionPayoutBy
(
Long
.
valueOf
(
loginId
));
});
customerFortuneDalService
.
updateBatch
(
fortuneList
);
}
private
PageInfo
<
ComeCommissionVO
>
queryComeCommissionListPage
(
QueryComeCommissionListRequestVO
requestVO
)
{
...
...
yd-api/src/main/java/com/yd/dal/mapper/transaction/TransSendlistMapper.java
View file @
c125ff6d
...
...
@@ -5,7 +5,7 @@ import com.yd.dal.entity.transaction.TransSendList;
public
interface
TransSendlistMapper
{
int
deleteByPrimaryKey
(
Long
id
);
TransSendList
insert
(
TransSendList
record
);
void
insert
(
TransSendList
record
);
int
insertSelective
(
TransSendList
record
);
...
...
yd-api/src/main/java/com/yd/dal/service/transaction/Impl/TransSendListServiceImpl.java
View file @
c125ff6d
...
...
@@ -14,8 +14,8 @@ public class TransSendListServiceImpl implements TransSendListService {
private
TransSendlistMapper
transSendlistMapper
;
@Override
public
TransSendList
save
(
TransSendList
transSendList
)
{
return
transSendlistMapper
.
insert
(
transSendList
);
public
void
save
(
TransSendList
transSendList
)
{
transSendlistMapper
.
insert
(
transSendList
);
}
@Override
...
...
yd-api/src/main/java/com/yd/dal/service/transaction/TransSendListService.java
View file @
c125ff6d
...
...
@@ -12,7 +12,7 @@ public interface TransSendListService {
* @param transSendList
* @return
*/
TransSendList
save
(
TransSendList
transSendList
);
void
save
(
TransSendList
transSendList
);
/**
* 按id删除对象
* @param id
...
...
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