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
d2528918
Commit
d2528918
authored
Apr 07, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
57dab836
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
+13
-11
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
View file @
d2528918
...
@@ -161,26 +161,28 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
...
@@ -161,26 +161,28 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
*/
*/
@Override
@Override
public
Result
<
ApiQueryRemainingResponse
>
queryRemaining
(
ApiQueryRemainingRequest
request
)
{
public
Result
<
ApiQueryRemainingResponse
>
queryRemaining
(
ApiQueryRemainingRequest
request
)
{
//
查询
出账记录是否存在
//
1. 校验
出账记录是否存在
FortuneAccount
fortuneAccount
=
fortuneAccountService
.
queryOne
(
request
.
getFortuneAccountBizId
());
FortuneAccount
fortuneAccount
=
fortuneAccountService
.
queryOne
(
request
.
getFortuneAccountBizId
());
if
(
fortuneAccount
==
null
)
{
if
(
fortuneAccount
==
null
)
{
throw
new
BusinessException
(
"出账记录不存在"
);
throw
new
BusinessException
(
"出账记录不存在"
);
}
}
BigDecimal
beSplitAmount
=
BigDecimal
.
ZERO
;
// 查询所有拆分记录,计算已拆分总金额
List
<
SalarySplit
>
salarySplits
=
iSalarySplitService
.
lambdaQuery
()
.
eq
(
SalarySplit:
:
getFortuneAccountBizId
,
request
.
getFortuneAccountBizId
())
.
list
();
BigDecimal
splitTotal
=
salarySplits
.
stream
()
.
map
(
SalarySplit:
:
getFromAmount
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
// 2. 计算本次拟拆分金额总和(使用请求中的 fromAmountList)
BigDecimal
splitTotal
=
BigDecimal
.
ZERO
;
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getFromAmountList
()))
{
splitTotal
=
request
.
getFromAmountList
().
stream
()
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
}
// 3. 计算剩余可拆金额(账户总额 - 本次拟拆分总额)
BigDecimal
fortuneAmount
=
fortuneAccount
.
getHkdAmount
()
!=
null
?
fortuneAccount
.
getHkdAmount
()
:
BigDecimal
.
ZERO
;
BigDecimal
fortuneAmount
=
fortuneAccount
.
getHkdAmount
()
!=
null
?
fortuneAccount
.
getHkdAmount
()
:
BigDecimal
.
ZERO
;
beSplitAmount
=
fortuneAmount
.
subtract
(
splitTotal
);
BigDecimal
beSplitAmount
=
fortuneAmount
.
subtract
(
splitTotal
);
if
(
beSplitAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
if
(
beSplitAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
beSplitAmount
=
BigDecimal
.
ZERO
;
// 防止负数
beSplitAmount
=
BigDecimal
.
ZERO
;
// 防止负数
}
}
// 4. 封装响应
ApiQueryRemainingResponse
response
=
new
ApiQueryRemainingResponse
();
ApiQueryRemainingResponse
response
=
new
ApiQueryRemainingResponse
();
response
.
setCurrency
(
fortuneAccount
.
getCurrency
());
response
.
setCurrency
(
fortuneAccount
.
getCurrency
());
response
.
setFromAmount
(
beSplitAmount
);
response
.
setFromAmount
(
beSplitAmount
);
...
...
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