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
5312e991
Commit
5312e991
authored
Dec 05, 2016
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据库连接用户
parent
6111da1c
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
4490 additions
and
187 deletions
+4490
-187
DifCheckOutAPP.java
src/main/java/cn/gq/financial/app/DifCheckOutAPP.java
+86
-0
PatchFuck.java
src/main/java/cn/gq/financial/app/PatchFuck.java
+122
-0
RepayFinancialAPP.java
src/main/java/cn/gq/financial/app/RepayFinancialAPP.java
+17
-17
TestAA.java
src/main/java/cn/gq/financial/app/TestAA.java
+42
-0
DifCheckOutHandler.java
.../java/cn/gq/financial/app/handler/DifCheckOutHandler.java
+78
-0
RepayHandler.java
src/main/java/cn/gq/financial/app/handler/RepayHandler.java
+32
-19
RepayHandlerAsync.java
...n/java/cn/gq/financial/app/handler/RepayHandlerAsync.java
+4
-3
RepayDetailFinancialEntityMapper.java
...ancial/db/local/dao/RepayDetailFinancialEntityMapper.java
+30
-0
RepayDetailFinancialEntityMapper.xml
...ial/db/local/mapping/RepayDetailFinancialEntityMapper.xml
+719
-0
RepayDetailFinancialEntity.java
.../financial/db/local/model/RepayDetailFinancialEntity.java
+376
-0
RepayDetailFinancialEntityExample.java
...ial/db/local/model/RepayDetailFinancialEntityExample.java
+2582
-0
ExportExcelMapper.java
...n/java/cn/gq/financial/db/xyqb/dao/ExportExcelMapper.java
+7
-1
ExportExcelMapper.xml
...ava/cn/gq/financial/db/xyqb/mapping/ExportExcelMapper.xml
+106
-1
Bill.java
src/main/java/cn/gq/financial/model/bill/Bill.java
+13
-0
WXBill.java
src/main/java/cn/gq/financial/model/bill/WXBill.java
+15
-2
YeepayBill.java
src/main/java/cn/gq/financial/model/bill/YeepayBill.java
+10
-0
BaitiaoOfflineDetailService.java
.../cn/gq/financial/service/BaitiaoOfflineDetailService.java
+91
-87
BaitiaoOnlineDetailService.java
...a/cn/gq/financial/service/BaitiaoOnlineDetailService.java
+50
-13
XYQBDetailService.java
src/main/java/cn/gq/financial/service/XYQBDetailService.java
+55
-4
BillParsers.java
src/main/java/cn/gq/financial/utils/BillParsers.java
+50
-31
applicationContext.properties
src/main/resources/applicationContext.properties
+3
-8
mybatis-local-repayment-config.xml
src/main/resources/mybatis-local-repayment-config.xml
+2
-1
No files found.
src/main/java/cn/gq/financial/app/DifCheckOutAPP.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
app
;
import
cn.gq.financial.app.handler.DifCheckOutHandler
;
import
cn.gq.financial.app.handler.RepayHandler
;
import
cn.gq.financial.bills.PayType
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.UMPayBill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
cn.gq.financial.service.FinancialRepayDetailService
;
import
cn.gq.financial.utils.BillParsers
;
import
cn.gq.financial.utils.Constants
;
import
cn.gq.financial.utils.FileUtils
;
import
org.springframework.context.support.ClassPathXmlApplicationContext
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Created by ocean on 2016/11/4.
*/
public
class
DifCheckOutAPP
{
static
final
String
CONFIG_LOCAL
=
"applicationContext.xml"
;
private
static
ClassPathXmlApplicationContext
context
=
null
;
private
static
List
<
String
>
lostOrder
=
new
ArrayList
<>();
static
{
String
[]
lost
=
{
"1476879442402"
,
"1476879519371"
,
"1476879520479"
,
"1476879597863"
};
Collections
.
addAll
(
lostOrder
,
lost
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
File
file
=
new
File
(
"E:\\financial-system-data\\weichat\\baitiao"
);
File
[]
files
=
file
.
listFiles
();
List
<
WXBill
>
bills
=
new
ArrayList
<>();
for
(
File
f
:
files
)
{
List
<
WXBill
>
wxBills
=
BillParsers
.
parseBillFromInputStream
(
f
,
WXBill
.
class
);
bills
.
addAll
(
wxBills
);
}
// List<WXBill> lostBills = bills.stream().filter(bill->{
// return lostOrder.contains(bill.getOrderId());
// }).collect(Collectors.toList());
//
// List<String> collect = lostBills.stream().map(WXBill::getSrcStr).collect(Collectors.toList());
// FileUtils.writeOutStrsToFile(collect,"E:\\work\\balance\\10\\微信丢失的.txt");
// BigDecimal totalRepay = bills.stream().map(YeepayBill::getIncome).reduce(BigDecimal.ZERO,BigDecimal::add);
// BigDecimal totalPoundage = bills.stream().map(YeepayBill::getPoundage).reduce(BigDecimal.ZERO,BigDecimal::add);
// System.out.println(totalRepay);
// System.out.println(totalPoundage);
getSpringContext
().
getBean
(
DifCheckOutHandler
.
class
).
checkDif
(
bills
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
context
)
context
.
close
();
}
}
public
static
ClassPathXmlApplicationContext
getSpringContext
()
{
if
(
null
==
context
)
{
context
=
new
ClassPathXmlApplicationContext
(
CONFIG_LOCAL
);
}
return
context
;
}
}
src/main/java/cn/gq/financial/app/PatchFuck.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
app
;
import
cn.gq.financial.app.handler.RepayHandler
;
import
cn.gq.financial.bills.PayType
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.UMPayBill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
cn.gq.financial.service.FinancialRepayDetailService
;
import
cn.gq.financial.utils.BillParsers
;
import
cn.gq.financial.utils.Constants
;
import
cn.gq.financial.utils.FileUtils
;
import
com.google.common.base.Joiner
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.support.ClassPathXmlApplicationContext
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Created by ocean on 2016/11/4.
*/
public
class
PatchFuck
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PatchFuck
.
class
);
static
final
String
CONFIG_LOCAL
=
"applicationContext.xml"
;
private
static
ClassPathXmlApplicationContext
context
=
null
;
private
static
List
<
String
>
lostOrder
=
new
ArrayList
<>();
static
{
String
[]
lost
=
{
"1479723803867"
,
"1479723705451"
,
"1479723756822"
,
"1479723960441"
,
"1479723715103"
,
"1479723644338"
,
"1479723901873"
,
"1479468897498"
,
"1479723640540"
,
"1479723772020"
,
"1479715791006"
,
"1479723894931"
,
"1479723945809"
,
"1479723886848"
,
"1479723749299"
,
"1479723728097"
,
"1479723682621"
,
"1479723926731"
,
"1479723721258"
,
"1479723696263"
,
"1479723586168"
,
"1479723810786"
,
"1479723761490"
,
"1479723645846"
,
"1479723873449"
,
"1479723712002"
};
Collections
.
addAll
(
lostOrder
,
lost
);
}
public
static
void
main
(
String
[]
args
)
{
try
{
LOGGER
.
info
(
"======开始处理丢失的的还款账单======"
);
long
begin
=
System
.
currentTimeMillis
();
File
file
=
new
File
(
"E:\\financial-system-data\\yeepay\\baitiao"
);
File
[]
files
=
file
.
listFiles
();
List
<
YeepayBill
>
bills
=
new
ArrayList
<>();
for
(
File
f
:
files
)
{
List
<
YeepayBill
>
wxBills
=
BillParsers
.
parseBillFromInputStream
(
f
,
YeepayBill
.
class
);
bills
.
addAll
(
wxBills
);
}
List
<
YeepayBill
>
lost
=
bills
.
stream
().
filter
(
bill
->
lostOrder
.
contains
(
bill
.
getOrderId
())).
collect
(
Collectors
.
toList
());
FileUtils
.
writeOutStrsToFile
(
lost
.
stream
().
map
(
YeepayBill:
:
getSrcStr
).
collect
(
Collectors
.
toList
()),
"E:\\LOST_11.txt"
);
// for (Bill bill : bills) {
// bill.setPayAccount(PayType.YeePay_BaiTiao.getChannelAccount());
// bill.setMonth(11);
// }
// List<YeepayBill> lostBills = bills.stream().filter(bill->{
// return lostOrder.contains(bill.getOrderId());
// }).collect(Collectors.toList());
//
// RepayHandler handler = getSpringContext().getBean(RepayHandler.class);
// //按照参数,对账
// handler.repayBillDetailHandler(YeepayBill.class,lostBills);
// FinancialRepayDetailService repayDetailService = getSpringContext().getBean(FinancialRepayDetailService.class);
// 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
{
if
(
null
!=
context
)
context
.
close
();
}
}
public
static
ClassPathXmlApplicationContext
getSpringContext
()
{
if
(
null
==
context
)
{
context
=
new
ClassPathXmlApplicationContext
(
CONFIG_LOCAL
);
}
return
context
;
}
}
src/main/java/cn/gq/financial/app/RepayFinancialAPP.java
View file @
5312e991
package
cn
.
gq
.
financial
.
app
;
import
cn.gq.financial.app.handler.RepayHandler
;
import
cn.gq.financial.bills.AbstractBills
;
import
cn.gq.financial.bills.PayType
;
import
cn.gq.financial.bills.UMPayBills
;
import
cn.gq.financial.bills.WeichatBills
;
import
cn.gq.financial.bills.PayType
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.UMPayBill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
cn.gq.financial.service.FinancialRepayDetailService
;
import
cn.gq.financial.utils.Constants
;
import
com.google.common.base.Joiner
;
import
org.apache.commons.io.FileUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.support.ClassPathXmlApplicationContext
;
import
cn.gq.financial.app.handler.RepayHandler
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.UMPayBill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Paths
;
...
...
@@ -33,9 +31,9 @@ public class RepayFinancialAPP {
* Tip: 对帐单时 只需修改currentMonth和payType
* currentMonth 当前是几月就输入几 无须减1 后续代码里面已经处理
*/
static
Integer
currentMonth
=
7
;
static
Integer
currentMonth
=
11
;
static
PayType
payType
=
PayType
.
UMPay_BaiTiao
;
static
PayType
payType
=
PayType
.
WeiChat_Xjd
;
static
AbstractBills
bill
;
...
...
@@ -60,15 +58,17 @@ public class RepayFinancialAPP {
clazz
=
UMPayBill
.
class
;
break
;
}
// 拉取帐单前先清理目录
if
(
Paths
.
get
(
path
).
toFile
().
exists
())
{
try
{
FileUtils
.
cleanDirectory
(
Paths
.
get
(
path
).
toFile
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
if
(!
payType
.
getChannelName
().
equals
(
"易宝"
))
{
//易宝的不删了,易宝是手工准备的数据啊
// 拉取帐单前先清理目录
if
(
Paths
.
get
(
path
).
toFile
().
exists
())
{
try
{
FileUtils
.
cleanDirectory
(
Paths
.
get
(
path
).
toFile
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
bill
.
pullBills
(
payType
);
}
bill
.
pullBills
(
payType
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
src/main/java/cn/gq/financial/app/TestAA.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
app
;
import
cn.gq.financial.utils.FileUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.time.LocalDate
;
import
java.time.Month
;
import
java.time.Period
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created by ocean on 2016/11/2.
*/
public
class
TestAA
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
List
<
String
>
loanIds
=
Files
.
readAllLines
(
Paths
.
get
(
"E:\\lost_order_id.txt"
));
List
<
String
>
handl
=
new
ArrayList
<>();
loanIds
.
stream
().
forEach
(
l
->
handl
.
add
(
"'"
.
concat
(
l
).
concat
(
"',"
)));
FileUtils
.
writeOutStrsToFile
(
handl
,
"E:\\lost_order_id_d.txt"
);
/*List<Integer> list= new ArrayList<>();
for (int i =0 ;i<10;i++){
list.add(new Integer(i+1));
}
System.out.println(list.contains(new Integer(5)));*/
// Calendar cal = Calendar.getInstance();
// cal.setTime(new Date());
// cal.set(Calendar.HOUR_OF_DAY, 0);
// cal.set(Calendar.MINUTE,0);
// cal.set(Calendar.SECOND, 0);
// System.out.println(DateFormatUtils.ISO_DATETIME_FORMAT.format(cal.getTime()));
// System.out.println(cal.getTimeInMillis());
// System.out.println(cal.getTime().getTime());
}
}
src/main/java/cn/gq/financial/app/handler/DifCheckOutHandler.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
app
.
handler
;
import
cn.gq.financial.db.local.dao.RepayDetailFinancialEntityMapper
;
import
cn.gq.financial.db.local.model.RepayDetailFinancialEntity
;
import
cn.gq.financial.db.local.model.RepayDetailFinancialEntityExample
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.model.bill.YeepayBill
;
import
cn.gq.financial.utils.FileUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* Created by ocean on 2016/11/4.
*/
@Component
public
class
DifCheckOutHandler
{
static
int
item_size
=
1000
;
@Autowired
RepayDetailFinancialEntityMapper
repayDetailFinancialEntityMapper
;
public
void
checkDif
(
List
<?
extends
Bill
>
bills
)
throws
Exception
{
List
<
String
>
wrong
=
new
ArrayList
<>();
if
(
bills
.
size
()<
item_size
){
wrong
.
addAll
(
checkOut
(
bills
));
}
else
{
int
group
=
bills
.
size
()/
item_size
;
int
i
;
for
(
i
=
0
;
i
<
group
;
i
++){
wrong
.
addAll
(
checkOut
(
bills
.
subList
((
i
*
item_size
),
((
i
+
1
)
*
item_size
))));
}
if
(
bills
.
size
()%
item_size
!=
0
){
wrong
.
addAll
(
checkOut
(
bills
.
subList
((
i
*
item_size
),
bills
.
size
())));
}
}
FileUtils
.
writeOutStrsToFile
(
wrong
,
"E:\\work\\balance\\10\\微信-白条丢失的.txt"
);
}
private
Collection
<?
extends
String
>
checkOut
(
List
<?
extends
Bill
>
bills
)
{
List
<
String
>
res
=
new
ArrayList
<>();
List
<
String
>
collect
=
bills
.
stream
().
map
(
Bill:
:
getOrderId
).
collect
(
Collectors
.
toList
());
RepayDetailFinancialEntityExample
example
=
new
RepayDetailFinancialEntityExample
();
example
.
createCriteria
().
andOrderIdIn
(
collect
);
List
<
RepayDetailFinancialEntity
>
details
=
repayDetailFinancialEntityMapper
.
selectByExample
(
example
);
Map
<
String
,
List
<
RepayDetailFinancialEntity
>>
listMap
=
details
.
stream
().
collect
(
Collectors
.
groupingBy
(
RepayDetailFinancialEntity:
:
getOrderId
));
bills
.
stream
().
forEach
(
bill
->
{
List
<
RepayDetailFinancialEntity
>
list
=
listMap
.
get
(
bill
.
getOrderId
());
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
BigDecimal
totalRepay
=
list
.
stream
().
map
(
RepayDetailFinancialEntity:
:
getCurrentRepayment
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalPoundage
=
list
.
stream
().
map
(
RepayDetailFinancialEntity:
:
getPayApproachPoundage
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
bill
.
getIncome
().
compareTo
(
totalRepay
)
!=
0
)
{
res
.
add
(
"订单-->"
.
concat
(
bill
.
getOrderId
()).
concat
(
" 的还款金额有误差,交易时间-->"
).
concat
(
DateFormatUtils
.
ISO_DATE_FORMAT
.
format
(
bill
.
getTrandingDate
())));
}
if
(
bill
.
getPoundage
().
compareTo
(
totalPoundage
)
!=
0
)
{
res
.
add
(
"订单-->"
.
concat
(
bill
.
getOrderId
()).
concat
(
" 的手续费用有误差,交易时间-->"
).
concat
(
DateFormatUtils
.
ISO_DATE_FORMAT
.
format
(
bill
.
getTrandingDate
())));
}
}
else
{
// res.add("订单-->".concat(bill.getOrderId()).concat(" 详细丢失了,交易时间-->").concat(DateFormatUtils.ISO_DATE_FORMAT.format(bill.getTrandingDate())));
res
.
add
(((
WXBill
)
bill
).
getSrcStr
());
}
});
return
res
;
}
}
src/main/java/cn/gq/financial/app/handler/RepayHandler.java
View file @
5312e991
package
cn
.
gq
.
financial
.
app
.
handler
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.CountDownLatch
;
import
cn.gq.financial.db.local.dao.FinancialRepayDetailMapper
;
import
cn.gq.financial.model.bill.
Yeepay
Bill
;
import
cn.gq.financial.
model.db.RepayDetailFinancial
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.
service.BizRepayDetailService
;
import
cn.gq.financial.service.FinancialRepayDetailService
;
import
cn.gq.financial.service.PaycenterService
;
import
cn.gq.financial.utils.BillParsers
;
import
cn.gq.financial.utils.Constants
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Component
;
import
cn.gq.financial.model.bill.Bill
;
import
cn.gq.financial.model.bill.WXBill
;
import
cn.gq.financial.service.BizRepayDetailService
;
import
cn.gq.financial.service.PaycenterService
;
import
cn.gq.financial.utils.BillParsers
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.CountDownLatch
;
@Component
public
class
RepayHandler
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RepayHandler
.
class
);
static
int
ITEM_SIZE
=
30000
;
@Autowired
...
...
@@ -34,6 +33,9 @@ public class RepayHandler {
@Autowired
private
BizRepayDetailService
bizRepayDetailService
;
@Autowired
private
FinancialRepayDetailService
repayDetailService
;
@Autowired
private
FinancialRepayDetailMapper
repayDetailMapper
;
...
...
@@ -53,9 +55,19 @@ public class RepayHandler {
}
}
public
void
repayBillDetailHandler
(
final
Class
<?
extends
Bill
>
clazz
,
List
<?
extends
Bill
>
bills
)
throws
Exception
{
if
(!
CollectionUtils
.
isEmpty
(
bills
)){
asyncHandlerRepayData
(
clazz
,
bills
);
count
.
await
();
//等待所有线程结束
}
else
{
throw
new
RuntimeException
(
"没有读入任何账单"
);
}
}
p
rivate
void
asyncHandlerRepayData
(
final
Class
<?
extends
Bill
>
clazz
,
List
<
Bill
>
bills
)
{
p
ublic
void
asyncHandlerRepayData
(
final
Class
<?
extends
Bill
>
clazz
,
List
<
?
extends
Bill
>
bills
)
{
if
(
bills
.
size
()<
ITEM_SIZE
)
{
count
=
new
CountDownLatch
(
1
);
threadPoolTaskExecutor
.
execute
(
new
RepayHandlerAsync
(
bills
,
clazz
,
paycenterService
,
bizRepayDetailService
,
count
));
...
...
@@ -66,13 +78,13 @@ public class RepayHandler {
cnt
+=
1
;
}
count
=
new
CountDownLatch
(
cnt
);
int
i
=
0
;
int
i
;
for
(
i
=
0
;
i
<
group
;
i
++)
{
List
<
Bill
>
subList
=
bills
.
subList
(
i
*
ITEM_SIZE
,
(
i
+
1
)*
ITEM_SIZE
);
List
<
?
extends
Bill
>
subList
=
bills
.
subList
(
i
*
ITEM_SIZE
,
(
i
+
1
)*
ITEM_SIZE
);
threadPoolTaskExecutor
.
execute
(
new
RepayHandlerAsync
(
subList
,
clazz
,
paycenterService
,
bizRepayDetailService
,
count
));
}
if
(
bills
.
size
()%
ITEM_SIZE
!=
0
){
List
<
Bill
>
subList
=
bills
.
subList
(
i
*
ITEM_SIZE
,
bills
.
size
());
List
<
?
extends
Bill
>
subList
=
bills
.
subList
(
i
*
ITEM_SIZE
,
bills
.
size
());
threadPoolTaskExecutor
.
execute
(
new
RepayHandlerAsync
(
subList
,
clazz
,
paycenterService
,
bizRepayDetailService
,
count
));
}
}
...
...
@@ -82,6 +94,7 @@ public class RepayHandler {
File
[]
billFiles
=
getFiles
(
srcPath
);
List
<
Bill
>
bills
=
new
ArrayList
<
Bill
>();
for
(
int
i
=
0
;
i
<
billFiles
.
length
;
i
++)
{
LOGGER
.
info
(
"解析账单文件-->file:{},账单类型-->{}"
,
billFiles
[
i
].
getAbsolutePath
(),
clazz
.
getName
());
List
<?
extends
Bill
>
billAday
=
BillParsers
.
parseBillFromInputStream
(
billFiles
[
i
],
clazz
);
bills
.
addAll
(
billAday
);
}
...
...
src/main/java/cn/gq/financial/app/handler/RepayHandlerAsync.java
View file @
5312e991
...
...
@@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public
class
RepayHandlerAsync
implements
Runnable
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RepayHandlerAsync
.
class
);
private
List
<
Bill
>
bills
;
private
List
<
?
extends
Bill
>
bills
;
private
Class
<?
extends
Bill
>
clazz
;
private
PaycenterService
paycenterService
;
...
...
@@ -36,7 +36,7 @@ public class RepayHandlerAsync implements Runnable {
private
CountDownLatch
count
;
public
RepayHandlerAsync
(
List
<
Bill
>
bills
,
Class
<?
extends
Bill
>
clazz
,
PaycenterService
paycenterService
,
BizRepayDetailService
bizRepayDetailService
,
public
RepayHandlerAsync
(
List
<
?
extends
Bill
>
bills
,
Class
<?
extends
Bill
>
clazz
,
PaycenterService
paycenterService
,
BizRepayDetailService
bizRepayDetailService
,
CountDownLatch
count
)
{
super
();
this
.
bills
=
bills
;
...
...
@@ -59,6 +59,7 @@ public class RepayHandlerAsync implements Runnable {
LOGGER
.
info
(
"##Thread-->{}处理账单异常了##"
,
Thread
.
currentThread
().
getName
());
LOGGER
.
error
(
"异常信息:"
,
e
);
}
finally
{
if
(
null
!=
count
)
count
.
countDown
();
}
}
...
...
@@ -68,7 +69,7 @@ public class RepayHandlerAsync implements Runnable {
Constants
.
result
.
addAll
(
all
);
}
private
void
balanceBillAndDetail
(
List
<
Bill
>
bills
,
List
<
RepayDetailFinancial
>
all
)
{
private
void
balanceBillAndDetail
(
List
<
?
extends
Bill
>
bills
,
List
<
RepayDetailFinancial
>
all
)
{
Map
<
String
,
Bill
>
billMap
=
new
HashMap
<
String
,
Bill
>();
Map
<
String
,
List
<
RepayDetailFinancial
>>
detailMap
=
new
HashMap
<
String
,
List
<
RepayDetailFinancial
>>();
for
(
Bill
bill
:
bills
)
{
...
...
src/main/java/cn/gq/financial/db/local/dao/RepayDetailFinancialEntityMapper.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
db
.
local
.
dao
;
import
cn.gq.financial.db.local.model.RepayDetailFinancialEntity
;
import
cn.gq.financial.db.local.model.RepayDetailFinancialEntityExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
RepayDetailFinancialEntityMapper
{
int
countByExample
(
RepayDetailFinancialEntityExample
example
);
int
deleteByExample
(
RepayDetailFinancialEntityExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
RepayDetailFinancialEntity
record
);
int
insertSelective
(
RepayDetailFinancialEntity
record
);
List
<
RepayDetailFinancialEntity
>
selectByExample
(
RepayDetailFinancialEntityExample
example
);
RepayDetailFinancialEntity
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
RepayDetailFinancialEntity
record
,
@Param
(
"example"
)
RepayDetailFinancialEntityExample
example
);
int
updateByExample
(
@Param
(
"record"
)
RepayDetailFinancialEntity
record
,
@Param
(
"example"
)
RepayDetailFinancialEntityExample
example
);
int
updateByPrimaryKeySelective
(
RepayDetailFinancialEntity
record
);
int
updateByPrimaryKey
(
RepayDetailFinancialEntity
record
);
}
\ No newline at end of file
src/main/java/cn/gq/financial/db/local/mapping/RepayDetailFinancialEntityMapper.xml
0 → 100644
View file @
5312e991
This diff is collapsed.
Click to expand it.
src/main/java/cn/gq/financial/db/local/model/RepayDetailFinancialEntity.java
0 → 100644
View file @
5312e991
package
cn
.
gq
.
financial
.
db
.
local
.
model
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
RepayDetailFinancialEntity
{
private
Long
id
;
private
String
bizType
;
private
String
payAccount
;
private
Byte
month
;
private
Long
repaymentPlanId
;
private
String
orderId
;
private
String
lhpSeriaNo
;
private
String
customerFrom
;
private
String
fundingCorpName
;
private
String
contractNo
;
private
String
userName
;
private
String
userIdNo
;
private
String
userPhone
;
private
Date
loanPaidTime
;
private
BigDecimal
shouldLoanAmount
;
private
BigDecimal
realLoanAmount
;
private
Byte
contractTerm
;
private
Byte
termNo
;
private
Date
deadline
;
private
BigDecimal
requiredRepayment
;
private
Date
repaidTime
;
private
BigDecimal
principalAmount
;
private
BigDecimal
interest
;
private
BigDecimal
overdueFee
;
private
BigDecimal
selfMangemetFee
;
private
BigDecimal
activityRelief
;
private
BigDecimal
collectionRelief
;
private
BigDecimal
currentRepayment
;
private
BigDecimal
payApproachPoundage
;
private
String
financialMerchant
;
private
String
actualFundingCorp
;
private
String
payCenterOrderno
;
private
Long
loanHistoryId
;
private
Date
contractCreateTime
;
private
String
remark
;
private
String
phoneMerchant
;
private
String
productName3c
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
String
bizType
)
{
this
.
bizType
=
bizType
==
null
?
null
:
bizType
.
trim
();
}
public
String
getPayAccount
()
{
return
payAccount
;
}
public
void
setPayAccount
(
String
payAccount
)
{
this
.
payAccount
=
payAccount
==
null
?
null
:
payAccount
.
trim
();
}
public
Byte
getMonth
()
{
return
month
;
}
public
void
setMonth
(
Byte
month
)
{
this
.
month
=
month
;
}
public
Long
getRepaymentPlanId
()
{
return
repaymentPlanId
;
}
public
void
setRepaymentPlanId
(
Long
repaymentPlanId
)
{
this
.
repaymentPlanId
=
repaymentPlanId
;
}
public
String
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
==
null
?
null
:
orderId
.
trim
();
}
public
String
getLhpSeriaNo
()
{
return
lhpSeriaNo
;
}
public
void
setLhpSeriaNo
(
String
lhpSeriaNo
)
{
this
.
lhpSeriaNo
=
lhpSeriaNo
==
null
?
null
:
lhpSeriaNo
.
trim
();
}
public
String
getCustomerFrom
()
{
return
customerFrom
;
}
public
void
setCustomerFrom
(
String
customerFrom
)
{
this
.
customerFrom
=
customerFrom
==
null
?
null
:
customerFrom
.
trim
();
}
public
String
getFundingCorpName
()
{
return
fundingCorpName
;
}
public
void
setFundingCorpName
(
String
fundingCorpName
)
{
this
.
fundingCorpName
=
fundingCorpName
==
null
?
null
:
fundingCorpName
.
trim
();
}
public
String
getContractNo
()
{
return
contractNo
;
}
public
void
setContractNo
(
String
contractNo
)
{
this
.
contractNo
=
contractNo
==
null
?
null
:
contractNo
.
trim
();
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
==
null
?
null
:
userName
.
trim
();
}
public
String
getUserIdNo
()
{
return
userIdNo
;
}
public
void
setUserIdNo
(
String
userIdNo
)
{
this
.
userIdNo
=
userIdNo
==
null
?
null
:
userIdNo
.
trim
();
}
public
String
getUserPhone
()
{
return
userPhone
;
}
public
void
setUserPhone
(
String
userPhone
)
{
this
.
userPhone
=
userPhone
==
null
?
null
:
userPhone
.
trim
();
}
public
Date
getLoanPaidTime
()
{
return
loanPaidTime
;
}
public
void
setLoanPaidTime
(
Date
loanPaidTime
)
{
this
.
loanPaidTime
=
loanPaidTime
;
}
public
BigDecimal
getShouldLoanAmount
()
{
return
shouldLoanAmount
;
}
public
void
setShouldLoanAmount
(
BigDecimal
shouldLoanAmount
)
{
this
.
shouldLoanAmount
=
shouldLoanAmount
;
}
public
BigDecimal
getRealLoanAmount
()
{
return
realLoanAmount
;
}
public
void
setRealLoanAmount
(
BigDecimal
realLoanAmount
)
{
this
.
realLoanAmount
=
realLoanAmount
;
}
public
Byte
getContractTerm
()
{
return
contractTerm
;
}
public
void
setContractTerm
(
Byte
contractTerm
)
{
this
.
contractTerm
=
contractTerm
;
}
public
Byte
getTermNo
()
{
return
termNo
;
}
public
void
setTermNo
(
Byte
termNo
)
{
this
.
termNo
=
termNo
;
}
public
Date
getDeadline
()
{
return
deadline
;
}
public
void
setDeadline
(
Date
deadline
)
{
this
.
deadline
=
deadline
;
}
public
BigDecimal
getRequiredRepayment
()
{
return
requiredRepayment
;
}
public
void
setRequiredRepayment
(
BigDecimal
requiredRepayment
)
{
this
.
requiredRepayment
=
requiredRepayment
;
}
public
Date
getRepaidTime
()
{
return
repaidTime
;
}
public
void
setRepaidTime
(
Date
repaidTime
)
{
this
.
repaidTime
=
repaidTime
;
}
public
BigDecimal
getPrincipalAmount
()
{
return
principalAmount
;
}
public
void
setPrincipalAmount
(
BigDecimal
principalAmount
)
{
this
.
principalAmount
=
principalAmount
;
}
public
BigDecimal
getInterest
()
{
return
interest
;
}
public
void
setInterest
(
BigDecimal
interest
)
{
this
.
interest
=
interest
;
}
public
BigDecimal
getOverdueFee
()
{
return
overdueFee
;
}
public
void
setOverdueFee
(
BigDecimal
overdueFee
)
{
this
.
overdueFee
=
overdueFee
;
}
public
BigDecimal
getSelfMangemetFee
()
{
return
selfMangemetFee
;
}
public
void
setSelfMangemetFee
(
BigDecimal
selfMangemetFee
)
{
this
.
selfMangemetFee
=
selfMangemetFee
;
}
public
BigDecimal
getActivityRelief
()
{
return
activityRelief
;
}
public
void
setActivityRelief
(
BigDecimal
activityRelief
)
{
this
.
activityRelief
=
activityRelief
;
}
public
BigDecimal
getCollectionRelief
()
{
return
collectionRelief
;
}
public
void
setCollectionRelief
(
BigDecimal
collectionRelief
)
{
this
.
collectionRelief
=
collectionRelief
;
}
public
BigDecimal
getCurrentRepayment
()
{
return
currentRepayment
;
}
public
void
setCurrentRepayment
(
BigDecimal
currentRepayment
)
{
this
.
currentRepayment
=
currentRepayment
;
}
public
BigDecimal
getPayApproachPoundage
()
{
return
payApproachPoundage
;
}
public
void
setPayApproachPoundage
(
BigDecimal
payApproachPoundage
)
{
this
.
payApproachPoundage
=
payApproachPoundage
;
}
public
String
getFinancialMerchant
()
{
return
financialMerchant
;
}
public
void
setFinancialMerchant
(
String
financialMerchant
)
{
this
.
financialMerchant
=
financialMerchant
==
null
?
null
:
financialMerchant
.
trim
();
}
public
String
getActualFundingCorp
()
{
return
actualFundingCorp
;
}
public
void
setActualFundingCorp
(
String
actualFundingCorp
)
{
this
.
actualFundingCorp
=
actualFundingCorp
==
null
?
null
:
actualFundingCorp
.
trim
();
}
public
String
getPayCenterOrderno
()
{
return
payCenterOrderno
;
}
public
void
setPayCenterOrderno
(
String
payCenterOrderno
)
{
this
.
payCenterOrderno
=
payCenterOrderno
==
null
?
null
:
payCenterOrderno
.
trim
();
}
public
Long
getLoanHistoryId
()
{
return
loanHistoryId
;
}
public
void
setLoanHistoryId
(
Long
loanHistoryId
)
{
this
.
loanHistoryId
=
loanHistoryId
;
}
public
Date
getContractCreateTime
()
{
return
contractCreateTime
;
}
public
void
setContractCreateTime
(
Date
contractCreateTime
)
{
this
.
contractCreateTime
=
contractCreateTime
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
==
null
?
null
:
remark
.
trim
();
}
public
String
getPhoneMerchant
()
{
return
phoneMerchant
;
}
public
void
setPhoneMerchant
(
String
phoneMerchant
)
{
this
.
phoneMerchant
=
phoneMerchant
==
null
?
null
:
phoneMerchant
.
trim
();
}
public
String
getProductName3c
()
{
return
productName3c
;
}
public
void
setProductName3c
(
String
productName3c
)
{
this
.
productName3c
=
productName3c
==
null
?
null
:
productName3c
.
trim
();
}
}
\ No newline at end of file
src/main/java/cn/gq/financial/db/local/model/RepayDetailFinancialEntityExample.java
0 → 100644
View file @
5312e991
This diff is collapsed.
Click to expand it.
src/main/java/cn/gq/financial/db/xyqb/dao/ExportExcelMapper.java
View file @
5312e991
package
cn
.
gq
.
financial
.
db
.
xyqb
.
dao
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -15,6 +16,7 @@ import cn.gq.financial.model.db.RepayCollectionEntity;
public
interface
ExportExcelMapper
{
public
List
<
ExportExcelEntity
>
getInfoByOrderIds
(
@Param
(
"payCenterNoList"
)
List
<
String
>
orderNos
);
public
List
<
ExportPayInfoEntity
>
getExportPayInfoEntity
(
@Param
(
"list"
)
List
<
Long
>
subList
);
public
List
<
RepayCollectionEntity
>
getRepayCollections
(
@Param
(
"list"
)
List
<
String
>
orderNos
);
...
...
@@ -25,5 +27,9 @@ public interface ExportExcelMapper {
public
List
<
LoanExpEntity
>
exportYeepay
(
@Param
(
"list"
)
List
<
Long
>
loanIds
);
public
List
<
BaitiaoExpEntity
>
baitiaoRepayExport
(
@Param
(
"list"
)
List
<
Long
>
list
);
public
List
<
BaitiaoExpEntity
>
baitiaoRepayExport
(
@Param
(
"list"
)
List
<
String
>
list
);
public
List
<
BaitiaoExpEntity
>
baitiaoRepayExport1
(
@Param
(
"list"
)
List
<
Long
>
ids
);
public
List
<
ExportExcelEntity
>
getInfoByOrderIds1
(
@Param
(
"list"
)
List
<
Long
>
repaymentPlanIds
);
}
src/main/java/cn/gq/financial/db/xyqb/mapping/ExportExcelMapper.xml
View file @
5312e991
...
...
@@ -88,6 +88,59 @@
#{listItem}
</foreach>
</select>
<select
id =
"getInfoByOrderIds1"
resultMap=
"BaseResultMap"
>
SELECT
t1.id AS repayment_plan_id,
(SELECT '' FROM dual) AS lhp_seria_no,
t1.repayment_status AS repayment_status,
t7.name AS customer_from,
t3.name AS funding_corp_name,
t8.contract_no AS contract_no,
t4.name AS user_name,
t4.id_no AS user_id_no ,
t4.phone_no AS user_phone,
t2.loan_paid_at AS loan_paid_at,
t2.real_loan_amount AS should_loan_amount,
t2.real_loan_amount AS real_loan_amount,
t2.contract_term AS contract_term ,
t1.term_no AS term_no,
t1.deadline AS deadline ,
t1.required_repayment AS required_repayment ,
(SELECT '易宝账户' FROM DUAL) AS receive_account,
t1.repaid_at AS repaid_at ,
t5.principal_amount AS principal_amount,
t5.interest AS interest ,
t5.overdue_fee AS overdue_fee,
(SELECT 0.0 FROM DUAL) AS term_poundage,
(SELECT 0.0 FROM DUAL) AS fundcorp_admin_fee,
t5.self_manexpense AS self_manexpense,
(SELECT 0.0 FROM DUAL) AS overdue_fee_pl,
(SELECT 0.0 FROM DUAL) AS overdue_fee_lhp,
t5.activity_relief AS activity_relief,
t5.collection_relief AS collection_relief ,
t1.current_repayment AS current_repayment ,
t3.name AS financial_merchant,
t3.name AS actually_funding_corp,
t1.pay_center_order_no AS pay_center_order_no,
t1.loan_application_history_id AS loan_application_history_id,
t8.created_at AS contract_create_at
FROM
repayment_plan t1
LEFT JOIN loan_application_manifest_history t2 ON t1.loan_application_manifest_history_id = t2.id
LEFT JOIN funding_corp t3 ON t3.id = t2.funding_corp_id
LEFT JOIN user_detail t4 ON t1.user_id = t4.user_id
LEFT JOIN repayment_plan_detail t5 ON t4.id= t5.repayment_plan_id
LEFT JOIN loan_application_history t6 ON t6.id = t1.loan_application_history_id
LEFT JOIN channel t7 ON t7.id = t6.created_from
LEFT JOIN contract t8 ON t8.loan_application_manifest_history_id = t1.loan_application_manifest_history_id and t8.signed=1
WHERE
t1.id IN
<foreach
collection=
"list"
item=
"listItem"
open=
"("
close=
")"
separator=
","
>
#{listItem}
</foreach>
</select>
<resultMap
id=
"payInfo"
type=
"cn.gq.financial.model.db.ExportPayInfoEntity"
>
<result
column=
"loan_id"
property=
"loanId"
jdbcType=
"BIGINT"
/>
...
...
@@ -369,9 +422,61 @@
AND bm.id=bo.`merchant_id`
AND ud.`user_id` = brp.`user_id`
WHERE
brp.`id` IN
brp.pay_center_order_no IN
<foreach
collection=
"list"
item=
"listItem"
open=
"("
close=
")"
separator=
","
>
#{listItem}
</foreach>
<!--
brp.`id` IN
<foreach collection="list" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
-->
</select>
<select
id=
"baitiaoRepayExport1"
resultMap=
"baitiaoRepayExpResultMap"
>
SELECT
brp.id AS repayment_plan_id,
bm.`remark` AS merchant_name,
bm.id AS merchant_id,
bo.`order_no` AS order_no,
ud.`name` AS user_name,
ud.`id_no` AS id_no,
ud.`phone_no` AS phone_no,
bo.`created_at` AS order_time,
bo.`order_amount` AS order_amount,
CASE bo.repay_term
WHEN 0 THEN 1
WHEN 1 THEN 3
WHEN 2 THEN 6
WHEN 3 THEN 9
WHEN 4 THEN 12
END AS contract_term,
brp.`term_no` AS curr_term_no,
brp.`deadline` AS deadline,
brp.`repaid_at` AS repaid_at,
brp.`required_repayment` AS required_repayment,
brp.`origin_amount` AS principal_amount,
brp.`interest_amount` AS interest_amount,
brp.`overstay_amount` AS overdue_fee,
brp.`reduce_amount` AS reduce_amount,
brp.`current_repayment` AS current_repayment,
brp.pay_center_order_no AS pay_center_order_no
FROM baitiao_repayment_plan brp
JOIN baitiao_order bo
JOIN baitiao_merchant bm
JOIN user_detail ud
ON bo.id= brp.`order_id`
AND bm.id=bo.`merchant_id`
AND ud.`user_id` = brp.`user_id`
WHERE
brp.`id` IN
<foreach
collection=
"list"
item=
"listItem"
open=
"("
close=
")"
separator=
","
>
#{listItem}
</foreach>
</select>
</mapper>
\ No newline at end of file
src/main/java/cn/gq/financial/model/bill/Bill.java
View file @
5312e991
...
...
@@ -79,4 +79,17 @@ public abstract class Bill {
public
void
setTrandingDate
(
Date
trandingDate
)
{
this
.
trandingDate
=
trandingDate
;
}
@Override
public
String
toString
()
{
return
"Bill{"
+
"month="
+
month
+
", trandingDate="
+
trandingDate
+
", payAccount='"
+
payAccount
+
'\''
+
", orderId='"
+
orderId
+
'\''
+
", income="
+
income
+
", cost="
+
cost
+
", poundage="
+
poundage
+
'}'
;
}
}
src/main/java/cn/gq/financial/model/bill/WXBill.java
View file @
5312e991
...
...
@@ -18,6 +18,16 @@ public class WXBill extends Bill {
private
BigDecimal
rate
=
BigDecimal
.
ZERO
;
private
String
srcStr
;
public
String
getSrcStr
()
{
return
srcStr
;
}
public
void
setSrcStr
(
String
srcStr
)
{
this
.
srcStr
=
srcStr
;
}
public
BigDecimal
getRate
()
{
return
rate
;
}
...
...
@@ -49,6 +59,9 @@ public class WXBill extends Bill {
public
void
setWxBizAccount
(
String
wxBizAccount
)
{
this
.
wxBizAccount
=
wxBizAccount
;
}
@Override
public
String
toString
()
{
return
super
.
toString
();
}
}
src/main/java/cn/gq/financial/model/bill/YeepayBill.java
View file @
5312e991
...
...
@@ -18,6 +18,16 @@ public class YeepayBill extends Bill {
private
String
remak
;
//备注信息
private
String
srcStr
;
public
String
getSrcStr
()
{
return
srcStr
;
}
public
void
setSrcStr
(
String
srcStr
)
{
this
.
srcStr
=
srcStr
;
}
public
String
getAccountType
()
{
return
accountType
;
}
...
...
src/main/java/cn/gq/financial/service/BaitiaoOfflineDetailService.java
View file @
5312e991
This diff is collapsed.
Click to expand it.
src/main/java/cn/gq/financial/service/BaitiaoOnlineDetailService.java
View file @
5312e991
...
...
@@ -44,17 +44,19 @@ public class BaitiaoOnlineDetailService implements DetailService {
public
List
<
RepayDetailFinancial
>
getDetailByPayCenterRepayOrder
(
List
<
RepayOrderEntity
>
repayOrderEntities
)
{
List
<
RepayDetailFinancial
>
result
=
new
ArrayList
<
RepayDetailFinancial
>();
// 从xyqb库查出白条的还款明细,再从mall查出白条详单
Map
<
String
,
RepayOrderEntity
>
map
=
new
HashMap
<
String
,
RepayOrderEntity
>();
Set
<
String
>
merchantRepayOrderNoSet
=
new
HashSet
<
String
>();
Map
<
String
,
RepayOrderEntity
>
map
=
new
HashMap
<>();
Set
<
String
>
merchantRepayOrderNoSet
=
new
HashSet
<>();
Set
<
Long
>
repaymentPlanIds
=
new
HashSet
<>();
for
(
RepayOrderEntity
entity
:
repayOrderEntities
)
{
merchantRepayOrderNoSet
.
add
(
entity
.
getMerchantRepayOrderNo
());
String
[]
split
=
entity
.
getMerchantRepayOrderNo
().
split
(
"_"
);
for
(
String
id:
split
){
map
.
put
(
id
,
entity
);
repaymentPlanIds
.
add
(
Long
.
valueOf
(
id
)
);
}
//
map.put(entity.getMerchantRepayOrderNo(), entity);
map
.
put
(
entity
.
getMerchantRepayOrderNo
(),
entity
);
}
List
<
BaitiaoExpEntity
>
baitiaoExpEntities
=
getBaiTiaoExp
(
new
ArrayList
<
String
>(
merchantRepayOrderNoSet
));
// List<BaitiaoExpEntity> baitiaoExpEntities = getBaiTiaoExp(new ArrayList<String>(merchantRepayOrderNoSet));
List
<
BaitiaoExpEntity
>
baitiaoExpEntities
=
getBaiTiaoExp1
(
new
ArrayList
<
Long
>(
repaymentPlanIds
));
Set
<
String
>
mallOrder
=
new
HashSet
<>();
Map
<
String
,
List
<
BaitiaoExpEntity
>>
baitiaoMap
=
new
HashMap
<>();
for
(
BaitiaoExpEntity
baitiaoExpEntity
:
baitiaoExpEntities
)
{
...
...
@@ -85,20 +87,55 @@ public class BaitiaoOnlineDetailService implements DetailService {
}
// 放如量化派流水号
for
(
BaitiaoExpEntity
expEntity
:
baitiaoExpEntities
)
{
RepayOrderEntity
repayOrderEntity
=
map
.
get
(
expEntity
.
getRepaymentPlanId
().
toString
());
// RepayOrderEntity repayOrderEntity = map.get(expEntity.getPayCenterOrderNo());
RepayOrderEntity
repayOrderEntity
=
null
;
Set
<
String
>
strings
=
map
.
keySet
();
for
(
String
key:
strings
){
if
(
key
.
contains
(
String
.
valueOf
(
expEntity
.
getRepaymentPlanId
()))){
repayOrderEntity
=
map
.
get
(
key
);
}
}
expEntity
.
setLhpNo
(
repayOrderEntity
.
getOrderId
());
result
.
add
(
convert2RepayDetailFinancial
(
expEntity
));
}
return
result
;
}
private
List
<
BaitiaoExpEntity
>
getBaiTiaoExp1
(
ArrayList
<
Long
>
ids
)
{
int
size
=
ids
.
size
();
List
<
BaitiaoExpEntity
>
baitiaoExpEntities
=
null
;
if
(
size
>
0
)
{
if
(
size
<
item_size
)
{
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport1
(
ids
);
return
list
;
}
else
{
baitiaoExpEntities
=
new
ArrayList
<>();
int
group
=
size
/
item_size
;
int
i
;
for
(
i
=
0
;
i
<
group
;
i
++)
{
List
<
Long
>
subList
=
ids
.
subList
(
i
*
item_size
,
(
i
+
1
)
*
item_size
);
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport1
(
subList
);
baitiaoExpEntities
.
addAll
(
list
);
}
if
(
0
!=
size
%
item_size
)
{
List
<
Long
>
subList
=
ids
.
subList
(
i
*
item_size
,
ids
.
size
());
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport1
(
subList
);
baitiaoExpEntities
.
addAll
(
list
);
}
return
baitiaoExpEntities
;
}
}
return
null
;
}
private
RepayDetailFinancial
convert2RepayDetailFinancial
(
BaitiaoExpEntity
entity
)
{
RepayDetailFinancial
detail
=
new
RepayDetailFinancial
();
detail
.
setBizType
(
DetailService
.
BIZ_TYPE_BAITIAO
);
detail
.
setRepaymentPlanId
(
entity
.
getRepaymentPlanId
());
detail
.
setFundingCorpName
(
entity
.
getMerchantName
());
detail
.
setOrderId
(
entity
.
getLhpNo
());
detail
.
setLhpSeriaNo
(
entity
.
get
Lhp
No
());
detail
.
setLhpSeriaNo
(
entity
.
get
Order
No
());
detail
.
setUserName
(
entity
.
getUserName
());
detail
.
setUserIdNo
(
entity
.
getIdNo
());
detail
.
setUserPhone
(
entity
.
getPhoneNo
());
...
...
@@ -190,28 +227,28 @@ public class BaitiaoOnlineDetailService implements DetailService {
private
List
<
BaitiaoExpEntity
>
getBaiTiaoExp
(
List
<
String
>
merchantRepayOrderNoList
)
{
int
size
=
merchantRepayOrderNoList
.
size
();
List
<
BaitiaoExpEntity
>
baitiaoExpEntities
=
null
;
List
<
Long
>
baitiaoOrderIds
=
new
ArrayList
<>();
/*
List<Long> baitiaoOrderIds = new ArrayList<>();
for (String payCenterRepayOrderNo:merchantRepayOrderNoList){
String[] split = payCenterRepayOrderNo.split("_");
for (String id:split){
baitiaoOrderIds.add(Long.valueOf(id));
}
}
}
*/
if
(
size
>
0
)
{
if
(
size
<
item_size
)
{
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport
(
baitiaoOrderIds
);
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport
(
merchantRepayOrderNoList
);
return
list
;
}
else
{
baitiaoExpEntities
=
new
ArrayList
<
BaitiaoExpEntity
>();
baitiaoExpEntities
=
new
ArrayList
<>();
int
group
=
size
/
item_size
;
int
i
=
0
;
for
(
i
=
0
;
i
<
group
;
i
++)
{
List
<
Long
>
subList
=
baitiaoOrderIds
.
subList
(
i
*
item_size
,
(
i
+
1
)
*
item_size
);
List
<
String
>
subList
=
merchantRepayOrderNoList
.
subList
(
i
*
item_size
,
(
i
+
1
)
*
item_size
);
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport
(
subList
);
baitiaoExpEntities
.
addAll
(
list
);
}
if
(
0
!=
size
%
item_size
)
{
List
<
Long
>
subList
=
baitiaoOrderIds
.
subList
(
i
*
item_size
,
baitiaoOrderIds
.
size
());
List
<
String
>
subList
=
merchantRepayOrderNoList
.
subList
(
i
*
item_size
,
merchantRepayOrderNoList
.
size
());
List
<
BaitiaoExpEntity
>
list
=
exportExcelMapper
.
baitiaoRepayExport
(
subList
);
baitiaoExpEntities
.
addAll
(
list
);
}
...
...
src/main/java/cn/gq/financial/service/XYQBDetailService.java
View file @
5312e991
...
...
@@ -52,8 +52,16 @@ public class XYQBDetailService implements DetailService {
}
List
<
String
>
merchantRepayOrderNoList
=
new
ArrayList
<
String
>(
merchantRepayOrderNoSet
);
LOGGER
.
info
(
"#############################开始查询!#########################"
);
List
<
ExportExcelEntity
>
exportExcelEntities
=
getExportExcelEntities
(
merchantRepayOrderNoList
);
Set
<
Long
>
repaymentPlanIds
=
new
HashSet
<>();
for
(
String
payCenterNo
:
merchantRepayOrderNoList
){
String
[]
split
=
payCenterNo
.
split
(
"_"
);
for
(
String
s
:
split
){
repaymentPlanIds
.
add
(
Long
.
valueOf
(
s
.
trim
()));
}
}
List
<
ExportExcelEntity
>
exportExcelEntities
=
getExportExcelEntities1
(
new
ArrayList
<>(
repaymentPlanIds
));
// List<ExportExcelEntity> exportExcelEntities = getExportExcelEntities(merchantRepayOrderNoList);
// 找出合同时间是最新的
Map
<
Long
,
ExportExcelEntity
>
emap
=
new
HashMap
<
Long
,
ExportExcelEntity
>();
...
...
@@ -76,7 +84,14 @@ public class XYQBDetailService implements DetailService {
// 此处放入量化派流水号,如果是正确的话
for
(
int
i
=
0
;
i
<
exportExcelEntities
.
size
();
i
++)
{
ExportExcelEntity
exportExcelEntity
=
exportExcelEntities
.
get
(
i
);
RepayOrderEntity
repayOrderEntity
=
map
.
get
(
exportExcelEntity
.
getPayCenterOrderNo
());
// RepayOrderEntity repayOrderEntity = map.get(exportExcelEntity.getPayCenterOrderNo());
RepayOrderEntity
repayOrderEntity
=
null
;
Set
<
String
>
keys
=
map
.
keySet
();
for
(
String
key
:
keys
){
if
(
key
.
contains
(
exportExcelEntity
.
getRepaymentPlanId
().
toString
())){
repayOrderEntity
=
map
.
get
(
key
);
}
}
if
(
null
!=
exportExcelEntity
)
{
exportExcelEntity
.
setLhpSeriaNo
(
repayOrderEntity
.
getyOrderId
());
exportExcelEntity
.
setOrderId
(
repayOrderEntity
.
getOrderId
());
...
...
@@ -122,6 +137,33 @@ public class XYQBDetailService implements DetailService {
return
returnValue
;
}
private
List
<
ExportExcelEntity
>
getExportExcelEntities1
(
List
<
Long
>
repaymentPlanIds
)
{
int
size
=
repaymentPlanIds
.
size
();
List
<
ExportExcelEntity
>
exportExcelEntities
=
null
;
if
(
size
>
0
)
{
if
(
size
<
item_size
)
{
exportExcelEntities
=
exportExcelMapper
.
getInfoByOrderIds1
(
repaymentPlanIds
);
return
exportExcelEntities
;
}
else
{
exportExcelEntities
=
new
ArrayList
<
ExportExcelEntity
>();
int
group
=
size
/
item_size
;
int
i
=
0
;
for
(
i
=
0
;
i
<
group
;
i
++)
{
List
<
Long
>
subList
=
repaymentPlanIds
.
subList
(
i
*
item_size
,
(
i
+
1
)
*
item_size
);
List
<
ExportExcelEntity
>
list
=
exportExcelMapper
.
getInfoByOrderIds1
(
subList
);
exportExcelEntities
.
addAll
(
list
);
}
if
(
0
!=
size
%
item_size
)
{
List
<
Long
>
subList
=
repaymentPlanIds
.
subList
(
i
*
item_size
,
repaymentPlanIds
.
size
());
List
<
ExportExcelEntity
>
list
=
exportExcelMapper
.
getInfoByOrderIds1
(
subList
);
exportExcelEntities
.
addAll
(
list
);
}
return
exportExcelEntities
;
}
}
return
null
;
}
private
RepayDetailFinancial
convert2RepayDetailFinancial
(
ExportExcelEntity
entity
)
{
RepayDetailFinancial
detail
=
new
RepayDetailFinancial
();
BeanUtils
.
copyProperties
(
entity
,
detail
);
...
...
@@ -212,7 +254,16 @@ public class XYQBDetailService implements DetailService {
long
begin
=
System
.
currentTimeMillis
();
Long
loanId
=
entity
.
getLoanApplicationHistoryId
();
String
payCenterOrderNo
=
entity
.
getPayCenterOrderNo
();
RepayOrderEntity
orderEntity
=
map
.
get
(
payCenterOrderNo
);
// RepayOrderEntity orderEntity = map.get(payCenterOrderNo);
RepayOrderEntity
orderEntity
=
null
;
Set
<
String
>
keys
=
map
.
keySet
();
for
(
String
key
:
keys
){
if
(
key
.
contains
(
entity
.
getRepaymentPlanId
().
toString
())){
orderEntity
=
map
.
get
(
key
);
payCenterOrderNo
=
key
;
}
}
Long
repaidAt
=
orderEntity
.
getCreatedAt
().
getTime
();
String
tmpURL
=
url
+
"?"
+
"merchantOrderNo="
+
loanId
+
"&merchantRepayOrder="
+
payCenterOrderNo
+
"&repaidAt="
+
repaidAt
;
String
response
=
HttpUtils
.
doGet
(
tmpURL
);
...
...
src/main/java/cn/gq/financial/utils/BillParsers.java
View file @
5312e991
...
...
@@ -9,6 +9,8 @@ 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
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.*
;
import
java.math.BigDecimal
;
...
...
@@ -21,6 +23,9 @@ import java.util.List;
public
class
BillParsers
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
BillParsers
.
class
);
static
String
PARSE_PATTERN_1
=
"yyyy-MM-dd HH:mm:ss"
;
static
String
PARSE_PATTERN_2
=
"yyyyMMdd"
;
...
...
@@ -35,7 +40,8 @@ public class BillParsers {
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
List
<
T
>
parseBillFromInputStream
(
InputStream
inputStream
,
Class
<
T
>
clazz
)
throws
Exception
{
if
(
clazz
.
equals
(
YeepayBill
.
class
))
{
return
(
List
<
T
>)
parseBillYeepayFromInputStream
(
inputStream
);
return
(
List
<
T
>)
parseBillYeepay
(
inputStream
);
// return (List<T>) parseBillYeepayFromInputStream(inputStream);
}
if
(
clazz
.
equals
(
WXBill
.
class
))
{
return
(
List
<
T
>)
parseBillWXPayFromInputStream
(
inputStream
);
...
...
@@ -62,6 +68,7 @@ public class BillParsers {
while
(
StringUtils
.
isNoneBlank
(
line
=
reader
.
readLine
()))
{
if
(
line
.
startsWith
(
"TRADEDETAIL-END"
))
break
;
UMPayBill
bill
=
createUMPayBill
(
line
);
LOGGER
.
info
(
"解析账单结果,bill.orderId-->{}"
,
bill
.
getOrderId
());
bills
.
add
(
bill
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -110,6 +117,8 @@ public class BillParsers {
String
[]
split
=
line
.
split
(
","
);
if
(
split
.
length
>
9
&&
"SUCCESS"
.
equals
(
split
[
9
]))
{
WXBill
bill
=
createWXBill
(
split
);
bill
.
setSrcStr
(
line
);
LOGGER
.
info
(
"解析账单结果,bill.orderId-->{}"
,
bill
.
getOrderId
());
bills
.
add
(
bill
);
}
}
...
...
@@ -176,13 +185,16 @@ public class BillParsers {
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
;
String
lineContent
=
null
;
reader
.
readLine
()
;
List
<
YeepayBill
>
bills
=
new
ArrayList
<>();
while
(
StringUtils
.
isNotBlank
(
reader
.
readLine
()))
{
split
=
StringUtils
.
splitPreserveAllTokens
(
lineContent
,
","
);
YeepayBill
bill
=
setYeePayBillProps
(
split
);
bills
.
add
(
bill
);
while
(
StringUtils
.
isNotBlank
(
lineContent
=
reader
.
readLine
()))
{
String
[]
split
=
StringUtils
.
splitPreserveAllTokens
(
lineContent
,
","
);
if
(
YeepayBill
.
REPAY
.
equals
(
split
[
3
].
trim
()))
{
YeepayBill
bill
=
setYeePayBillProps
(
split
);
bill
.
setSrcStr
(
lineContent
);
bills
.
add
(
bill
);
}
}
return
bills
;
}
...
...
@@ -205,37 +217,44 @@ public class BillParsers {
iterator
.
next
();
//跳过表头
while
(
iterator
.
hasNext
())
{
YeepayBill
bill
=
createYeepayBill
(
iterator
.
next
());
bills
.
add
(
bill
);
if
(
null
!=
bill
)
{
LOGGER
.
info
(
"解析账单结果,bill.orderId-->{}"
,
bill
.
getOrderId
());
bills
.
add
(
bill
);
}
}
return
bills
;
}
private
static
YeepayBill
createYeepayBill
(
Row
row
)
{
YeepayBill
bill
=
new
YeepayBill
();
bill
.
setTrandingDate
(
row
.
getCell
(
1
).
getDateCellValue
());
bill
.
setAccountType
(
row
.
getCell
(
2
).
getStringCellValue
());
bill
.
setBizType
(
row
.
getCell
(
3
).
getStringCellValue
());
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
4
).
getStringCellValue
()))
{
bill
.
setOrderId
(
row
.
getCell
(
4
).
getStringCellValue
().
trim
());
}
row
.
getCell
(
5
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
5
).
getStringCellValue
()))
{
bill
.
setIncome
(
new
BigDecimal
(
row
.
getCell
(
5
).
getStringCellValue
()));
}
row
.
getCell
(
6
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
6
).
getStringCellValue
()))
{
bill
.
setCost
(
new
BigDecimal
(
row
.
getCell
(
6
).
getStringCellValue
()));
}
if
(
null
!=
row
.
getCell
(
7
))
{
row
.
getCell
(
7
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
7
).
getStringCellValue
()))
{
bill
.
setPoundage
(
new
BigDecimal
(
row
.
getCell
(
7
).
getStringCellValue
()));
Cell
cell0
=
row
.
getCell
(
0
);
if
(
null
!=
cell0
&&
StringUtils
.
isNotBlank
(
cell0
.
getStringCellValue
()))
{
YeepayBill
bill
=
new
YeepayBill
();
bill
.
setTrandingDate
(
row
.
getCell
(
1
).
getDateCellValue
());
bill
.
setAccountType
(
row
.
getCell
(
2
).
getStringCellValue
());
bill
.
setBizType
(
row
.
getCell
(
3
).
getStringCellValue
());
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
4
).
getStringCellValue
()))
{
bill
.
setOrderId
(
row
.
getCell
(
4
).
getStringCellValue
().
trim
());
}
row
.
getCell
(
5
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
5
).
getStringCellValue
()))
{
bill
.
setIncome
(
new
BigDecimal
(
row
.
getCell
(
5
).
getStringCellValue
()));
}
row
.
getCell
(
6
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
6
).
getStringCellValue
()))
{
bill
.
setCost
(
new
BigDecimal
(
row
.
getCell
(
6
).
getStringCellValue
()));
}
if
(
null
!=
row
.
getCell
(
7
))
{
row
.
getCell
(
7
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
if
(
StringUtils
.
isNotBlank
(
row
.
getCell
(
7
).
getStringCellValue
()))
{
bill
.
setPoundage
(
new
BigDecimal
(
row
.
getCell
(
7
).
getStringCellValue
()));
}
}
if
(
null
!=
row
.
getCell
(
10
))
{
bill
.
setRemak
(
row
.
getCell
(
10
).
getStringCellValue
());
}
return
bill
;
}
if
(
null
!=
row
.
getCell
(
10
))
{
bill
.
setRemak
(
row
.
getCell
(
10
).
getStringCellValue
());
}
return
bill
;
return
null
;
}
...
...
src/main/resources/applicationContext.properties
View file @
5312e991
...
...
@@ -11,11 +11,6 @@ xyqb.jdbc.username=xyqb_query
xyqb.jdbc.password
=
Uiwb@o^fR&nHOa5t
#local
local.jdbc.url
=
jdbc:mysql://127.0.0.1:3306/financial?useUnicode=true&characterEncoding=UTF8
local.jdbc.username
=
root
local.jdbc.password
=
root
#mall
mall.jdbc.url
=
jdbc:mysql://172.16.1.7:3306/mall?useUnicode=true&characterEncoding=UTF8
mall.jdbc.username
=
xyqb_query
...
...
@@ -27,9 +22,9 @@ financial.jdbc.username=xyqb_query
financial.jdbc.password
=
Uiwb@o^fR&nHOa5t
#lkbadmin
lkbadmin.jdbc.url
=
jdbc:mysql://10.0.44.12:3306/lkbadmin?useUnicode=true&characterEncoding=utf8
lkbadmin.jdbc.username
=
lkbadmin_w
lkbadmin.jdbc.password
=
wj0msj8J8/v2Ee6Xl75ZDizrJBdEDOAQGlxTGKbRFng=
#
lkbadmin.jdbc.url=jdbc:mysql://10.0.44.12:3306/lkbadmin?useUnicode=true&characterEncoding=utf8
#
lkbadmin.jdbc.username=lkbadmin_w
#
lkbadmin.jdbc.password=wj0msj8J8/v2Ee6Xl75ZDizrJBdEDOAQGlxTGKbRFng=
#localDB
local.repayment.jdbc.url
=
jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8
...
...
src/main/resources/mybatis-local-repayment-config.xml
View file @
5312e991
...
...
@@ -5,5 +5,6 @@
<configuration>
<mappers>
<mapper
resource=
"cn/gq/financial/db/local/mapping/LocalDataSourceMapper.xml"
/>
</mappers>
<mapper
resource=
"cn/gq/financial/db/local/mapping/RepayDetailFinancialEntityMapper.xml"
/>
</mappers>
</configuration>
\ 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