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
7899cd79
Commit
7899cd79
authored
Sep 20, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保费到期提醒25-保单邮件逐条通知
parent
d640c5c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/RenewalDispatchServiceImpl.java
+10
-18
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/RenewalDispatchServiceImpl.java
View file @
7899cd79
...
@@ -92,7 +92,6 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
...
@@ -92,7 +92,6 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
RenewalReminderData
data
=
null
;
RenewalReminderData
data
=
null
;
String
fileName
=
null
;
String
fileName
=
null
;
String
recipientsSnapshot
=
null
;
String
recipientsSnapshot
=
null
;
boolean
failBatchRecorded
=
false
;
List
<
String
>
failures
=
new
ArrayList
<>();
List
<
String
>
failures
=
new
ArrayList
<>();
try
{
try
{
// 1. 配置 fail-fast:任何收件配置错误都在发信前暴露
// 1. 配置 fail-fast:任何收件配置错误都在发信前暴露
...
@@ -132,20 +131,7 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
...
@@ -132,20 +131,7 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
sendRound
(
r1List
,
RenewalMailTypeEnum
.
R1
,
bizMonth
,
policyTo
,
ccSnapshot
,
sendRound
(
r1List
,
RenewalMailTypeEnum
.
R1
,
bizMonth
,
policyTo
,
ccSnapshot
,
succeededKeys
,
failures
,
missingTotal
,
attempted
,
data
.
getSkipped
());
succeededKeys
,
failures
,
missingTotal
,
attempted
,
data
.
getSkipped
());
// 6. 存在任一 FAIL:批次 FAIL,不发 Excel 汇总
// 6. R1 非空即发送 Excel 汇总:汇总收件人与逐单收件人不同,清单送达不与逐单通道成败挂钩
if
(!
failures
.
isEmpty
())
{
String
errorMsg
=
StringUtils
.
substring
(
String
.
join
(
"; "
,
failures
),
0
,
ERROR_MSG_MAX_LEN
);
saveBatch
(
existBatch
,
execMonth
,
data
,
null
,
RenewalRemindStatusEnum
.
FAIL
,
errorMsg
,
recipientsSnapshot
,
r2List
.
size
(),
failures
.
size
());
failBatchRecorded
=
true
;
log
.
error
(
"续期提醒存在 {} 封逐单邮件失败,批次 FAIL。bizMonth={}, 明细={}"
,
failures
.
size
(),
bizMonth
,
errorMsg
);
throw
new
BusinessException
(
"续期提醒跑批失败,逐单邮件失败 "
+
failures
.
size
()
+
" 封: "
+
errorMsg
);
}
// 7. 全部成功:R1 非空才生成并发送 Excel 汇总(仅 R2 命中时无清单可附)
if
(
CollectionUtils
.
isNotEmpty
(
r1List
))
{
if
(
CollectionUtils
.
isNotEmpty
(
r1List
))
{
fileName
=
renewalPolicyReportService
.
buildFileName
(
data
,
LocalDate
.
now
());
fileName
=
renewalPolicyReportService
.
buildFileName
(
data
,
LocalDate
.
now
());
byte
[]
attachment
=
renewalPolicyReportService
.
generate
(
data
);
byte
[]
attachment
=
renewalPolicyReportService
.
generate
(
data
);
...
@@ -154,18 +140,24 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
...
@@ -154,18 +140,24 @@ public class RenewalDispatchServiceImpl implements RenewalDispatchService {
renewalMailService
.
sendWithAttachment
(
summaryRecipients
,
subject
,
content
,
fileName
,
attachment
);
renewalMailService
.
sendWithAttachment
(
summaryRecipients
,
subject
,
content
,
fileName
,
attachment
);
}
}
// 7. 逐单存在失败:汇总已送达,批次仍记 FAIL 并抛出,使调度标红、重跑只补失败封
if
(!
failures
.
isEmpty
())
{
String
errorMsg
=
StringUtils
.
substring
(
String
.
join
(
"; "
,
failures
),
0
,
ERROR_MSG_MAX_LEN
);
log
.
error
(
"续期提醒 {} 封逐单邮件失败(汇总邮件已发送)。bizMonth={}, 明细={}"
,
failures
.
size
(),
bizMonth
,
errorMsg
);
throw
new
BusinessException
(
"续期提醒逐单邮件失败 "
+
failures
.
size
()
+
" 封: "
+
errorMsg
);
}
saveBatch
(
existBatch
,
execMonth
,
data
,
fileName
,
saveBatch
(
existBatch
,
execMonth
,
data
,
fileName
,
RenewalRemindStatusEnum
.
SUCCESS
,
null
,
recipientsSnapshot
,
r2List
.
size
(),
0
);
RenewalRemindStatusEnum
.
SUCCESS
,
null
,
recipientsSnapshot
,
r2List
.
size
(),
0
);
log
.
info
(
"续期提醒发送完成。bizMonth={}, R1={}, R2={}, 待核对项={}"
,
log
.
info
(
"续期提醒发送完成。bizMonth={}, R1={}, R2={}, 待核对项={}"
,
bizMonth
,
r1List
.
size
(),
r2List
.
size
(),
missingTotal
[
0
]);
bizMonth
,
r1List
.
size
(),
r2List
.
size
(),
missingTotal
[
0
]);
}
catch
(
BusinessException
e
)
{
}
catch
(
BusinessException
e
)
{
// 配置 fail-fast、中断、逐单失败等业务异常:确保批次落 FAIL(逐单失败分支已落库则不重复写)
// 配置 fail-fast、逐单失败等业务异常:批次落 FAIL(汇总可能已发出,fileName 保留)
if
(!
failBatchRecorded
)
{
String
errorMsg
=
StringUtils
.
substring
(
e
.
getMessage
(),
0
,
ERROR_MSG_MAX_LEN
);
String
errorMsg
=
StringUtils
.
substring
(
e
.
getMessage
(),
0
,
ERROR_MSG_MAX_LEN
);
saveBatch
(
existBatch
,
execMonth
,
data
,
fileName
,
saveBatch
(
existBatch
,
execMonth
,
data
,
fileName
,
RenewalRemindStatusEnum
.
FAIL
,
errorMsg
,
recipientsSnapshot
,
RenewalRemindStatusEnum
.
FAIL
,
errorMsg
,
recipientsSnapshot
,
data
==
null
?
0
:
data
.
getDunPolicies
().
size
(),
failures
.
size
());
data
==
null
?
0
:
data
.
getDunPolicies
().
size
(),
failures
.
size
());
}
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// 汇总邮件等非逐单环节异常:批次 FAIL(逐单成功封已留痕,重跑只补未竟部分)
// 汇总邮件等非逐单环节异常:批次 FAIL(逐单成功封已留痕,重跑只补未竟部分)
...
...
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