Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
7cede336
Commit
7cede336
authored
Nov 10, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 20221110 LocalDate转换类用来支持easyExcel能导出LocalDate格式的字段
parent
c1b95b89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
LocalDateConverter.java
...loud/plus/v1/yifu/insurances/util/LocalDateConverter.java
+44
-0
No files found.
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/util/LocalDateConverter.java
0 → 100644
View file @
7cede336
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
insurances
.
util
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.enums.CellDataTypeEnum
;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.data.ReadCellData
;
import
com.alibaba.excel.metadata.data.WriteCellData
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
/**
* @author licancan
* @description easyExcel时间转换类 (Can not find ‘Converter‘ support class LocalDate)
* @date 2022-11-10 14:41:42
*/
public
class
LocalDateConverter
implements
Converter
<
LocalDate
>
{
@Override
public
Class
<
LocalDate
>
supportJavaTypeKey
()
{
return
LocalDate
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
return
CellDataTypeEnum
.
STRING
;
}
@Override
public
LocalDate
convertToJavaData
(
ReadCellData
cellData
,
ExcelContentProperty
contentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
LocalDate
.
parse
(
cellData
.
getStringValue
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
}
@Override
public
WriteCellData
<
String
>
convertToExcelData
(
LocalDate
value
,
ExcelContentProperty
contentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
new
WriteCellData
<>(
value
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)));
}
}
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