From 916a3cbabe4e50062fce61ff6f2f5d46c05dfbd1 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 목, 17 3월 2022 17:47:45 +0900 Subject: [PATCH] - api로 이슈 추가 시 url/ip로 업체 찾는 코드 수정 --- src/main/java/kr/wisestone/owl/util/CommonUtil.java | 64 ++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/util/CommonUtil.java b/src/main/java/kr/wisestone/owl/util/CommonUtil.java index af20eb8..6ee3905 100644 --- a/src/main/java/kr/wisestone/owl/util/CommonUtil.java +++ b/src/main/java/kr/wisestone/owl/util/CommonUtil.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; -import com.google.gson.Gson; +import kr.wisestone.owl.constant.Regular; import kr.wisestone.owl.domain.enumType.FileType; import kr.wisestone.owl.type.LikeType; import kr.wisestone.owl.vo.DepartmentVo; @@ -12,6 +12,7 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.ss.usermodel.Cell; import org.jsoup.Jsoup; import org.slf4j.Logger; @@ -55,7 +56,9 @@ private static final String PASS_PHRASE = "1024"; // AES128 �븫�샇�솕�뿉 �궗�슜 private static final int ITERATION_COUNT = 10000; // AES128 �븫�샇�솕�뿉 �궗�슜 private static final int KEY_SIZE = 128; // AES128 �븫�샇�솕�뿉 �궗�슜 - private static final String TMP_UPLOAD_FOLDER = "/tmpUploadFolder/"; // �씠�뒋 �깮�꽦, �닔�젙�뿉�꽌 �뙆�씪 �뾽濡쒕뱶�븷 �븣 �엫�떆 �뤃�뜑濡� �궗�슜 + private static final String TMP_UPLOAD_FOLDER = "/tmpUploadFolder/"; // �씠�뒋 �깮�꽦, �닔�젙�뿉�꽌 �뙆�씪 �뾽濡쒕뱶�븷 �븣 �엫�떆 �뤃�뜑濡� �궗�슜' + public static final String COMMA = ","; // 援щ텇�옄 + public static String getClinetIp() { try { @@ -960,17 +963,24 @@ switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC : - double doubleValue = cell.getNumericCellValue(); - int intValue; + + // �궇吏� �삎�떇�씤 寃쎌슦 �궇吏쒕줈 蹂��솚 + if (HSSFDateUtil.isCellDateFormatted(cell)) { + Date date = cell.getDateCellValue(); + cellValue = DateUtil.convertDateToStr(date, "yyyy-MM-dd HH:mm:ss"); - if (doubleValue % 1 == 0) { - intValue = (int)doubleValue; - cellValue = intValue + ""; - } - else { - cellValue = doubleValue + ""; - } + } else { + double doubleValue = cell.getNumericCellValue(); + int intValue; + if (doubleValue % 1 == 0) { + intValue = (int)doubleValue; + cellValue = intValue + ""; + } + else { + cellValue = doubleValue + ""; + } + } break; case Cell.CELL_TYPE_STRING : @@ -1034,4 +1044,36 @@ } return ""; } + + + /** + * �젙洹쒖떇 寃��궗(URL) + * @param url ���긽 臾몄옄�뿴(URL) + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyUrl(String url) { + return verifyRegular(url, Regular.URL); + } + + /** + * �젙洹쒖떇 寃��궗(IP) + * @param ip ���긽 臾몄옄�뿴(IP) + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyIp(String ip) { + return verifyRegular(ip, Regular.IP); + } + + /** + * �젙洹쒖떇 寃��궗 + * @param value ���긽 臾몄옄�뿴 + * @param regular �젙洹쒖떇 寃��궗瑜� �븷 �젙洹쒖떇 援щЦ + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyRegular(String value, String regular) { + if (!StringUtils.isEmpty(value)) { + return Pattern.matches(regular, value); + } + return false; + } } -- Gitblit v1.8.0