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
3824b779
Commit
3824b779
authored
Nov 15, 2019
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据同步修改,增加钉钉报警
parent
6d785121
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
315 additions
and
58 deletions
+315
-58
BaiHangHistoryConstant.java
...cn/quantgroup/report/constant/BaiHangHistoryConstant.java
+9
-6
LoanApplicationManifestHistoryTask.java
...tgroup/report/job/LoanApplicationManifestHistoryTask.java
+92
-50
ManualToolService.java
...antgroup/report/service/manualTool/ManualToolService.java
+64
-2
DingTalk.java
...in/java/cn/quantgroup/report/utils/dingtalk/DingTalk.java
+103
-0
QgException.java
...java/cn/quantgroup/report/utils/dingtalk/QgException.java
+47
-0
No files found.
src/main/java/cn/quantgroup/report/constant/BaiHangHistoryConstant.java
View file @
3824b779
...
...
@@ -19,7 +19,7 @@ package cn.quantgroup.report.constant;/**
*/
public
class
BaiHangHistoryConstant
{
public
static
final
int
MAX_COMMIT_COUT
=
2
0
000
;
//大于2万条会出现事务提交过长报错
public
static
final
int
MAX_COMMIT_COUT
=
2
4
000
;
//大于2万条会出现事务提交过长报错
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY
=
"INSERT xyqb_i_loan_a_m_history_bak "
+
" select * from xyqb_i_loan_application_manifest_history b "
+
...
...
@@ -39,20 +39,23 @@ public class BaiHangHistoryConstant {
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY_BAK_MAX_ID
=
"select MAX(b.id) as bakMaxId from xyqb_i_loan_a_m_history_bak b; "
;
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY_MAX_ID
=
" select MAX(b2.id) from xyqb_i_loan_application_manifest_history b2 "
+
" where b2.funding_corp_id in (420,520,580,650,670,810,240,640,700) "
;
//借款清单表xyqb_i_loan_application_manifest_history
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY_SYN_COUNT
=
"select count(b.id) from xyqb_i_loan_application_manifest_history b "
+
" where b.funding_corp_id in (420,520,580,650,670,810,240,640,700) "
+
" and b.id > ##BAKMAXID## ;"
;
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY_SYN_DATA
=
"
INSERT xyqb_i_loan_a_m_history_bak "
+
" and b.id > ##BAKMAXID##
AND b.id <= ##NEWMAXID##
;"
;
public
static
final
String
SQL_COMMONE_TEMPLATE_HISTORY_SYN_DATA
=
"
REPLACE INTO xyqb_i_loan_a_m_history_bak "
+
//"INSERT xyqb_i_loan_a_m_history_bak "
" select b.* from xyqb_i_loan_application_manifest_history b "
+
" where b.funding_corp_id in (420,520,580,650,670,810,240,640,700) "
+
" and b.id > ##STARTID## "
;
//AND b.id <= ##ENDID##
//还款计划表还款计划表xyqb_i_repayment_plan
public
static
final
String
SQL_COMMONE_TEMPLATE_PLAN_SYN_COUNT
=
"select count(a.id) from xyqb_i_repayment_plan a "
+
" join xyqb_i_loan_a_m_history_bak b on a.loan_application_history_id = b.loan_application_history_id "
+
" where b.id > ##BAKMAXID##;"
;
public
static
final
String
SQL_COMMONE_TEMPLATE_PLAN_SYN_DATA
=
"
INSERT xyqb_i_repayment_plan_bak "
+
" where b.id > ##BAKMAXID##
AND b.id <= ##NEWMAXID##
;"
;
public
static
final
String
SQL_COMMONE_TEMPLATE_PLAN_SYN_DATA
=
"
REPLACE INTO xyqb_i_repayment_plan_bak "
+
//"INSERT xyqb_i_repayment_plan_bak "
"select a.* from xyqb_i_repayment_plan a "
+
" join xyqb_i_loan_a_m_history_bak b on a.loan_application_history_id = b.loan_application_history_id "
+
" where b.id > ##STARTID## "
;
//AND b.id <= ##ENDID##
...
...
src/main/java/cn/quantgroup/report/job/LoanApplicationManifestHistoryTask.java
View file @
3824b779
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/report/service/manualTool/ManualToolService.java
View file @
3824b779
...
...
@@ -767,7 +767,7 @@ public class ManualToolService implements CommonSuperService {
public
static
void
writeLog
(
String
msg
)
{
System
.
out
.
println
(
msg
);
try
{
String
fileName
=
"D:\\
用户目录\\Downloads
\\out_log.txt"
;
String
fileName
=
"D:\\
JavaTeam\\D3_build
\\out_log.txt"
;
FileUtils
.
write
(
new
File
(
fileName
),
msg
+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
@@ -933,6 +933,66 @@ public class ManualToolService implements CommonSuperService {
System
.
err
.
println
(
"build data finTechAgencyBusiness end."
);
}
public
static
void
buildD3_logicerror
()
{
List
<
String
>
logicerrorList
=
ReadOrWriteTxt
.
readTxtList
(
"D:\\JavaTeam\\D3_build\\d3_041_errData.txt"
);
Map
<
String
,
String
>
err_log_loanIdMap
=
new
HashMap
<>(
logicerrorList
.
size
());
for
(
String
strs
:
logicerrorList
){
String
[]
tmpArr
=
strs
.
split
(
"[|]"
);
err_log_loanIdMap
.
put
(
tmpArr
[
1
],
strs
);
}
System
.
out
.
println
(
"err_log_loanIdMap 大小:"
+
err_log_loanIdMap
.
size
());
List
<
String
>
lineList
=
ReadOrWriteTxt
.
readTxtList
(
"D:\\JavaTeam\\D3_build\\D3_04.txt"
);
System
.
out
.
println
(
"lineList:"
+
lineList
.
size
());
String
fileName
=
"D:\\JavaTeam\\D3_build\\new_D3_04.txt"
;
int
totalCount
=
0
,
removeCount
=
0
;
for
(
int
i
=
0
;
i
<
lineList
.
size
();
i
++){
System
.
out
.
println
(
"START:"
+
i
);
String
str
=
lineList
.
get
(
i
);
if
(
str
.
length
()
<
30
){
//#applyInfo #singleLoanAccountInfo
continue
;
}
RepaymentInfoZhuDai
repaymentLoanInfo
=
new
Gson
().
fromJson
(
str
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
String
loanId
=
repaymentLoanInfo
.
getLoanId
();
if
(
err_log_loanIdMap
.
containsKey
(
loanId
)){
//2|100011189|9|2019-02-22T00:00:00|
String
[]
errMsgArr
=
err_log_loanIdMap
.
get
(
loanId
).
split
(
"[|]"
);
if
(
repaymentLoanInfo
.
getTermNo
()==
Integer
.
parseInt
(
errMsgArr
[
2
])
&&
repaymentLoanInfo
.
getStatusConfirmAt
().
equals
(
errMsgArr
[
3
])){
if
(
repaymentLoanInfo
.
getRealRepayment
()==
null
||
repaymentLoanInfo
.
getRealRepayment
().
intValue
()==
0
){
if
(
repaymentLoanInfo
.
getRealRepaymentDate
()==
null
||
repaymentLoanInfo
.
getRealRepaymentDate
().
equals
(
""
)){
writeLog
(
JSON
.
toJSONString
(
repaymentLoanInfo
));
removeCount
++;
continue
;
}
}
}
}
try
{
FileUtils
.
write
(
new
File
(
fileName
),
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"build D3 data,"
+
e
);
}
totalCount
++;
}
System
.
out
.
println
(
"build D3 end, lineList="
+
lineList
.
size
()+
",totalCount="
+
totalCount
+
",removeCount="
+
removeCount
+
", 合="
+(
totalCount
+
removeCount
));
}
public
static
void
main
(
String
[]
args
)
{
// List<String> lineList = ReadOrWriteTxt.readTxtList("D:\\用户目录\\Downloads\\D2_M_01.txt");
// System.out.println("lineList:"+lineList.size());
...
...
@@ -950,7 +1010,9 @@ public class ManualToolService implements CommonSuperService {
//buildD2_inputerror();
buildD2_logicerror
();
// buildD2_logicerror();
buildD3_logicerror
();
}
}
src/main/java/cn/quantgroup/report/utils/dingtalk/DingTalk.java
0 → 100644
View file @
3824b779
package
cn
.
quantgroup
.
report
.
utils
.
dingtalk
;
import
cn.quantgroup.report.service.http.IHttpService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author :dongjianhua
* @date :Created in 2019/11/1 10:34
* @description:钉钉提醒
* @modified By:
* @version: 1.0
*/
@Component
@Slf4j
public
class
DingTalk
{
@Autowired
private
IHttpService
iHttpService
;
public
static
final
String
talkUri
=
"https://alertserv-dataservice.quantgroup.cn/common/alert/dingtalk"
;
public
static
final
String
webHook
=
"https://oapi.dingtalk.com/robot/send?access_token=ef3cafb299ec6cb7442b2795d4d0c48e940756f7f267cfa895dbb419adb00128"
;
@Async
public
void
talk
(
String
alarmLevel
,
String
msgTitle
,
String
msgContent
)
{
try
{
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"webhook"
,
webHook
);
param
.
put
(
"alarmLevel"
,
alarmLevel
);
//"Warn"
param
.
put
(
"msgTitle"
,
"量化派2百行:"
+
msgTitle
);
param
.
put
(
"msgContent"
,
msgContent
);
// param.put("toUsers", "15542661376,18612632691");
String
resp
=
iHttpService
.
post
(
talkUri
,
param
);
log
.
info
(
"钉钉报警接口调用结束, resp: {} "
,
resp
);
}
catch
(
Exception
e
){
log
.
warn
(
"钉钉报警接口调用异常! "
,
e
);
}
}
@Async
public
void
talk
(
String
alarmLevel
,
String
msgTitle
,
Exception
e
)
{
try
{
if
(
e
==
null
)
{
return
;
}
StringWriter
sw
=
new
StringWriter
();
e
.
printStackTrace
(
new
PrintWriter
(
sw
));
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"webhook"
,
webHook
);
param
.
put
(
"alarmLevel"
,
alarmLevel
);
//"Warn"
param
.
put
(
"msgTitle"
,
"量化派2百行:"
+
msgTitle
);
param
.
put
(
"msgContent"
,
sw
.
toString
().
length
()
>
500
?
sw
.
toString
().
substring
(
0
,
499
)
:
sw
.
toString
());
// param.put("toUsers", "15542661376,18612632691");
String
resp
=
iHttpService
.
post
(
talkUri
,
param
);
log
.
info
(
"测试钉钉报警接口结果!resp:{}"
,
resp
);
log
.
info
(
"钉钉报警接口调用结束, resp: {} "
,
resp
);
}
catch
(
Exception
e2
){
log
.
warn
(
"钉钉报警接口调用异常! "
,
e2
);
}
}
@Async
public
void
talk_ToUser
(
String
msgContent
)
{
try
{
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"webhook"
,
webHook
);
param
.
put
(
"alarmLevel"
,
"ERROE"
);
//
param
.
put
(
"msgTitle"
,
"量化派2百行:数据同步失败"
);
param
.
put
(
"msgContent"
,
msgContent
);
param
.
put
(
"toUsers"
,
"18010105506"
);
String
resp
=
iHttpService
.
post
(
talkUri
,
param
);
log
.
info
(
"钉钉报警接口调用结束, resp: {} "
,
resp
);
}
catch
(
Exception
e
){
log
.
warn
(
"钉钉报警接口调用异常! "
,
e
);
}
}
@Async
public
void
talk
(
String
alarmLevel
,
String
msgTitle
,
QgException
e
)
{
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"webhook"
,
webHook
);
param
.
put
(
"alarmLevel"
,
alarmLevel
);
//"Warn"
param
.
put
(
"msgTitle"
,
"量化派2百行:"
+
msgTitle
);
param
.
put
(
"msgContent"
,
exceptionToString
(
e
));
// param.put("toUsers", "15542661376,18612632691");
String
resp
=
iHttpService
.
post
(
talkUri
,
param
);
log
.
info
(
"测试钉钉报警接口结果!resp:{}"
,
resp
);
}
public
String
exceptionToString
(
QgException
e
)
{
return
new
StringBuffer
()
.
append
(
e
.
alarm
)
.
append
(
":"
)
.
append
(
e
.
message
==
null
?
""
:
(
e
.
message
.
length
()
>
500
?
e
.
message
.
substring
(
0
,
499
)
:
e
.
message
)).
toString
();
}
}
src/main/java/cn/quantgroup/report/utils/dingtalk/QgException.java
0 → 100644
View file @
3824b779
package
cn
.
quantgroup
.
report
.
utils
.
dingtalk
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
/**
* @author :dongjianhua
* @date :Created in 2019/11/4 10:38
* @description:异常类
* @modified By:
* @version: 1.0
*/
public
class
QgException
extends
RuntimeException
{
//提醒标题
public
String
alarm
;
//堆栈信息 或者报错信息
public
String
message
;
public
QgException
(
String
exMsg
)
{
alarm
=
exMsg
;
}
public
QgException
(
String
exMsg
,
String
message
)
{
super
(
message
,
null
);
alarm
=
exMsg
;
this
.
message
=
message
;
}
public
QgException
(
String
exMsg
,
Exception
e
)
{
super
(
e
);
alarm
=
exMsg
;
message
=
getStackTrace
(
e
);
}
public
static
String
getStackTrace
(
Throwable
t
)
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
try
{
t
.
printStackTrace
(
pw
);
return
sw
.
toString
();
}
finally
{
pw
.
close
();
}
}
}
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