Commit fc88bf28 by zhangxk

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

1 parent 39266651
...@@ -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) {
......
...@@ -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;
} }
......
...@@ -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("收到繁星发来的一条记录,不在博康接收范围内");
......
...@@ -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;
......
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!