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 fc88bf28
authored
Sep 25, 2020
by
zhangxk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改视频文件名,去掉文件名前的目录
1 parent
39266651
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
0 deletions
src/main/java/com/viontech/process/BehaviorProcess.java
src/main/java/com/viontech/process/Process.java
src/main/java/com/viontech/process/ProcessService.java
src/main/java/com/viontech/process/TrafficProcess.java
src/main/java/com/viontech/utils/StringUtil.java
src/main/java/com/viontech/process/BehaviorProcess.java
View file @
fc88bf2
...
@@ -8,6 +8,7 @@ import com.viontech.model.BehaviorModel;
...
@@ -8,6 +8,7 @@ import com.viontech.model.BehaviorModel;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.IntUtils
;
import
com.viontech.utils.IntUtils
;
import
com.viontech.utils.VideoUtil
;
import
com.viontech.utils.VideoUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -20,6 +21,7 @@ import java.util.Optional;
...
@@ -20,6 +21,7 @@ import java.util.Optional;
import
java.util.Properties
;
import
java.util.Properties
;
@Component
@Component
@Slf4j
public
class
BehaviorProcess
implements
Process
{
public
class
BehaviorProcess
implements
Process
{
@Resource
@Resource
private
Properties
vehicleColorProp
;
private
Properties
vehicleColorProp
;
...
@@ -80,7 +82,9 @@ public class BehaviorProcess implements Process {
...
@@ -80,7 +82,9 @@ public class BehaviorProcess implements Process {
if
(
filename
!=
null
&&
!
""
.
equals
(
filename
))
{
if
(
filename
!=
null
&&
!
""
.
equals
(
filename
))
{
String
filePath
=
""
;
String
filePath
=
""
;
try
{
try
{
log
.
warn
(
"behavior filename:"
+
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
log
.
warn
(
"behavior filepath:"
+
filePath
);
// 提交推送任务
// 提交推送任务
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
}
catch
(
Exception
ignore
)
{
}
catch
(
Exception
ignore
)
{
...
...
src/main/java/com/viontech/process/Process.java
View file @
fc88bf2
...
@@ -3,7 +3,9 @@ package com.viontech.process;
...
@@ -3,7 +3,9 @@ package com.viontech.process;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.model.BaseModel
;
import
com.viontech.model.BaseModel
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.StringUtil
;
import
com.viontech.utils.Utils
;
import
com.viontech.utils.Utils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -27,6 +29,7 @@ public interface Process {
...
@@ -27,6 +29,7 @@ public interface Process {
ip
=
"null"
;
ip
=
"null"
;
LOGGER
.
error
(
""
,
e
);
LOGGER
.
error
(
""
,
e
);
}
}
fileName
=
StringUtil
.
subFileName
(
fileName
);
return
"video/"
+
yyyyMMdd
+
"/12401/"
+
fileName
;
return
"video/"
+
yyyyMMdd
+
"/12401/"
+
fileName
;
}
}
...
...
src/main/java/com/viontech/process/ProcessService.java
View file @
fc88bf2
...
@@ -54,6 +54,7 @@ public class ProcessService {
...
@@ -54,6 +54,7 @@ public class ProcessService {
//综治
//综治
case
"behavior"
:
case
"behavior"
:
log
.
info
(
"收到繁星发来的一条综治记录"
);
log
.
info
(
"收到繁星发来的一条综治记录"
);
log
.
warn
(
"收到繁星发来的一条综治记录"
);
return
behaviorProcess
.
process
(
jsonObject
);
return
behaviorProcess
.
process
(
jsonObject
);
default
:
default
:
log
.
error
(
"收到繁星发来的一条记录,不在博康接收范围内"
);
log
.
error
(
"收到繁星发来的一条记录,不在博康接收范围内"
);
...
...
src/main/java/com/viontech/process/TrafficProcess.java
View file @
fc88bf2
...
@@ -97,8 +97,10 @@ public class TrafficProcess implements Process {
...
@@ -97,8 +97,10 @@ public class TrafficProcess implements Process {
}
}
String
filePath
;
String
filePath
;
try
{
try
{
log
.
warn
(
"traffic filename:"
+
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
// 提交推送任务
// 提交推送任务
log
.
warn
(
"traffic filepath:"
+
filePath
);
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
}
catch
(
Exception
ignore
)
{
}
catch
(
Exception
ignore
)
{
return
;
return
;
...
...
src/main/java/com/viontech/utils/StringUtil.java
0 → 100644
View file @
fc88bf2
package
com
.
viontech
.
utils
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @author zxk
**/
public
class
StringUtil
{
/**
* 截取文件名中的路径,只保留文件名
* @param filename -
*/
public
static
String
subFileName
(
String
filename
){
int
i
=
filename
.
lastIndexOf
(
"/"
);
filename
=
StringUtils
.
substring
(
filename
,
i
+
1
,
filename
.
length
());
return
filename
;
}
}
\ No newline at end of file
\ No newline at end of file
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