Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hzjtpushdateService
Project overview
Project overview
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
建金
hzjtpushdateService
Commits
26e5f214
Commit
26e5f214
authored
Jun 24, 2021
by
yzm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复时区相差8小时问题
parent
33ecd994
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
163 deletions
+120
-163
pom.xml
pom.xml
+20
-5
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+38
-33
src/main/java/com/hzjt/domain/Traffalarmrecord.java
src/main/java/com/hzjt/domain/Traffalarmrecord.java
+3
-2
src/main/java/com/hzjt/redis/Receiver.java
src/main/java/com/hzjt/redis/Receiver.java
+2
-2
src/main/java/com/hzjt/service/EventWriteService.java
src/main/java/com/hzjt/service/EventWriteService.java
+2
-2
src/main/java/com/hzjt/util/DateUtils.java
src/main/java/com/hzjt/util/DateUtils.java
+40
-105
src/main/resources/application.properties
src/main/resources/application.properties
+13
-11
src/main/resources/mapper/Traffalarmrecord.xml
src/main/resources/mapper/Traffalarmrecord.xml
+2
-3
No files found.
pom.xml
View file @
26e5f214
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
hzjt
</name>
<name>
hzjt
</name>
<description>
Demo project for Spring Boot
</description>
<parent>
<parent>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -29,6 +28,8 @@
...
@@ -29,6 +28,8 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
@@ -148,12 +149,26 @@
...
@@ -148,12 +149,26 @@
<artifactId>
commons-io
</artifactId>
<artifactId>
commons-io
</artifactId>
<version>
2.6
</version>
<version>
2.6
</version>
</dependency>
</dependency>
<!--<dependency>-->
<!--<groupId>com.fasterxml.jackson.datatype</groupId>-->
<!--<artifactId>jackson-datatype-joda</artifactId>-->
<!--<version>2.9.6</version>-->
<!--</dependency>-->
<dependency>
<dependency>
<groupId>
com.fasterxml.jackson.datatype
</groupId>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-datatype-joda
</artifactId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.9.6
</version>
<exclusions>
<exclusion>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
<version>
2.9.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
commons-dbcp
</groupId>
<groupId>
commons-dbcp
</groupId>
<artifactId>
commons-dbcp
</artifactId>
<artifactId>
commons-dbcp
</artifactId>
...
...
src/main/java/com/hzjt/controller/TraffController.java
View file @
26e5f214
...
@@ -95,6 +95,7 @@ public class TraffController {
...
@@ -95,6 +95,7 @@ public class TraffController {
@Autowired
@Autowired
FLVCacheService
flvCacheService
;
FLVCacheService
flvCacheService
;
Long
eightHour
=
25200000L
;
// @Autowired
// @Autowired
// private SimpMessagingTemplate template;
// private SimpMessagingTemplate template;
...
@@ -127,11 +128,9 @@ public class TraffController {
...
@@ -127,11 +128,9 @@ public class TraffController {
*/
*/
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
System
.
out
.
println
(
DateUtils
.
formatDate
(
new
Date
(
Long
.
valueOf
(
"1624331555000"
))));
//查询素有videowbbh
//查询素有videowbbh
List
<
String
>
sbbhlist
=
sbtdspsrMapper
.
selectAllWbbh
();
List
<
String
>
sbbhlist
=
sbtdspsrMapper
.
selectAllWbbh
();
mQTTSubsribe
.
subscribe
(
sbbhlist
);
mQTTSubsribe
.
subscribe
(
sbbhlist
);
}
}
@PostMapping
(
"/alarmevent"
)
@PostMapping
(
"/alarmevent"
)
...
@@ -148,6 +147,19 @@ public class TraffController {
...
@@ -148,6 +147,19 @@ public class TraffController {
log
.
info
(
"incident_type值不能为空"
+
trffClientMessage
.
toString
());
log
.
info
(
"incident_type值不能为空"
+
trffClientMessage
.
toString
());
return
ResultObj
.
error
(
ResponseEnum
.
E_1004
.
getCode
(),
"incident_type值不能为空"
);
return
ResultObj
.
error
(
ResponseEnum
.
E_1004
.
getCode
(),
"incident_type值不能为空"
);
}
}
//加8个小时兼容算法
log
.
info
(
"trffClientMessage ts===="
+
trffClientMessage
.
getTs
());
log
.
info
(
"trffClientMessage nowtime======="
+
new
Date
().
getTime
());
Long
current
=
new
Date
().
getTime
()-
Long
.
valueOf
(
trffClientMessage
.
getTs
());
log
.
info
(
"current.longValue()>=eightHour.longValue()======"
+(
current
.
longValue
()>=
eightHour
.
longValue
()));
if
(
current
.
longValue
()>=
eightHour
.
longValue
())
{
//系统时间小于8小时
Long
lontime
=
Long
.
valueOf
(
trffClientMessage
.
getTs
())+
28800000L
;
log
.
info
(
"trffClientMessage lontime====="
+
lontime
);
trffClientMessage
.
setTs
(
String
.
valueOf
(
lontime
));
}
String
videoId
=
trffClientMessage
.
getVideo_id
();
String
videoId
=
trffClientMessage
.
getVideo_id
();
if
(
StringUtils
.
isBlank
(
videoId
))
{
if
(
StringUtils
.
isBlank
(
videoId
))
{
...
@@ -205,44 +217,20 @@ public class TraffController {
...
@@ -205,44 +217,20 @@ public class TraffController {
Traffalarmrecord
traffAlarmRecord
=
new
Traffalarmrecord
();
Traffalarmrecord
traffAlarmRecord
=
new
Traffalarmrecord
();
traffAlarmRecord
.
setAreaid
(
Long
.
valueOf
(
trffClientMessage
.
getDept
()));
traffAlarmRecord
.
setAreaid
(
Long
.
valueOf
(
trffClientMessage
.
getDept
()));
traffAlarmRecord
.
setRecordtype
(
trffClientMessage
.
getIncident_type
().
toLowerCase
());
traffAlarmRecord
.
setRecordtype
(
trffClientMessage
.
getIncident_type
().
toLowerCase
());
traffAlarmRecord
.
setRecordtime
(
new
Date
(
Long
.
valueOf
(
trffClientMessage
.
getTs
(
))));
traffAlarmRecord
.
setRecordtime
(
DateUtils
.
getDateString
(
new
Date
(
Long
.
valueOf
(
trffClientMessage
.
getTs
()
))));
Integer
channelid
=
Integer
.
valueOf
(
0
);
Integer
channelid
=
Integer
.
valueOf
(
0
);
// if(trffClientMessage.getVideo_id().contains("_")&& trffClientMessage.getVideo_id().split("_").length == 2) {
// String[] videoIdArr = trffClientMessage.getVideo_id().split("_");
// traffAlarmRecord.setFdid(videoIdArr[0]);
// channelid = Integer.valueOf(videoIdArr[1]) + 1;
// }
// else{
traffAlarmRecord
.
setFdid
(
trffClientMessage
.
getVideo_id
());
traffAlarmRecord
.
setFdid
(
trffClientMessage
.
getVideo_id
());
channelid
=
0
;
channelid
=
0
;
// }
traffAlarmRecord
.
setChannelid
(
channelid
);
traffAlarmRecord
.
setChannelid
(
channelid
);
//判断是否在正检时间内
//int exists = traffAlarmRecordMapper.selectInChecktimeTraffAlarm(traffAlarmRecord);
// log.info("selectInChecktimeTraffAlarm" + exists);
//if (exists > 0) {
// return;
// }
traffAlarmRecord
.
setVideourlfrom
(
trffClientMessage
.
getVideo_record_url
());
traffAlarmRecord
.
setVideourlfrom
(
trffClientMessage
.
getVideo_record_url
());
traffAlarmRecord
.
setCreatetime
(
new
Date
(
));
traffAlarmRecord
.
setCreatetime
(
DateUtils
.
getDateString
(
new
Date
()
));
traffAlarmRecord
.
setObjlable
(
trffClientMessage
.
getObjLabel
());
traffAlarmRecord
.
setObjlable
(
trffClientMessage
.
getObjLabel
());
traffAlarmRecord
.
setPushstatus
(
9
);
//设置为未推送
traffAlarmRecord
.
setPushstatus
(
9
);
//设置为未推送
//// log.info("selectInworkRectifytimeTraffAlarm" + exists);
// if ((traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks_out_of_line") || traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks"))) {
//
// //支持对某一个点位报施工事件后 倒推RECTIFYTIME 查看是否是施工事件 一段时间(时间可以配置)之前的停车事件和行人闯入事件矫正为施工事件
// exists = traffAlarmRecordMapper.updateInworkRectifytimeTraffAlarm(traffAlarmRecord);
// //这个事件如果为停车事件或者行人闯入事件时,设置纠偏状态为1
// if (exists > 0) {
// log.info("setRectificationtype=1");
// }
//
// }
List
<
String
>
imgBase64List
=
trffClientMessage
.
getImg_base64
();
List
<
String
>
imgBase64List
=
trffClientMessage
.
getImg_base64
();
String
imgEnumHead
=
"IMG"
;
String
imgEnumHead
=
"IMG"
;
Ftp
ftp
=
ftpService
.
reloadFtp
();
Ftp
ftp
=
ftpService
.
reloadFtp
();
...
@@ -283,6 +271,9 @@ public class TraffController {
...
@@ -283,6 +271,9 @@ public class TraffController {
webSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
webSocket
.
GroupSending
(
JsonUtil
.
beanToString
(
map
));
traffAlarmRecord
.
setProcessstatus
(
"0"
);
traffAlarmRecord
.
setProcessstatus
(
"0"
);
log
.
info
(
traffAlarmRecord
.
getRecordtime
());
log
.
info
(
"JSONUtil.toJsonStr 告警记录数据插入:{}"
,
JSONUtil
.
toJsonStr
(
traffAlarmRecord
));
log
.
info
(
"JSON.toJSONString 告警记录数据插入:{}"
,
JSON
.
toJSONString
(
traffAlarmRecord
));
traffAlarmRecordMapper
.
inserTraffAlarmRecord
(
traffAlarmRecord
);
traffAlarmRecordMapper
.
inserTraffAlarmRecord
(
traffAlarmRecord
);
try
{
try
{
...
@@ -344,6 +335,7 @@ public class TraffController {
...
@@ -344,6 +335,7 @@ public class TraffController {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
toString
());
System
.
out
.
println
(
e
.
toString
());
log
.
error
(
e
.
toString
());
log
.
error
(
e
.
toString
());
sendtomqtt
(
trffClientMessage
,
wbbh
,
traffAlarmRecord
);
return
0
;
return
0
;
}
}
}
}
...
@@ -372,6 +364,18 @@ public class TraffController {
...
@@ -372,6 +364,18 @@ public class TraffController {
}
}
}
}
public
static
void
main
(
String
args
[])
{
long
a
=
1624377806000
l
;
Date
date
=
new
Date
(
a
);
System
.
out
.
println
(
date
);
}
private
void
sendtomqtt
(
Alarm
trffClientMessage
,
String
wbbh
,
Traffalarmrecord
traffAlarmRecord
)
{
private
void
sendtomqtt
(
Alarm
trffClientMessage
,
String
wbbh
,
Traffalarmrecord
traffAlarmRecord
)
{
if
(
null
==
wbbh
||
""
.
equals
(
wbbh
))
if
(
null
==
wbbh
||
""
.
equals
(
wbbh
))
{
{
...
@@ -381,7 +385,7 @@ public class TraffController {
...
@@ -381,7 +385,7 @@ public class TraffController {
MqttAlarm
mqttalarm
=
new
MqttAlarm
();
MqttAlarm
mqttalarm
=
new
MqttAlarm
();
//查询事件类型mqtt 对应的编号
//查询事件类型mqtt 对应的编号
String
mqttbh
=
traffAlarmRecordMapper
.
seletmqttbh
(
trffClientMessage
.
getIncident_type
());
String
mqttbh
=
traffAlarmRecordMapper
.
seletmqttbh
(
trffClientMessage
.
getIncident_type
());
mqttalarm
.
setAlarmTime
(
DateUtils
.
formatDate
(
new
Date
(
Long
.
valueOf
(
trffClientMessage
.
getTs
()))
));
mqttalarm
.
setAlarmTime
(
traffAlarmRecord
.
getRecordtime
(
));
mqttalarm
.
setCompanyId
(
"66211"
);
mqttalarm
.
setCompanyId
(
"66211"
);
//设置图片
//设置图片
mqttalarm
.
setImagePath
(
traffAlarmRecord
.
getImg1path
()==
null
?
""
:
ftpServiceUrl
+
"?location="
+
traffAlarmRecord
.
getImg1path
().
replace
(
"ftp://"
+
ftppath
+
"/"
,
""
));
mqttalarm
.
setImagePath
(
traffAlarmRecord
.
getImg1path
()==
null
?
""
:
ftpServiceUrl
+
"?location="
+
traffAlarmRecord
.
getImg1path
().
replace
(
"ftp://"
+
ftppath
+
"/"
,
""
));
...
@@ -394,8 +398,9 @@ public class TraffController {
...
@@ -394,8 +398,9 @@ public class TraffController {
mqttalarm
.
setHeight
(
trffClientMessage
.
getObj_location
().
get
(
"height"
)
==
null
?
null
:
trffClientMessage
.
getObj_location
().
get
(
"height"
).
toString
());
mqttalarm
.
setHeight
(
trffClientMessage
.
getObj_location
().
get
(
"height"
)
==
null
?
null
:
trffClientMessage
.
getObj_location
().
get
(
"height"
).
toString
());
}
}
mqttalarm
.
setEventTypeId
(
mqttbh
);
mqttalarm
.
setEventTypeId
(
mqttbh
);
log
.
info
(
"mqtt data========"
+
JSONUtil
.
toJsonStr
(
mqttalarm
));
log
.
info
(
"JSONUtil mqtt data:{}"
,
JSON
.
toJSONString
(
mqttalarm
));
mQTTSubsribe
.
publishMessage
(
"event/"
+
wbbh
+
"/videoEvent"
,
JsonUtil
.
beanToString
(
mqttalarm
));
log
.
info
(
"mqtt data:{}"
+
JSON
.
toJSONString
(
mqttalarm
));
mQTTSubsribe
.
publishMessage
(
"event/"
+
wbbh
+
"/videoEvent"
,
JSON
.
toJSONString
(
mqttalarm
));
}
}
}
}
...
@@ -535,7 +540,7 @@ public class TraffController {
...
@@ -535,7 +540,7 @@ public class TraffController {
if
(
traffalarmrecord
==
null
)
return
0
;
if
(
traffalarmrecord
==
null
)
return
0
;
Alarm
alarm
=
new
Alarm
();
Alarm
alarm
=
new
Alarm
();
Base64Encoder
base64Encoder
=
new
Base64Encoder
();
Base64Encoder
base64Encoder
=
new
Base64Encoder
();
alarm
.
setTs
(
Long
.
toString
(
traffalarmrecord
.
getRecordtime
()==
null
?
new
Date
().
getTime
():
traffalarmrecord
.
getRecordtime
(
).
getTime
()));
alarm
.
setTs
(
Long
.
toString
(
traffalarmrecord
.
getRecordtime
()==
null
?
new
Date
().
getTime
():
DateUtils
.
Parsedate
(
traffalarmrecord
.
getRecordtime
()
).
getTime
()));
alarm
.
setDept
(
traffalarmrecord
.
getAreaid
()==
null
?
null
:
Long
.
toString
(
traffalarmrecord
.
getAreaid
()));
alarm
.
setDept
(
traffalarmrecord
.
getAreaid
()==
null
?
null
:
Long
.
toString
(
traffalarmrecord
.
getAreaid
()));
alarm
.
setVideo_id
(
traffalarmrecord
.
getFdid
()+
"_"
+
traffalarmrecord
.
getChannelid
());
alarm
.
setVideo_id
(
traffalarmrecord
.
getFdid
()+
"_"
+
traffalarmrecord
.
getChannelid
());
alarm
.
setIncident_type
(
traffalarmrecord
.
getRecordtype
());
alarm
.
setIncident_type
(
traffalarmrecord
.
getRecordtype
());
...
...
src/main/java/com/hzjt/domain/Traffalarmrecord.java
View file @
26e5f214
package
com
.
hzjt
.
domain
;
package
com
.
hzjt
.
domain
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
...
@@ -16,7 +17,7 @@ public class Traffalarmrecord implements java.io.Serializable {
...
@@ -16,7 +17,7 @@ public class Traffalarmrecord implements java.io.Serializable {
private
Integer
channelid
;
//--ͨ�����
private
Integer
channelid
;
//--ͨ�����
private
Integer
channeletype
;
//ͨ������ �ɺ���
private
Integer
channeletype
;
//ͨ������ �ɺ���
private
String
channelname
;
//ͨ������
private
String
channelname
;
//ͨ������
private
Date
recordtime
;
//�¼���¼ʱ��
private
String
recordtime
;
//�¼���¼ʱ��
private
String
recordtype
;
//�¼���¼����
private
String
recordtype
;
//�¼���¼����
private
String
location
;
//Ŀ�궨λ��Ϣ
private
String
location
;
//Ŀ�궨λ��Ϣ
private
String
img1urlfrom
;
//ͼƬԴ��ַ
private
String
img1urlfrom
;
//ͼƬԴ��ַ
...
@@ -36,7 +37,7 @@ public class Traffalarmrecord implements java.io.Serializable {
...
@@ -36,7 +37,7 @@ public class Traffalarmrecord implements java.io.Serializable {
private
Integer
recordlevel
;
//�¼����� --Ĭ��Ϊ0 ����������ʱδ֪
private
Integer
recordlevel
;
//�¼����� --Ĭ��Ϊ0 ����������ʱδ֪
private
Integer
checkstatus
;
//0:����� 1:���ͨ�� 2:��˲�ͨ�� 9:����
private
Integer
checkstatus
;
//0:����� 1:���ͨ�� 2:��˲�ͨ�� 9:����
private
String
creator
;
//������
private
String
creator
;
//������
private
Date
createtime
;
//����ʱ��
private
String
createtime
;
//����ʱ��
private
String
updator
;
//������
private
String
updator
;
//������
private
Date
updatetime
;
//����ʱ��
private
Date
updatetime
;
//����ʱ��
private
String
remark
;
private
String
remark
;
...
...
src/main/java/com/hzjt/redis/Receiver.java
View file @
26e5f214
...
@@ -101,8 +101,8 @@ public class Receiver {
...
@@ -101,8 +101,8 @@ public class Receiver {
traffAlarmRecord
.
setAreaid
(
Long
.
valueOf
(
trffClientMessage
.
getDept
()));
traffAlarmRecord
.
setAreaid
(
Long
.
valueOf
(
trffClientMessage
.
getDept
()));
traffAlarmRecord
.
setRecordtype
(
trffClientMessage
.
getIncident_type
().
toLowerCase
());
traffAlarmRecord
.
setRecordtype
(
trffClientMessage
.
getIncident_type
().
toLowerCase
());
traffAlarmRecord
.
setVideourlfrom
(
trffClientMessage
.
getVideo_record_url
());
traffAlarmRecord
.
setVideourlfrom
(
trffClientMessage
.
getVideo_record_url
());
traffAlarmRecord
.
setRecordtime
(
new
Date
(
Long
.
valueOf
(
trffClientMessage
.
getTs
(
))));
traffAlarmRecord
.
setRecordtime
(
DateUtils
.
getDateString
(
new
Date
(
Long
.
valueOf
(
trffClientMessage
.
getTs
()
))));
traffAlarmRecord
.
setCreatetime
(
new
Date
(
));
traffAlarmRecord
.
setCreatetime
(
DateUtils
.
getDateString
(
new
Date
()
));
traffAlarmRecord
.
setObjlable
(
trffClientMessage
.
getObjLabel
());
traffAlarmRecord
.
setObjlable
(
trffClientMessage
.
getObjLabel
());
traffAlarmRecord
.
setPushstatus
(
9
);
//设置为未推送
traffAlarmRecord
.
setPushstatus
(
9
);
//设置为未推送
...
...
src/main/java/com/hzjt/service/EventWriteService.java
View file @
26e5f214
...
@@ -99,7 +99,7 @@ public class EventWriteService {
...
@@ -99,7 +99,7 @@ public class EventWriteService {
alarm
.
setDept
(
record
.
getAreaid
().
toString
());
alarm
.
setDept
(
record
.
getAreaid
().
toString
());
alarm
.
setIncident_type
(
record
.
getRecordtype
());
alarm
.
setIncident_type
(
record
.
getRecordtype
());
alarm
.
setType
(
"TRAFFIC_INCIDENT_ALARM"
);
alarm
.
setType
(
"TRAFFIC_INCIDENT_ALARM"
);
alarm
.
setTs
(
String
.
valueOf
(
record
.
getRecordtime
().
getTime
()
));
alarm
.
setTs
(
record
.
getRecordtime
(
));
alarm
.
setVideo_id
(
record
.
getFdid
());
alarm
.
setVideo_id
(
record
.
getFdid
());
List
<
String
>
img_urls
=
new
ArrayList
<>();
List
<
String
>
img_urls
=
new
ArrayList
<>();
img_urls
.
add
(
record
.
getImg1urlfrom
());
img_urls
.
add
(
record
.
getImg1urlfrom
());
...
@@ -187,7 +187,7 @@ public class EventWriteService {
...
@@ -187,7 +187,7 @@ public class EventWriteService {
eventWriteParam
.
setEventSource
(
EVENT_SOURCE
);
eventWriteParam
.
setEventSource
(
EVENT_SOURCE
);
eventWriteParam
.
setRegionID
(
traffalarmrecord
.
getAreaid
());
eventWriteParam
.
setRegionID
(
traffalarmrecord
.
getAreaid
());
eventWriteParam
.
setEventType
(
traffalarmrecord
.
getRecordtype
());
eventWriteParam
.
setEventType
(
traffalarmrecord
.
getRecordtype
());
eventWriteParam
.
setOccurTime
(
DateUtils
.
formatDateToNoSign
(
traffalarmrecord
.
getRecordtime
()
));
eventWriteParam
.
setOccurTime
(
traffalarmrecord
.
getRecordtime
(
));
//获得外部编号
//获得外部编号
List
<
Sbtdspsr
>
sbtdspsr
=
sbtdspsrMapper
.
selectBySbbh
(
traffalarmrecord
.
getFdid
(),
traffalarmrecord
.
getChannelid
());
List
<
Sbtdspsr
>
sbtdspsr
=
sbtdspsrMapper
.
selectBySbbh
(
traffalarmrecord
.
getFdid
(),
traffalarmrecord
.
getChannelid
());
...
...
src/main/java/com/hzjt/util/DateUtils.java
View file @
26e5f214
package
com
.
hzjt
.
util
;
package
com
.
hzjt
.
util
;
import
org.joda.time.DateTime
;
import
lombok.extern.slf4j.Slf4j
;
import
org.joda.time.Days
;
import
java.text.SimpleDateFormat
;
import
org.joda.time.Months
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.TimeZone
;
/**
/**
* ʱ���ʽת���� 2019.10.23
* ʱ���ʽת���� 2019.10.23
* @author cp
* @author cp
*/
*/
@Slf4j
public
class
DateUtils
{
public
class
DateUtils
{
private
static
final
DateTimeFormatter
YMD_HMS
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
DateTimeFormatter
YMDHMS
=
DateTimeFormat
.
forPattern
(
"yyyyMMddHHmmss"
);
private
static
final
DateTimeFormatter
YMD
=
DateTimeFormat
.
forPattern
(
"yyyyMMdd"
);
private
static
final
DateTimeFormatter
Y_M_D
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
String
formatCurrDate
(){
return
formatCurrDateByType
(
YMD_HMS
);
}
public
static
String
formatCurrDateNoSign
(){
return
formatCurrDateByType
(
YMDHMS
);
}
public
static
String
formatCurrDateYMD
(){
return
formatCurrDateByType
(
Y_M_D
);
}
public
static
String
formatCurrDayNoSign
(){
return
formatCurrDateByType
(
YMD
);
}
public
static
Date
parseDate
(
String
date
){
return
DateTime
.
parse
(
date
,
YMD_HMS
).
toDate
();
}
public
static
Date
parseDateNoSign
(
String
date
){
return
DateTime
.
parse
(
date
,
YMDHMS
).
toDate
();
}
public
static
String
getYesterday
(
int
day
){
Date
date
=
addDay
(
new
Date
(),
day
);
return
new
DateTime
(
date
).
toString
(
YMD_HMS
);
}
public
static
String
getlastMonth
(
int
month
){
Date
date
=
addMonth
(
new
Date
(),
month
);
return
new
DateTime
(
date
).
toString
(
YMD_HMS
);
}
public
static
String
formatDate
(
Date
date
){
return
new
DateTime
(
date
).
toString
(
YMD_HMS
);
}
public
static
String
formatDateToNoSign
(
Date
date
){
return
new
DateTime
(
date
).
toString
(
YMDHMS
);
}
public
static
String
formatDateToNoSign
(
String
date
){
return
DateTime
.
parse
(
date
,
YMD_HMS
).
toString
(
YMDHMS
);
}
private
static
String
formatCurrDateByType
(
DateTimeFormatter
dateTimeFormatter
){
return
DateTime
.
now
().
toString
(
dateTimeFormatter
);
}
public
static
Date
addMinutes
(
Date
date
,
int
minutes
)
{
return
new
DateTime
(
date
).
plusMinutes
(
minutes
).
toDate
();
}
public
static
Date
addDay
(
Date
date
,
int
day
)
{
if
(
day
==
0
){
return
date
;
}
return
new
DateTime
(
date
).
plusDays
(
day
).
toDate
();
}
public
static
Date
addMonth
(
Date
date
,
int
month
)
{
public
static
String
getDateString
(
Date
date
)
{
if
(
month
==
0
){
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
date
;
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
formatter
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
String
dateString
=
formatter
.
format
(
date
);
return
dateString
;
}
public
static
String
getDateStringNoSign
(
Date
date
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
formatter
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
String
dateString
=
formatter
.
format
(
date
);
return
dateString
;
}
public
static
String
formatCurrDayNoSign
()
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
formatter
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
String
dateString
=
formatter
.
format
(
new
Date
());
return
dateString
;
}
public
static
Date
Parsedate
(
String
datestr
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
formatter
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
log
.
info
(
"date timezone:{}"
,
formatter
.
getTimeZone
())
;
try
{
Date
dateString
=
formatter
.
parse
(
datestr
);
return
dateString
;
}
catch
(
Exception
ex
){
return
null
;
}
}
return
new
DateTime
(
date
).
plusMonths
(
month
).
toDate
();
}
}
/**
* ����ʱ����������
* @param date1 ʱ��1
* @param date2 ʱ��2
* @return ����
*/
public
static
int
diffMonth
(
Date
date1
,
Date
date2
)
{
if
(
date1
==
null
||
date2
==
null
)
{
return
0
;
}
DateTime
dt1
=
new
DateTime
(
date1
);
DateTime
dt2
=
new
DateTime
(
date2
);
return
Months
.
monthsBetween
(
dt1
,
dt2
).
getMonths
();
}
/**
* ����ʱ����������
* @param date1 ʱ��1
* @param date2 ʱ��2
* @return ����
*/
public
static
int
diffDay
(
Date
date1
,
Date
date2
)
{
if
(
date1
==
null
||
date2
==
null
)
{
return
0
;
}
DateTime
dt1
=
new
DateTime
(
date1
);
DateTime
dt2
=
new
DateTime
(
date2
);
return
Days
.
daysBetween
(
dt1
,
dt2
).
getDays
();
}
}
}
src/main/resources/application.properties
View file @
26e5f214
...
@@ -7,6 +7,7 @@ spring.thymeleaf.content-type=text/html
...
@@ -7,6 +7,7 @@ spring.thymeleaf.content-type=text/html
spring.thymeleaf.enabled
=
true
spring.thymeleaf.enabled
=
true
spring.thymeleaf.encoding
=
UTF-8
spring.thymeleaf.encoding
=
UTF-8
spring.thymeleaf.mode
=
HTML5
spring.thymeleaf.mode
=
HTML5
# mybatis
# mybatis
mybatis.type-aliases-package
=
com.hzjt.domain
mybatis.type-aliases-package
=
com.hzjt.domain
mybatis.configuration.map-underscore-to-camel-case
=
true
mybatis.configuration.map-underscore-to-camel-case
=
true
...
@@ -14,15 +15,13 @@ mybatis.configuration.default-fetch-size=100
...
@@ -14,15 +15,13 @@ mybatis.configuration.default-fetch-size=100
mybatis.configuration.default-statement-timeout
=
3000
mybatis.configuration.default-statement-timeout
=
3000
#mybatis.mapperLocations = classpath:xxx.xml
#mybatis.mapperLocations = classpath:xxx.xml
logging.level.com.hzjt
=
debug
logging.level.com.hzjt
=
debug
# Mysql���ݿ�-����Դ����
# Mysql���ݿ�-����Դ����
spring.datasource.username
=
hzjt
spring.datasource.password
=
hzjt
spring.datasource.url
=
jdbc:oracle:thin:@192.168.168.212:1521:helowin
#spring.datasource.username=hzjt
#spring.datasource.username=hzjt
#spring.datasource.password=hzjt
#spring.datasource.password=hzjt
#spring.datasource.url=jdbc:oracle:thin:@33.65.219.103:1521:helowin
#spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1521:helowin
spring.datasource.username
=
hzjt
spring.datasource.password
=
hzjt
spring.datasource.url
=
jdbc:oracle:thin:@33.65.250.179:1521:helowin
spring.datasource.driverClassName
=
oracle.jdbc.OracleDriver
spring.datasource.driverClassName
=
oracle.jdbc.OracleDriver
# druid
# druid
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
...
@@ -43,8 +42,8 @@ spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowS
...
@@ -43,8 +42,8 @@ spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowS
spring.datasource.useGlobalDataSourceStat
=
true
spring.datasource.useGlobalDataSourceStat
=
true
#redis
#redis
#spring.redis.host=33.65.219.103
spring.redis.host
=
33.65.250.179
spring.redis.host
=
127.0.0.1
#
spring.redis.host=127.0.0.1
spring.redis.port
=
6379
spring.redis.port
=
6379
#spring.redis.password=123456
#spring.redis.password=123456
spring.redis.database
=
0
spring.redis.database
=
0
...
@@ -54,17 +53,18 @@ spring.redis.pool.max-idle=8
...
@@ -54,17 +53,18 @@ spring.redis.pool.max-idle=8
spring.redis.pool.min-idle
=
0
spring.redis.pool.min-idle
=
0
spring.redis.timeout
=
2000
spring.redis.timeout
=
2000
spring.session.store-type
=
none
spring.session.store-type
=
none
ip.host
=
33.65.2
19.103
ip.host
=
33.65.2
50.179
port
=
21
port
=
21
message.dept
=
33030
message.dept
=
33030
message.rate
=
10
message.rate
=
10
ftp.host
=
33.65.219.40:21:hzjt:1qaz2wsx
ftp.host
=
33.65.219.40:21:hzjt:1qaz2wsx
ftppath
=
hzjt:1qaz2wsx@33.65.219.40:21
ftppath
=
hzjt:1qaz2wsx@33.65.219.40:21
ftpServiceUrl
=
http://33.65.2
19.103
:8089/api/alg/files
ftpServiceUrl
=
http://33.65.2
50.179
:8089/api/alg/files
alarm.subscribe.data.key
=
gs:traff:alarmlist
alarm.subscribe.data.key
=
gs:traff:alarmlist
spring.jackson.date-format
=
yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone
=
GMT+8
# 免审标记 0需审核 1免审
# 免审标记 0需审核 1免审
alarmrecord.check.enable
=
1
alarmrecord.check.enable
=
1
...
@@ -105,3 +105,5 @@ spring.mqtt.completionTimeout=3000
...
@@ -105,3 +105,5 @@ spring.mqtt.completionTimeout=3000
spring.mqtt.qos
=
2
spring.mqtt.qos
=
2
#mqtt配置 - end
#mqtt配置 - end
src/main/resources/mapper/Traffalarmrecord.xml
View file @
26e5f214
...
@@ -67,7 +67,6 @@
...
@@ -67,7 +67,6 @@
<if
test=
"manualstatus != null"
>
manualstatus ,
</if>
<if
test=
"manualstatus != null"
>
manualstatus ,
</if>
</trim>
</trim>
<trim
prefix=
"select"
suffix=
"from dual"
suffixOverrides=
","
>
<trim
prefix=
"select"
suffix=
"from dual"
suffixOverrides=
","
>
<if
test=
"recordid != null"
>
#{recordid},
</if>
<if
test=
"recordid != null"
>
#{recordid},
</if>
<if
test=
"algotype != null"
>
#{algotype},
</if>
<if
test=
"algotype != null"
>
#{algotype},
</if>
<if
test=
"areaid != null"
>
#{areaid},
</if>
<if
test=
"areaid != null"
>
#{areaid},
</if>
...
@@ -75,7 +74,7 @@
...
@@ -75,7 +74,7 @@
<if
test=
"channelid != null"
>
#{ channelid},
</if>
<if
test=
"channelid != null"
>
#{ channelid},
</if>
<if
test=
"channeletype != null"
>
#{channeletype},
</if>
<if
test=
"channeletype != null"
>
#{channeletype},
</if>
<if
test=
"channelname != null"
>
#{ channelname },
</if>
<if
test=
"channelname != null"
>
#{ channelname },
</if>
<if
test=
"recordtime != null"
>
#{ recordtime}
,
</if>
<if
test=
"recordtime != null"
>
to_date(#{recordtime},'yyyy-mm-dd hh24:mi:ss')
,
</if>
<if
test=
"recordtype != null"
>
#{ recordtype},
</if>
<if
test=
"recordtype != null"
>
#{ recordtype},
</if>
<if
test=
"location != null"
>
#{ location},
</if>
<if
test=
"location != null"
>
#{ location},
</if>
<if
test=
"img1urlfrom != null"
>
#{img1urlfrom},
</if>
<if
test=
"img1urlfrom != null"
>
#{img1urlfrom},
</if>
...
@@ -95,7 +94,7 @@
...
@@ -95,7 +94,7 @@
<if
test=
"recordlevel != null"
>
#{recordlevel,jdbcType=INTEGER},
</if>
<if
test=
"recordlevel != null"
>
#{recordlevel,jdbcType=INTEGER},
</if>
<if
test=
"checkstatus != null"
>
#{checkstatus,jdbcType=INTEGER},
</if>
<if
test=
"checkstatus != null"
>
#{checkstatus,jdbcType=INTEGER},
</if>
<if
test=
"creator != null"
>
#{creator},
</if>
<if
test=
"creator != null"
>
#{creator},
</if>
<if
test=
"createtime != null"
>
#{createtime}
,
</if>
<if
test=
"createtime != null"
>
to_date(#{createtime},'yyyy-mm-dd hh24:mi:ss')
,
</if>
<if
test=
"updator != null"
>
#{updator},
</if>
<if
test=
"updator != null"
>
#{updator},
</if>
<if
test=
"updatetime != null"
>
#{updatetime},
</if>
<if
test=
"updatetime != null"
>
#{updatetime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
...
...
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