Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
recv_data_longhua
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 880a79a0
authored
Sep 24, 2020
by
zhangxk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改对接时间为GMT+8
1 parent
e80ee508
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
7 deletions
src/main/java/com/viontech/process/BehaviorProcess.java
src/main/java/com/viontech/process/FlowProcess.java
src/main/java/com/viontech/process/TrafficProcess.java
src/main/java/com/viontech/utils/DateUtil.java
src/main/java/com/viontech/process/BehaviorProcess.java
View file @
880a79a
...
...
@@ -40,12 +40,12 @@ public class BehaviorProcess implements Process {
String
startStr
=
video
.
getString
(
"start_dt"
);
String
endStr
=
video
.
getString
(
"end_dt"
);
if
(
startStr
!=
null
&&
!
""
.
equals
(
startStr
.
trim
()))
{
long
start
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
startStr
).
getTime
();
long
start
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
startStr
,
8
).
getTime
();
model
.
setRecordingStartSecond
((
int
)
(
start
/
1000
));
model
.
setRecordingStartMillisecond
((
int
)
(
start
%
1000
));
}
if
(
endStr
!=
null
&&
!
""
.
equals
(
endStr
.
trim
()))
{
long
end
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
endStr
).
getTime
();
long
end
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
endStr
,
8
).
getTime
();
model
.
setRecordingEndSecond
((
int
)
(
end
/
1000
));
model
.
setRecordingEndMillisecond
((
int
)
(
end
%
1000
));
}
...
...
@@ -53,7 +53,7 @@ public class BehaviorProcess implements Process {
String
eventDtStr
=
jsonObject
.
getString
(
"event_dt"
);
if
(
eventDtStr
!=
null
)
{
long
time
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDtStr
).
getTime
();
long
time
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDtStr
,
8
).
getTime
();
model
.
setEventStartSecond
((
int
)
(
time
/
1000
));
model
.
setEventStartMillisecond
((
int
)
(
time
%
1000
));
//结束时间暂定和开始时间一致
...
...
src/main/java/com/viontech/process/FlowProcess.java
View file @
880a79a
...
...
@@ -6,8 +6,10 @@ import com.viontech.model.BaseModel;
import
com.viontech.model.FlowModel
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.IntUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
/**
...
...
@@ -25,7 +27,7 @@ public class FlowProcess implements Process {
model
.
setTimeDuring
(
120
);
String
eventDtStr
=
jsonObject
.
getString
(
"event_dt"
);
if
(
eventDtStr
!=
null
)
{
long
time
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDtStr
).
getTime
();
long
time
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDtStr
,
8
).
getTime
();
model
.
setTime
((
int
)
(
time
/
1000
));
}
JSONObject
eventData
=
jsonObject
.
getJSONObject
(
"event_data"
);
...
...
src/main/java/com/viontech/process/TrafficProcess.java
View file @
880a79a
...
...
@@ -60,7 +60,7 @@ public class TrafficProcess implements Process {
}
// ------------------------ 车辆信息 车牌信息 --------------
String
eventTimeStr
=
jsonObject
.
getString
(
"event_dt"
);
Date
eventTime
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventTimeStr
);
Date
eventTime
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventTimeStr
,
8
);
long
eventTimeL
=
eventTime
.
getTime
();
model
.
setDiscernTime
(
BaseModel
.
toInt
(
eventTimeL
/
1000
));
model
.
setDiscernMillisecondTime
(
BaseModel
.
toInt
(
eventTimeL
%
1000
));
...
...
@@ -230,11 +230,11 @@ public class TrafficProcess implements Process {
long
redStart
=
0
;
long
redEnd
=
0
;
if
(
redStartStr
!=
null
&&
!
""
.
equals
(
redStartStr
.
trim
()))
{
redStart
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
redStartStr
).
getTime
();
redStart
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
redStartStr
,
8
).
getTime
();
}
String
redEndStr
=
detail
.
getString
(
"end_dt"
);
if
(
redEndStr
!=
null
&&
!
""
.
equals
(
redEndStr
.
trim
()))
{
redEnd
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
redEndStr
).
getTime
();
redEnd
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
redEndStr
,
8
).
getTime
();
}
model
.
setRedLightBeginTime
((
int
)
(
redStart
/
1000
));
model
.
setRedLightBeginMillisecondTime
((
int
)
(
redStart
%
1000
));
...
...
src/main/java/com/viontech/utils/DateUtil.java
View file @
880a79a
...
...
@@ -1326,6 +1326,12 @@ public class DateUtil extends DateUtils {
return
parse
(
dateFormatStr
,
dateStr
,
locale
);
}
public
static
Date
parse
(
String
dateFormatStr
,
String
dateStr
,
int
offset
)
throws
ParseException
{
Locale
locale
=
LocaleContextHolder
.
getLocale
();
Date
parse
=
parse
(
dateFormatStr
,
dateStr
,
locale
);
return
DateUtils
.
addHours
(
parse
,
offset
);
}
public
static
String
format
(
String
dateFormatStr
,
Date
date
,
Locale
locale
)
{
SimpleDateFormat
sdf
=
null
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment