fix: 검수등록대기 목록에서 등록 누를 때, 시추공 시작 종료 날짜가 실제 존재하는 날짜인지 확인하는 로직 추가
parent
69a4adfb88
commit
379a755d44
|
|
@ -2,6 +2,7 @@ package geoinfo.com;
|
||||||
|
|
||||||
import comm.framework.dbcp.*;
|
import comm.framework.dbcp.*;
|
||||||
import egovframework.com.cmm.service.EgovProperties;
|
import egovframework.com.cmm.service.EgovProperties;
|
||||||
|
import geoinfo.util.MyUtil;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -235,13 +236,13 @@ public class WebConfirm
|
||||||
String dateTo = rs.getString("HOLE_DATE_TO");
|
String dateTo = rs.getString("HOLE_DATE_TO");
|
||||||
|
|
||||||
// HOLE_DATE_FROM 유효성 검사
|
// HOLE_DATE_FROM 유효성 검사
|
||||||
if (!isValidDateString(dateFrom)) {
|
if (!MyUtil.isValidDate(dateFrom)) {
|
||||||
errorMessages.append("- " + holeCode + " 시추공의 시추시작일(" + (dateFrom == null ? "" : dateFrom) + ") 형식이 8자리 숫자가 아닙니다.\\n");
|
errorMessages.append("- " + holeCode + " 시추공의 시추시작일(" + (dateFrom == null ? "" : dateFrom) + ") 형식이 8자리 숫자가 아니거나 실제 존재하는 날짜가 아닙니다.\\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// HOLE_DATE_TO 유효성 검사
|
// HOLE_DATE_TO 유효성 검사
|
||||||
if (!isValidDateString(dateTo)) {
|
if (!MyUtil.isValidDate(dateTo)) {
|
||||||
errorMessages.append("- " + holeCode + " 시추공의 시추종료일(" + (dateTo == null ? "" : dateTo) + ") 형식이 8자리 숫자가 아닙니다.\\n");
|
errorMessages.append("- " + holeCode + " 시추공의 시추종료일(" + (dateTo == null ? "" : dateTo) + ") 형식이 8자리 숫자가 아니거나 실제 존재하는 날짜가 아닙니다.\\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,7 +316,7 @@ public class WebConfirm
|
||||||
double consolE = rs.getDouble("CONSOL_E");
|
double consolE = rs.getDouble("CONSOL_E");
|
||||||
int count = rs.getInt("COUNT");
|
int count = rs.getInt("COUNT");
|
||||||
|
|
||||||
errorMessages.append("- 시료코드[" + sampleCode + "]의 하중(" + consolP + ") 및 간극비(" + consolE + ") 데이터가 " + count + "개 중복됨.\\n");
|
errorMessages.append("- 시료코드[" + sampleCode + "]의 하중(" + consolP + ") 및 공극비(" + consolE + ") 데이터가 " + count + "개 중복됨.\\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMessages.length() > 0) {
|
if (errorMessages.length() > 0) {
|
||||||
|
|
@ -344,20 +345,6 @@ public class WebConfirm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 날짜 문자열이 8자리 숫자로 구성되어 있는지 확인합니다.
|
|
||||||
* @param dateStr 날짜 문자열
|
|
||||||
* @return 유효하면 true, 아니면 false
|
|
||||||
*/
|
|
||||||
private boolean isValidDateString(String dateStr) {
|
|
||||||
if (dateStr == null) return false;
|
|
||||||
String trimmedDate = dateStr.trim();
|
|
||||||
// 8자리 숫자 정규식 체크 (예: 20131108)
|
|
||||||
return trimmedDate.matches("^\\d{8}$");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -392,7 +379,7 @@ public class WebConfirm
|
||||||
|
|
||||||
// 유효성 체크 ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
|
// 유효성 체크 ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// 압밀시험 정보(TEMP_CONSOLIDATION) 중복 체크 수행
|
// 토사 압밀시험 정보(TEMP_CONSOLIDATION) 중복 체크 수행
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
Map<String, Object> consolValidation = validationCheckTempConsolidation(request, PROJECT_CODE);
|
Map<String, Object> consolValidation = validationCheckTempConsolidation(request, PROJECT_CODE);
|
||||||
|
|
||||||
|
|
@ -401,7 +388,7 @@ public class WebConfirm
|
||||||
logger.warn("Consolidation validation failed for PROJECT_CODE [{}]: {}", PROJECT_CODE, errorMessage);
|
logger.warn("Consolidation validation failed for PROJECT_CODE [{}]: {}", PROJECT_CODE, errorMessage);
|
||||||
|
|
||||||
// 예외를 발생시켜 전체 로직 롤백 및 사용자 알림
|
// 예외를 발생시켜 전체 로직 롤백 및 사용자 알림
|
||||||
throw new SQLException("등록에 실패하였습니다.\\n\\n압밀시험 정보(TEMP_CONSOLIDATION) 중 시료코드, 하중, 간극비 조합이 중복되었습니다. 데이터를 확인해 주세요:\\n\\n" + errorMessage);
|
throw new SQLException("등록에 실패하였습니다.\\n\\n토사 압밀시험 정보(TEMP_CONSOLIDATION) 중 시료코드, 하중, 간극비 조합이 중복되었습니다. 데이터를 확인해 주세요:\\n\\n" + errorMessage);
|
||||||
}
|
}
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// 유효성 체크 ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
|
// 유효성 체크 ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
|
||||||
|
|
|
||||||
|
|
@ -943,5 +943,31 @@ public final class MyUtil {
|
||||||
return detectedWords.toString();
|
return detectedWords.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 날짜 문자열이 8자리 숫자이며, 실제 달력상 유효한 날짜인지 확인합니다.
|
||||||
|
* @param dateStr 날짜 문자열 (YYYYMMDD)
|
||||||
|
* @return 유효하면 true, 아니면 false
|
||||||
|
*/
|
||||||
|
public static boolean isValidDate(String dateStr) {
|
||||||
|
if (dateStr == null || dateStr.trim().length() != 8) return false;
|
||||||
|
|
||||||
|
String trimmedDate = dateStr.trim();
|
||||||
|
|
||||||
|
// 1. 숫자 8자리 정규식 체크
|
||||||
|
if (!trimmedDate.matches("^\\d{8}$")) return false;
|
||||||
|
|
||||||
|
// 2. 실제 달력상 존재하는 날짜인지 체크 (예: 20140229 체크)
|
||||||
|
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
|
||||||
|
sdf.setLenient(false); // 엄격한 검사 설정 (false로 해야 2월 29일 같은 날을 에러 처리함)
|
||||||
|
|
||||||
|
try {
|
||||||
|
sdf.parse(trimmedDate);
|
||||||
|
return true;
|
||||||
|
} catch (java.text.ParseException e) {
|
||||||
|
return false; // 유효하지 않은 날짜 (20140229 등)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue