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
af50b376
Commit
af50b376
authored
Sep 25, 2019
by
zt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
d9329eb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
30 deletions
+41
-30
SoundMonitorService.java
src/main/java/com/foc/service/SoundMonitorService.java
+40
-29
mybatis-config.xml
src/main/resources/mybatis-config.xml
+1
-1
No files found.
src/main/java/com/foc/service/SoundMonitorService.java
View file @
af50b376
...
...
@@ -62,9 +62,13 @@ public class SoundMonitorService {
SoundsMaxIdDao
soundsMaxIdDao
=
session
.
getMapper
(
SoundsMaxIdDao
.
class
);
//检查ip锁数据库
List
<
String
>
blackIpList
=
soundsMaxIdDao
.
getBlackIpList
();
blackIpList
.
forEach
(
(
blackIp
)
->
soundsMaxIdDao
.
deleteBlackIp
(
blackIp
)
);
session
.
commit
();
if
(
blackIpList
!=
null
){
blackIpList
.
forEach
(
(
blackIp
)
->{
soundsMaxIdDao
.
deleteBlackIp
(
blackIp
);
log
.
info
(
"删除的ip地址有:{}"
,
blackIp
);
session
.
commit
();
});
}
SoundsMaxId
maxId
=
soundsMaxIdDao
.
getMaxId
();
String
updateTime
=
maxId
.
getUpdateDate
();
Date
date
=
new
Date
();
...
...
@@ -126,19 +130,7 @@ public class SoundMonitorService {
FocSmsEmailRecord
focSmsEmailRecord
=
soundsMaxIdDao
.
selectLatestOne
();
Date
currentTime
=
focSmsEmailRecord
.
getCreateTime
();
boolean
smsFlag
;
Date
smsSendTime
=
focSendSmsRecord
.
getSmsSendTime
();
if
(
smsSendTime
==
null
){
smsFlag
=
true
;
}
else
{
//判断是否超过了一小时
long
second
=
currentTime
.
getTime
()-
smsSendTime
.
getTime
()/
1000
;
if
(
second
/
360
<
1
){
smsFlag
=
true
;
}
else
{
smsFlag
=
false
;
}
}
boolean
smsFlag
=
checkSmsFlag
(
focSendSmsRecord
,
currentTime
);
if
(
smsFlag
){
//发送短信
String
smsResult
=
Sms
.
sendSms
(
accessInfo
,
mobile
,
"预警:智能首航录音记录显示异常,请处理。"
);
...
...
@@ -159,19 +151,7 @@ public class SoundMonitorService {
}
}
boolean
emailFlag
;
Date
emailSendTime
=
focSendEmailRecord
.
getEmailSendTime
();
if
(
emailSendTime
==
null
){
emailFlag
=
true
;
}
else
{
//判断是否超过了一小时
long
emailSecond
=
currentTime
.
getTime
()-
emailSendTime
.
getTime
()/
1000
;
if
(
emailSecond
/
360
<
1
){
emailFlag
=
true
;
}
else
{
emailFlag
=
false
;
}
}
boolean
emailFlag
=
checkEmailFlag
(
focSendEmailRecord
,
currentTime
);
if
(
emailFlag
){
//发送邮件
String
emailResult
=
Email
.
sendEmail
(
"录音记录预警"
,
"智能首航录音记录显示异常,请处理。"
);
...
...
@@ -192,4 +172,35 @@ public class SoundMonitorService {
}
}
}
private
static
boolean
checkEmailFlag
(
FocSmsEmailRecord
focSendEmailRecord
,
Date
currentTime
)
{
Date
emailSendTime
=
focSendEmailRecord
.
getEmailSendTime
();
if
(
emailSendTime
==
null
){
return
true
;
}
else
{
//判断是否超过了一小时
long
emailSecond
=
(
currentTime
.
getTime
()-
emailSendTime
.
getTime
())/
1000
;
if
(
emailSecond
/
3600
>
1
){
return
true
;
}
else
{
return
false
;
}
}
}
private
static
boolean
checkSmsFlag
(
FocSmsEmailRecord
focSendSmsRecord
,
Date
currentTime
)
{
Date
smsSendTime
=
focSendSmsRecord
.
getSmsSendTime
();
if
(
smsSendTime
==
null
){
return
true
;
}
else
{
//判断是否超过了一小时
long
second
=
(
currentTime
.
getTime
()
-
smsSendTime
.
getTime
())/
1000
;
log
.
info
(
"{}"
,
second
);
if
(
second
/
3600
>
1
){
return
true
;
}
else
{
return
false
;
}
}
}
}
src/main/resources/mybatis-config.xml
View file @
af50b376
...
...
@@ -46,7 +46,7 @@
<!-- 配置数据库连接信息 -->
<dataSource
type=
"POOLED"
>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<property
name=
"url"
value=
"jdbc:mysql://106.75.97.50:3306/jd_foc?useUnicode=true&characterEncoding=utf-8"
/>
<property
name=
"url"
value=
"jdbc:mysql://106.75.97.50:3306/jd_foc?
serverTimezone=CTT&
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=
"password"
value=
"FOC@2016"
/>
...
...
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