Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-tools
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
financial-tools
Commits
d899d4ff
Commit
d899d4ff
authored
Oct 08, 2016
by
Java-范 志勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
e16407d2
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
495 additions
and
422 deletions
+495
-422
RepayFinancialAPP.java
src/main/java/cn/gq/financial/app/RepayFinancialAPP.java
+30
-17
RepayHandler.java
src/main/java/cn/gq/financial/app/handler/RepayHandler.java
+3
-8
FinancialRepayDetailService.java
.../cn/gq/financial/service/FinancialRepayDetailService.java
+9
-3
BillParsers.java
src/main/java/cn/gq/financial/utils/BillParsers.java
+96
-56
HttpUtils.java
src/main/java/cn/gq/financial/utils/HttpUtils.java
+349
-327
applicationContext.xml
src/main/resources/applicationContext.xml
+5
-1
log4j.properties
src/main/resources/log4j.properties
+3
-10
No files found.
src/main/java/cn/gq/financial/app/RepayFinancialAPP.java
View file @
d899d4ff
...
@@ -12,17 +12,25 @@ import cn.gq.financial.model.bill.UMPayBill;
...
@@ -12,17 +12,25 @@ import cn.gq.financial.model.bill.UMPayBill;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
java.util.concurrent.TimeUnit
;
public
class
RepayFinancialAPP
{
public
class
RepayFinancialAPP
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RepayFinancialAPP
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RepayFinancialAPP
.
class
);
static
final
String
CONFIG_LOCAL
=
"applicationContext.xml"
;
static
final
String
CONFIG_LOCAL
=
"applicationContext.xml"
;
static
Integer
month
=
8
;
static
Integer
month
=
8
;
static
String
SRC_BILL_PATH
=
"E:\\易宝白条-9月"
;
// static String SRC_BILL_PATH = "E:\\financial-system-data\\weichat\\baitiao"; //微信白条
// static String SRC_BILL_PATH ="E:\\WX_BILL\\GBK";
// static String SRC_BILL_PATH = "E:\\financial-system-data\\weichat\\xianjindai"; //微信现金贷
static
String
payAprroach
=
"易宝"
;
// static String SRC_BILL_PATH = "E:\\financial-system-data\\umpay\\baitiao"; //联动优势白条
// static String SRC_BILL_PATH = "E:\\financial-system-data\\umpay\\xianjindai"; //联动优势现金贷
static
String
SRC_BILL_PATH
=
"E:\\financial-system-data\\yeepay\\xianjindai"
;
//易宝现金贷
static
String
payAprroach
=
"易宝"
;
static
String
payAccount
=
"易宝-
白条
账户"
;
static
String
payAccount
=
"易宝-
现金贷
账户"
;
private
static
ClassPathXmlApplicationContext
context
=
null
;
private
static
ClassPathXmlApplicationContext
context
=
null
;
...
@@ -43,19 +51,24 @@ public class RepayFinancialAPP {
...
@@ -43,19 +51,24 @@ public class RepayFinancialAPP {
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
LOGGER
.
info
(
"======开始处理还款账单======"
);
try
{
long
begin
=
System
.
currentTimeMillis
();
LOGGER
.
info
(
"======开始处理还款账单======"
);
RepayHandler
handler
=
getSpringContext
().
getBean
(
RepayHandler
.
class
);
long
begin
=
System
.
currentTimeMillis
();
//按照参数,对账
RepayHandler
handler
=
getSpringContext
().
getBean
(
RepayHandler
.
class
);
handler
.
repayBillDetailHandler
(
SRC_BILL_PATH
,
clazz
,
payAccount
,
month
);
//按照参数,对账
FinancialRepayDetailService
repayDetailService
=
getSpringContext
().
getBean
(
FinancialRepayDetailService
.
class
);
handler
.
repayBillDetailHandler
(
SRC_BILL_PATH
,
clazz
,
payAccount
,
month
+
1
);
if
(
Constants
.
result
.
size
()
!=
0
)
{
FinancialRepayDetailService
repayDetailService
=
getSpringContext
().
getBean
(
FinancialRepayDetailService
.
class
);
repayDetailService
.
saveDetails
(
Constants
.
result
);
if
(
Constants
.
result
.
size
()
!=
0
)
{
repayDetailService
.
saveDetails
(
Constants
.
result
);
}
LOGGER
.
info
(
"总还款明细数量-->{}"
,
Constants
.
result
.
size
());
LOGGER
.
info
(
"======结束处理还款账单======"
);
LOGGER
.
info
(
"总计耗时--->{}mm"
,
(
System
.
currentTimeMillis
()
-
begin
));
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
context
.
close
();
}
}
LOGGER
.
info
(
"总还款明细数量-->{}"
,
Constants
.
result
.
size
());
context
.
close
();
LOGGER
.
info
(
"======结束处理还款账单======"
);
LOGGER
.
info
(
"总计耗时--->{}mm"
,
(
System
.
currentTimeMillis
()
-
begin
));
}
}
public
static
ClassPathXmlApplicationContext
getSpringContext
()
{
public
static
ClassPathXmlApplicationContext
getSpringContext
()
{
...
...
src/main/java/cn/gq/financial/app/handler/RepayHandler.java
View file @
d899d4ff
...
@@ -13,6 +13,7 @@ import cn.gq.financial.service.FinancialRepayDetailService;
...
@@ -13,6 +13,7 @@ import cn.gq.financial.service.FinancialRepayDetailService;
import
cn.gq.financial.utils.Constants
;
import
cn.gq.financial.utils.Constants
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -27,7 +28,7 @@ public class RepayHandler {
...
@@ -27,7 +28,7 @@ public class RepayHandler {
static
int
ITEM_SIZE
=
10000
;
static
int
ITEM_SIZE
=
10000
;
@Autowired
@Autowired
private
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
private
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
@Autowired
@Autowired
private
PaycenterService
paycenterService
;
private
PaycenterService
paycenterService
;
@Autowired
@Autowired
...
@@ -42,13 +43,7 @@ public class RepayHandler {
...
@@ -42,13 +43,7 @@ public class RepayHandler {
private
CountDownLatch
count
=
null
;
private
CountDownLatch
count
=
null
;
public
void
repayBillDetailHandler
(
final
String
srcPaht
,
final
Class
<?
extends
Bill
>
clazz
,
String
payAccount
,
Integer
month
)
throws
Exception
{
public
void
repayBillDetailHandler
(
final
String
srcPaht
,
final
Class
<?
extends
Bill
>
clazz
,
String
payAccount
,
Integer
month
)
throws
Exception
{
// List<Bill> bills = getBillsFromFile(srcPaht,clazz,payAccount,month);
List
<
Bill
>
bills
=
getBillsFromFile
(
srcPaht
,
clazz
,
payAccount
,
month
);
List
<
Bill
>
bills
=
new
ArrayList
<>();
YeepayBill
bill
=
new
YeepayBill
();
bill
.
setOrderId
(
"1469787374013"
);
bill
.
setIncome
(
new
BigDecimal
(
"830.04"
));
bill
.
setBizType
(
YeepayBill
.
REPAY
);
bills
.
add
(
bill
);
if
(!
CollectionUtils
.
isEmpty
(
bills
)){
if
(!
CollectionUtils
.
isEmpty
(
bills
)){
asyncHandlerRepayData
(
clazz
,
bills
);
asyncHandlerRepayData
(
clazz
,
bills
);
count
.
await
();
//等待所有线程结束
count
.
await
();
//等待所有线程结束
...
...
src/main/java/cn/gq/financial/service/FinancialRepayDetailService.java
View file @
d899d4ff
...
@@ -5,6 +5,7 @@ import cn.gq.financial.model.db.RepayDetailFinancial;
...
@@ -5,6 +5,7 @@ import cn.gq.financial.model.db.RepayDetailFinancial;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -67,9 +68,14 @@ public class FinancialRepayDetailService {
...
@@ -67,9 +68,14 @@ public class FinancialRepayDetailService {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
int
succCount
=
repayDetailMapper
.
insert
(
records
);
try
{
latch
.
countDown
();
int
succCount
=
repayDetailMapper
.
insert
(
records
);
LOGGER
.
info
(
"待插入记录数为{}条, 成功插入{}条"
,
records
.
size
(),
succCount
);
LOGGER
.
info
(
"待插入记录数为{}条, 成功插入{}条"
,
records
.
size
(),
succCount
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
latch
.
countDown
();
}
}
}
}
}
}
}
src/main/java/cn/gq/financial/utils/BillParsers.java
View file @
d899d4ff
package
cn
.
gq
.
financial
.
utils
;
package
cn
.
gq
.
financial
.
utils
;
import
java.io.BufferedReader
;
import
cn.gq.financial.model.bill.UMPayBill
;
import
java.io.File
;
import
cn.gq.financial.model.bill.WXBill
;
import
java.io.FileInputStream
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
java.io.IOException
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.InputStream
;
import
org.apache.commons.lang3.time.DateUtils
;
import
java.io.InputStreamReader
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -13,35 +18,25 @@ import java.util.ArrayList;
...
@@ -13,35 +18,25 @@ import java.util.ArrayList;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
cn.gq.financial.model.bill.UMPayBill
;
public
class
BillParsers
{
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
static
String
PARSE_PATTERN_1
=
"yyyy-MM-dd HH:mm:ss"
;
static
String
PARSE_PATTERN_2
=
"yyyyMMdd"
;
public
class
BillParsers
{
public
static
<
T
>
List
<
T
>
parseBillFromInputStream
(
File
file
,
Class
<
T
>
clazz
)
throws
Exception
{
return
parseBillFromInputStream
(
new
FileInputStream
(
file
),
clazz
);
static
String
PARSE_PATTERN_1
=
"yyyy-MM-dd HH:mm:ss"
;
static
String
PARSE_PATTERN_2
=
"yyyyMMdd"
;
public
static
<
T
>
List
<
T
>
parseBillFromInputStream
(
File
file
,
Class
<
T
>
clazz
)
throws
Exception
{
return
parseBillFromInputStream
(
new
FileInputStream
(
file
),
clazz
);
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
List
<
T
>
parseBillFromInputStream
(
InputStream
inputStream
,
Class
<
T
>
clazz
)
throws
Exception
{
public
static
<
T
>
List
<
T
>
parseBillFromInputStream
(
InputStream
inputStream
,
Class
<
T
>
clazz
)
throws
Exception
{
if
(
clazz
.
equals
(
YeepayBill
.
class
))
{
if
(
clazz
.
equals
(
YeepayBill
.
class
))
{
return
(
List
<
T
>)
parseBillYeepay
FromInputStream
(
inputStream
);
return
(
List
<
T
>)
parseBillYeepay
(
inputStream
);
}
}
if
(
clazz
.
equals
(
WXBill
.
class
))
{
if
(
clazz
.
equals
(
WXBill
.
class
))
{
return
(
List
<
T
>)
parseBillWXPayFromInputStream
(
inputStream
);
return
(
List
<
T
>)
parseBillWXPayFromInputStream
(
inputStream
);
}
}
if
(
clazz
.
equals
(
UMPayBill
.
class
))
{
if
(
clazz
.
equals
(
UMPayBill
.
class
))
{
return
(
List
<
T
>)
parseBillUMPayFromInputStream
(
inputStream
);
return
(
List
<
T
>)
parseBillUMPayFromInputStream
(
inputStream
);
}
}
throw
new
IllegalArgumentException
(
"未知的第三方对账单类型,请核实"
);
throw
new
IllegalArgumentException
(
"未知的第三方对账单类型,请核实"
);
...
@@ -49,6 +44,7 @@ public class BillParsers {
...
@@ -49,6 +44,7 @@ public class BillParsers {
/**
/**
* 解析联动优势的账单
* 解析联动优势的账单
*
* @param inputStream
* @param inputStream
* @return
* @return
* @throws Exception
* @throws Exception
...
@@ -57,17 +53,17 @@ public class BillParsers {
...
@@ -57,17 +53,17 @@ public class BillParsers {
BufferedReader
reader
=
null
;
BufferedReader
reader
=
null
;
List
<
UMPayBill
>
bills
=
new
ArrayList
<
UMPayBill
>();
List
<
UMPayBill
>
bills
=
new
ArrayList
<
UMPayBill
>();
try
{
try
{
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
String
line
=
reader
.
readLine
();
String
line
=
reader
.
readLine
();
while
(
StringUtils
.
isNoneBlank
(
line
=
reader
.
readLine
()))
{
while
(
StringUtils
.
isNoneBlank
(
line
=
reader
.
readLine
()))
{
if
(
line
.
startsWith
(
"TRADEDETAIL-END"
))
break
;
if
(
line
.
startsWith
(
"TRADEDETAIL-END"
))
break
;
UMPayBill
bill
=
createUMPayBill
(
line
);
UMPayBill
bill
=
createUMPayBill
(
line
);
bills
.
add
(
bill
);
bills
.
add
(
bill
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
e
;
throw
e
;
}
finally
{
}
finally
{
if
(
null
!=
reader
)
{
if
(
null
!=
reader
)
{
try
{
try
{
reader
.
close
();
reader
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -92,6 +88,7 @@ public class BillParsers {
...
@@ -92,6 +88,7 @@ public class BillParsers {
/**
/**
* 解析微信的账单
* 解析微信的账单
*
* @param inputStream
* @param inputStream
* @return
* @return
* @throws Exception
* @throws Exception
...
@@ -101,22 +98,22 @@ public class BillParsers {
...
@@ -101,22 +98,22 @@ public class BillParsers {
List
<
WXBill
>
bills
=
new
ArrayList
<
WXBill
>();
List
<
WXBill
>
bills
=
new
ArrayList
<
WXBill
>();
try
{
try
{
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Charset
.
forName
(
"UTF-8"
)));
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Charset
.
forName
(
"UTF-8"
)));
String
line
=
reader
.
readLine
();
//越过第一行,同时判断该日是否有账单
String
line
=
reader
.
readLine
();
//越过第一行,同时判断该日是否有账单
if
(
line
.
startsWith
(
"<xml>"
))
return
bills
;
if
(
line
.
startsWith
(
"<xml>"
))
return
bills
;
while
(
StringUtils
.
isNoneBlank
(
line
=
reader
.
readLine
()))
{
while
(
StringUtils
.
isNoneBlank
(
line
=
reader
.
readLine
()))
{
if
(
line
.
startsWith
(
"总交易单数"
))
break
;
//账单条目结束
if
(
line
.
startsWith
(
"总交易单数"
))
break
;
//账单条目结束
String
[]
split
=
line
.
split
(
","
);
String
[]
split
=
line
.
split
(
","
);
if
(
"SUCCESS"
.
equals
(
split
[
9
]))
{
if
(
"SUCCESS"
.
equals
(
split
[
9
]))
{
WXBill
bill
=
createWXBill
(
split
);
WXBill
bill
=
createWXBill
(
split
);
bills
.
add
(
bill
);
bills
.
add
(
bill
);
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
e
;
throw
e
;
}
finally
{
}
finally
{
if
(
null
!=
reader
)
{
if
(
null
!=
reader
)
{
try
{
try
{
reader
.
close
();
reader
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -130,30 +127,74 @@ public class BillParsers {
...
@@ -130,30 +127,74 @@ public class BillParsers {
private
static
WXBill
createWXBill
(
String
[]
split
)
throws
Exception
{
private
static
WXBill
createWXBill
(
String
[]
split
)
throws
Exception
{
WXBill
bill
=
new
WXBill
();
WXBill
bill
=
new
WXBill
();
bill
.
setOrderId
(
split
[
6
].
trim
());
bill
.
setOrderId
(
split
[
6
].
trim
());
if
(
StringUtils
.
isNotBlank
(
split
[
12
]))
{
if
(
StringUtils
.
isNotBlank
(
split
[
12
]))
{
bill
.
setIncome
(
new
BigDecimal
(
split
[
12
]));
bill
.
setIncome
(
new
BigDecimal
(
split
[
12
]));
}
}
if
(
StringUtils
.
isNoneBlank
(
split
[
22
]))
{
if
(
StringUtils
.
isNoneBlank
(
split
[
22
]))
{
bill
.
setPoundage
(
new
BigDecimal
(
split
[
22
]));
bill
.
setPoundage
(
new
BigDecimal
(
split
[
22
]));
}
}
bill
.
setTrandingDate
(
DateUtils
.
parseDate
(
split
[
0
],
PARSE_PATTERN_1
));
bill
.
setTrandingDate
(
DateUtils
.
parseDate
(
split
[
0
],
PARSE_PATTERN_1
));
bill
.
setWxOrderId
(
split
[
5
]);
bill
.
setWxOrderId
(
split
[
5
]);
bill
.
setWxBizAccount
(
split
[
2
]);
bill
.
setWxBizAccount
(
split
[
2
]);
bill
.
setPubWXAccount
(
split
[
1
]);
bill
.
setPubWXAccount
(
split
[
1
]);
if
(
split
[
23
].
endsWith
(
"%"
))
{
if
(
split
[
23
].
endsWith
(
"%"
))
{
String
str
=
split
[
23
].
substring
(
0
,
split
[
23
].
length
()
-
1
);
String
str
=
split
[
23
].
substring
(
0
,
split
[
23
].
length
()
-
1
);
BigDecimal
rate
=
new
BigDecimal
(
str
).
divide
(
BigDecimal
.
TEN
).
divide
(
BigDecimal
.
TEN
);
BigDecimal
rate
=
new
BigDecimal
(
str
).
divide
(
BigDecimal
.
TEN
).
divide
(
BigDecimal
.
TEN
);
bill
.
setRate
(
rate
);
bill
.
setRate
(
rate
);
}
}
return
bill
;
return
bill
;
}
}
private
static
YeepayBill
setYeePayBillProps
(
String
[]
contents
)
throws
ParseException
{
YeepayBill
yeepayBill
=
new
YeepayBill
();
if
(
contents
==
null
||
contents
.
length
==
0
)
{
throw
new
IllegalArgumentException
(
"Invalid contents: "
+
StringUtils
.
join
(
contents
,
","
));
}
yeepayBill
.
setTradingDate
(
DateUtils
.
parseDate
(
contents
[
1
],
"yyyy-MM-dd HH:mm:ss.SSS"
));
yeepayBill
.
setAccountType
(
contents
[
2
]);
yeepayBill
.
setBizType
(
contents
[
3
]);
if
(
StringUtils
.
isNotBlank
(
contents
[
4
]))
{
yeepayBill
.
setOrderId
(
contents
[
4
]);
}
if
(
StringUtils
.
isNotBlank
(
contents
[
5
]))
{
yeepayBill
.
setIncome
(
new
BigDecimal
(
contents
[
5
]));
}
if
(
StringUtils
.
isNotBlank
(
contents
[
6
]))
{
yeepayBill
.
setCost
(
new
BigDecimal
(
contents
[
6
]));
}
if
(
StringUtils
.
isNotBlank
(
contents
[
7
]))
{
yeepayBill
.
setPoundage
(
new
BigDecimal
(
contents
[
7
]));
}
return
yeepayBill
;
}
private
static
List
<
YeepayBill
>
parseBillYeepay
(
InputStream
is
)
throws
Exception
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
Charset
.
forName
(
"UTF-8"
)));
String
lineContent
=
reader
.
readLine
();
String
[]
split
;
List
<
YeepayBill
>
bills
=
new
ArrayList
<>();
int
flag
=
0
;
while
(
StringUtils
.
isNotBlank
(
lineContent
))
{
if
(
flag
>
0
)
{
split
=
StringUtils
.
splitPreserveAllTokens
(
lineContent
,
","
);
YeepayBill
bill
=
setYeePayBillProps
(
split
);
bills
.
add
(
bill
);
}
lineContent
=
reader
.
readLine
();
flag
++;
}
return
bills
;
}
;
/**
/**
* 解析易宝的账单文件
* 解析易宝的账单文件
*
* @param inputStream
* @param inputStream
* @return
* @return
* @throws IOException
* @throws IOException
*/
*/
private
static
List
<
YeepayBill
>
parseBillYeepayFromInputStream
(
InputStream
inputStream
)
throws
IOException
{
private
static
List
<
YeepayBill
>
parseBillYeepayFromInputStream
(
InputStream
inputStream
)
throws
IOException
{
XSSFWorkbook
workBook
;
XSSFWorkbook
workBook
;
...
@@ -161,8 +202,8 @@ public class BillParsers {
...
@@ -161,8 +202,8 @@ public class BillParsers {
workBook
=
new
XSSFWorkbook
(
inputStream
);
workBook
=
new
XSSFWorkbook
(
inputStream
);
XSSFSheet
sheet
=
workBook
.
getSheetAt
(
0
);
XSSFSheet
sheet
=
workBook
.
getSheetAt
(
0
);
Iterator
<
Row
>
iterator
=
sheet
.
iterator
();
Iterator
<
Row
>
iterator
=
sheet
.
iterator
();
iterator
.
next
();
//跳过表头
iterator
.
next
();
//跳过表头
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
YeepayBill
bill
=
createYeepayBill
(
iterator
.
next
());
YeepayBill
bill
=
createYeepayBill
(
iterator
.
next
());
bills
.
add
(
bill
);
bills
.
add
(
bill
);
}
}
...
@@ -174,29 +215,28 @@ public class BillParsers {
...
@@ -174,29 +215,28 @@ public class BillParsers {
bill
.
setTradingDate
(
row
.
getCell
(
1
).
getDateCellValue
());
bill
.
setTradingDate
(
row
.
getCell
(
1
).
getDateCellValue
());
bill
.
setAccountType
(
row
.
getCell
(
2
).
getStringCellValue
());
bill
.
setAccountType
(
row
.
getCell
(
2
).
getStringCellValue
());
bill
.
setBizType
(
row
.
getCell
(
3
).
getStringCellValue
());
bill
.
setBizType
(
row
.
getCell
(
3
).
getStringCellValue
());
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
4
).
getStringCellValue
()))
{
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
4
).
getStringCellValue
()))
{
bill
.
setOrderId
(
row
.
getCell
(
4
).
getStringCellValue
().
trim
());
bill
.
setOrderId
(
row
.
getCell
(
4
).
getStringCellValue
().
trim
());
}
}
row
.
getCell
(
5
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
5
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
5
).
getStringCellValue
()))
{
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
5
).
getStringCellValue
()))
{
bill
.
setIncome
(
new
BigDecimal
(
row
.
getCell
(
5
).
getStringCellValue
()));
bill
.
setIncome
(
new
BigDecimal
(
row
.
getCell
(
5
).
getStringCellValue
()));
}
}
row
.
getCell
(
6
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
6
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
6
).
getStringCellValue
()))
{
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
6
).
getStringCellValue
()))
{
bill
.
setCost
(
new
BigDecimal
(
row
.
getCell
(
6
).
getStringCellValue
()));
bill
.
setCost
(
new
BigDecimal
(
row
.
getCell
(
6
).
getStringCellValue
()));
}
}
if
(
null
!=
row
.
getCell
(
7
))
{
if
(
null
!=
row
.
getCell
(
7
))
{
row
.
getCell
(
7
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
7
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
7
).
getStringCellValue
()))
{
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
7
).
getStringCellValue
()))
{
bill
.
setPoundage
(
new
BigDecimal
(
row
.
getCell
(
7
).
getStringCellValue
()));
bill
.
setPoundage
(
new
BigDecimal
(
row
.
getCell
(
7
).
getStringCellValue
()));
}
}
}
}
if
(
null
!=
row
.
getCell
(
10
))
{
if
(
null
!=
row
.
getCell
(
10
))
{
bill
.
setRemak
(
row
.
getCell
(
10
).
getStringCellValue
());
bill
.
setRemak
(
row
.
getCell
(
10
).
getStringCellValue
());
}
}
return
bill
;
return
bill
;
}
}
}
}
src/main/java/cn/gq/financial/utils/HttpUtils.java
View file @
d899d4ff
This diff is collapsed.
Click to expand it.
src/main/resources/applicationContext.xml
View file @
d899d4ff
...
@@ -33,8 +33,9 @@
...
@@ -33,8 +33,9 @@
DiscardPolicy:抛弃当前任务、暂不支持;会导致被丢弃的任务无法再次被执行
DiscardPolicy:抛弃当前任务、暂不支持;会导致被丢弃的任务无法再次被执行
<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" />
<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" />
</property> -->
</property> -->
<property
name=
"awaitTerminationSeconds"
value=
"300"
/>
</bean>
</bean>
<bean
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<bean
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"locations"
>
<property
name=
"locations"
>
<list>
<list>
...
@@ -279,6 +280,9 @@
...
@@ -279,6 +280,9 @@
<property
name=
"maxActive"
value=
"50"
/>
<property
name=
"maxActive"
value=
"50"
/>
<!--minIdle: 最小空闲连接-->
<!--minIdle: 最小空闲连接-->
<property
name=
"minIdle"
value=
"5"
/>
<property
name=
"minIdle"
value=
"5"
/>
<property
name=
"testOnBorrow"
value=
"true"
/>
<property
name=
"validationQuery"
value=
"select 1"
/>
<property
name=
"maxWait"
value=
"10000"
/>
</bean>
</bean>
<bean
id=
"localRepaymentSqlSessionFactory"
class=
"org.mybatis.spring.SqlSessionFactoryBean"
>
<bean
id=
"localRepaymentSqlSessionFactory"
class=
"org.mybatis.spring.SqlSessionFactoryBean"
>
...
...
src/main/resources/log4j.properties
View file @
d899d4ff
...
@@ -3,9 +3,9 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
...
@@ -3,9 +3,9 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern
=
%d [%t] %-5p - %c %x - %m%n
log4j.appender.stdout.layout.ConversionPattern
=
%d [%t] %-5p - %c %x - %m%n
log4j.
appender.R
=
error
log4j.
logger.R
=
ERROR
log4j.appender.R
=
org.apache.log4j.DailyRollingFileAppender
log4j.appender.R
=
org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File
=
/logs/
my-repay-handler
.log
log4j.appender.R.File
=
/logs/
info
.log
log4j.appender.RollingFile.DatePattern
=
yyyy-MM-dd'.log'
log4j.appender.RollingFile.DatePattern
=
yyyy-MM-dd'.log'
log4j.appender.R.layout
=
org.apache.log4j.PatternLayout
log4j.appender.R.layout
=
org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern
=
%d [%t] %-5p - %c %x - %m%n
log4j.appender.R.layout.ConversionPattern
=
%d [%t] %-5p - %c %x - %m%n
...
@@ -17,11 +17,4 @@ log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = debug
...
@@ -17,11 +17,4 @@ log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = debug
log4j.logger.java.sql.Connection
=
debug
log4j.logger.java.sql.Connection
=
debug
log4j.logger.java.sql.Statement
=
debug
log4j.logger.java.sql.Statement
=
debug
log4j.logger.java.sql.PreparedStatement
=
debug,R
log4j.logger.java.sql.PreparedStatement
=
debug,R
log4j.logger.java.sql.ResultSet
=
debug
log4j.logger.java.sql.ResultSet
=
debug
\ No newline at end of file
log4j.appender.R
=
info
log4j.appender.R
=
org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File
=
/logs/info.log
log4j.appender.RollingFile.DatePattern
=
yyyy-MM-dd'.log'
log4j.appender.R.layout
=
org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern
=
%d [%t] %-5p - %c %x - %m%n
\ 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