package com.base.plan.utils;

import org.springframework.core.io.ClassPathResource;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 读取卫星调整拍摄装置时间
 */
public class PropertiesUtil {

    public static int getSatelliteConstraintInfo(String satCode) {
        Properties property = new Properties();
        int satParamter = 0;
        try {
            ClassPathResource resource = new ClassPathResource("SatelliteTimeConstraint.properties");
            InputStream inputStream = resource.getInputStream();
            property.load(inputStream);
            satParamter = Integer.parseInt(property.getProperty(satCode).trim()) * 60;
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        } catch (NullPointerException e3) {
            e3.printStackTrace();
        }
        return satParamter;
    }
}
