Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task3.0
Overview
Overview
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
首航-临时账号
task3.0
Commits
e6487870
Commit
e6487870
authored
Sep 23, 2019
by
zt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
594b5971
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
DbSoundsMonitorTask.java
src/main/java/com/foc/DbSoundsMonitorTask.java
+12
-10
SoundMonitorService.java
src/main/java/com/foc/service/SoundMonitorService.java
+1
-1
mybatis-config.xml
src/main/resources/mybatis-config.xml
+2
-2
No files found.
src/main/java/com/foc/DbSoundsMonitorTask.java
View file @
e6487870
...
@@ -12,8 +12,11 @@ import org.slf4j.Logger;
...
@@ -12,8 +12,11 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.time.Instant
;
import
java.time.ZoneId
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* @Author: lisu
* @Author: lisu
...
@@ -51,7 +54,9 @@ public class DbSoundsMonitorTask {
...
@@ -51,7 +54,9 @@ public class DbSoundsMonitorTask {
//查看定时任务最后同步时间
//查看定时任务最后同步时间
SoundMonitorService
.
init
();
SoundMonitorService
.
init
();
boolean
i
=
SoundMonitorService
.
test
();
boolean
i
=
SoundMonitorService
.
test
();
if
(
i
){
if
(!
i
){
log
.
info
(
"没有异常!"
);
}
//发送短信
//发送短信
AccessInfo
accessInfo
=
new
AccessInfo
();
AccessInfo
accessInfo
=
new
AccessInfo
();
accessInfo
.
setAicc
(
aicc
);
accessInfo
.
setAicc
(
aicc
);
...
@@ -61,22 +66,19 @@ public class DbSoundsMonitorTask {
...
@@ -61,22 +66,19 @@ public class DbSoundsMonitorTask {
//发送邮件
//发送邮件
String
emailResult
=
Email
.
sendEmail
(
"录音记录预警"
,
"智能首航录音记录显示异常,请处理。"
);
String
emailResult
=
Email
.
sendEmail
(
"录音记录预警"
,
"智能首航录音记录显示异常,请处理。"
);
EmailResult
emailResult1
=
JSON
.
parseObject
(
emailResult
,
EmailResult
.
class
);
EmailResult
emailResult1
=
JSON
.
parseObject
(
emailResult
,
EmailResult
.
class
);
//当前时间
Instant
now
=
Instant
.
now
().
plusMillis
(
TimeUnit
.
HOURS
.
toMillis
(
8
));
if
(
emailResult1
.
getResult
().
getResultCode
().
equals
(
resultCode
)){
if
(
emailResult1
.
getResult
().
getResultCode
().
equals
(
resultCode
)){
log
.
info
(
"邮件发送成功,Time:"
+
new
Date
()
+
"result:"
+
result
);
log
.
info
(
"邮件发送成功,Time:{},result:{}"
,
now
,
result
);
}
else
{
}
else
{
log
.
info
(
"邮件发送失败,Time:"
+
new
Date
()
+
"result:"
+
result
);
log
.
info
(
"邮件发送失败,Time:{},result:{}"
,
now
,
result
);
}
}
SmsResult
rootEntity
=
JSON
.
parseObject
(
result
,
SmsResult
.
class
);
SmsResult
rootEntity
=
JSON
.
parseObject
(
result
,
SmsResult
.
class
);
if
(
rootEntity
.
getResult
().
getResultCode
().
equals
(
resultCode
)){
if
(
rootEntity
.
getResult
().
getResultCode
().
equals
(
resultCode
)){
log
.
info
(
"短信发送成功,Time:"
+
new
Date
()
+
"result:"
+
result
);
log
.
info
(
"短信发送成功,Time:{},result:{}"
,
now
,
result
);
}
else
{
}
else
{
log
.
info
(
"短信发送失败,Time:"
+
new
Date
()
+
"result:"
+
result
);
log
.
info
(
"短信发送失败,Time:{},result:{}"
,
now
,
result
);
}
}
else
{
log
.
info
(
"没有异常!"
);
}
}
}
}
}
}
src/main/java/com/foc/service/SoundMonitorService.java
View file @
e6487870
...
@@ -64,7 +64,7 @@ public class SoundMonitorService {
...
@@ -64,7 +64,7 @@ public class SoundMonitorService {
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDateTime
ldt
=
LocalDateTime
.
parse
(
updateTime
,
df
);
LocalDateTime
ldt
=
LocalDateTime
.
parse
(
updateTime
,
df
);
if
(
DateUtils
.
until
(
ldt
)
>
Long
.
parseLong
(
interval
)){
if
(
DateUtils
.
until
(
ldt
)
>
Long
.
parseLong
(
interval
)){
log
.
info
(
"更新时间异常,与最新时间间隔大于20分钟,updateTime:
"
+
updateTime
)
;
log
.
info
(
"更新时间异常,与最新时间间隔大于20分钟,updateTime:
{}"
,
updateTime
)
;
return
true
;
return
true
;
}
}
...
...
src/main/resources/mybatis-config.xml
View file @
e6487870
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
<!-- 配置数据库连接信息 -->
<!-- 配置数据库连接信息 -->
<dataSource
type=
"POOLED"
>
<dataSource
type=
"POOLED"
>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<
!--<property name="url" value="jdbc:mysql://106.75.97.50:3306/jd_foc"/>--
>
<
property
name=
"url"
value=
"jdbc:mysql://106.75.97.50:3306/jd_foc"
/
>
<
property
name=
"url"
value=
"jdbc:mysql://mysql_server:3306/foc?useUnicode=true&characterEncoding=utf-8"
/
>
<
!--<property name="url" value="jdbc:mysql://mysql_server:3306/foc?useUnicode=true&characterEncoding=utf-8"/>--
>
<property
name=
"username"
value=
"focuser"
/>
<property
name=
"username"
value=
"focuser"
/>
<property
name=
"password"
value=
"FOC@2016"
/>
<property
name=
"password"
value=
"FOC@2016"
/>
</dataSource>
</dataSource>
...
...
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