Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baihang-report
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
baihang-report
Commits
dcf35437
Commit
dcf35437
authored
Mar 04, 2021
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试补报
parent
c1a84127
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
488 additions
and
35 deletions
+488
-35
BaiHangDataSourceConfig.java
...rt/config/datasource/baihang/BaiHangDataSourceConfig.java
+0
-1
RepairController.java
...antgroup/report/controller/external/RepairController.java
+36
-0
RepairDataPO.java
...ava/cn/quantgroup/report/domain/baihang/RepairDataPO.java
+42
-0
RepairDataPOMapper.java
.../quantgroup/report/mapper/baihang/RepairDataPOMapper.java
+19
-0
RepaymentLoanInfoSycMapper.java
...oup/report/mapper/baihang/RepaymentLoanInfoSycMapper.java
+25
-0
RepairService.java
...va/cn/quantgroup/report/service/repair/RepairService.java
+260
-0
RepairDataPOMapper.xml
...n/quantgroup/report/mapper/baihang/RepairDataPOMapper.xml
+25
-0
RepaymentLoanInfoSycMapper.xml
...roup/report/mapper/baihang/RepaymentLoanInfoSycMapper.xml
+66
-0
BaihangReportApplicationTests.java
...a/cn/quantgroup/report/BaihangReportApplicationTests.java
+15
-34
No files found.
src/main/java/cn/quantgroup/report/config/datasource/baihang/BaiHangDataSourceConfig.java
View file @
dcf35437
...
@@ -44,7 +44,6 @@ public class BaiHangDataSourceConfig {
...
@@ -44,7 +44,6 @@ public class BaiHangDataSourceConfig {
public
DataSource
baihangDataSource
()
{
public
DataSource
baihangDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
"jdbc:mysql://172.30.5.27:7434?useUnicode=true&characterEncoding=UTF8&useSSL=false"
);
config
.
setJdbcUrl
(
"jdbc:mysql://172.30.5.27:7434?useUnicode=true&characterEncoding=UTF8&useSSL=false"
);
config
.
setPassword
(
"AHvVRT3eOGsm3tHS"
);
config
.
setPassword
(
"AHvVRT3eOGsm3tHS"
);
config
.
setUsername
(
"jian.zheng"
);
config
.
setUsername
(
"jian.zheng"
);
log
.
info
(
"百行征信数据库地址:{}"
,
"jdbc:mysql://172.30.5.27:7434?useUnicode=true&characterEncoding=UTF8&useSSL=false"
);
log
.
info
(
"百行征信数据库地址:{}"
,
"jdbc:mysql://172.30.5.27:7434?useUnicode=true&characterEncoding=UTF8&useSSL=false"
);
...
...
src/main/java/cn/quantgroup/report/controller/external/RepairController.java
0 → 100644
View file @
dcf35437
package
cn
.
quantgroup
.
report
.
controller
.
external
;
import
cn.quantgroup.report.service.repair.RepairService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author jian.zheng
* @date 2021/3/2 - 18:43
**/
@Slf4j
@RestController
(
"/zhudai"
)
public
class
RepairController
{
@Autowired
RepairService
repairService
;
/**
* 修复数据
* pageNo 从0开始
*/
@RequestMapping
(
"/repair"
)
public
String
mainLoanInfoSend
(
int
pageNo
,
String
type
){
try
{
repairService
.
doRepair
(
pageNo
,
type
);
log
.
info
(
"数据补报成功"
);
return
"数据补报成功"
;
}
catch
(
Exception
e
){
log
.
error
(
"数据补报出现异常"
,
e
);
return
"数据补报出现异常"
;
}
}
}
src/main/java/cn/quantgroup/report/domain/baihang/RepairDataPO.java
0 → 100644
View file @
dcf35437
package
cn
.
quantgroup
.
report
.
domain
.
baihang
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
/**
* @author jian.zheng
* @date 2021/3/2 - 18:35
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
RepairDataPO
{
private
String
id
;
private
Long
planId
;
private
String
loanId
;
private
Long
userId
;
private
Long
termNo
;
private
String
repayStatus
;
private
Long
overdueDay
;
private
Long
loanApplicationHistoryId
;
private
Boolean
flag
;
private
Date
deadline
;
private
Date
repaidAt
;
private
Date
loanPaidAt
;
}
src/main/java/cn/quantgroup/report/mapper/baihang/RepairDataPOMapper.java
0 → 100644
View file @
dcf35437
package
cn
.
quantgroup
.
report
.
mapper
.
baihang
;
import
cn.quantgroup.report.domain.baihang.RepairDataPO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author jian.zheng
* @date 2021/3/2 - 19:05
**/
@Repository
public
interface
RepairDataPOMapper
{
List
<
RepairDataPO
>
findByPage
(
@Param
(
"start"
)
int
start
,
@Param
(
"size"
)
int
size
,
@Param
(
"fundingId"
)
Integer
fundingIds
);
}
src/main/java/cn/quantgroup/report/mapper/baihang/RepaymentLoanInfoSycMapper.java
0 → 100644
View file @
dcf35437
package
cn
.
quantgroup
.
report
.
mapper
.
baihang
;
import
cn.quantgroup.report.domain.baihang.BaiHangRepayment
;
import
cn.quantgroup.report.domain.baihang.BaiHangUpDateRecord
;
import
cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai
;
import
cn.quantgroup.report.domain.baihang.RepaymentLoanInfoLog
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* -----------------------------------------------------------------------------<br>
* 描述: 还款信息查询 <br>
* 作者:yanhui.Hao <br>
* 时间:2019.11.06 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Repository
public
interface
RepaymentLoanInfoSycMapper
{
RepaymentInfoZhuDai
findLastOne
(
BaiHangRepayment
baiHangRepayment
);
}
src/main/java/cn/quantgroup/report/service/repair/RepairService.java
0 → 100644
View file @
dcf35437
package
cn
.
quantgroup
.
report
.
service
.
repair
;
import
cn.quantgroup.report.domain.baihang.BaiHangRepayment
;
import
cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai
;
import
cn.quantgroup.report.domain.baihang.RepairDataPO
;
import
cn.quantgroup.report.domain.master.RepaymentLoanWhiteList
;
import
cn.quantgroup.report.mapper.baihang.RepairDataPOMapper
;
import
cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoMapper
;
import
cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoSycMapper
;
import
cn.quantgroup.report.mapper.master.RepaymentLoanInfoDbMapper
;
import
cn.quantgroup.report.mapper.master.RepaymentLoanWhiteListMapper
;
import
cn.quantgroup.report.service.CommonSuperService
;
import
cn.quantgroup.report.service.baihang.BaiHangZhuDaiService
;
import
cn.quantgroup.report.service.baihang.util.Base64
;
import
cn.quantgroup.report.service.http.IHttpService
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
* @author jian.zheng
* @date 2021/3/2 - 18:46
**/
@Service
@Slf4j
public
class
RepairService
implements
CommonSuperService
{
@Value
(
"${baihang.zhudai.repaymentloaninfo.url}"
)
public
String
baiHangRepayMentLoanInfoUrl
;
@Value
(
"${baihang.zhudai.account.name}"
)
public
String
account
;
@Value
(
"${baihang.zhudai.password}"
)
public
String
password
;
@Autowired
RepairDataPOMapper
mapper
;
@Autowired
RepaymentLoanInfoDbMapper
writeMapper
;
@Autowired
IHttpService
iHttpService
;
@Autowired
RepaymentLoanWhiteListMapper
repaymentLoanWhiteListMapper
;
@Autowired
RepaymentLoanInfoMapper
repaymentLoanInfoMapper
;
@Autowired
RepaymentLoanInfoSycMapper
findMapper
;
private
static
Integer
[]
fundingIds
=
{
420
,
520
,
580
,
650
,
670
,
810
,
240
,
640
,
700
};
private
static
Integer
[]
fundingIdsLh
=
{
880
,
890
};
private
static
final
String
logFilePath
=
"C:\\Users\\Administrator\\Desktop\\data\\"
;
public
static
final
String
errorLog
=
"C:\\Users\\Administrator\\Desktop\\data\\error.txt"
;
public
boolean
doRepair
(
int
pageNo
,
String
type
)
throws
Exception
{
final
int
size
=
2000
;
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
Integer
[]
currentFundingIds
;
if
(
"normal"
.
equals
(
type
)
||
"overdue"
.
equals
(
type
)){
currentFundingIds
=
fundingIds
;
}
else
{
currentFundingIds
=
fundingIdsLh
;
}
Map
<
Integer
,
Boolean
>
finishFlag
=
new
HashMap
<>();
for
(
Integer
fundId
:
currentFundingIds
){
List
<
RepaymentInfoZhuDai
>
addList
=
new
ArrayList
<>();
List
<
RepaymentInfoZhuDai
>
modifyList
=
new
ArrayList
<>();
List
<
RepairDataPO
>
newDataEmptyList
=
new
ArrayList
<>();
List
<
RepairDataPO
>
oldDataEmptyList
=
new
ArrayList
<>();
List
<
RepairDataPO
>
list
=
pageFind
(
pageNo
,
size
,
fundId
);
log
.
info
(
"本次查询RepairData fundId : {} page : {} size : {} time : {}"
,
fundId
,
pageNo
,
list
.
size
(),
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
if
(
CollectionUtils
.
isEmpty
(
list
)){
log
.
info
(
"当前资方 {} 已完成 第 {} 页跳过"
,
fundId
,
pageNo
);
finishFlag
.
put
(
fundId
,
true
);
if
(
finishFlag
.
size
()
==
currentFundingIds
.
length
&&
!
finishFlag
.
containsValue
(
false
)){
return
false
;
}
else
{
continue
;
}
}
else
{
finishFlag
.
put
(
fundId
,
false
);
}
stopwatch
.
reset
();
stopwatch
.
start
();
List
<
Long
>
planIds
=
list
.
stream
().
collect
(
ArrayList:
:
new
,(
l
,
i
)->
l
.
add
(
i
.
getPlanId
()),
ArrayList:
:
addAll
);
List
<
RepaymentInfoZhuDai
>
newList
=
findNewData
(
planIds
,
type
,
fundId
);
log
.
info
(
"本次查询newList fundId : {} size : {} time : {}"
,
fundId
,
newList
.
size
(),
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
stopwatch
.
reset
();
stopwatch
.
start
();
if
(
CollectionUtils
.
isEmpty
(
newList
)){
throw
new
RuntimeException
(
"当前type无数据补报"
);
}
Map
<
Long
,
RepaymentInfoZhuDai
>
newMap
=
newList
.
stream
().
collect
(
Collectors
.
toMap
(
i
->
Long
.
parseLong
(
i
.
getReqID
()),
i
->
i
));
for
(
RepairDataPO
po
:
list
){
RepaymentInfoZhuDai
newData
=
newMap
.
get
(
po
.
getPlanId
());
//等建刚的SQL
RepaymentInfoZhuDai
oldData
=
findMapper
.
findLastOne
(
BaiHangRepayment
.
builder
().
loanId
(
po
.
getLoanId
()).
termNo
(
Integer
.
parseInt
(
po
.
getTermNo
().
toString
())).
build
());
if
(
newData
==
null
){
newDataEmptyList
.
add
(
po
);
continue
;
}
else
if
(
oldData
==
null
){
String
id
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
newData
.
setRecordId
(
id
);
addList
.
add
(
newData
);
oldDataEmptyList
.
add
(
po
);
}
else
{
boolean
flag
=
compareRepaymentInfo
(
newData
,
oldData
);
if
(!
flag
){
newData
.
setOpCode
(
"M"
);
newData
.
setRecordId
(
oldData
.
getRecordId
());
modifyList
.
add
(
newData
);
}
}
writeMapper
.
saveRepaymentLoanInfoLog
(
newData
);
}
log
.
info
(
"本次查询旧数据并对比写入报送日志表 fundId : {} page : {} size : {} time : {}"
,
fundId
,
pageNo
,
size
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
stopwatch
.
reset
();
stopwatch
.
start
();
try
{
log
.
info
(
"开始报送 新增 {} 条,修复 {} 条"
,
addList
.
size
(),
modifyList
.
size
());
report
(
addList
);
report
(
modifyList
);
File
newEmpty
=
new
File
(
logFilePath
+
"newEmpty-"
+
fundId
+
"-"
+
pageNo
+
type
+
".txt"
);
File
oldEmpty
=
new
File
(
logFilePath
+
"oldEmpty-"
+
fundId
+
"-"
+
pageNo
+
type
+
".txt"
);
FileUtils
.
write
(
newEmpty
,
JSON
.
toJSONString
(
newDataEmptyList
));
FileUtils
.
write
(
oldEmpty
,
JSON
.
toJSONString
(
oldDataEmptyList
));
log
.
info
(
"本次上报数据 : {} size : {} time : {}"
,
pageNo
,
addList
.
size
()
+
modifyList
.
size
(),
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
catch
(
Exception
e
)
{
log
.
error
(
"第 {} 次 {} 报送发生异常"
,
pageNo
,
type
,
e
);
}
}
return
true
;
}
private
void
report
(
List
<
RepaymentInfoZhuDai
>
addList
)
throws
Exception
{
int
successCount
=
0
;
if
(
CollectionUtils
.
isEmpty
(
addList
)){
return
;
}
int
jumpCount
=
0
;
for
(
RepaymentInfoZhuDai
info
:
addList
){
if
(
info
.
getTermStatus
()
!=
null
&&
"overdue"
.
equals
(
info
.
getTermStatus
()))
{
String
newnyr
=
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ISO_DATE
);
String
bakFileName
=
"whiteList_"
+
newnyr
+
".json"
;
if
(
checkOverdueInWhiteList
(
info
,
2
,
bakFileName
))
{
log
.
info
(
"众信利民助贷模式TO百行手动报送还款在白名单跳过报送, reqId: {} , loanId: {} , termNo: {} , newnyr: {} "
,
info
.
getReqID
(),
info
.
getLoanId
(),
info
.
getTermNo
(),
newnyr
);
jumpCount
++;
continue
;
}
}
// info.setReqID(info.getRecordId());
// info.setRecordId(null);
// info.setPid(BaiHangZhuDaiService.interfaceUploadClient(info.getPid()));
// info.setName(BaiHangZhuDaiService.interfaceUploadClient(info.getName()));
// info.setMobile(BaiHangZhuDaiService.interfaceUploadClient(info.getMobile()));
// String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(info));
Thread
.
sleep
(
120L
);
// log.info("众信利民助贷模式TO百行手动报送还款记录 reqID: {} , bean: {} , result: {} ", info.getReqID(), JSON.toJSONString(info), resultStr);
// if (Objects.isNull(resultStr) || "success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
successCount
++;
// }else {
// File file = new File(errorLog);
// List<String> logs = FileUtils.readLines(file,"utf-8");
// logs.add(JSON.toJSONString(resultStr));
// FileUtils.writeLines(file,logs);
// }
}
log
.
info
(
"报送成功 {} 条, 失败 {} 条 , 跳过 {} 条"
,
successCount
,
addList
.
size
()
-
successCount
,
jumpCount
);
}
private
boolean
compareRepaymentInfo
(
RepaymentInfoZhuDai
newData
,
RepaymentInfoZhuDai
oldData
)
{
boolean
finalFlag
=
true
;
if
(!
newData
.
getTermStatus
().
equals
(
oldData
.
getTermStatus
())){
finalFlag
=
false
;
}
if
(!
newData
.
getRealRepaymentDate
().
equals
(
oldData
.
getRealRepaymentDate
())){
finalFlag
=
false
;
}
if
(!
newData
.
getTargetRepayment
().
equals
(
oldData
.
getTargetRepayment
())){
finalFlag
=
false
;
}
if
(!
newData
.
getRealRepayment
().
equals
(
oldData
.
getRealRepayment
())){
finalFlag
=
false
;
}
if
(!
newData
.
getRealRepayment
().
equals
(
oldData
.
getRealRepayment
())){
finalFlag
=
false
;
}
if
(!
newData
.
getOverdueStatus
().
equals
(
oldData
.
getOverdueStatus
())){
finalFlag
=
false
;
}
if
(!
newData
.
getOverdueAmount
().
equals
(
oldData
.
getOverdueAmount
())){
finalFlag
=
false
;
}
if
(!
newData
.
getRemainingAmount
().
equals
(
oldData
.
getRemainingAmount
())){
finalFlag
=
false
;
}
if
(
newData
.
getLoanStatus
()!=
oldData
.
getLoanStatus
()){
finalFlag
=
false
;
}
// log.info("本次对比存在差异 newData : {} oldDataId : {}",JSON.toJSONString(newData),oldData.getReqID());
return
finalFlag
;
}
private
Map
<
String
,
String
>
getHeader
()
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"Authorization"
,
"Basic "
+
Base64
.
byteArrayToBase64
((
account
+
":"
+
password
).
getBytes
()));
headerMap
.
put
(
"Content-Type"
,
"application/json"
);
return
headerMap
;
}
private
List
<
RepairDataPO
>
pageFind
(
int
pageNo
,
int
size
,
Integer
fundingId
){
return
mapper
.
findByPage
(
pageNo
*
size
,
size
,
fundingId
);
}
private
List
<
RepaymentInfoZhuDai
>
findNewData
(
List
<
Long
>
planIds
,
String
type
,
Integer
fundId
)
{
if
(
"normal"
.
equals
(
type
)){
return
repaymentLoanInfoMapper
.
repairNormal
(
planIds
,
fundId
);
}
else
if
(
"overdue"
.
equals
(
type
)){
return
repaymentLoanInfoMapper
.
repairOverdue
(
planIds
,
fundId
);
}
else
if
(
"normal_lh"
.
equals
(
type
)){
return
repaymentLoanInfoMapper
.
repairNormalLH
(
planIds
);
}
else
if
(
"overdue_lh"
.
equals
(
type
)){
return
repaymentLoanInfoMapper
.
repairOverdueLH
(
planIds
);
}
else
{
log
.
info
(
"type : {} 不在定义中"
,
type
);
throw
new
RuntimeException
(
"错误的type"
);
}
}
private
boolean
checkOverdueInWhiteList
(
RepaymentInfoZhuDai
repaymentLoanInfo
,
int
type
,
String
bakFileName
)
{
try
{
RepaymentLoanWhiteList
object
=
repaymentLoanWhiteListMapper
.
findRepaymentLoanWhiteListOne
(
repaymentLoanInfo
.
getLoanId
(),
type
);
if
(
object
!=
null
&&
object
.
getPid
()
!=
null
&&
object
.
getPid
().
equals
(
repaymentLoanInfo
.
getPid
()))
{
try
{
FileUtils
.
write
(
new
File
(
"/home/quant_group/baihang-report/data/baihang/D3/yuqi_tg/"
+
bakFileName
),
JSON
.
toJSONString
(
repaymentLoanInfo
)
+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送-逾期还款在白名单跳过报送, Json数据保存文件异常, bean: {} "
,
JSON
.
toJSONString
(
repaymentLoanInfo
),
e
);
}
return
true
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"检测逾期还款是在在白名单异常,"
,
e
);
}
return
false
;
}
}
src/main/resources/cn/quantgroup/report/mapper/baihang/RepairDataPOMapper.xml
0 → 100644
View file @
dcf35437
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.report.mapper.baihang.RepairDataPOMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.quantgroup.report.domain.baihang.RepairDataPO"
>
<result
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"loan_id"
jdbcType=
"VARCHAR"
property=
"loanId"
/>
<result
column=
"user_id"
jdbcType=
"INTEGER"
property=
"userId"
/>
<result
column=
"term_no"
jdbcType=
"INTEGER"
property=
"termNo"
/>
<result
column=
"repay_status"
jdbcType=
"VARCHAR"
property=
"repayStatus"
/>
<result
column=
"overdue_day"
jdbcType=
"INTEGER"
property=
"overdueDay"
/>
<result
column=
"loan_application_history_id"
jdbcType=
"INTEGER"
property=
"loanApplicationHistoryId"
/>
<result
column=
"flag"
jdbcType=
"BOOLEAN"
property=
"flag"
/>
<result
column=
"deadline"
jdbcType=
"DATE"
property=
"deadline"
/>
<result
column=
"repaid_at"
jdbcType=
"DATE"
property=
"repaidAt"
/>
<result
column=
"loan_paid_at"
jdbcType=
"DATE"
property=
"loanPaidAt"
/>
</resultMap>
<select
id=
"findByPage"
resultMap=
"BaseResultMap"
>
select * from risk_datasource.repair_data where (repay_status = 'overdue_repay' or repay_status = 'normal')
and funding_corp_id = #{fundingId}
limit #{start},#{size};
</select>
</mapper>
\ No newline at end of file
src/main/resources/cn/quantgroup/report/mapper/baihang/RepaymentLoanInfoSycMapper.xml
0 → 100644
View file @
dcf35437
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoSycMapper"
>
<resultMap
id=
"RepaymetnLoanInfoResultMap"
type=
"cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai"
>
<result
column=
"reqID"
jdbcType=
"VARCHAR"
property=
"req_id"
/>
<result
column=
"recordId"
jdbcType=
"VARCHAR"
property=
"record_id"
/>
<result
column=
"opCode"
jdbcType=
"VARCHAR"
property=
"op_code"
/>
<result
column=
"uploadTs"
jdbcType=
"VARCHAR"
property=
"upload_ts"
/>
<result
column=
"loanId"
jdbcType=
"VARCHAR"
property=
"loan_id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"pid"
jdbcType=
"VARCHAR"
property=
"pid"
/>
<result
column=
"mobile"
jdbcType=
"VARCHAR"
property=
"mobile"
/>
<result
column=
"termNo"
jdbcType=
"INTEGER"
property=
"term_no"
/>
<result
column=
"termStatus"
jdbcType=
"VARCHAR"
property=
"term_status"
/>
<result
column=
"targetRepaymentDate"
jdbcType=
"VARCHAR"
property=
"target_repayment_date"
/>
<result
column=
"realRepaymentDate"
jdbcType=
"VARCHAR"
property=
"real_repayment_date"
/>
<result
column=
"plannedPayment"
jdbcType=
"DECIMAL"
property=
"planned_payment"
/>
<result
column=
"targetRepayment"
jdbcType=
"DECIMAL"
property=
"target_repayment"
/>
<result
column=
"realRepayment"
jdbcType=
"DECIMAL"
property=
"real_repayment"
/>
<result
column=
"overdueStatus"
jdbcType=
"VARCHAR"
property=
"overdue_status"
/>
<result
column=
"statusConfirmAt"
jdbcType=
"VARCHAR"
property=
"status_confirm_at"
/>
<result
column=
"overdueAmount"
jdbcType=
"DECIMAL"
property=
"overdue_amount"
/>
<result
column=
"remainingAmount"
jdbcType=
"DECIMAL"
property=
"remaining_amount"
/>
<result
column=
"loanStatus"
jdbcType=
"INTEGER"
property=
"loan_status"
/>
</resultMap>
<resultMap
id=
"RepaymentLoanInfoVoResultMapByBS"
type=
"cn.quantgroup.report.domain.baihang.RepaymentLoanInfoLog"
>
<result
column=
"reqID"
jdbcType=
"VARCHAR"
property=
"req_id"
/>
<result
column=
"opCode"
jdbcType=
"VARCHAR"
property=
"op_code"
/>
<result
column=
"uploadTs"
jdbcType=
"VARCHAR"
property=
"upload_ts"
/>
<result
column=
"loanId"
jdbcType=
"VARCHAR"
property=
"loan_id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"pid"
jdbcType=
"VARCHAR"
property=
"pid"
/>
<result
column=
"mobile"
jdbcType=
"VARCHAR"
property=
"mobile"
/>
<result
column=
"termNo"
jdbcType=
"INTEGER"
property=
"term_no"
/>
<result
column=
"termStatus"
jdbcType=
"VARCHAR"
property=
"term_status"
/>
<result
column=
"targetRepaymentDate"
jdbcType=
"VARCHAR"
property=
"target_repayment_date"
/>
<result
column=
"realRepaymentDate"
jdbcType=
"VARCHAR"
property=
"real_repayment_date"
/>
<result
column=
"plannedPayment"
jdbcType=
"DECIMAL"
property=
"planned_payment"
/>
<result
column=
"targetRepayment"
jdbcType=
"DECIMAL"
property=
"target_repayment"
/>
<result
column=
"realRepayment"
jdbcType=
"DECIMAL"
property=
"real_repayment"
/>
<result
column=
"overdueStatus"
jdbcType=
"VARCHAR"
property=
"overdue_status"
/>
<result
column=
"statusConfirmAt"
jdbcType=
"VARCHAR"
property=
"status_confirm_at"
/>
<result
column=
"overdueAmount"
jdbcType=
"DECIMAL"
property=
"overdue_amount"
/>
<result
column=
"remainingAmount"
jdbcType=
"DECIMAL"
property=
"remaining_amount"
/>
<result
column=
"loanStatus"
jdbcType=
"INTEGER"
property=
"loan_status"
/>
<result
column=
"recordId"
jdbcType=
"VARCHAR"
property=
"record_id"
/>
<result
column=
"id"
jdbcType=
"DECIMAL"
property=
"id"
/>
<result
column=
"enable"
jdbcType=
"INTEGER"
property=
"enable"
/>
<result
column=
"createdAt"
jdbcType=
"VARCHAR"
property=
"created_at"
/>
<result
column=
"updatedAt"
jdbcType=
"VARCHAR"
property=
"updated_at"
/>
</resultMap>
<select
id=
"findLastOne"
parameterType=
"cn.quantgroup.report.domain.baihang.BaiHangRepayment"
resultType=
"cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai"
>
select id, record_id, req_id, loan_id, term_no, status_confirm_at, term_status
from risk_datasource.repayment_loan_info_zhudai where loan_id = #{loanId} and term_no = #{termNo}
<!--2020.01.07 17:55 值针对当天,还款报了,逾期又有一条的情况 DATE_FORMAT(now(),'%Y-%m-%d') -->
<!-- 2020.02.06 16:14和广达保持一致 and created_at >= #{sendDate} -->
limit 1;
</select>
</mapper>
\ No newline at end of file
src/test/java/cn/quantgroup/report/BaihangReportApplicationTests.java
View file @
dcf35437
...
@@ -30,47 +30,28 @@ public class BaihangReportApplicationTests {
...
@@ -30,47 +30,28 @@ public class BaihangReportApplicationTests {
@Test
@Test
public
void
testRepair
(){
public
void
testRepair
(){
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
boolean
flag
=
false
;
doRepair
(
"normal_lh"
);
doRepair
(
"overdue_lh"
);
doRepair
(
"normal"
);
doRepair
(
"overdue"
);
log
.
info
(
"本次测试总耗时 {}"
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
private
void
doRepair
(
String
type
)
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
log
.
info
(
"开始报送 {}"
,
type
);
boolean
flag
=
true
;
int
i
=
0
;
int
i
=
0
;
while
(
!
flag
){
while
(
flag
){
try
{
try
{
flag
=
service
.
doRepair
(
i
,
"overdue_lh"
);
flag
=
service
.
doRepair
(
i
,
type
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"overdue_lh 第 {} 页 异常"
,
i
,
e
);
log
.
info
(
"overdue_lh 第 {} 页 异常"
,
i
,
e
);
continue
;
}
}
i
++;
i
++;
}
}
i
=
0
;
log
.
info
(
"本次测试 {} 总耗时 {}"
,
type
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
flag
=
false
;
while
(!
flag
){
try
{
flag
=
service
.
doRepair
(
i
,
"overdue"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"overdue 第 {} 页 异常"
,
i
,
e
);
}
i
++;
}
i
=
0
;
flag
=
false
;
while
(!
flag
){
try
{
flag
=
service
.
doRepair
(
i
,
"normal_lh"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"normal_lh 第 {} 页 异常"
,
i
,
e
);
}
i
++;
}
i
=
0
;
flag
=
false
;
while
(!
flag
){
try
{
flag
=
service
.
doRepair
(
i
,
"normal"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"normal 第 {} 页 异常"
,
i
,
e
);
}
i
++;
}
log
.
info
(
"本次测试总耗时 {}"
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
}
}
}
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