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
Hide 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;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.IntUtils
;
import
com.viontech.utils.VideoUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
...
...
@@ -20,6 +21,7 @@ import java.util.Optional;
import
java.util.Properties
;
@Component
@Slf4j
public
class
BehaviorProcess
implements
Process
{
@Resource
private
Properties
vehicleColorProp
;
...
...
@@ -80,7 +82,9 @@ public class BehaviorProcess implements Process {
if
(
filename
!=
null
&&
!
""
.
equals
(
filename
))
{
String
filePath
=
""
;
try
{
log
.
warn
(
"behavior filename:"
+
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
log
.
warn
(
"behavior filepath:"
+
filePath
);
// 提交推送任务
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
}
catch
(
Exception
ignore
)
{
...
...
src/main/java/com/viontech/process/Process.java
View file @
fc88bf2
...
...
@@ -3,7 +3,9 @@ package com.viontech.process;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.model.BaseModel
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.StringUtil
;
import
com.viontech.utils.Utils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -27,6 +29,7 @@ public interface Process {
ip
=
"null"
;
LOGGER
.
error
(
""
,
e
);
}
fileName
=
StringUtil
.
subFileName
(
fileName
);
return
"video/"
+
yyyyMMdd
+
"/12401/"
+
fileName
;
}
...
...
src/main/java/com/viontech/process/ProcessService.java
View file @
fc88bf2
...
...
@@ -54,6 +54,7 @@ public class ProcessService {
//综治
case
"behavior"
:
log
.
info
(
"收到繁星发来的一条综治记录"
);
log
.
warn
(
"收到繁星发来的一条综治记录"
);
return
behaviorProcess
.
process
(
jsonObject
);
default
:
log
.
error
(
"收到繁星发来的一条记录,不在博康接收范围内"
);
...
...
src/main/java/com/viontech/process/TrafficProcess.java
View file @
fc88bf2
...
...
@@ -97,8 +97,10 @@ public class TrafficProcess implements Process {
}
String
filePath
;
try
{
log
.
warn
(
"traffic filename:"
+
filename
);
filePath
=
Process
.
getFileFTPPath
(
eventTime
,
deviceSerialnum
,
filename
);
// 提交推送任务
log
.
warn
(
"traffic filepath:"
+
filePath
);
VideoUtil
.
submitTask
(
refid
,
filePath
,
ftpClientHelper
);
}
catch
(
Exception
ignore
)
{
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
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