feat: 검수사용자 유통데이터 등록 시, 실내 토사시험 이미지가 없어도 등록되도록 개선

main
thkim 2026-03-23 15:12:07 +09:00
parent c312d40d3f
commit ffd57bf698
3 changed files with 147 additions and 110 deletions

View File

@ -1503,6 +1503,14 @@ public class RegiController {
}
}
model.put("triCu_code", triCu_code);
triCu_image1 = MyUtil.removeSpaceAndComma(triCu_image1);
triCu_image2 = MyUtil.removeSpaceAndComma(triCu_image2);
if( triCu_image1.equals("") ) {
//토사 삼축압축 시험 그래프 이미지 없음. 1
}
if( triCu_image2.equals("") ) {
//토사 삼축압축 시험 그래프 이미지 없음. 2
}
model.put("triCu_image1", triCu_image1);
model.put("triCu_image2", triCu_image2);

View File

@ -28,7 +28,7 @@ public final class MyUtil {
private static final Logger logger = LoggerFactory.getLogger(MyUtil.class);
public static final String VERSION = "20260206_1430";
public static final String VERSION = "20260323_1328";
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
@ -969,5 +969,16 @@ public final class MyUtil {
}
}
/**
* .
* @param input
* @return
*/
public static String removeSpaceAndComma(String input) {
if (input == null) return null;
// [ ,] : 공백(' ') 또는 쉼표(',')를 의미하는 정규식
return input.replaceAll("[ ,]", "");
}
}

View File

@ -16,10 +16,15 @@
<%@page import="java.nio.file.Path"%>
<%@page import="java.nio.file.Paths"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.UUID"%><%-- UUID 임포트 추가 --%>
<%@page import="geoinfo.regi.util.CompressZip"%>
<%@page import="egovframework.com.cmm.service.EgovProperties"%>
<%
// 1. UUID 생성 (요청 식별용)
String reqUuid = UUID.randomUUID().toString();
System.out.println("[" + reqUuid + "] createZip.jsp 요청 시작 - 일시: " + new Date().toString());
String propertyPath = request.getSession().getServletContext().getRealPath("/") + File.separator + "WEB-INF" + File.separator + "clipreport4" + File.separator + "clipreport4.properties";
out.clear();
out = pageContext.pushBody();
@ -48,9 +53,9 @@ Path directoryPath = Paths.get(fileCreatePathZip+projectCode);
try {
// 디렉토리 삭제
Files.deleteIfExists(directoryPath);
System.out.println("기존파일이삭제되었습니다.");
System.out.println("[" + reqUuid + "]" + "기존파일이삭제되었습니다.");
} catch (DirectoryNotEmptyException e) {
System.out.println("디렉토리가 비어있지 않습니다");
System.out.println("[" + reqUuid + "]" + "디렉토리가 비어있지 않습니다");
} catch (IOException e) {
e.printStackTrace();
}
@ -61,7 +66,7 @@ try {
String[] fileNames = new String[3000];
fileNames[0] = "프로젝트정보\\프로젝트정보";
System.out.println("sampleYn----------"+sampleYn);
System.out.println("[" + reqUuid + "]" + "sampleYn----------"+sampleYn);
int sampleCount = Integer.parseInt(String.valueOf(request.getAttribute("sampleCount")));
OOFDocument oof = OOFDocument.newOOF();
oof.addConnectionData("*", "oracle1");
@ -632,7 +637,7 @@ if(("Y").equals(waterpressure)){
"new Date().toString():[" + new Date().toString() + "]\n" + "\n" +
"---------- BUG REPORTING END ----------" + "\n" +
"";
System.out.println(strTxt);
System.out.println("[" + reqUuid + "]" + strTxt);
}
for(int i=0; i<waterpressureCnt; i++){
@ -646,7 +651,7 @@ if(("Y").equals(waterpressure)){
"new Date().toString():[" + new Date().toString() + "]\n" + "\n" +
"---------- BUG REPORTING END ----------" + "\n" +
"";
System.out.println(strTxt);
System.out.println("[" + reqUuid + "]" + strTxt);
imagePath = null;
} else {
if("noImage".equals(waterpressureImage[0]) || "noImage".equals(waterpressureImage[i])){
@ -1595,95 +1600,98 @@ if(("Y").equals(consolidation)){
}
}
if(("Y").equals(triaxialCu)){
String triCu_code = (String)request.getAttribute("triCu_code");
String triCu_image1 = (String)request.getAttribute("triCu_image1");
String triCu_image2 = (String)request.getAttribute("triCu_image2");
if (("Y").equals(triaxialCu)) {
String triCu_code = (String) request.getAttribute("triCu_code");
String triCu_image1 = (String) request.getAttribute("triCu_image1");
String triCu_image2 = (String) request.getAttribute("triCu_image2");
System.out.println("[" + reqUuid + "]" + "[실내토사시험] - triCu_image1 [" + (triCu_image1 == null ? "null" : triCu_image1) + "]" );
System.out.println("[" + reqUuid + "]" + "[실내토사시험] - triCu_image2 [" + (triCu_image2 == null ? "null" : triCu_image2) + "]" );
String triCuCode[] = triCu_code.split(",");
String triCuImage1[] = triCu_image1.split(",");
String triCuImage2[] = triCu_image2.split(",");
int triCuCnt = triCuCode.length;
int triCuImageCnt1 = triCuImage1.length;
int triCuImageCnt2 = triCuImage2.length;
String triCuCode[] = triCu_code.split(",");
String triCuImage1[] = triCu_image1.split(",");
String triCuImage2[] = triCu_image2.split(",");
int triCuCnt = triCuCode.length;
int triCuImageCnt1 = triCuImage1.length;
int triCuImageCnt2 = triCuImage2.length;
String holecode_unit = (String) request.getAttribute("triCu_holecode_unit");
String item_info_code = (String) request.getAttribute("triCu_item_info_code");
String REFERENCE_DESE = (String) request.getAttribute("triCu_REFERENCE_DESE");
String holecode_unit = (String)request.getAttribute("triCu_holecode_unit");
String item_info_code = (String)request.getAttribute("triCu_item_info_code");
String REFERENCE_DESE = (String)request.getAttribute("triCu_REFERENCE_DESE");
String HoleCodeUnit[] = holecode_unit.split(",");
String ItemInfoCode[] = item_info_code.split(",");
String REFERENCEDESE[] = REFERENCE_DESE.split(",");
String HoleCodeUnit[] = holecode_unit.split(",");
String ItemInfoCode[] = item_info_code.split(",");
String REFERENCEDESE[] = REFERENCE_DESE.split(",");
oof = OOFDocument.newOOF();
oof.addConnectionData("*", "oracle1");
file = oof.addFile("reb.root", realPath + "web\\service\\SOIL_TRIAXIAL_CU.reb");
oof = OOFDocument.newOOF();
oof.addConnectionData("*", "oracle1");
file = oof.addFile("reb.root", realPath+"web\\service\\SOIL_TRIAXIAL_CU.reb");;
for (int i = 0; i < triCuCnt; i++) {
// 이미지 1 경로 설정
if( triCuImage1 == null ) {
imagePath1 = Path + "/web/images/no_image.png";
} else if( triCuImage1.length -1 < i ) {
imagePath1 = Path + "/web/images/no_image.png";
} else if ("noImage".equals(triCuImage1[0]) || "noImage".equals(triCuImage1[i])) {
imagePath1 = Path + "/web/images/no_image.png";
} else {
imagePath1 = Path + "/files/web/CH/" + projectCode + "/" + triCuCode[i].substring(0, (triCuCode[i]).length() - 6) + "/SAND_TRIAXIAL/" + triCuImage1[i];
}
for(int i=0; i<triCuCnt; i++){
if("noImage".equals(triCuImage1[0]) || "noImage".equals(triCuImage1[i])){
imagePath1 = Path + "/web/images/no_image.png";
}else{
imagePath1 = Path + "/files/web/CH/" + projectCode + "/" + triCuCode[i].substring(0, (triCuCode[i]).length()-6)+ "/SAND_TRIAXIAL/" + triCuImage1[i];
}
if("noImage".equals(triCuImage2[0]) || "noImage".equals(triCuImage2[i])){
imagePath2 = Path + "/web/images/no_image.png";
}else{
imagePath2 = Path + "/files/web/CH/" + projectCode + "/" + triCuCode[i].substring(0, (triCuCode[i]).length()-6) + "/SAND_TRIAXIAL/" + triCuImage2[i];
}
// 이미지 2 경로 설정
if( triCuImage1 == null ) {
imagePath2 = Path + "/web/images/no_image.png";
} else if( triCuImage1.length -1 < i ) {
imagePath2 = Path + "/web/images/no_image.png";
} else if ("noImage".equals(triCuImage2[0]) || "noImage".equals(triCuImage2[i])) {
imagePath2 = Path + "/web/images/no_image.png";
} else {
imagePath2 = Path + "/files/web/CH/" + projectCode + "/" + triCuCode[i].substring(0, (triCuCode[i]).length() - 6) + "/SAND_TRIAXIAL/" + triCuImage2[i];
}
file.addField("project_code", projectCode);
file.addField("tri_code", triCuCode[i]);
file.addField("image1", imagePath1);
file.addField("image2", imagePath2);
file.addField("project_code", projectCode);
file.addField("tri_code", triCuCode[i]);
file.addField("image1", imagePath1);
file.addField("image2", imagePath2);
for(int k =0; k <HoleCodeUnit.length; k++ ){
if(triCuCode[i].contains(HoleCodeUnit[k])){
if(ItemInfoCode[k].equals("TRI_CU")){
file.addField("TRI_CU", REFERENCEDESE[k]);
// 상세 시험 데이터 매핑
for (int k = 0; k < HoleCodeUnit.length; k++) {
if (triCuCode[i].contains(HoleCodeUnit[k])) {
if (ItemInfoCode[k].equals("TRI_CU")) {
file.addField("TRI_CU", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_MAXSIGMA")) {
file.addField("TRICU_MAXSIGMA", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_RD0")) {
file.addField("TRICU_RD0", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_SIGMA3")) {
file.addField("TRICU_SIGMA3", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_U")) {
file.addField("TRICU_U", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_UF")) {
file.addField("TRICU_UF", REFERENCEDESE[k]);
} else if (ItemInfoCode[k].equals("TRICU_ULTSIGMA")) {
file.addField("TRICU_ULTSIGMA", REFERENCEDESE[k]);
}
}
}
}else if(ItemInfoCode[k].equals("TRICU_MAXSIGMA")){
file.addField("TRICU_MAXSIGMA", REFERENCEDESE[k]);
// 폴더 생성 및 파일 저장
folerPath = fileCreatePathZip + projectCode + "\\4.실내토사시험";
Folder = new File(folerPath);
if (!Folder.exists()) {
try {
Folder.mkdirs();
} catch (Exception e) {
e.printStackTrace();
}
}
}else if(ItemInfoCode[k].equals("TRICU_RD0")){
file.addField("TRICU_RD0", REFERENCEDESE[k]);
// 파일명 특수문자 제거 및 PDF 생성
String cleanTriCuCode = triCuCode[i].replaceAll("[\\./\\\\&]", "");
localFileSave = new File(folerPath + "\\토사_삼축압축시험_CU_" + cleanTriCuCode + ".pdf");
fileStream = new FileOutputStream(localFileSave);
ClipReportExport.createExportForPDF(request, fileStream, propertyPath, oof, option);
}else if(ItemInfoCode[k].equals("TRICU_SIGMA3")){
file.addField("TRICU_SIGMA3", REFERENCEDESE[k]);
}else if(ItemInfoCode[k].equals("TRICU_U")){
file.addField("TRICU_U", REFERENCEDESE[k]);
}else if(ItemInfoCode[k].equals("TRICU_UF")){
file.addField("TRICU_UF", REFERENCEDESE[k]);
}else if(ItemInfoCode[k].equals("TRICU_ULTSIGMA")){
file.addField("TRICU_ULTSIGMA", REFERENCEDESE[k]);
}
}
}
folerPath = fileCreatePathZip+projectCode+"\\4.실내토사시험";
Folder = new File(folerPath);
if (!Folder.exists()) {
try{
Folder.mkdirs(); //폴더 생성합니다.
}
catch(Exception e){
e.getStackTrace();
}
}else {
}
triCuCode[i] = triCuCode[i].replaceAll("\\.", "").replaceAll("/", "").replaceAll("\\\\", "").replaceAll("&", "");
String triCuCodeName = triCuCode[i];
triCuCodeName = triCuCodeName.replaceAll("\\.", "").replaceAll("/", "").replaceAll("\\\\", "").replaceAll("&", "");
localFileSave = new File(fileCreatePathZip+projectCode+"\\4.실내토사시험\\토사_삼축압축시험_CU_"+ triCuCodeName+".pdf");
fileStream = new FileOutputStream(localFileSave);
ClipReportExport.createExportForPDF(request, fileStream, propertyPath, oof, option);
}
}
}
if(("Y").equals(triaxialUu)){
String triUu_code = (String)request.getAttribute("triUu_code");
@ -1713,15 +1721,25 @@ if(("Y").equals(triaxialUu)){
for(int i=0; i<triUuCnt; i++){
if("noImage".equals(triUuImage1[0]) || "noImage".equals(triUuImage1[i])){
imagePath1 = Path + "/web/images/no_image.png";
if( triUuImage1 == null ) {
imagePath1 = Path + "/web/images/no_image.png";
} else if( triUuImage1.length -1 < i ) {
imagePath1 = Path + "/web/images/no_image.png";
} else if("noImage".equals(triUuImage1[0]) || "noImage".equals(triUuImage1[i])){
imagePath1 = Path + "/web/images/no_image.png";
}else{
imagePath1 = Path + "/files/web/CH/" + projectCode + "/" + triUuCode[i].substring(0, (triUuCode[i]).length()-6) + "/SAND_TRIAXIAL/" + triUuImage1[i];
imagePath1 = Path + "/files/web/CH/" + projectCode + "/" + triUuCode[i].substring(0, (triUuCode[i]).length()-6) + "/SAND_TRIAXIAL/" + triUuImage1[i];
}
if("noImage".equals(triUuImage2[0]) || "noImage".equals(triUuImage2[i])){
imagePath2 = Path + "/web/images/no_image.png";
if( triUuImage2 == null ) {
imagePath2 = Path + "/web/images/no_image.png";
} else if( triUuImage2.length -1 < i ) {
imagePath2 = Path + "/web/images/no_image.png";
} else if("noImage".equals(triUuImage2[0]) || "noImage".equals(triUuImage2[i])){
imagePath2 = Path + "/web/images/no_image.png";
}else{
imagePath2 = Path + "/files/web/CH/" + projectCode + "/" + triUuCode[i].substring(0, (triUuCode[i]).length()-6) + "/SAND_TRIAXIAL/" + triUuImage2[i];
imagePath2 = Path + "/files/web/CH/" + projectCode + "/" + triUuCode[i].substring(0, (triUuCode[i]).length()-6) + "/SAND_TRIAXIAL/" + triUuImage2[i];
}
file.addField("project_code", projectCode);
@ -1943,9 +1961,9 @@ if (!Folder.exists()) {
}else {
}
System.out.println("zipPath----------" + zipPath);
System.out.println("fileCreatePathZip+zipFilep----------" + fileCreatePathZip + zipFile);
System.out.println("savePath----------" + savePath);
System.out.println("[" + reqUuid + "]" + "zipPath----------" + zipPath);
System.out.println("[" + reqUuid + "]" + "fileCreatePathZip+zipFilep----------" + fileCreatePathZip + zipFile);
System.out.println("[" + reqUuid + "]" + "savePath----------" + savePath);
try {
// 대상 파일 경로 생성
@ -1954,25 +1972,25 @@ System.out.println("zipPath----------" + zipPath);
// 파일이 존재하는지 확인 후 삭제
if (targetFile.exists()) {
if (targetFile.delete()) {
System.out.println("기존 파일 삭제 성공: " + targetFile.getAbsolutePath());
System.out.println("[" + reqUuid + "]" + "기존 파일 삭제 성공: " + targetFile.getAbsolutePath());
} else {
System.err.println("기존 파일 삭제 실패: " + targetFile.getAbsolutePath());
System.err.println("[" + reqUuid + "]" + "기존 파일 삭제 실패: " + targetFile.getAbsolutePath());
}
}
compressZip.compress(zipPath, savePath, zipFile);
out.println("압축 성공!");
out.println("[" + reqUuid + "]" + "압축 성공!");
} catch (IOException e) {
out.println("압축 실패 (IOException): " + e.getMessage());
out.println("[" + reqUuid + "]" + "압축 실패 (IOException): " + e.getMessage());
e.printStackTrace(); // 콘솔 또는 로그에 에러 메시지 출력 (디버깅에 유용)
} catch (NullPointerException e) {
out.println("압축 실패 (NullPointerException): " + e.getMessage());
out.println("[" + reqUuid + "]" + "압축 실패 (NullPointerException): " + e.getMessage());
e.printStackTrace();
} catch (IllegalArgumentException e) {
out.println("압축 실패 (IllegalArgumentException): " + e.getMessage());
out.println("[" + reqUuid + "]" + "압축 실패 (IllegalArgumentException): " + e.getMessage());
e.printStackTrace();
} catch (Exception e) { // 그 외의 예외
out.println("압축 실패 (기타 예외): " + e.getMessage());
out.println("[" + reqUuid + "]" + "압축 실패 (기타 예외): " + e.getMessage());
e.printStackTrace();
}
@ -1996,14 +2014,14 @@ System.out.println("zipPath----------" + zipPath);
/* int statusType = ClipReportExport.createExportForPDF(request, fileStream, propertyPath, oof, splitPage, fileNames, option);
*/
/* System.out.println("값확인request----------"+request);
System.out.println("값확인fileStream----------"+fileStream);
System.out.println("값확인propertyPath----------"+propertyPath);
System.out.println("값확인oof----------"+oof);
System.out.println("값확인splitPage----------"+splitPage);
System.out.println("값확인fileNames----------"+fileNames);
System.out.println("option----------"+option);
System.out.println("값확인----------"+statusType); */
/* System.out.println("[" + reqUuid + "]" + "값확인request----------"+request);
System.out.println("[" + reqUuid + "]" + "값확인fileStream----------"+fileStream);
System.out.println("[" + reqUuid + "]" + "값확인propertyPath----------"+propertyPath);
System.out.println("[" + reqUuid + "]" + "값확인oof----------"+oof);
System.out.println("[" + reqUuid + "]" + "값확인splitPage----------"+splitPage);
System.out.println("[" + reqUuid + "]" + "값확인fileNames----------"+fileNames);
System.out.println("[" + reqUuid + "]" + "option----------"+option);
System.out.println("[" + reqUuid + "]" + "값확인----------"+statusType); */
//statusType == 0 정상적인 출력
//statusType == 1 인스톨 오류
//statusType == 2 oof 문서 오류