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
52680af7
Commit
52680af7
authored
Jul 08, 2021
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
续年佣金计算-更新续佣检核状态前先校验9
parent
97d807c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
8 deletions
+66
-8
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
+51
-4
yd-api/src/main/java/com/yd/dal/mapper/commission/AgPoOrderCommissionMapper.java
+3
-0
yd-api/src/main/resources/mapper/commission/AgPoOrderCommissionMapper.xml
+8
-0
yd-api/src/main/resources/mapper/lifecommission/LifeCommissionMapper.xml
+4
-4
No files found.
yd-api/src/main/java/com/yd/api/commission/service/impl/LifeCommissionServiceImpl.java
View file @
52680af7
...
@@ -85,11 +85,15 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -85,11 +85,15 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
resp
.
setCommonResult
(
new
CommonResult
(
false
,
"检核日期不能为空"
));
resp
.
setCommonResult
(
new
CommonResult
(
false
,
"检核日期不能为空"
));
return
resp
;
return
resp
;
}
}
try
{
try
{
// 1.更新财富等信息
// 1.检核续年佣金时先判断,前面期数的佣金是否检核过
this
.
validateContinuePremium
(
paramsList
);
// 2.更新财富等信息
this
.
processOrderAndFortune
(
paramsList
,
status
,
loginId
,
checkBatch
);
this
.
processOrderAndFortune
(
paramsList
,
status
,
loginId
,
checkBatch
);
//
2
.更新多年期佣金
//
3
.更新多年期佣金
this
.
updateOrderCommission
(
paramsList
,
status
,
loginId
,
checkBatch
);
this
.
updateOrderCommission
(
paramsList
,
status
,
loginId
,
checkBatch
);
resp
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
resp
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
...
@@ -101,14 +105,57 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -101,14 +105,57 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
return
resp
;
return
resp
;
}
}
private
void
validateContinuePremium
(
List
<
ComeCommissionParams
>
paramsList
)
throws
Exception
{
// 提示信息
StringBuffer
stringBuffer
=
new
StringBuffer
(
"以下来佣的往期来佣未检核: "
);
List
<
String
>
commissionNos
=
new
ArrayList
<>();
for
(
ComeCommissionParams
params:
paramsList
)
{
if
(
StringUtils
.
isNotBlank
(
params
.
getCommissionNo
()))
{
commissionNos
.
add
(
params
.
getCommissionNo
());
}
}
String
str
=
""
;
String
prefix
=
""
;
String
suffix
=
""
;
boolean
flag
=
false
;
for
(
String
commissionNo:
commissionNos
)
{
str
=
commissionNo
;
if
(!
"1"
.
equals
(
suffix
))
{
prefix
=
str
.
substring
(
0
,
str
.
length
()
-
1
);
suffix
=
str
.
substring
(
str
.
length
()-
1
)
;
// 前一期的来佣编号
String
preCommissionNo
=
prefix
+
(
Integer
.
valueOf
(
suffix
)
-
1
);
System
.
out
.
println
(
"看看commissionNo------"
+
commissionNo
);
System
.
out
.
println
(
"看看preCommissionNo------"
+
preCommissionNo
);
AgPoOrderCommission
agPoOrderCommission
=
orderCommissionMapper
.
selectByCommissionNo
(
preCommissionNo
);
if
(
agPoOrderCommission
!=
null
&&
"1"
.
equals
(
agPoOrderCommission
.
getCommissionStatus
()))
{
stringBuffer
.
append
(
commissionNo
).
append
(
" "
);
flag
=
true
;
}
}
}
if
(
flag
)
{
throw
new
Exception
(
stringBuffer
.
toString
());
}
}
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
// 获取首年度佣金的orderId
, 只有首年佣金才更新order记录和fortune记录
List
<
Long
>
orderIds
=
new
ArrayList
<>();
List
<
Long
>
orderIds
=
new
ArrayList
<>();
for
(
ComeCommissionParams
params:
paramsList
)
{
for
(
ComeCommissionParams
params:
paramsList
)
{
if
(
"1"
.
equals
(
params
.
getCommissionPeriod
()))
{
if
(
"1"
.
equals
(
params
.
getCommissionPeriod
()))
{
orderIds
.
add
(
params
.
getOrderId
());
orderIds
.
add
(
params
.
getOrderId
());
}
}
}
}
if
(
orderIds
.
size
()
==
0
)
{
return
;
}
// 操作前先检查是否已关账
// 操作前先检查是否已关账
// 查询对应订单记录
// 查询对应订单记录
...
@@ -151,7 +198,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
...
@@ -151,7 +198,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
// 获取批次号(如2020-11的字符串)
// 获取批次号(如2020-11的字符串)
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
Long
checkBatchId
=
this
.
getOrderCommissionCheckBatch
(
checkBatch
,
loginId
);
// 更新检核状态
for
(
String
commissionNo:
commissionNos
)
{
for
(
String
commissionNo:
commissionNos
)
{
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
AgPoOrderCommission
orderCommission
=
new
AgPoOrderCommission
();
orderCommission
.
setCommissionNo
(
commissionNo
);
orderCommission
.
setCommissionNo
(
commissionNo
);
...
...
yd-api/src/main/java/com/yd/dal/mapper/commission/AgPoOrderCommissionMapper.java
View file @
52680af7
...
@@ -19,4 +19,6 @@ public interface AgPoOrderCommissionMapper {
...
@@ -19,4 +19,6 @@ public interface AgPoOrderCommissionMapper {
int
updateByPrimaryKey
(
AgPoOrderCommission
record
);
int
updateByPrimaryKey
(
AgPoOrderCommission
record
);
void
updateBycommissionNo
(
AgPoOrderCommission
orderCommission
);
void
updateBycommissionNo
(
AgPoOrderCommission
orderCommission
);
AgPoOrderCommission
selectByCommissionNo
(
String
commissionNo
);
}
}
\ No newline at end of file
yd-api/src/main/resources/mapper/commission/AgPoOrderCommissionMapper.xml
View file @
52680af7
...
@@ -343,4 +343,11 @@
...
@@ -343,4 +343,11 @@
</set>
</set>
where commission_no = #{commissionNo,jdbcType=VARCHAR}
where commission_no = #{commissionNo,jdbcType=VARCHAR}
</update>
</update>
<select
id=
"selectByCommissionNo"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_po_order_commission
where commission_no = #{commissionNo,jdbcType=VARCHAR}
</select>
</mapper>
</mapper>
\ No newline at end of file
yd-api/src/main/resources/mapper/lifecommission/LifeCommissionMapper.xml
View file @
52680af7
...
@@ -45,10 +45,10 @@
...
@@ -45,10 +45,10 @@
) o
) o
LEFT JOIN
LEFT JOIN
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time, commission_check_id,
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time, commission_check_id,
commission_period, rate
commission_period, rate
, order_id
from ag_po_order_commission t
from ag_po_order_commission t
) orderCommission
) orderCommission
ON o.
policy_no = orderCommission.policyNo
ON o.
id = orderCommission.order_id
WHERE 1=1
WHERE 1=1
<if
test=
"startDate != null "
>
<if
test=
"startDate != null "
>
and date_format(commission_year, '%Y-%m')
>
= #{startDate}
and date_format(commission_year, '%Y-%m')
>
= #{startDate}
...
@@ -171,10 +171,10 @@
...
@@ -171,10 +171,10 @@
) o
) o
LEFT JOIN
LEFT JOIN
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time, rate, commission_check_id,
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time, rate, commission_check_id,
commission_period
commission_period
, order_id
from ag_po_order_commission t
from ag_po_order_commission t
) orderCommission
) orderCommission
ON o.
policy_no = orderCommission.policyNo
ON o.
id = orderCommission.order_id
WHERE 1=1
WHERE 1=1
<if
test=
"startDate != null "
>
<if
test=
"startDate != null "
>
and date_format(commission_year, '%Y-%m')
>
= #{startDate}
and date_format(commission_year, '%Y-%m')
>
= #{startDate}
...
...
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