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
b420e7e3
Commit
b420e7e3
authored
Nov 15, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缴费库精度丢失
parent
3c96e062
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
105 deletions
+170
-105
BigDecimalConverter.java
...u/cloud/plus/v1/yifu/social/util/BigDecimalConverter.java
+63
-0
TPaymentHeFeiVo.java
...om/yifu/cloud/plus/v1/yifu/social/vo/TPaymentHeFeiVo.java
+33
-32
TPaymentInfoVo.java
...com/yifu/cloud/plus/v1/yifu/social/vo/TPaymentInfoVo.java
+74
-73
No files found.
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/BigDecimalConverter.java
0 → 100644
View file @
b420e7e3
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
util
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.converters.ReadConverterContext
;
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.math.BigDecimal
;
import
java.math.MathContext
;
import
java.math.RoundingMode
;
/**
* @author hgw
* @description easyExcel金额转换类
* @date 2022-11-15 11:29:08
*/
public
class
BigDecimalConverter
implements
Converter
<
BigDecimal
>
{
@Override
public
Class
<
BigDecimal
>
supportJavaTypeKey
()
{
return
BigDecimal
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
return
CellDataTypeEnum
.
STRING
;
}
/**
* 这里读的时候会调用
* @return
*/
@Override
public
BigDecimal
convertToJavaData
(
ReadConverterContext
<?>
context
)
{
BigDecimal
value
=
context
.
getReadCellData
().
getNumberValue
();
if
(
null
==
value
)
{
if
(
null
!=
context
.
getReadCellData
().
getStringValue
())
{
value
=
new
BigDecimal
(
context
.
getReadCellData
().
getStringValue
());
}
else
{
return
null
;
}
}
return
value
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
@Override
public
BigDecimal
convertToJavaData
(
ReadCellData
cellData
,
ExcelContentProperty
contentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
new
BigDecimal
(
cellData
.
getStringValue
()).
round
(
new
MathContext
(
10
,
RoundingMode
.
HALF_UP
));
}
@Override
public
WriteCellData
<
String
>
convertToExcelData
(
BigDecimal
value
,
ExcelContentProperty
contentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
new
WriteCellData
<>(
String
.
valueOf
(
value
));
}
}
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/vo/TPaymentHeFeiVo.java
View file @
b420e7e3
This diff is collapsed.
Click to expand it.
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/vo/TPaymentInfoVo.java
View file @
b420e7e3
This diff is collapsed.
Click to expand it.
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