Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
DQMP
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
DQMP
Commits
ae3ea969
Commit
ae3ea969
authored
Dec 25, 2019
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
da291251
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
88 additions
and
19 deletions
+88
-19
ScheduleConfig.java
src/main/java/com/gmei/data/dqmp/config/ScheduleConfig.java
+15
-0
CheckServiceImpl.java
...ava/com/gmei/data/dqmp/service/impl/CheckServiceImpl.java
+13
-6
DingdingServiceImpl.java
.../com/gmei/data/dqmp/service/impl/DingdingServiceImpl.java
+1
-0
MailServiceImpl.java
...java/com/gmei/data/dqmp/service/impl/MailServiceImpl.java
+1
-0
MonitorServiceImpl.java
...a/com/gmei/data/dqmp/service/impl/MonitorServiceImpl.java
+9
-6
CrontabUtils.java
src/main/java/com/gmei/data/dqmp/utils/CrontabUtils.java
+6
-6
jdbc.properties
src/main/resources/jdbc.properties
+2
-1
demo.html
src/main/resources/templates/static/demo.html
+41
-0
echarts.min.js
src/main/resources/templates/static/echarts.min.js
+0
-0
jquery-3.4.1.js
src/main/resources/templates/static/js/jquery-3.4.1.js
+0
-0
No files found.
src/main/java/com/gmei/data/dqmp/config/ScheduleConfig.java
0 → 100644
View file @
ae3ea969
package
com
.
gmei
.
data
.
dqmp
.
config
;
import
java.util.concurrent.Executors
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.SchedulingConfigurer
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
@Configuration
public
class
ScheduleConfig
implements
SchedulingConfigurer
{
@Override
public
void
configureTasks
(
ScheduledTaskRegistrar
taskRegistrar
)
{
taskRegistrar
.
setScheduler
(
Executors
.
newScheduledThreadPool
(
10
));
}
}
src/main/java/com/gmei/data/dqmp/service/impl/CheckServiceImpl.java
View file @
ae3ea969
...
@@ -3,6 +3,7 @@ package com.gmei.data.dqmp.service.impl;
...
@@ -3,6 +3,7 @@ package com.gmei.data.dqmp.service.impl;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -61,9 +62,10 @@ public class CheckServiceImpl implements CheckService {
...
@@ -61,9 +62,10 @@ public class CheckServiceImpl implements CheckService {
.
andCheckTypeEqualTo
(
checkType
)
.
andCheckTypeEqualTo
(
checkType
)
.
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
.
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
List
<
TblSqlCheckSingle
>
sqlList
=
tblSqlCheckSingleMapper
.
selectByExampleWithBLOBs
(
tblCheckSingleSqlCriteria
);
List
<
TblSqlCheckSingle
>
sqlList
=
tblSqlCheckSingleMapper
.
selectByExampleWithBLOBs
(
tblCheckSingleSqlCriteria
);
Date
currentDate
=
new
Date
();
for
(
TblSqlCheckSingle
tblCheckSql
:
sqlList
)
{
for
(
TblSqlCheckSingle
tblCheckSql
:
sqlList
)
{
String
checkTime
=
tblCheckSql
.
getCheckTime
();
String
checkTime
=
tblCheckSql
.
getCheckTime
();
if
(!
CrontabUtils
.
isToRunByMinites
(
checkTime
))
{
if
(!
CrontabUtils
.
isToRunByMinites
(
c
urrentDate
,
c
heckTime
))
{
continue
;
continue
;
}
}
String
sql
=
tblCheckSql
.
getSqlContent
();
String
sql
=
tblCheckSql
.
getSqlContent
();
...
@@ -98,11 +100,14 @@ public class CheckServiceImpl implements CheckService {
...
@@ -98,11 +100,14 @@ public class CheckServiceImpl implements CheckService {
}
}
tblResultCheckUnblank
.
setSqlId
(
id
);
tblResultCheckUnblank
.
setSqlId
(
id
);
rs
=
tblResultCheckUnblankMapper
.
insert
(
tblResultCheckUnblank
);
rs
=
tblResultCheckUnblankMapper
.
insert
(
tblResultCheckUnblank
);
}
else
{
logger
.
error
(
"Check type is error: {}"
,
checkType
);
continue
;
}
}
if
(
rs
==
1
)
{
if
(
rs
==
1
)
{
logger
.
info
(
"Run success
: {}"
,
sql
);
logger
.
info
(
"Run success
!"
);
}
else
{
}
else
{
logger
.
error
(
"Run failed
: {}"
,
sql
);
logger
.
error
(
"Run failed
!"
);
}
}
}
}
}
}
...
@@ -118,9 +123,10 @@ public class CheckServiceImpl implements CheckService {
...
@@ -118,9 +123,10 @@ public class CheckServiceImpl implements CheckService {
.
andCheckTypeEqualTo
(
checkType
)
.
andCheckTypeEqualTo
(
checkType
)
.
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
.
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
List
<
TblSqlCheckDuplex
>
sqlList
=
tblSqlCheckDuplexMapper
.
selectByExampleWithBLOBs
(
tblCheckMultipleSqlCriteria
);
List
<
TblSqlCheckDuplex
>
sqlList
=
tblSqlCheckDuplexMapper
.
selectByExampleWithBLOBs
(
tblCheckMultipleSqlCriteria
);
Date
currentDate
=
new
Date
();
for
(
TblSqlCheckDuplex
tblCheckSql
:
sqlList
)
{
for
(
TblSqlCheckDuplex
tblCheckSql
:
sqlList
)
{
String
checkTime
=
tblCheckSql
.
getCheckTime
();
String
checkTime
=
tblCheckSql
.
getCheckTime
();
if
(!
CrontabUtils
.
isToRunByMinites
(
checkTime
))
{
if
(!
CrontabUtils
.
isToRunByMinites
(
c
urrentDate
,
c
heckTime
))
{
continue
;
continue
;
}
}
String
sql
=
tblCheckSql
.
getSqlContent
();
String
sql
=
tblCheckSql
.
getSqlContent
();
...
@@ -143,9 +149,9 @@ public class CheckServiceImpl implements CheckService {
...
@@ -143,9 +149,9 @@ public class CheckServiceImpl implements CheckService {
rs
=
tblResultCheckReferMapper
.
insert
(
referCheckResult
);
rs
=
tblResultCheckReferMapper
.
insert
(
referCheckResult
);
}
}
if
(
rs
==
1
)
{
if
(
rs
==
1
)
{
logger
.
info
(
"Run success
: {}"
,
sql
);
logger
.
info
(
"Run success
!"
);
}
else
{
}
else
{
logger
.
error
(
"Run failed
: {}"
,
sql
);
logger
.
error
(
"Run failed
!"
);
}
}
}
}
}
}
...
@@ -262,5 +268,6 @@ public class CheckServiceImpl implements CheckService {
...
@@ -262,5 +268,6 @@ public class CheckServiceImpl implements CheckService {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
sql
=
""
;
}
}
}
}
src/main/java/com/gmei/data/dqmp/service/impl/DingdingServiceImpl.java
View file @
ae3ea969
...
@@ -33,6 +33,7 @@ public class DingdingServiceImpl implements DingdingService {
...
@@ -33,6 +33,7 @@ public class DingdingServiceImpl implements DingdingService {
*/
*/
@Override
@Override
public
Boolean
sendMsgToDingding
(
String
msg
)
{
public
Boolean
sendMsgToDingding
(
String
msg
)
{
msg
=
"数据质量监控预警触发,具体参数信息如下:\n"
+
msg
;
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"msgtype"
,
"text"
);
jsonObject
.
put
(
"msgtype"
,
"text"
);
JSONObject
jo
=
new
JSONObject
();
JSONObject
jo
=
new
JSONObject
();
...
...
src/main/java/com/gmei/data/dqmp/service/impl/MailServiceImpl.java
View file @
ae3ea969
...
@@ -26,6 +26,7 @@ public class MailServiceImpl implements MailService{
...
@@ -26,6 +26,7 @@ public class MailServiceImpl implements MailService{
@Override
@Override
public
void
sendSimpleMail
(
String
content
)
{
public
void
sendSimpleMail
(
String
content
)
{
content
=
"数据质量监控预警触发,具体参数信息如下:\n"
+
content
;
SimpleMailMessage
message
=
new
SimpleMailMessage
();
SimpleMailMessage
message
=
new
SimpleMailMessage
();
message
.
setFrom
(
from
);
message
.
setFrom
(
from
);
message
.
setTo
(
to
);
message
.
setTo
(
to
);
...
...
src/main/java/com/gmei/data/dqmp/service/impl/MonitorServiceImpl.java
View file @
ae3ea969
...
@@ -3,6 +3,7 @@ package com.gmei.data.dqmp.service.impl;
...
@@ -3,6 +3,7 @@ package com.gmei.data.dqmp.service.impl;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -58,9 +59,10 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -58,9 +59,10 @@ public class MonitorServiceImpl implements MonitorService {
tblmonitorVolatilitySqlCriteria
.
createCriteria
().
andIndicatorTypeEqualTo
(
indicatorType
).
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
tblmonitorVolatilitySqlCriteria
.
createCriteria
().
andIndicatorTypeEqualTo
(
indicatorType
).
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
List
<
TblSqlMonitorVolatility
>
sqlList
=
tblSqlMonitorVolatilityMapper
List
<
TblSqlMonitorVolatility
>
sqlList
=
tblSqlMonitorVolatilityMapper
.
selectByExampleWithBLOBs
(
tblmonitorVolatilitySqlCriteria
);
.
selectByExampleWithBLOBs
(
tblmonitorVolatilitySqlCriteria
);
Date
currentDate
=
new
Date
();
for
(
TblSqlMonitorVolatility
tblCheckSql
:
sqlList
)
{
for
(
TblSqlMonitorVolatility
tblCheckSql
:
sqlList
)
{
String
checkTime
=
tblCheckSql
.
getCheckTime
();
String
checkTime
=
tblCheckSql
.
getCheckTime
();
if
(!
CrontabUtils
.
isToRunByMinites
(
checkTime
))
{
if
(!
CrontabUtils
.
isToRunByMinites
(
c
urrentDate
,
c
heckTime
))
{
continue
;
continue
;
}
}
String
sql
=
tblCheckSql
.
getSqlContent
();
String
sql
=
tblCheckSql
.
getSqlContent
();
...
@@ -81,9 +83,9 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -81,9 +83,9 @@ public class MonitorServiceImpl implements MonitorService {
tblResultMonitorVolatility
.
setSqlId
(
id
);
tblResultMonitorVolatility
.
setSqlId
(
id
);
rs
=
tblResultMonitorVolatilityMapper
.
insert
(
tblResultMonitorVolatility
);
rs
=
tblResultMonitorVolatilityMapper
.
insert
(
tblResultMonitorVolatility
);
if
(
rs
==
1
)
{
if
(
rs
==
1
)
{
logger
.
info
(
"Run success
: {}"
,
sql
);
logger
.
info
(
"Run success
!"
);
}
else
{
}
else
{
logger
.
error
(
"Run failed
: {}"
,
sql
);
logger
.
error
(
"Run failed
!"
);
}
}
}
}
}
}
...
@@ -97,9 +99,10 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -97,9 +99,10 @@ public class MonitorServiceImpl implements MonitorService {
TblSqlMonitorSpecialCriteria
tblMonitorSpecialSqlCriteria
=
new
TblSqlMonitorSpecialCriteria
();
TblSqlMonitorSpecialCriteria
tblMonitorSpecialSqlCriteria
=
new
TblSqlMonitorSpecialCriteria
();
tblMonitorSpecialSqlCriteria
.
createCriteria
().
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
tblMonitorSpecialSqlCriteria
.
createCriteria
().
andIsValidEqualTo
(
Constants
.
IS_VALID_ON
);
List
<
TblSqlMonitorSpecial
>
sqlList
=
tblSqlMonitorSpecialMapper
.
selectByExampleWithBLOBs
(
tblMonitorSpecialSqlCriteria
);
List
<
TblSqlMonitorSpecial
>
sqlList
=
tblSqlMonitorSpecialMapper
.
selectByExampleWithBLOBs
(
tblMonitorSpecialSqlCriteria
);
Date
currentDate
=
new
Date
();
for
(
TblSqlMonitorSpecial
tblCheckSql
:
sqlList
)
{
for
(
TblSqlMonitorSpecial
tblCheckSql
:
sqlList
)
{
String
checkTime
=
tblCheckSql
.
getCheckTime
();
String
checkTime
=
tblCheckSql
.
getCheckTime
();
if
(!
CrontabUtils
.
isToRunByMinites
(
checkTime
))
{
if
(!
CrontabUtils
.
isToRunByMinites
(
c
urrentDate
,
c
heckTime
))
{
continue
;
continue
;
}
}
String
sql
=
tblCheckSql
.
getSqlContent
();
String
sql
=
tblCheckSql
.
getSqlContent
();
...
@@ -120,9 +123,9 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -120,9 +123,9 @@ public class MonitorServiceImpl implements MonitorService {
tblResultMonitorSpecial
.
setSqlId
(
id
);
tblResultMonitorSpecial
.
setSqlId
(
id
);
rs
=
tblResultMonitorSpecialMapper
.
insert
(
tblResultMonitorSpecial
);
rs
=
tblResultMonitorSpecialMapper
.
insert
(
tblResultMonitorSpecial
);
if
(
rs
==
1
)
{
if
(
rs
==
1
)
{
logger
.
info
(
"Run success
: {}"
,
sql
);
logger
.
info
(
"Run success
!"
);
}
else
{
}
else
{
logger
.
error
(
"Run failed
: {}"
,
sql
);
logger
.
error
(
"Run failed
!"
);
}
}
}
}
}
}
...
...
src/main/java/com/gmei/data/dqmp/utils/CrontabUtils.java
View file @
ae3ea969
...
@@ -16,9 +16,8 @@ public class CrontabUtils {
...
@@ -16,9 +16,8 @@ public class CrontabUtils {
* @param crontabStr
* @param crontabStr
* @return
* @return
*/
*/
public
static
boolean
isToRunByTimeRange
(
String
crontabStr
)
{
public
static
boolean
isToRunByTimeRange
(
Date
currentDate
,
String
crontabStr
)
{
boolean
rs
=
false
;
boolean
rs
=
false
;
Date
currentDate
=
new
Date
();
long
currentDateMilliseconds
=
currentDate
.
getTime
();
long
currentDateMilliseconds
=
currentDate
.
getTime
();
CronExpression
expression
=
null
;
CronExpression
expression
=
null
;
try
{
try
{
...
@@ -42,11 +41,10 @@ public class CrontabUtils {
...
@@ -42,11 +41,10 @@ public class CrontabUtils {
* @param crontabStr
* @param crontabStr
* @return
* @return
*/
*/
public
static
boolean
isToRunByMinites
(
String
crontabStr
)
{
public
static
boolean
isToRunByMinites
(
Date
currentDate
,
String
crontabStr
)
{
boolean
rs
=
false
;
boolean
rs
=
false
;
try
{
try
{
CronExpression
expression
=
new
CronExpression
(
crontabStr
);
CronExpression
expression
=
new
CronExpression
(
crontabStr
);
Date
currentDate
=
new
Date
();
rs
=
expression
.
isSatisfiedBy
(
currentDate
);
rs
=
expression
.
isSatisfiedBy
(
currentDate
);
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
logger
.
error
(
"Fail to parse cron express"
,
e
);
logger
.
error
(
"Fail to parse cron express"
,
e
);
...
@@ -57,7 +55,9 @@ public class CrontabUtils {
...
@@ -57,7 +55,9 @@ public class CrontabUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
isToRunByTimeRange
(
"0 0 12 25 * ?"
));
Date
currentDate
=
new
Date
();
System
.
out
.
println
(
isToRunByMinites
(
"* 57 10 25 * ?"
));
System
.
out
.
println
(
isToRunByTimeRange
(
currentDate
,
"0 0 12 25 * ?"
));
System
.
out
.
println
(
isToRunByMinites
(
currentDate
,
"* 57 10 25 * ?"
));
System
.
out
.
println
(
isToRunByMinites
(
currentDate
,
"* 50 11 ? * WED"
));
}
}
}
}
src/main/resources/jdbc.properties
View file @
ae3ea969
#base
#base
driverClassName
=
org.apache.hive.jdbc.HiveDriver
driverClassName
=
org.apache.hive.jdbc.HiveDriver
url
=
jdbc:hive2://152.136.57.57:10010
#url=jdbc:hive2://152.136.57.57:10010
url
=
jdbc:hive2://bj-gm-prod-cos-datacenter007:10010
username
=
data
username
=
data
password
=
password
=
...
...
src/main/resources/templates/static/demo.html
0 → 100644
View file @
ae3ea969
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
ECharts
</title>
<!-- 引入 echarts.js -->
<script
src=
"echarts.min.js"
></script>
</head>
<body>
123
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div
id=
"main"
style=
"width: 600px;height:400px;"
></div>
<script
type=
"text/javascript"
>
// 基于准备好的dom,初始化echarts实例
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'main'
));
// 指定图表的配置项和数据
var
option
=
{
title
:
{
text
:
'ECharts 入门示例'
},
tooltip
:
{},
legend
:
{
data
:[
'销量'
]
},
xAxis
:
{
data
:
[
"衬衫"
,
"羊毛衫"
,
"雪纺衫"
,
"裤子"
,
"高跟鞋"
,
"袜子"
]
},
yAxis
:
{},
series
:
[{
name
:
'销量'
,
type
:
'bar'
,
data
:
[
5
,
20
,
36
,
10
,
10
,
20
]
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart
.
setOption
(
option
);
</script>
</body>
</html>
src/main/resources/templates/static/echarts.min.js
0 → 100644
View file @
ae3ea969
This diff is collapsed.
Click to expand it.
src/main/resources/templates/static/js/jquery-3.4.1.js
0 → 100644
View file @
ae3ea969
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