OWL ITS + 탐지시스템(인터넷 진흥원)
박지현
2022-03-07 398a4927e195755bd6a46be99337efd8dacc3dc2
src/main/java/kr/wisestone/owl/util/ConvertUtil.java
@@ -5,6 +5,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import kr.wisestone.owl.constant.MsgConstants;
import kr.wisestone.owl.exception.OwlRuntimeException;
import kr.wisestone.owl.vo.CompanyFieldVo;
import kr.wisestone.owl.vo.IspFieldVo;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -355,7 +357,9 @@
                }
            }
        } catch (Exception e) {
            LOGGER.error("fieldName : " + fieldName, e);
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("fieldName : " + fieldName, e);
            }
            return false;
        }
@@ -549,4 +553,24 @@
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        return mapper;
    }
    public static String[] ToArray(List<String> list) {
        return  list.toArray(new String[list.size()]);
    }
    /**
     * ip주소 long으로 변환
     * @param ipAddress String
     * @return long
     */
    public static long ipToLong(String ipAddress) {
        long result = 0;
        String[] ipAddressArr = ipAddress.split("\\.");
        for (int i=0; i<ipAddressArr.length; i++) {
            result += Integer.parseInt(ipAddressArr[i]) * Math.pow(256, 3-i);
        }
        return result;
    }
}