Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
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
xingmin
yd-csf
Commits
8e3d44b1
Commit
8e3d44b1
authored
Mar 09, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
c1719ae5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
4 deletions
+32
-4
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
+32
-4
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
View file @
8e3d44b1
...
@@ -198,10 +198,38 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
...
@@ -198,10 +198,38 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
return
true
;
return
true
;
}
}
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
apiProductPlanMainInfoDto
)
{
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
dto
)
{
// 计算总保费
// 校验每期保费(必填)
return
apiProductPlanMainInfoDto
.
getEachIssuePremium
()
BigDecimal
eachIssuePremium
=
dto
.
getEachIssuePremium
();
.
multiply
(
new
BigDecimal
(
apiProductPlanMainInfoDto
.
getPaymentFrequency
()))
if
(
eachIssuePremium
==
null
)
{
throw
new
BusinessException
(
"每期保费不能为空"
);
}
String
issueNumberStr
=
dto
.
getIssueNumber
();
BigDecimal
issueNumber
;
// 供款期数为空时,默认按 1 期处理
if
(
StringUtils
.
isBlank
(
issueNumberStr
))
{
issueNumber
=
BigDecimal
.
ONE
;
}
else
{
// 安全转换为 BigDecimal
try
{
issueNumber
=
new
BigDecimal
(
issueNumberStr
.
trim
());
}
catch
(
NumberFormatException
e
)
{
throw
new
BusinessException
(
"供款期数格式不正确,请填写数字"
);
}
// 业务逻辑校验:期数必须为正整数
if
(
issueNumber
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
"供款期数必须大于0"
);
}
// 检查是否为整数(去除小数部分后与原值比较)
if
(
issueNumber
.
stripTrailingZeros
().
scale
()
>
0
)
{
throw
new
BusinessException
(
"供款期数必须为整数"
);
}
}
// 计算总保费并保留4位小数
return
eachIssuePremium
.
multiply
(
issueNumber
)
.
setScale
(
4
,
RoundingMode
.
HALF_UP
);
.
setScale
(
4
,
RoundingMode
.
HALF_UP
);
}
}
...
...
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