Process.java
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
import java.util.Date;
/**
* .
*
* @author 谢明辉
* @date 2020/8/20
*/
public interface Process {
Logger LOGGER = LoggerFactory.getLogger(Process.class);
static String getFileFTPPath(Date date, String deviceId, String fileName) {
String yyyyMMdd = DateUtil.format("yyyyMMdd", date);
String ip;
try {
ip = Utils.INSTANCE.getIpAddress();
} catch (Exception e) {
ip = "null";
LOGGER.error("", e);
}
fileName = StringUtil.subFileName(fileName);
if(fileName.endsWith(".mp4") || fileName.endsWith("avi")){
return "video/" + yyyyMMdd + "/12401/" + fileName;
}
return "image/" + yyyyMMdd + "/12401/event/" + fileName;
}
static byte[] downloadFile(String url) {
return new byte[]{};
}
BaseModel process(JSONObject jsonObject) throws Exception;
}