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
4a58ae34
Commit
4a58ae34
authored
Jan 15, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
16cb097b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
8 deletions
+47
-8
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
+47
-8
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
View file @
4a58ae34
...
...
@@ -198,6 +198,7 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
// 改为使用列表保存转换信息,按顺序匹配
List
<
ConvertInfo
>
convertInfoList
=
new
ArrayList
<>();
// 调试:记录每个对账记录的详细信息
for
(
Map
.
Entry
<
String
,
List
<
ApiPremiumRemittanceDto
>>
entry
:
reconciliationRemittanceMap
.
entrySet
())
{
String
reconciliationBizId
=
entry
.
getKey
();
List
<
ApiPremiumRemittanceDto
>
remittanceDtos
=
entry
.
getValue
();
...
...
@@ -214,9 +215,17 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
continue
;
}
log
.
info
(
"
开始
处理对账记录: {}, 保单: {}, 保单币种: {}, 汇款记录数: {}"
,
log
.
info
(
"处理对账记录: {}, 保单: {}, 保单币种: {}, 汇款记录数: {}"
,
reconciliationBizId
,
policyNo
,
policyCurrency
,
remittanceDtos
.
size
());
// 打印所有汇款记录详情
for
(
int
i
=
0
;
i
<
remittanceDtos
.
size
();
i
++)
{
ApiPremiumRemittanceDto
dto
=
remittanceDtos
.
get
(
i
);
log
.
info
(
"汇款记录 {}: ID={}, 金额={}, 币种={}, 日期={}"
,
i
,
dto
.
getPremiumRemittanceBizId
(),
dto
.
getPaymentAmount
(),
dto
.
getPaymentCurrency
(),
dto
.
getPaymentDate
());
}
// 初始化总金额
BigDecimal
totalAmount
=
BigDecimal
.
ZERO
;
String
paymentCurrency
=
policyCurrency
;
...
...
@@ -230,11 +239,11 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
if
(
policyCurrency
.
equalsIgnoreCase
(
remittanceCurrency
))
{
totalAmount
=
totalAmount
.
add
(
amount
);
sameCurrencyCount
++;
log
.
debug
(
"相同币种汇款记录: {} {}"
,
amount
,
remittanceCurrency
);
log
.
info
(
"相同币种汇款记录: {} {}"
,
amount
,
remittanceCurrency
);
}
}
log
.
debug
(
"相同币种汇款记录数: {}, 累计金额: {}"
,
sameCurrencyCount
,
totalAmount
);
log
.
info
(
"相同币种汇款记录数: {}, 累计金额: {}"
,
sameCurrencyCount
,
totalAmount
);
// 然后处理需要转换的汇款记录
int
convertCount
=
0
;
...
...
@@ -248,7 +257,8 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
}
convertCount
++;
log
.
debug
(
"需要转换的汇款记录: {} {} -> {}"
,
amount
,
remittanceCurrency
,
policyCurrency
);
log
.
info
(
"需要转换的汇款记录: ID={}, 金额={} {}, 目标币种={}"
,
remittanceDto
.
getPremiumRemittanceBizId
(),
amount
,
remittanceCurrency
,
policyCurrency
);
// 构建转换请求
ApiExchangeRateConvertRequest
convertRequest
=
new
ApiExchangeRateConvertRequest
();
...
...
@@ -283,9 +293,12 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
info
.
targetCurrency
=
policyCurrency
;
info
.
requestId
=
requestId
;
// 保存requestId,如果汇率服务返回则使用
convertInfoList
.
add
(
info
);
log
.
debug
(
"添加转换请求: requestId={}, {} {} -> {}"
,
requestId
,
amount
,
remittanceCurrency
,
policyCurrency
);
}
log
.
debug
(
"需要转换的汇款记录数: {}"
,
convertCount
);
log
.
info
(
"需要转换的汇款记录数: {}"
,
convertCount
);
// 先保存相同币种的累计金额
totalAmount
=
totalAmount
.
setScale
(
2
,
RoundingMode
.
HALF_EVEN
);
...
...
@@ -309,9 +322,20 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
log
.
info
(
"发送第 {} 批汇率转换请求,共 {} 条"
,
i
/
batchSize
+
1
,
batch
.
size
());
// 记录每个请求的详细信息
for
(
ApiExchangeRateConvertRequest
req
:
batch
)
{
log
.
info
(
"转换请求: requestId={}, 金额={}, 从{}到{}"
,
req
.
getRequestId
(),
req
.
getAmount
(),
req
.
getFromCurrency
(),
req
.
getToCurrency
());
}
Result
<
List
<
ApiExchangeRateConvertResponse
>>
batchResult
=
apiExchangeRateFeignClient
.
batchConvert
(
batch
);
log
.
info
(
"汇率转换服务返回: code={}, message={}, 数据量={}"
,
batchResult
!=
null
?
batchResult
.
getCode
()
:
"null"
,
batchResult
!=
null
?
batchResult
.
getMsg
()
:
"null"
,
batchResult
!=
null
&&
batchResult
.
getData
()
!=
null
?
batchResult
.
getData
().
size
()
:
0
);
if
(
batchResult
!=
null
&&
batchResult
.
getCode
()
==
200
&&
!
CollectionUtils
.
isEmpty
(
batchResult
.
getData
()))
{
...
...
@@ -320,6 +344,13 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
// 处理转换结果 - 使用顺序匹配
List
<
ApiExchangeRateConvertResponse
>
responses
=
batchResult
.
getData
();
// 记录每个响应的详细信息
for
(
ApiExchangeRateConvertResponse
resp
:
responses
)
{
log
.
info
(
"转换响应: requestId={}, 原金额={} {}, 转换金额={} {}"
,
resp
.
getRequestId
(),
resp
.
getOriginalAmount
(),
resp
.
getOriginalCurrency
(),
resp
.
getConvertedAmount
(),
resp
.
getTargetCurrency
());
}
// 确保响应数量与请求数量一致
if
(
responses
.
size
()
!=
batch
.
size
())
{
log
.
warn
(
"汇率转换响应数量({})与请求数量({})不一致,可能无法正确匹配"
,
...
...
@@ -337,6 +368,8 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
for
(
ConvertInfo
ci
:
convertInfoList
)
{
if
(
convertResponse
.
getRequestId
().
equals
(
ci
.
requestId
))
{
info
=
ci
;
log
.
info
(
"通过requestId匹配成功: requestId={}, 对账记录ID={}"
,
convertResponse
.
getRequestId
(),
info
.
reconciliationBizId
);
break
;
}
}
...
...
@@ -345,13 +378,14 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
// 如果通过requestId没有找到,则使用顺序匹配
if
(
info
==
null
&&
j
<
batchConvertInfos
.
size
())
{
info
=
batchConvertInfos
.
get
(
j
);
log
.
info
(
"尝试顺序匹配: 批次索引={}, 对账记录ID={}"
,
j
,
info
.
reconciliationBizId
);
}
if
(
info
!=
null
&&
convertResponse
.
getConvertedAmount
()
!=
null
)
{
BigDecimal
currentTotal
=
totalPaymentAmounts
.
getOrDefault
(
info
.
reconciliationBizId
,
BigDecimal
.
ZERO
);
BigDecimal
convertedAmount
=
convertResponse
.
getConvertedAmount
();
log
.
debug
(
"汇率转换结果: {} {} -> {} {}, 汇率={}"
,
log
.
info
(
"汇率转换结果: {} {} -> {} {}, 汇率={}"
,
convertResponse
.
getOriginalAmount
(),
convertResponse
.
getOriginalCurrency
(),
convertedAmount
,
convertResponse
.
getTargetCurrency
(),
convertResponse
.
getExchangeRate
());
...
...
@@ -360,7 +394,7 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
BigDecimal
newTotal
=
currentTotal
.
add
(
convertedAmount
);
totalPaymentAmounts
.
put
(
info
.
reconciliationBizId
,
newTotal
);
log
.
debug
(
"对账记录 {} 累加后总金额: {} (之前: {} + 转换: {})"
,
log
.
info
(
"对账记录 {} 累加后总金额: {} (之前: {} + 转换: {})"
,
info
.
reconciliationBizId
,
newTotal
,
currentTotal
,
convertedAmount
);
}
else
{
log
.
warn
(
"转换结果缺少必要信息或无法匹配: requestId={}, info={}, convertedAmount={}"
,
...
...
@@ -402,6 +436,11 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
}
}
// 调试:打印所有对账记录的总付款金额
for
(
Map
.
Entry
<
String
,
BigDecimal
>
entry
:
totalPaymentAmounts
.
entrySet
())
{
log
.
info
(
"对账记录 {} 最终总付款金额: {}"
,
entry
.
getKey
(),
entry
.
getValue
());
}
// 更新分页响应
int
updatedCount
=
0
;
for
(
ApiPremiumReconciliationPageResponse
item
:
iPage
.
getRecords
())
{
...
...
@@ -422,7 +461,7 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
}
updatedCount
++;
}
else
{
log
.
debug
(
"对账记录 {} 没有找到付款金额汇总"
,
reconciliationBizId
);
log
.
info
(
"对账记录 {} 没有找到付款金额汇总"
,
reconciliationBizId
);
}
}
...
...
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