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
7b94e33c
Commit
7b94e33c
authored
Sep 15, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保费到期提醒14
parent
56d5964b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
28 deletions
+150
-28
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/RenewalMailServiceImpl.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/component/RenewalPolicyReportService.java
+1
-19
yd-csf-service/src/main/java/com/yd/csf/service/component/TemplateStyleStrategy.java
+141
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/RenewalPolicyExportDTO.java
+7
-8
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/RenewalMailServiceImpl.java
View file @
7b94e33c
...
...
@@ -57,7 +57,7 @@ public class RenewalMailServiceImpl implements RenewalMailService {
}
}
private
String
resolveFrom
()
throws
UnsupportedEncodingException
{
private
String
resolveFrom
()
{
String
from
=
StringUtils
.
defaultIfBlank
(
mailFrom
,
mailUsername
);
if
(
StringUtils
.
isBlank
(
from
))
{
throw
new
IllegalStateException
(
"未配置发件人:renewal.reminder.mail-from 或 spring.mail.username"
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/component/RenewalPolicyReportService.java
View file @
7b94e33c
package
com
.
yd
.
csf
.
service
.
component
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.write.metadata.style.WriteCellStyle
;
import
com.alibaba.excel.write.style.HorizontalCellStyleStrategy
;
import
com.yd.csf.service.dto.RenewalDuePolicy
;
import
com.yd.csf.service.dto.RenewalReminderData
;
import
com.yd.csf.service.model.PolicyFollow
;
import
com.yd.csf.service.vo.RenewalPolicyExportDTO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.poi.ss.usermodel.BorderStyle
;
import
org.springframework.stereotype.Component
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -37,7 +34,7 @@ public class RenewalPolicyReportService {
try
(
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
())
{
EasyExcel
.
write
(
out
,
RenewalPolicyExportDTO
.
class
)
.
useDefaultStyle
(
false
)
.
registerWriteHandler
(
cell
StyleStrategy
())
.
registerWriteHandler
(
new
Template
StyleStrategy
())
.
sheet
(
"续期保单"
)
.
doWrite
(
rows
);
return
out
.
toByteArray
();
...
...
@@ -56,21 +53,6 @@ public class RenewalPolicyReportService {
today
.
format
(
DAY_FMT
));
}
/**
* 表头无样式(无填充/无边框/默认字体),数据区四边细边框
*/
private
HorizontalCellStyleStrategy
cellStyleStrategy
()
{
WriteCellStyle
headStyle
=
new
WriteCellStyle
();
WriteCellStyle
contentStyle
=
new
WriteCellStyle
();
contentStyle
.
setBorderTop
(
BorderStyle
.
THIN
);
contentStyle
.
setBorderBottom
(
BorderStyle
.
THIN
);
contentStyle
.
setBorderLeft
(
BorderStyle
.
THIN
);
contentStyle
.
setBorderRight
(
BorderStyle
.
THIN
);
return
new
HorizontalCellStyleStrategy
(
headStyle
,
contentStyle
);
}
private
List
<
RenewalPolicyExportDTO
>
toRows
(
RenewalReminderData
data
)
{
List
<
RenewalPolicyExportDTO
>
rows
=
new
ArrayList
<>();
if
(
data
==
null
||
CollectionUtils
.
isEmpty
(
data
.
getDuePolicies
()))
{
...
...
yd-csf-service/src/main/java/com/yd/csf/service/component/TemplateStyleStrategy.java
0 → 100644
View file @
7b94e33c
package
com
.
yd
.
csf
.
service
.
component
;
import
com.alibaba.excel.metadata.Head
;
import
com.alibaba.excel.metadata.data.WriteCellData
;
import
com.alibaba.excel.write.handler.CellWriteHandler
;
import
com.alibaba.excel.write.handler.SheetWriteHandler
;
import
com.alibaba.excel.write.metadata.holder.WriteSheetHolder
;
import
com.alibaba.excel.write.metadata.holder.WriteTableHolder
;
import
com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder
;
import
org.apache.poi.ss.usermodel.BorderStyle
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Font
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.IndexedColors
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
java.util.List
;
/**
* 严格复刻 policy报表模版.xlsx 的样式:
* 宋体 11 不加粗、四边细边框、垂直居中;对齐与数字格式按列区分;冻结首行;按模板列宽。
* 模板中表头与数据使用同一套样式。
*/
public
class
TemplateStyleStrategy
implements
SheetWriteHandler
,
CellWriteHandler
{
/** 文本:常规左对齐(模板 cellXfs 8) */
private
static
final
int
TEXT_LEFT
=
0
;
/** 居中(模板 9:D/U/V) */
private
static
final
int
CENTER
=
1
;
/** 数值 #,##0.00 左对齐(模板 10:J 每期保费) */
private
static
final
int
NUMBER_LEFT
=
2
;
/** 常规右对齐(模板 13:L/M/S) */
private
static
final
int
GENERAL_RIGHT
=
3
;
/** 日期 yyyy/MM/dd 右对齐(模板 12:N/O/Q;P/R 模板为常规右对齐,但写入真实日期需日期格式) */
private
static
final
int
DATE_RIGHT
=
4
;
/** 30 列(A..AD)对应的样式类别 */
private
static
final
int
[]
STYLE_BY_COL
=
{
TEXT_LEFT
,
// A id
TEXT_LEFT
,
// B 保单号
TEXT_LEFT
,
// C 产品名称
CENTER
,
// D PI
TEXT_LEFT
,
// E 保单持有人(中文)
TEXT_LEFT
,
// F 保单持有人(英文)
TEXT_LEFT
,
// G 受保人(中文)
TEXT_LEFT
,
// H 受保人(英文)
TEXT_LEFT
,
// I 状态
NUMBER_LEFT
,
// J 每期保费
TEXT_LEFT
,
// K 保单币种
GENERAL_RIGHT
,
// L 征费
GENERAL_RIGHT
,
// M 总保费及征费
DATE_RIGHT
,
// N 生效日
DATE_RIGHT
,
// O 签单日
DATE_RIGHT
,
// P 缮发日期
DATE_RIGHT
,
// Q 冷静期结束日期
DATE_RIGHT
,
// R 保费到期日
GENERAL_RIGHT
,
// S 缴费年期
TEXT_LEFT
,
// T 缴费频率
CENTER
,
// U 是否预缴
CENTER
,
// V 预缴年期
TEXT_LEFT
,
// W 产品险种
TEXT_LEFT
,
// X 保险公司
TEXT_LEFT
,
// Y 出单经纪公司
TEXT_LEFT
,
// Z 转介人
TEXT_LEFT
,
// AA 签单员
TEXT_LEFT
,
// AB 签单员牌照号码
TEXT_LEFT
,
// AC 预约编号
TEXT_LEFT
// AD 签单地点
};
/** 模板列宽(字符单位);日期列保证最小宽度避免显示 ### */
private
static
final
double
[]
COL_WIDTH
=
{
4.43
,
22.00
,
35.57
,
7.14
,
19.29
,
20.57
,
23.14
,
16.14
,
12.57
,
18.14
,
15.14
,
10.71
,
16.29
,
12.43
,
12.43
,
12.00
,
16.29
,
12.00
,
12.29
,
9.57
,
9.71
,
9.57
,
9.57
,
11.71
,
14.00
,
16.14
,
14.86
,
16.14
,
20.00
,
34.00
};
private
CellStyle
[]
styles
;
@Override
public
void
afterSheetCreate
(
WriteWorkbookHolder
writeWorkbookHolder
,
WriteSheetHolder
writeSheetHolder
)
{
Sheet
sheet
=
writeSheetHolder
.
getSheet
();
Workbook
workbook
=
sheet
.
getWorkbook
();
initStyles
(
workbook
);
for
(
int
i
=
0
;
i
<
COL_WIDTH
.
length
;
i
++)
{
sheet
.
setColumnWidth
(
i
,
(
int
)
Math
.
round
(
COL_WIDTH
[
i
]
*
256
));
}
// 冻结表头首行
sheet
.
createFreezePane
(
0
,
1
);
}
@Override
public
void
afterCellDispose
(
WriteSheetHolder
writeSheetHolder
,
WriteTableHolder
writeTableHolder
,
List
<
WriteCellData
<?>>
cellDataList
,
Cell
cell
,
Head
head
,
Integer
relativeRowIndex
,
Boolean
isHead
)
{
int
col
=
cell
.
getColumnIndex
();
if
(
col
<
0
||
col
>=
STYLE_BY_COL
.
length
||
styles
==
null
)
{
return
;
}
cell
.
setCellStyle
(
styles
[
STYLE_BY_COL
[
col
]]);
}
private
void
initStyles
(
Workbook
workbook
)
{
Font
font
=
workbook
.
createFont
();
font
.
setFontName
(
"宋体"
);
font
.
setFontHeightInPoints
((
short
)
11
);
font
.
setBold
(
false
);
styles
=
new
CellStyle
[
5
];
styles
[
TEXT_LEFT
]
=
baseStyle
(
workbook
,
font
,
HorizontalAlignment
.
LEFT
,
null
);
styles
[
CENTER
]
=
baseStyle
(
workbook
,
font
,
HorizontalAlignment
.
CENTER
,
null
);
styles
[
NUMBER_LEFT
]
=
baseStyle
(
workbook
,
font
,
HorizontalAlignment
.
LEFT
,
"#,##0.00"
);
styles
[
GENERAL_RIGHT
]
=
baseStyle
(
workbook
,
font
,
HorizontalAlignment
.
RIGHT
,
null
);
styles
[
DATE_RIGHT
]
=
baseStyle
(
workbook
,
font
,
HorizontalAlignment
.
RIGHT
,
"yyyy/MM/dd"
);
}
private
CellStyle
baseStyle
(
Workbook
workbook
,
Font
font
,
HorizontalAlignment
align
,
String
fmt
)
{
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setFont
(
font
);
style
.
setBorderTop
(
BorderStyle
.
THIN
);
style
.
setBorderBottom
(
BorderStyle
.
THIN
);
style
.
setBorderLeft
(
BorderStyle
.
THIN
);
style
.
setBorderRight
(
BorderStyle
.
THIN
);
style
.
setTopBorderColor
(
IndexedColors
.
AUTOMATIC
.
getIndex
());
style
.
setBottomBorderColor
(
IndexedColors
.
AUTOMATIC
.
getIndex
());
style
.
setLeftBorderColor
(
IndexedColors
.
AUTOMATIC
.
getIndex
());
style
.
setRightBorderColor
(
IndexedColors
.
AUTOMATIC
.
getIndex
());
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setAlignment
(
align
);
if
(
fmt
!=
null
)
{
style
.
setDataFormat
(
workbook
.
createDataFormat
().
getFormat
(
fmt
));
}
return
style
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/RenewalPolicyExportDTO.java
View file @
7b94e33c
...
...
@@ -2,17 +2,16 @@ package com.yd.csf.service.vo;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 续期保单清单导出 DTO,列顺序与表头严格对齐 policy报表模版.xlsx(30 列)
* 续期保单清单导出 DTO,列顺序与表头严格对齐 policy报表模版.xlsx(30 列)。
* 字体/边框/对齐/列宽/冻结统一由 {@link com.yd.csf.service.component.TemplateStyleStrategy} 复刻模板。
*/
@Data
@ColumnWidth
(
20
)
public
class
RenewalPolicyExportDTO
{
@ExcelProperty
(
"id"
)
...
...
@@ -55,23 +54,23 @@ public class RenewalPolicyExportDTO {
private
String
totalPremiumAndLevy
;
@ExcelProperty
(
"生效日"
)
@DateTimeFormat
(
"yyyy
-MM-
dd"
)
@DateTimeFormat
(
"yyyy
/MM/
dd"
)
private
Date
effectiveDate
;
@ExcelProperty
(
"签单日"
)
@DateTimeFormat
(
"yyyy
-MM-
dd"
)
@DateTimeFormat
(
"yyyy
/MM/
dd"
)
private
Date
signDate
;
@ExcelProperty
(
"缮发日期"
)
@DateTimeFormat
(
"yyyy
-MM-
dd"
)
@DateTimeFormat
(
"yyyy
/MM/
dd"
)
private
Date
issueDate
;
@ExcelProperty
(
"冷静期结束日期"
)
@DateTimeFormat
(
"yyyy
-MM-
dd"
)
@DateTimeFormat
(
"yyyy
/MM/
dd"
)
private
Date
coolingOffEndDate
;
@ExcelProperty
(
"保费到期日"
)
@DateTimeFormat
(
"yyyy
-MM-
dd"
)
@DateTimeFormat
(
"yyyy
/MM/
dd"
)
private
Date
dueDate
;
@ExcelProperty
(
"缴费年期"
)
...
...
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