Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
2328fa41
Commit
2328fa41
authored
Mar 06, 2023
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付流程核心数据类处理,优化支付流程,优化文件处理
parent
7d8ca8d1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
343 additions
and
250 deletions
+343
-250
FileUtils.kt
app/src/main/java/com/miya/fastcashier/util/FileUtils.kt
+95
-0
PrintService.kt
...com/fastcashier/lib_common/function/print/PrintService.kt
+4
-5
ViewOrderStatisticsInfo.java
...er/lib_common/function/print/ViewOrderStatisticsInfo.java
+0
-245
ViewOrderStatisticsInfo.kt
...hier/lib_common/function/print/ViewOrderStatisticsInfo.kt
+244
-0
No files found.
app/src/main/java/com/miya/fastcashier/util/FileUtils.
java
→
app/src/main/java/com/miya/fastcashier/util/FileUtils.
kt
View file @
2328fa41
package
com
.
miya
.
fastcashier
.
util
;
package
com.miya.fastcashier.util
import
com.miya.fastcashier.util.manage.log.FileComparator
;
import
com.miya.fastcashier.util.manage.log.FileComparator
import
java.io.File
import
java.io.FileFilter
import
java.text.DecimalFormat
import
java.util.*
import
java.io.File
;
import
java.io.FileFilter
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
public
class
FileUtils
{
public
static
List
<
File
>
getFileListByDirPath
(
String
path
,
FileFilter
filter
)
{
File
directory
=
new
File
(
path
);
File
[]
files
=
directory
.
listFiles
(
filter
);
List
<
File
>
result
=
new
ArrayList
<>();
object
FileUtils
{
fun
getFileListByDirPath
(
path
:
String
?,
filter
:
FileFilter
?):
MutableList
<
File
>
{
val
directory
=
File
(
path
)
val
files
=
directory
.
listFiles
(
filter
)
val
result
:
MutableList
<
File
>
=
ArrayList
()
if
(
files
==
null
)
{
return
new
ArrayList
<>();
return
ArrayList
()
}
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
result
.
add
(
files
[
i
]);
for
(
i
in
files
.
indices
)
{
result
.
add
(
files
[
i
])
}
Collections
.
sort
(
result
,
new
FileComparator
());
return
result
;
Collections
.
sort
(
result
,
FileComparator
())
return
result
}
public
static
String
cutLastSegmentOfPath
(
String
path
)
{
return
path
.
substring
(
0
,
path
.
lastIndexOf
(
"/"
))
;
fun
cutLastSegmentOfPath
(
path
:
String
):
String
{
return
path
.
substring
(
0
,
path
.
lastIndexOf
(
"/"
))
}
public
static
String
getReadableFileSize
(
long
size
)
{
if
(
size
<=
0
)
return
"0"
;
final
String
[]
units
=
new
String
[]{
"B"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
};
int
digitGroups
=
(
int
)
(
Math
.
log10
(
size
)
/
Math
.
log10
(
1024
));
return
new
DecimalFormat
(
"#"
).
format
(
size
/
Math
.
pow
(
1024
,
digitGroups
))
+
" "
+
units
[
digitGroups
];
fun
getReadableFileSize
(
size
:
Long
):
String
{
if
(
size
<=
0
)
return
"0"
val
units
=
arrayOf
(
"B"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
)
val
digitGroups
=
(
Math
.
log10
(
size
.
toDouble
())
/
Math
.
log10
(
1024.0
)).
toInt
()
return
DecimalFormat
(
"#"
).
format
(
size
/
Math
.
pow
(
1024.0
,
digitGroups
.
toDouble
()
)
)
+
" "
+
units
[
digitGroups
]
}
/**
...
...
@@ -44,19 +43,18 @@ public class FileUtils {
* @param file 文件
* @return 文件长度
*/
public
static
long
getFileLength
(
final
File
file
)
{
if
(!
isFile
(
file
))
return
-
1
;
return
file
.
length
();
fun
getFileLength
(
file
:
File
):
Long
{
return
if
(!
isFile
(
file
))
-
1
else
file
.
length
()
}
/**
* 判断是否是文件
*
* @param file 文件
* @return
{@code true}: 是<br>{@code false}
: 否
* @return
`true`: 是<br></br>`false`
: 否
*/
public
static
boolean
isFile
(
final
File
file
)
{
return
file
!=
null
&&
file
.
exists
()
&&
file
.
isFile
();
fun
isFile
(
file
:
File
?):
Boolean
{
return
file
!=
null
&&
file
.
exists
()
&&
file
.
isFile
}
/**
...
...
@@ -64,29 +62,34 @@ public class FileUtils {
*
* @param path
* @return List<File>
*/
public
static
List
<
File
>
getFileList
(
String
path
,
FileFilter
filter
,
boolean
isGreater
,
long
targetSize
)
{
List
<
File
>
list
=
FileUtils
.
getFileListByDirPath
(
path
,
filter
);
</File> */
fun
getFileList
(
path
:
String
?,
filter
:
FileFilter
?,
isGreater
:
Boolean
,
targetSize
:
Long
):
List
<
File
>
{
val
list
=
getFileListByDirPath
(
path
,
filter
)
//进行过滤文件大小
Iterator
iterator
=
list
.
iterator
();
val
iterator
:
MutableIterator
<*>
=
list
.
iterator
()
while
(
iterator
.
hasNext
())
{
File
f
=
(
File
)
iterator
.
next
();
if
(
f
.
isFile
()
)
{
val
f
=
iterator
.
next
()
as
File
if
(
f
.
isFile
)
{
//获取当前文件大小
long
size
=
FileUtils
.
getFileLength
(
f
);
val
size
=
getFileLength
(
f
)
if
(
isGreater
)
{
//当前想要留下大于指定大小的文件,所以过滤掉小于指定大小的文件
if
(
size
<
targetSize
)
{
iterator
.
remove
()
;
iterator
.
remove
()
}
}
else
{
//当前想要留下小于指定大小的文件,所以过滤掉大于指定大小的文件
if
(
size
>
targetSize
)
{
iterator
.
remove
()
;
iterator
.
remove
()
}
}
}
}
return
list
;
return
list
}
}
}
\ No newline at end of file
lib_common/src/main/java/com/fastcashier/lib_common/function/print/PrintService.kt
View file @
2328fa41
...
...
@@ -529,7 +529,7 @@ object PrintService {
printer
.
printText
(
0
,
0
,
"结束时间:"
+
orderStatisticsInfo
.
endDate
,
true
)
val
totalStatistics
:
ViewOrderStatisticsInfo
.
StatisticBean
?
=
orderStatisticsInfo
.
totalStatistic
orderStatisticsInfo
.
getTotalStatistic
()
if
(
totalStatistics
!=
null
)
{
var
tradeCount
=
totalStatistics
.
tradeCount
+
totalStatistics
.
refundCount
...
...
@@ -551,11 +551,10 @@ object PrintService {
)
}
if
(!
isEmpty
(
orderStatisticsInfo
.
typeStatistic
))
{
val
typedStatisticList
:
List
<
ViewOrderStatisticsInfo
.
StatisticBean
>
=
orderStatisticsInfo
.
typeStatistic
if
(!
isEmpty
(
orderStatisticsInfo
.
getTypeStatistic
()))
{
val
typedStatisticList
:
List
<
ViewOrderStatisticsInfo
.
StatisticBean
>?
=
orderStatisticsInfo
.
getTypeStatistic
()
var
statisticBean
:
ViewOrderStatisticsInfo
.
StatisticBean
for
(
i
in
typedStatisticList
.
indices
)
{
for
(
i
in
typedStatisticList
?.
indices
!!
)
{
if
(
typedStatisticList
[
i
]
==
null
)
{
continue
}
...
...
lib_common/src/main/java/com/fastcashier/lib_common/function/print/ViewOrderStatisticsInfo.java
deleted
100644 → 0
View file @
7d8ca8d1
package
com
.
fastcashier
.
lib_common
.
function
.
print
;
import
android.text.TextUtils
;
import
com.fastcashier.lib_common.base.BaseBean
;
import
com.sdy.miya.moblie.component.pay.platform.bean.BaseDO
;
import
com.sdy.miya.moblie.component.pay.platform.bean.QueryTradesByTimeResponse
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 类描述:基础统计数据类
* 概述:仅用于打印的数据信息模型
* 创建人:zpxiang
* 创建时间:2022/6/1
* 修改人:
* 修改时间:
*/
public
class
ViewOrderStatisticsInfo
extends
BaseBean
{
private
String
beginDate
;
private
String
endDate
;
private
StatisticBean
totalStatistic
;
private
List
<
StatisticBean
>
typeStatistic
;
public
String
getBeginDate
()
{
return
beginDate
;
}
public
void
setBeginDate
(
String
beginDate
)
{
this
.
beginDate
=
beginDate
;
}
public
String
getEndDate
()
{
return
endDate
;
}
public
void
setEndDate
(
String
endDate
)
{
this
.
endDate
=
endDate
;
}
public
StatisticBean
getTotalStatistic
()
{
return
totalStatistic
;
}
public
void
setTotalStatistic
(
StatisticBean
totalStatistic
)
{
this
.
totalStatistic
=
totalStatistic
;
}
public
List
<
StatisticBean
>
getTypeStatistic
()
{
return
typeStatistic
;
}
public
void
setTypeStatistic
(
List
<
StatisticBean
>
typeStatistic
)
{
this
.
typeStatistic
=
typeStatistic
;
}
public
static
class
StatisticBean
extends
BaseDO
{
/**
* 支付方式
*/
private
String
payType
;
/**
* 交易笔数
*/
private
int
tradeCount
;
/**
* 交易总金额
*/
private
int
tradeTotalAmount
;
/**
* 退款笔数
*/
private
int
refundCount
;
/**
* 退款总金额
*/
private
int
refundTotalAmount
;
/**
* 商户优惠
*/
private
int
merchantDiscount
;
/**
* 平台优惠
*/
private
int
platformDiscount
;
/**
* 退款商户优惠
*/
private
int
refundMerchantDiscount
;
/**
* 退款平台优惠
*/
private
int
refundPlatformDiscount
;
public
String
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
String
payType
)
{
this
.
payType
=
payType
;
}
public
int
getTradeCount
()
{
return
tradeCount
;
}
public
void
setTradeCount
(
int
tradeCount
)
{
this
.
tradeCount
=
tradeCount
;
}
public
int
getTradeTotalAmount
()
{
return
tradeTotalAmount
;
}
public
void
setTradeTotalAmount
(
int
tradeTotalAmount
)
{
this
.
tradeTotalAmount
=
tradeTotalAmount
;
}
public
int
getRefundCount
()
{
return
refundCount
;
}
public
void
setRefundCount
(
int
refundCount
)
{
this
.
refundCount
=
refundCount
;
}
public
int
getRefundTotalAmount
()
{
return
refundTotalAmount
;
}
public
void
setRefundTotalAmount
(
int
refundTotalAmount
)
{
this
.
refundTotalAmount
=
refundTotalAmount
;
}
public
int
getMerchantDiscount
()
{
return
merchantDiscount
;
}
public
void
setMerchantDiscount
(
int
merchantDiscount
)
{
this
.
merchantDiscount
=
merchantDiscount
;
}
public
int
getPlatformDiscount
()
{
return
platformDiscount
;
}
public
void
setPlatformDiscount
(
int
platformDiscount
)
{
this
.
platformDiscount
=
platformDiscount
;
}
public
int
getRefundMerchantDiscount
()
{
return
refundMerchantDiscount
;
}
public
void
setRefundMerchantDiscount
(
int
refundMerchantDiscount
)
{
this
.
refundMerchantDiscount
=
refundMerchantDiscount
;
}
public
int
getRefundPlatformDiscount
()
{
return
refundPlatformDiscount
;
}
public
void
setRefundPlatformDiscount
(
int
refundPlatformDiscount
)
{
this
.
refundPlatformDiscount
=
refundPlatformDiscount
;
}
}
public
static
ViewOrderStatisticsInfo
transfer
(
QueryTradesByTimeResponse
queryTradesByTimeResponse
,
String
beginDate
,
String
endDate
)
{
ViewOrderStatisticsInfo
statisticsInfo
=
new
ViewOrderStatisticsInfo
();
statisticsInfo
.
setBeginDate
(
beginDate
);
statisticsInfo
.
setEndDate
(
endDate
);
if
(!
TextUtils
.
isEmpty
(
queryTradesByTimeResponse
.
getBillInformation
()))
{
String
billInformation
=
queryTradesByTimeResponse
.
getBillInformation
();
String
[]
serial
=
billInformation
.
split
(
";"
);
if
(
serial
.
length
>
0
)
{
statisticsInfo
.
typeStatistic
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
serial
.
length
;
i
++)
{
if
(!
TextUtils
.
isEmpty
(
serial
[
i
]))
{
String
[]
values
=
serial
[
i
].
split
(
","
);
StatisticBean
statisticBean
=
new
StatisticBean
();
for
(
int
j
=
0
;
j
<
values
.
length
;
j
++)
{
valueToField
(
statisticBean
,
values
[
j
],
j
);
}
statisticsInfo
.
typeStatistic
.
add
(
statisticBean
);
}
}
}
}
statisticsInfo
.
totalStatistic
=
new
StatisticBean
();
statisticsInfo
.
totalStatistic
.
payType
=
null
;
statisticsInfo
.
totalStatistic
.
tradeCount
=
queryTradesByTimeResponse
.
getTradeCount
();
statisticsInfo
.
totalStatistic
.
tradeTotalAmount
=
queryTradesByTimeResponse
.
getTradeTotalAmount
();
statisticsInfo
.
totalStatistic
.
refundCount
=
queryTradesByTimeResponse
.
getRefundCount
();
statisticsInfo
.
totalStatistic
.
refundTotalAmount
=
queryTradesByTimeResponse
.
getRefundTotalAmount
();
statisticsInfo
.
totalStatistic
.
merchantDiscount
=
queryTradesByTimeResponse
.
getMerchantDiscount
();
statisticsInfo
.
totalStatistic
.
platformDiscount
=
queryTradesByTimeResponse
.
getPlatformDiscount
();
statisticsInfo
.
totalStatistic
.
refundMerchantDiscount
=
queryTradesByTimeResponse
.
getRefundMerchantDiscount
();
statisticsInfo
.
totalStatistic
.
refundPlatformDiscount
=
queryTradesByTimeResponse
.
getRefundPlatformDiscount
();
return
statisticsInfo
;
}
private
static
void
valueToField
(
StatisticBean
statisticBean
,
String
value
,
int
index
)
{
switch
(
index
)
{
case
0
:
statisticBean
.
payType
=
value
;
break
;
case
1
:
statisticBean
.
tradeCount
=
toInt
(
value
);
break
;
case
2
:
statisticBean
.
tradeTotalAmount
=
toInt
(
value
);
break
;
case
3
:
statisticBean
.
refundCount
=
toInt
(
value
);
break
;
case
4
:
statisticBean
.
refundTotalAmount
=
toInt
(
value
);
break
;
case
5
:
statisticBean
.
merchantDiscount
=
toInt
(
value
);
break
;
case
6
:
statisticBean
.
platformDiscount
=
toInt
(
value
);
break
;
case
7
:
statisticBean
.
refundMerchantDiscount
=
toInt
(
value
);
break
;
case
8
:
statisticBean
.
refundPlatformDiscount
=
toInt
(
value
);
break
;
}
}
private
static
int
toInt
(
String
value
)
{
if
(
TextUtils
.
isEmpty
(
value
)
&&
!
TextUtils
.
isDigitsOnly
(
value
))
{
return
0
;
}
return
new
BigDecimal
(
value
).
intValue
();
}
}
lib_common/src/main/java/com/fastcashier/lib_common/function/print/ViewOrderStatisticsInfo.kt
0 → 100644
View file @
2328fa41
package
com.fastcashier.lib_common.function.print
import
com.fastcashier.lib_common.base.BaseBean
import
com.fastcashier.lib_common.function.print.ViewOrderStatisticsInfo.StatisticBean
import
com.sdy.miya.moblie.component.pay.platform.bean.BaseDO
import
com.sdy.miya.moblie.component.pay.platform.bean.QueryTradesByTimeResponse
import
com.fastcashier.lib_common.function.print.ViewOrderStatisticsInfo
import
android.text.TextUtils
import
java.math.BigDecimal
import
java.util.ArrayList
/**
* 类描述:基础统计数据类
* 概述:仅用于打印的数据信息模型
* 创建人:zpxiang
* 创建时间:2022/6/1
* 修改人:
* 修改时间:
*/
class
ViewOrderStatisticsInfo
:
BaseBean
()
{
var
beginDate
:
String
?
=
null
var
endDate
:
String
?
=
null
private
var
totalStatistic
:
StatisticBean
?
=
null
private
var
typeStatistic
:
MutableList
<
StatisticBean
>?
=
null
fun
getTotalStatistic
():
StatisticBean
?
{
return
totalStatistic
}
fun
setTotalStatistic
(
totalStatistic
:
StatisticBean
?)
{
this
.
totalStatistic
=
totalStatistic
}
fun
getTypeStatistic
():
List
<
StatisticBean
>?
{
return
typeStatistic
}
fun
setTypeStatistic
(
typeStatistic
:
MutableList
<
StatisticBean
>?)
{
this
.
typeStatistic
=
typeStatistic
}
class
StatisticBean
:
BaseDO
()
{
/**
* 支付方式
*/
var
payType
:
String
?
=
null
/**
* 交易笔数
*/
var
tradeCount
=
0
/**
* 交易总金额
*/
var
tradeTotalAmount
=
0
/**
* 退款笔数
*/
var
refundCount
=
0
/**
* 退款总金额
*/
var
refundTotalAmount
=
0
/**
* 商户优惠
*/
var
merchantDiscount
=
0
/**
* 平台优惠
*/
var
platformDiscount
=
0
/**
* 退款商户优惠
*/
var
refundMerchantDiscount
=
0
/**
* 退款平台优惠
*/
var
refundPlatformDiscount
=
0
@JvmName
(
"getPayType1"
)
fun
getPayType
():
String
?
{
return
payType
}
@JvmName
(
"setPayType1"
)
fun
setPayType
(
payType
:
String
?)
{
this
.
payType
=
payType
}
@JvmName
(
"getTradeCount1"
)
fun
getTradeCount
():
Int
{
return
tradeCount
}
@JvmName
(
"setTradeCount1"
)
fun
setTradeCount
(
tradeCount
:
Int
)
{
this
.
tradeCount
=
tradeCount
}
@JvmName
(
"getTradeTotalAmount1"
)
fun
getTradeTotalAmount
():
Int
{
return
tradeTotalAmount
}
@JvmName
(
"setTradeTotalAmount1"
)
fun
setTradeTotalAmount
(
tradeTotalAmount
:
Int
)
{
this
.
tradeTotalAmount
=
tradeTotalAmount
}
@JvmName
(
"getRefundCount1"
)
fun
getRefundCount
():
Int
{
return
refundCount
}
@JvmName
(
"setRefundCount1"
)
fun
setRefundCount
(
refundCount
:
Int
)
{
this
.
refundCount
=
refundCount
}
@JvmName
(
"getRefundTotalAmount1"
)
fun
getRefundTotalAmount
():
Int
{
return
refundTotalAmount
}
@JvmName
(
"setRefundTotalAmount1"
)
fun
setRefundTotalAmount
(
refundTotalAmount
:
Int
)
{
this
.
refundTotalAmount
=
refundTotalAmount
}
@JvmName
(
"getMerchantDiscount1"
)
fun
getMerchantDiscount
():
Int
{
return
merchantDiscount
}
@JvmName
(
"setMerchantDiscount1"
)
fun
setMerchantDiscount
(
merchantDiscount
:
Int
)
{
this
.
merchantDiscount
=
merchantDiscount
}
@JvmName
(
"getPlatformDiscount1"
)
fun
getPlatformDiscount
():
Int
{
return
platformDiscount
}
@JvmName
(
"setPlatformDiscount1"
)
fun
setPlatformDiscount
(
platformDiscount
:
Int
)
{
this
.
platformDiscount
=
platformDiscount
}
@JvmName
(
"getRefundMerchantDiscount1"
)
fun
getRefundMerchantDiscount
():
Int
{
return
refundMerchantDiscount
}
@JvmName
(
"setRefundMerchantDiscount1"
)
fun
setRefundMerchantDiscount
(
refundMerchantDiscount
:
Int
)
{
this
.
refundMerchantDiscount
=
refundMerchantDiscount
}
fun
getRefundPlatformDiscount
():
Int
?
{
return
refundPlatformDiscount
}
@JvmName
(
"setRefundPlatformDiscount1"
)
fun
setRefundPlatformDiscount
(
refundPlatformDiscount
:
Int
)
{
this
.
refundPlatformDiscount
=
refundPlatformDiscount
}
}
companion
object
{
fun
transfer
(
queryTradesByTimeResponse
:
QueryTradesByTimeResponse
,
beginDate
:
String
?,
endDate
:
String
?
):
ViewOrderStatisticsInfo
{
val
statisticsInfo
=
ViewOrderStatisticsInfo
()
statisticsInfo
.
beginDate
=
beginDate
statisticsInfo
.
endDate
=
endDate
if
(!
TextUtils
.
isEmpty
(
queryTradesByTimeResponse
.
billInformation
))
{
val
billInformation
=
queryTradesByTimeResponse
.
billInformation
val
serial
=
billInformation
.
split
(
";"
.
toRegex
()).
toTypedArray
()
if
(
serial
.
size
>
0
)
{
statisticsInfo
.
typeStatistic
=
ArrayList
()
for
(
i
in
serial
.
indices
)
{
if
(!
TextUtils
.
isEmpty
(
serial
[
i
]))
{
val
values
=
serial
[
i
].
split
(
","
.
toRegex
()).
toTypedArray
()
val
statisticBean
=
StatisticBean
()
for
(
j
in
values
.
indices
)
{
valueToField
(
statisticBean
,
values
[
j
],
j
)
}
(
statisticsInfo
.
typeStatistic
as
ArrayList
<
StatisticBean
>).
add
(
statisticBean
)
}
}
}
}
statisticsInfo
.
totalStatistic
=
StatisticBean
()
statisticsInfo
.
totalStatistic
!!
.
payType
=
null
statisticsInfo
.
totalStatistic
!!
.
tradeCount
=
queryTradesByTimeResponse
.
tradeCount
statisticsInfo
.
totalStatistic
!!
.
tradeTotalAmount
=
queryTradesByTimeResponse
.
tradeTotalAmount
statisticsInfo
.
totalStatistic
!!
.
refundCount
=
queryTradesByTimeResponse
.
refundCount
statisticsInfo
.
totalStatistic
!!
.
refundTotalAmount
=
queryTradesByTimeResponse
.
refundTotalAmount
statisticsInfo
.
totalStatistic
!!
.
merchantDiscount
=
queryTradesByTimeResponse
.
merchantDiscount
statisticsInfo
.
totalStatistic
!!
.
platformDiscount
=
queryTradesByTimeResponse
.
platformDiscount
statisticsInfo
.
totalStatistic
!!
.
refundMerchantDiscount
=
queryTradesByTimeResponse
.
refundMerchantDiscount
statisticsInfo
.
totalStatistic
!!
.
refundPlatformDiscount
=
queryTradesByTimeResponse
.
refundPlatformDiscount
return
statisticsInfo
}
private
fun
valueToField
(
statisticBean
:
StatisticBean
,
value
:
String
,
index
:
Int
)
{
when
(
index
)
{
0
->
statisticBean
.
payType
=
value
1
->
statisticBean
.
tradeCount
=
toInt
(
value
)
2
->
statisticBean
.
tradeTotalAmount
=
toInt
(
value
)
3
->
statisticBean
.
refundCount
=
toInt
(
value
)
4
->
statisticBean
.
refundTotalAmount
=
toInt
(
value
)
5
->
statisticBean
.
merchantDiscount
=
toInt
(
value
)
6
->
statisticBean
.
platformDiscount
=
toInt
(
value
)
7
->
statisticBean
.
refundMerchantDiscount
=
toInt
(
value
)
8
->
statisticBean
.
refundPlatformDiscount
=
toInt
(
value
)
}
}
private
fun
toInt
(
value
:
String
):
Int
{
return
if
(
TextUtils
.
isEmpty
(
value
)
&&
!
TextUtils
.
isDigitsOnly
(
value
))
{
0
}
else
BigDecimal
(
value
).
toInt
()
}
}
}
\ No newline at end of file
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