Process.java 1.19 KB
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;


}