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
e6856d4f
Commit
e6856d4f
authored
May 13, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出账检核-增加币种46
parent
786306b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+26
-21
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
e6856d4f
...
...
@@ -269,8 +269,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
/**
* 保单币种对预计来佣的结算币种的默认汇率
*
* @param policyCurrency 保单币种
* @param currency 预计来佣的结算币种
* @param currency
预计来佣的结算币种
* @return 汇率
*/
private
BigDecimal
queryExchangeRateByFeign
(
String
policyCurrency
,
String
currency
)
{
...
...
@@ -838,7 +839,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
private
ExpectedFortune
createExpectedFortune
(
FortuneAddRequest
fortuneAddRequest
,
Policy
policy
,
String
fortuneName
)
{
// 创建 expectedFortune
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
expectedFortune
);
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
expectedFortune
,
"payoutDate"
,
"actualPayoutDate"
);
// 设置 policy 关联字段
expectedFortune
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
...
...
@@ -856,6 +857,10 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
expectedFortune
.
setIsPart
(
0
);
// 默认保单币种汇率
expectedFortune
.
setDefaultExchangeRate
(
fortuneAddRequest
.
getExchangeRate
());
// 预计出账年月
expectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getPayoutDate
()
+
"-01"
));
// 实际出账年月
expectedFortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getActualPayoutDate
()
+
"-01"
));
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
...
...
@@ -900,26 +905,26 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
List
<
FortuneSplitDto
>
splitList
=
fortuneSplitRequest
.
getFortuneSplitDtoList
();
// 3. 金额验证
BigDecimal
totalSplitOriginalAmount
=
splitList
.
stream
()
.
map
(
FortuneSplitDto:
:
getOriginalAmount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
.
map
(
FortuneSplitDto:
:
getOriginalAmount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalSplitRatio
=
splitList
.
stream
()
.
map
(
FortuneSplitDto:
:
getSplitRatio
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
.
map
(
FortuneSplitDto:
:
getSplitRatio
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
tolerance
=
new
BigDecimal
(
"0.01"
);
BigDecimal
originalDifference
=
originalFortune
.
getOriginalAmount
().
subtract
(
totalSplitOriginalAmount
).
abs
();
if
(
originalDifference
.
compareTo
(
tolerance
)
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
String
.
format
(
"分期原始金额总和(%s)与原记录原始金额(%s)不匹配"
,
totalSplitOriginalAmount
,
originalFortune
.
getOriginalAmount
()));
String
.
format
(
"分期原始金额总和(%s)与原记录原始金额(%s)不匹配"
,
totalSplitOriginalAmount
,
originalFortune
.
getOriginalAmount
()));
}
if
(
totalSplitRatio
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BigDecimal
ratioDifference
=
new
BigDecimal
(
"100"
).
subtract
(
totalSplitRatio
).
abs
();
if
(
ratioDifference
.
compareTo
(
new
BigDecimal
(
"0.1"
))
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
String
.
format
(
"分期比例总和(%s%%)应为100%%"
,
totalSplitRatio
));
String
.
format
(
"分期比例总和(%s%%)应为100%%"
,
totalSplitRatio
));
}
}
...
...
@@ -941,9 +946,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
ExpectedFortune
newExpectedFortune
=
new
ExpectedFortune
();
BeanUtils
.
copyProperties
(
originalExpectedFortune
,
newExpectedFortune
,
"id"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"paidAmount"
,
"unpaidAmount"
,
"paidRatio"
,
"unpaidRatio"
,
"status"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
"id"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"paidAmount"
,
"unpaidAmount"
,
"paidRatio"
,
"unpaidRatio"
,
"status"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
String
newExpectedFortuneBizId
=
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
());
newExpectedFortune
.
setExpectedFortuneBizId
(
newExpectedFortuneBizId
);
...
...
@@ -987,10 +992,10 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
Fortune
newFortune
=
new
Fortune
();
BeanUtils
.
copyProperties
(
originalFortune
,
newFortune
,
"id"
,
"fortuneBizId"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"currentPaymentAmount"
,
"currentPaymentHkdAmount"
,
"currentPaymentRatio"
,
"status"
,
"isPart"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
"id"
,
"fortuneBizId"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"currentPaymentAmount"
,
"currentPaymentHkdAmount"
,
"currentPaymentRatio"
,
"status"
,
"isPart"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
newFortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
...
...
@@ -1011,8 +1016,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
String
fortuneRemark
=
StringUtils
.
isBlank
(
splitDto
.
getRemark
())
?
""
:
splitDto
.
getRemark
();
if
(
StringUtils
.
isNotBlank
(
originalFortune
.
getRemark
()))
{
fortuneRemark
=
StringUtils
.
isBlank
(
fortuneRemark
)
?
originalFortune
.
getRemark
()
:
originalFortune
.
getRemark
()
+
"; "
+
fortuneRemark
;
originalFortune
.
getRemark
()
:
originalFortune
.
getRemark
()
+
"; "
+
fortuneRemark
;
}
newFortune
.
setRemark
(
fortuneRemark
);
...
...
@@ -1199,15 +1204,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
FortuneSplitDto
dto
=
splitList
.
get
(
i
);
if
(
dto
.
getHkdAmount
()
==
null
||
dto
.
getHkdAmount
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:港币金额必须大于0"
);
"第"
+
(
i
+
1
)
+
"期:港币金额必须大于0"
);
}
if
(
dto
.
getExchangeRate
()
==
null
||
dto
.
getExchangeRate
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:汇率必须大于0"
);
"第"
+
(
i
+
1
)
+
"期:汇率必须大于0"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getPayoutYearMonth
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:出账年月不能为空"
);
"第"
+
(
i
+
1
)
+
"期:出账年月不能为空"
);
}
}
}
...
...
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