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
d753fa55
Commit
d753fa55
authored
Mar 04, 2021
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试补报
parent
dcf35437
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
38 deletions
+48
-38
RepairController.java
...antgroup/report/controller/external/RepairController.java
+9
-1
RepairService.java
...va/cn/quantgroup/report/service/repair/RepairService.java
+35
-17
BaihangReportApplicationTests.java
...a/cn/quantgroup/report/BaihangReportApplicationTests.java
+4
-20
No files found.
src/main/java/cn/quantgroup/report/controller/external/RepairController.java
View file @
d753fa55
package
cn
.
quantgroup
.
report
.
controller
.
external
;
import
cn.quantgroup.report.service.repair.RepairService
;
import
com.google.common.base.Stopwatch
;
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
;
import
java.util.concurrent.TimeUnit
;
/**
* @author jian.zheng
* @date 2021/3/2 - 18:43
...
...
@@ -24,7 +27,12 @@ public class RepairController {
@RequestMapping
(
"/repair"
)
public
String
mainLoanInfoSend
(
int
pageNo
,
String
type
){
try
{
repairService
.
doRepair
(
pageNo
,
type
);
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
repairService
.
doRepair
(
"normal_lh"
);
repairService
.
doRepair
(
"overdue_lh"
);
repairService
.
doRepair
(
"normal"
);
repairService
.
doRepair
(
"overdue"
);
log
.
info
(
"本次测试总耗时 {}"
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
log
.
info
(
"数据补报成功"
);
return
"数据补报成功"
;
}
catch
(
Exception
e
){
...
...
src/main/java/cn/quantgroup/report/service/repair/RepairService.java
View file @
d753fa55
...
...
@@ -57,14 +57,32 @@ public class RepairService implements CommonSuperService {
RepaymentLoanInfoSycMapper
findMapper
;
private
static
Integer
[]
fundingIds
=
{
420
,
520
,
580
,
650
,
670
,
810
,
240
,
640
,
700
};
// private static Integer[] fundingIds = {580};
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
;
public
void
doRepair
(
String
type
)
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
log
.
info
(
"开始报送 {}"
,
type
);
boolean
flag
=
true
;
int
i
=
0
;
while
(
flag
){
try
{
flag
=
doRepair
(
i
,
type
);
}
catch
(
Exception
e
)
{
log
.
info
(
"overdue_lh 第 {} 页 异常"
,
i
,
e
);
continue
;
}
i
++;
}
log
.
info
(
"本次测试 {} 总耗时 {}"
,
type
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
private
boolean
doRepair
(
int
pageNo
,
String
type
)
throws
Exception
{
final
int
size
=
5000
;
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
Integer
[]
currentFundingIds
;
if
(
"normal"
.
equals
(
type
)
||
"overdue"
.
equals
(
type
)){
...
...
@@ -127,7 +145,7 @@ public class RepairService implements CommonSuperService {
stopwatch
.
reset
();
stopwatch
.
start
();
try
{
log
.
info
(
"开始报送 新增 {} 条,修复 {} 条
"
,
addList
.
size
(),
modify
List
.
size
());
log
.
info
(
"开始报送 新增 {} 条,修复 {} 条
总计 {} 条"
,
addList
.
size
(),
modifyList
.
size
(),
modifyList
.
size
()
+
add
List
.
size
());
report
(
addList
);
report
(
modifyList
);
File
newEmpty
=
new
File
(
logFilePath
+
"newEmpty-"
+
fundId
+
"-"
+
pageNo
+
type
+
".txt"
);
...
...
@@ -158,22 +176,22 @@ public class RepairService implements CommonSuperService {
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));
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"))) {
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);
//
}
}
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
);
}
...
...
src/test/java/cn/quantgroup/report/BaihangReportApplicationTests.java
View file @
d753fa55
...
...
@@ -30,28 +30,12 @@ public class BaihangReportApplicationTests {
@Test
public
void
testRepair
(){
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
doRepair
(
"normal_lh"
);
doRepair
(
"overdue_lh"
);
doRepair
(
"normal"
);
doRepair
(
"overdue"
);
// service.
doRepair("normal_lh");
// service.
doRepair("overdue_lh");
service
.
doRepair
(
"normal"
);
service
.
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
;
while
(
flag
){
try
{
flag
=
service
.
doRepair
(
i
,
type
);
}
catch
(
Exception
e
)
{
log
.
info
(
"overdue_lh 第 {} 页 异常"
,
i
,
e
);
continue
;
}
i
++;
}
log
.
info
(
"本次测试 {} 总耗时 {}"
,
type
,
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