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
4ef9e937
Commit
4ef9e937
authored
Jun 04, 2020
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工具提交1
parent
b213d7e7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
343 additions
and
58 deletions
+343
-58
ExZhuDaiBaiHangReSendController.java
.../controller/external/ExZhuDaiBaiHangReSendController.java
+24
-0
RepaymentInfoZhuDai.java
...quantgroup/report/domain/baihang/RepaymentInfoZhuDai.java
+1
-0
BaiHangZhuDaiService.java
...antgroup/report/service/baihang/BaiHangZhuDaiService.java
+93
-54
ManualToolService.java
...antgroup/report/service/manualTool/ManualToolService.java
+25
-1
RepaymentLoanInfoMapper.xml
...ntgroup/report/mapper/baihang/RepaymentLoanInfoMapper.xml
+200
-3
No files found.
src/main/java/cn/quantgroup/report/controller/external/ExZhuDaiBaiHangReSendController.java
View file @
4ef9e937
...
@@ -315,4 +315,28 @@ public class ExZhuDaiBaiHangReSendController {
...
@@ -315,4 +315,28 @@ public class ExZhuDaiBaiHangReSendController {
return
"d3CheckToJson任务调度失败,参数错误"
;
return
"d3CheckToJson任务调度失败,参数错误"
;
}
}
}
}
@RequestMapping
(
"/manual/d3IsHaveD2"
)
public
String
d3IsHaveD2
(
String
p3
,
String
secretKey
,
String
filePath
){
if
(
manualToolService
.
checkSecretKey
(
p3
,
secretKey
)){
baiHangZhuDaiService
.
d3IsHaveD2
(
filePath
);
return
"d3IsHaveD2任务调度完成"
;
}
else
{
return
"d3IsHaveD2任务调度失败,参数错误"
;
}
}
@RequestMapping
(
"/manual/d3_saveDbLog"
)
public
String
d3_saveDbLog
(
String
p3
,
String
secretKey
,
String
filePath
,
String
writeFilePath
){
if
(
StringUtils
.
isEmpty
(
writeFilePath
)){
return
"d3_saveDbLog任务调度失败,参数为空"
;
}
if
(
manualToolService
.
checkSecretKey
(
p3
,
secretKey
)){
baiHangZhuDaiService
.
d3_saveDbLog
(
filePath
,
writeFilePath
);
return
"d3_saveDbLog任务调度完成"
;
}
else
{
return
"d3_saveDbLog任务调度失败,参数错误"
;
}
}
}
}
src/main/java/cn/quantgroup/report/domain/baihang/RepaymentInfoZhuDai.java
View file @
4ef9e937
...
@@ -41,4 +41,5 @@ public class RepaymentInfoZhuDai implements Serializable {
...
@@ -41,4 +41,5 @@ public class RepaymentInfoZhuDai implements Serializable {
private
String
recordId
;
private
String
recordId
;
public
boolean
getRecordId
;
}
}
src/main/java/cn/quantgroup/report/service/baihang/BaiHangZhuDaiService.java
View file @
4ef9e937
...
@@ -2168,73 +2168,112 @@ public class BaiHangZhuDaiService {
...
@@ -2168,73 +2168,112 @@ public class BaiHangZhuDaiService {
return
"处理D3数据结束 "
;
return
"处理D3数据结束 "
;
}
}
@Async
public
String
d3IsHaveD2
(
String
filePath
)
{
//写入文件的路径和前缀
String
writeFilePath
=
"/home/quant_group/baihang-report/data/tmp"
;
String
file_
=
"result"
;
if
(
filePath
.
lastIndexOf
(
"/"
)!=-
1
){
//linux
writeFilePath
=
filePath
.
substring
(
0
,
filePath
.
lastIndexOf
(
"/"
))
+
"/ishave"
;
file_
=
filePath
.
substring
(
filePath
.
lastIndexOf
(
"/"
),
filePath
.
lastIndexOf
(
"."
));
}
else
{
//windows
writeFilePath
=
filePath
.
substring
(
0
,
filePath
.
lastIndexOf
(
"\\"
))
+
"\\ishave"
;
file_
=
filePath
.
substring
(
filePath
.
lastIndexOf
(
"\\"
),
filePath
.
lastIndexOf
(
"."
));
}
public
static
void
main
(
String
[]
args
)
{
long
starUtc
=
System
.
currentTimeMillis
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mm:ss"
);
List
<
String
>
d2InfosList
=
null
;
/*Timestamp timestamp = new Timestamp((new Date()).getTime());
try
{
LocalDateTime nowTime = LocalDateTime.now();
d2InfosList
=
FileUtils
.
readLines
(
new
File
(
filePath
),
"utf-8"
);
String format = nowTime.format(DateTimeFormatter.ISO_DATE_TIME);
}
catch
(
IOException
e
)
{
format = nowTime.format(DateTimeFormatter.ISO_LOCAL_DATE);
e
.
printStackTrace
();
format = nowTime.format(formatter);
}
format = nowTime.toString();
log
.
info
(
"d2InfosList读取文件: {} , 大小: {} , 耗时: {} "
,
filePath
,
d2InfosList
.
size
(),
(
System
.
currentTimeMillis
()-
starUtc
));
System.out.println(format);*/
int
fsize
=
d2InfosList
.
size
();
LocalDateTime
loca_log_uploadTs
=
LocalDateTime
.
parse
(
"2016-08-23T00:00:00"
).
plusDays
(
1
);
//
String
SQL_QUERY_D2
=
" select d2.req_id, d2.record_id, d2.op_code from loan_info_zhudai d2 where d2.loan_id=? ;"
;
String
uploadTs_2
=
loca_log_uploadTs
.
format
(
formatter
);
for
(
int
i
=
0
;
i
<
fsize
;
i
++){
String
strJson
=
d2InfosList
.
get
(
i
);
String
run_lastTime
=
"2016-08-24T00:00:01"
;
try
{
if
(
StringUtils
.
isNotEmpty
(
run_lastTime
)){
if
(
strJson
.
length
()
<
30
){
//#singleLoanRepayInfo
LocalDateTime
loca_run_lastTime
=
LocalDateTime
.
parse
(
run_lastTime
);
log
.
warn
(
"d2InfosList筛选文件内容时发现数据错误, 文件: {} , 内容: {} "
,
filePath
,
strJson
);
if
(
loca_run_lastTime
.
compareTo
(
loca_log_uploadTs
)
>
0
)
{
continue
;
uploadTs_2
=
loca_run_lastTime
.
format
(
formatter
);
}
RepaymentInfoZhuDai
repaymentLoanInfo
=
new
Gson
().
fromJson
(
strJson
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
try
{
List
<
LoanInfoZhuDai
>
logBeanList
=
riskDatasourceJdbcTemplate
.
query
(
SQL_QUERY_D2
,
new
Object
[]{
repaymentLoanInfo
.
getLoanId
()},
new
RowMapper
<
LoanInfoZhuDai
>()
{
@Override
public
LoanInfoZhuDai
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
LoanInfoZhuDai
bean
=
new
LoanInfoZhuDai
();
bean
.
setRecordId
(
rs
.
getString
(
"record_id"
));
bean
.
setReqID
(
rs
.
getString
(
"req_id"
));
bean
.
setOpCode
(
rs
.
getString
(
"op_code"
));
return
bean
;
}
});
if
(
logBeanList
!=
null
&&
logBeanList
.
size
()>
0
){
if
(
StringUtils
.
isEmpty
(
repaymentLoanInfo
.
getRecordId
())){
repaymentLoanInfo
.
setRecordId
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
}
this
.
wirteFile
(
writeFilePath
+
file_
+
"_ok.txt"
,
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
);
}
else
{
this
.
wirteFile
(
writeFilePath
+
file_
+
"_isEmpty.txt"
,
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
);
}
}
catch
(
Exception
e
){
log
.
error
(
"在到d2中查询d3数据异常, loanId: {} "
,
repaymentLoanInfo
.
getLoanId
(),
e
);
}
}
catch
(
Exception
e
){
log
.
error
(
"在到d2中查询d3数据未知异常, 文件: {} , 内容: {} , 第i: {} "
,
filePath
,
strJson
,
i
,
e
);
}
}
log
.
info
(
"在到d2中查询d3数据结束, filePath: {} , 第i: {} <<<"
,
filePath
,
i
);
}
}
System
.
out
.
println
(
uploadTs_2
);
return
"在到d2中查询d3数据结束"
;
}
List
<
RepaymentLoanInfoLog
>
logBeanList
=
new
ArrayList
();
RepaymentLoanInfoLog
bean1
=
new
RepaymentLoanInfoLog
();
bean1
.
setUpdatedAt
(
Timestamp
.
valueOf
(
"2011-05-09 11:49:00"
));
logBeanList
.
add
(
bean1
);
RepaymentLoanInfoLog
bean2
=
new
RepaymentLoanInfoLog
();
@Async
bean2
.
setUpdatedAt
(
Timestamp
.
valueOf
(
"2011-05-09 11:50:00"
));
public
void
d3_saveDbLog
(
String
filePath
,
String
writeFilePath
)
{
logBeanList
.
add
(
bean2
);
long
starUtc
=
System
.
currentTimeMillis
();
List
<
String
>
d3InfosList
=
null
;
try
{
d3InfosList
=
FileUtils
.
readLines
(
new
File
(
filePath
),
"utf-8"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
int
fsize
=
d3InfosList
.
size
();
log
.
info
(
"d3InfosList读取文件: {} , 大小: {} , 耗时: {} "
,
filePath
,
fsize
,
(
System
.
currentTimeMillis
()-
starUtc
));
RepaymentLoanInfoLog
bean3
=
new
RepaymentLoanInfoLog
();
bean3
.
setUpdatedAt
(
Timestamp
.
valueOf
(
"2011-05-09 11:48:00"
));
logBeanList
.
add
(
bean3
);
Collections
.
sort
(
logBeanList
,
new
Comparator
<
RepaymentLoanInfoLog
>()
{
int
saveCount
=
0
;
public
int
compare
(
RepaymentLoanInfoLog
o1
,
RepaymentLoanInfoLog
o2
)
{
for
(
int
i
=
0
;
i
<
fsize
;
i
++){
// 按照学生的年龄进行降序排列
String
strJson
=
d3InfosList
.
get
(
i
);
if
(
o1
.
getUpdatedAt
().
getTime
()
>
o2
.
getUpdatedAt
().
getTime
())
{
try
{
return
-
1
;
if
(
strJson
.
length
()
<
30
){
//#singleLoanRepayInfo
}
log
.
warn
(
"d3InfosList筛选文件内容时发现数据错误, 文件: {} , 内容: {} "
,
filePath
,
strJson
);
if
(
o1
.
getUpdatedAt
().
getTime
()
==
o2
.
getUpdatedAt
().
getTime
())
{
continue
;
return
0
;
}
}
return
1
;
RepaymentInfoZhuDai
repaymentLoanInfo
=
new
Gson
().
fromJson
(
strJson
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
}
repaymentLoanInfoDbMapper
.
saveRepaymentLoanInfoLog
(
repaymentLoanInfo
);
});
System
.
out
.
println
(
JSON
.
toJSONString
(
logBeanList
));
repaymentLoanInfo
.
setReqID
(
repaymentLoanInfo
.
getRecordId
());
repaymentLoanInfo
.
setRecordId
(
null
);
this
.
wirteFile
(
writeFilePath
,
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
);
saveCount
++;
}
catch
(
Exception
e
){
log
.
error
(
"保存还款数据记录失败, fileName: {} , DATA: {} , 第i: {} "
,
filePath
,
strJson
,
i
,
e
);
}
//“本笔贷款状态”报送“3-结清”后,继续报送的还款记录中还款状态确认时间statusConfirmAt应早于等于结清时的还款状态确认时间。2017-03-10T00:00:00
log
.
info
(
"保存还款数据记录结束, 第i: {} <<<"
,
i
);
/* if(logBean_jq!=null){
}
if(repaymentLoanInfo.getTermNo() < logBean_jq.getTermNo()){*/
LocalDateTime
loca_new
=
LocalDateTime
.
parse
(
"2017-03-10T00:00:00"
);
//repaymentLoanInfo.getStatusConfirmAt()
LocalDateTime
loca_jq
=
LocalDateTime
.
parse
(
"2017-03-10T00:00:00"
);
//logBean_jq.getStatusConfirmAt()
if
(
loca_new
.
compareTo
(
loca_jq
)
>
0
)
{
String
statusConfirmAt_jq
=
loca_jq
.
format
(
formatter
);
System
.
out
.
println
(
statusConfirmAt_jq
);
//repaymentLoanInfo.setStatusConfirmAt(statusConfirmAt_jq);
//log.warn("查询比较两次报送数据不相同, 修改以M报送_且已经有结清的, filePath: {} , loanId: {} , termNo: {} , logBean: {} ", file_, loanId, termNo, JSON.toJSONString(logBean));
}
/* }
}*/
log
.
info
(
"All保存还款数据记录结束, 文件:{} ,list大小:{} , 保存成功:{} "
,
filePath
,
fsize
,
saveCount
);
}
}
}
}
src/main/java/cn/quantgroup/report/service/manualTool/ManualToolService.java
View file @
4ef9e937
...
@@ -3619,9 +3619,32 @@ public class ManualToolService implements CommonSuperService {
...
@@ -3619,9 +3619,32 @@ public class ManualToolService implements CommonSuperService {
}
}
public
static
void
main
(
String
[]
args
)
{
private
static
void
build_d3_reqId_20200604
(
String
filepath
,
String
readName
,
String
okName
)
{
try
{
List
<
String
>
d3JsonList_hk
=
FileUtils
.
readLines
(
new
File
(
filepath
+
readName
),
"utf-8"
);
log
.
info
(
"build_d3_reqId_20200604() read files jsonList_1 size:{} "
,
d3JsonList_hk
.
size
());
for
(
int
i
=
0
;
i
<
d3JsonList_hk
.
size
();
i
++){
String
jsonStr
=
d3JsonList_hk
.
get
(
i
).
trim
();
if
(
jsonStr
.
length
()<
30
){
continue
;
}
RepaymentInfoZhuDai
repaymentLoanInfo
=
new
Gson
().
fromJson
(
jsonStr
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
repaymentLoanInfo
.
setReqID
(
repaymentLoanInfo
.
getRecordId
());
repaymentLoanInfo
.
setRecordId
(
null
);
FileUtils
.
write
(
new
File
(
filepath
+
readName
),
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
,
"UTF-8"
,
true
);
}
log
.
info
(
"build_d3_reqId_20200604() All D3还款 LOG:保存记录结束"
);
}
catch
(
Exception
e
){
log
.
error
(
"build_d3_reqId_20200604()处理还款记录异常!"
,
e
);
}
}
public
static
void
main
(
String
[]
args
)
{
//d3_build_20200309();
//d3_build_20200309();
//d3_build_20200309_ok();
//d3_build_20200309_ok();
...
@@ -3637,6 +3660,7 @@ public class ManualToolService implements CommonSuperService {
...
@@ -3637,6 +3660,7 @@ public class ManualToolService implements CommonSuperService {
// bairong_ziduab_build();
// bairong_ziduab_build();
build_d3_reqId_20200604
(
"D:\\用户目录\\Downloads\\tmp_ok\\"
,
"all_D3_20191225_20200601_06_M.txt"
,
"all_D3_20191225_20200601_06_M_ok.txt"
);
}
}
...
...
src/main/resources/cn/quantgroup/report/mapper/baihang/RepaymentLoanInfoMapper.xml
View file @
4ef9e937
This diff is collapsed.
Click to expand it.
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