Commit fc88bf28 by zhangxk

修改视频文件名,去掉文件名前的目录

1 parent 39266651
......@@ -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) {
......
......@@ -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;
}
......
......@@ -54,6 +54,7 @@ public class ProcessService {
//综治
case "behavior":
log.info("收到繁星发来的一条综治记录");
log.warn("收到繁星发来的一条综治记录");
return behaviorProcess.process(jsonObject);
default:
log.error("收到繁星发来的一条记录,不在博康接收范围内");
......
......@@ -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;
......
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!