From 85a710bf679b1dfdcb77252932d329802f225952 Mon Sep 17 00:00:00 2001 From: jsp Date: Thu, 22 May 2025 10:25:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9C=84=EC=9B=90=EA=B4=80=EB=A6=AC=20>=20?= =?UTF-8?q?=EB=8F=84=EC=9E=A5=20=EC=B2=A8=EB=B6=80=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gtm/seedfile/SeedFileController.java | 8 +- .../com/gtm/seedfile/SeedFileService.java | 240 +++++++++--------- .../TrublchargermngController.java | 60 ++++- .../seed/_extra/gtm/trublchargermng/edit.jsp | 55 +++- .../seed/_extra/gtm/trublchargermng/write.jsp | 33 ++- .../WEB-INF/views/_common/_js/seedFileUtil.js | 118 ++++++++- 6 files changed, 377 insertions(+), 137 deletions(-) diff --git a/src/main/java/seed/com/gtm/seedfile/SeedFileController.java b/src/main/java/seed/com/gtm/seedfile/SeedFileController.java index 49b836a1..dc8dac04 100644 --- a/src/main/java/seed/com/gtm/seedfile/SeedFileController.java +++ b/src/main/java/seed/com/gtm/seedfile/SeedFileController.java @@ -33,11 +33,9 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; +import egovframework.rte.psl.dataaccess.util.EgovMap; import seed.com.gtm.util.CommonsCompress; import seed.com.gtm.util.JSPUtil; - -import egovframework.rte.psl.dataaccess.util.EgovMap; - import seed.utils.SeedDateUtil; import seed.utils.SeedProperties; import seed.utils.SeedUtils; @@ -91,7 +89,7 @@ public class SeedFileController { SeedProperties seedProperties = new SeedProperties(); String tempPath = ""; - if(funcType.equals("trublchargermng")){ + if(funcType.equals("trublchargermng") || funcType.equals("trublchargermng2")){ tempPath = globalRootPath; }else{ tempPath = globalTempPath; @@ -132,7 +130,7 @@ public class SeedFileController { reFileName = reFileName+"."+fileType; File makeFile = null; - if(funcType.equals("trublchargermng")){ + if(funcType.equals("trublchargermng") || funcType.equals("trublchargermng2")){ //위원회 사지파일만 site 밑으로 저장 makeFile = new File(tempPath+"/"+siteIdx+"/upload/tempFiles/"+funcType+"/"+reFileName); }else{ diff --git a/src/main/java/seed/com/gtm/seedfile/SeedFileService.java b/src/main/java/seed/com/gtm/seedfile/SeedFileService.java index 6a6137e8..f2c4dd96 100644 --- a/src/main/java/seed/com/gtm/seedfile/SeedFileService.java +++ b/src/main/java/seed/com/gtm/seedfile/SeedFileService.java @@ -47,138 +47,138 @@ public class SeedFileService { private String globalRootPath; public void fileInsert(Map paramMap, HttpServletRequest request, HttpSession session){ - - String siteIdx = SeedUtils.setReplaceNull(session.getAttribute("siteIdx")); - if(siteIdx.equals("")){ - siteIdx = SeedUtils.setReplaceNull(request.getParameter("siteIdx")); - } - String fileFuncType = (String)paramMap.get("fileFuncType"); - String fileChgType = (String)paramMap.get("fileChgType"); - - SeedProperties seedProperties = new SeedProperties(); - - /*AS-IS 분쟁조정 첨부파일 경로 설정*/ - /*String rootPath = null; - String tempPath = seedProperties.getConfigValue("file.temp.path"); - if(fileFuncType.equals("trublchargermng")){ - rootPath = seedProperties.getConfigValue("root.path"); - }else{ - rootPath = seedProperties.getConfigValue("file.real.path"); - }*/ - - String rootPath = null; - String tempPath = globalTempPath; - if(fileFuncType.equals("trublchargermng") || fileFuncType.indexOf("X-")>-1){ //gw 연동용 파일 - rootPath = globalRootPath; - }else{ - rootPath = globalRealPath; - } - - - - SeedDateUtil seedDateUtil = new SeedDateUtil(); - String toDate = seedDateUtil.getSimpleDateFormat(new Date(), "yyyyMMdd"); - String renameDate = seedDateUtil.getSimpleDateFormat(new Date(), "yyyyMMddHHmmss"); - - SeedUtils.setSeedMkDirs(rootPath + "/"+siteIdx+"/"+ fileFuncType); - - int fileCnt = 0; - - String[] uploadFileName = request.getParameterValues("uploadFileName"); - String[] uploadFileReName = request.getParameterValues("uploadFileReName"); - String[] copyContractYnList = request.getParameterValues("copyContractYn"); + System.out.println(">>>>>>> fileInsert Start <<<<<<<<<"); try { - System.out.println("uploadFileName"); - /*System.out.println(uploadFileName.length); */ - }catch(Exception ex) { - ex.printStackTrace(); - } - - - if(uploadFileName!=null && uploadFileName.length > 0){ - - for(int i=0; i-1){ - oldFile = new File(rootPath + "/"+siteIdx+"/upload/tempFiles/"+fileFuncType+ "/" + uploadFileReNameData); - }else{ - oldFile = new File(tempPath + "/"+siteIdx+"/"+fileFuncType+ "/" + uploadFileReNameData); - } - - System.out.println(oldFile.getAbsolutePath()); - - - if(oldFile.exists()){ - Long fileSize = oldFile.length(); - String filePath =""; - if(fileFuncType.equals("trublchargermng") || fileFuncType.indexOf("X-")>-1){ - SeedUtils.setSeedFileCopy(rootPath + "/"+siteIdx+"/upload/tempFiles/"+fileFuncType+ "/" + uploadFileReNameData, - rootPath + "/"+siteIdx+"/upload/uploadFiles/"+fileFuncType+"/"+reFileName+"."+fileType); - - filePath = rootPath + "/"+siteIdx+"/upload/uploadFiles/"+fileFuncType+"/"+reFileName+"."+fileType; + String siteIdx = SeedUtils.setReplaceNull(session.getAttribute("siteIdx")); + if(siteIdx.equals("")){ + siteIdx = SeedUtils.setReplaceNull(request.getParameter("siteIdx")); + } + String fileFuncType = (String)paramMap.get("fileFuncType"); + String fileChgType = (String)paramMap.get("fileChgType"); + + SeedProperties seedProperties = new SeedProperties(); + + /*AS-IS 분쟁조정 첨부파일 경로 설정*/ + /*String rootPath = null; + String tempPath = seedProperties.getConfigValue("file.temp.path"); + if(fileFuncType.equals("trublchargermng")){ + rootPath = seedProperties.getConfigValue("root.path"); + }else{ + rootPath = seedProperties.getConfigValue("file.real.path"); + }*/ + + String rootPath = null; + String tempPath = globalTempPath; + if(fileFuncType.equals("trublchargermng") || fileFuncType.equals("trublchargermng2") || fileFuncType.indexOf("X-")>-1){ //gw 연동용 파일 + rootPath = globalRootPath; + }else{ + rootPath = globalRealPath; + } + + + + SeedDateUtil seedDateUtil = new SeedDateUtil(); + String toDate = seedDateUtil.getSimpleDateFormat(new Date(), "yyyyMMdd"); + String renameDate = seedDateUtil.getSimpleDateFormat(new Date(), "yyyyMMddHHmmss"); + + SeedUtils.setSeedMkDirs(rootPath + "/"+siteIdx+"/"+ fileFuncType); + + int fileCnt = 0; + + String[] uploadFileName = request.getParameterValues("uploadFileName"); + String[] uploadFileReName = request.getParameterValues("uploadFileReName"); + String[] copyContractYnList = request.getParameterValues("copyContractYn"); + if(fileFuncType.equals("trublchargermng2")){ + uploadFileName = request.getParameterValues("uploadFileName2"); + uploadFileReName = request.getParameterValues("uploadFileReName2"); + } + + try { + System.out.println("uploadFileName"); + /*System.out.println(uploadFileName.length); */ + }catch(Exception ex) { + ex.printStackTrace(); + } + + + if(uploadFileName!=null && uploadFileName.length > 0){ + + for(int i=0; i-1){ + oldFile = new File(rootPath + "/"+siteIdx+"/upload/tempFiles/"+fileFuncType+ "/" + uploadFileReNameData); }else{ - - //241029 - 첨부파일 복사를 위해 real 파일 생성 처리 -/* File makeFile = null; - makeFile = new File(rootPath + "/"+siteIdx+"/"+fileFuncType+"/"+reFileName); - if(! makeFile.exists()){ - //경로에 해당하는 디렉토리들을 생성 - if(makeFile.getParentFile().mkdirs()){ - try { - makeFile.createNewFile(); //이후 파일 생성 - } catch (IOException e) { - // TODO Auto-generated catch block - } - } - }*/ - - SeedUtils.setSeedFileCopy(tempPath + "/"+siteIdx+"/"+fileFuncType + "/" + uploadFileReNameData, - rootPath + "/"+siteIdx+"/"+fileFuncType+"/"+reFileName+"."+fileType); - - filePath = rootPath + "/"+siteIdx+"/"+fileFuncType+"/"+reFileName+"."+fileType; + oldFile = new File(tempPath + "/"+siteIdx+"/"+fileFuncType+ "/" + uploadFileReNameData); } - System.out.println(oldFile.getAbsolutePath()); - - paramMap.put("uploadFileNameData", uploadFileNameData); - paramMap.put("reFileName", reFileName+"."+fileType); - paramMap.put("fileSize", fileSize); - paramMap.put("fileType", fileType); - paramMap.put("filePath", filePath); - paramMap.put("copyContractYn", copyContractYn); - //파일타입에 따라서 sql분기 - if(fileFuncType.equals("mediation")){ - System.out.println(oldFile.getAbsolutePath()); - dao.caseInsert(paramMap); - }else{ - System.out.println(oldFile.getAbsolutePath()); - - if (!"".equals(fileChgType)) { - paramMap.put("fileFuncType", fileChgType); + System.out.println("oldFile.getAbsolutePath() 1 : " + oldFile.getAbsolutePath()); + + if(oldFile.exists()){ + Long fileSize = oldFile.length(); + String filePath =""; + if(fileFuncType.equals("trublchargermng") || fileFuncType.equals("trublchargermng2") || fileFuncType.indexOf("X-")>-1){ + SeedUtils.setSeedFileCopy(rootPath + "/"+siteIdx+"/upload/tempFiles/"+fileFuncType+ "/" + uploadFileReNameData, + rootPath + "/"+siteIdx+"/upload/uploadFiles/"+fileFuncType+"/"+reFileName+"."+fileType); + + filePath = rootPath + "/"+siteIdx+"/upload/uploadFiles/"+fileFuncType+"/"+reFileName+"."+fileType; + }else{ + + SeedUtils.setSeedFileCopy(tempPath + "/"+siteIdx+"/"+fileFuncType + "/" + uploadFileReNameData, + rootPath + "/"+siteIdx+"/"+fileFuncType+"/"+reFileName+"."+fileType); + + filePath = rootPath + "/"+siteIdx+"/"+fileFuncType+"/"+reFileName+"."+fileType; } - System.out.println(paramMap.get("fileText").toString()); + System.out.println("oldFile.getAbsolutePath() 2 : " + oldFile.getAbsolutePath()); - dao.fileInsert(paramMap); + paramMap.put("uploadFileNameData", uploadFileNameData); + paramMap.put("reFileName", reFileName+"."+fileType); + paramMap.put("fileSize", fileSize); + paramMap.put("fileType", fileType); + paramMap.put("filePath", filePath); + paramMap.put("copyContractYn", copyContractYn); + //파일타입에 따라서 sql분기 + if(fileFuncType.equals("mediation")){ + System.out.println("mediation : " + oldFile.getAbsolutePath()); + dao.caseInsert(paramMap); + }else{ + System.out.println("etc : " + oldFile.getAbsolutePath()); + System.out.println("fileChgType : " + fileChgType); + + if (!"".equals(fileChgType)) { + paramMap.put("fileFuncType", fileChgType); + } + + //System.out.println("fileText : " + paramMap.get("fileText").toString()); + + dao.fileInsert(paramMap); + } + + System.out.println("oldFile.delete()"); + oldFile.delete(); + fileCnt = fileCnt+1; } - - oldFile.delete(); - fileCnt = fileCnt+1; } } + } catch (Exception e) { + System.out.println("fileInsert Error : " + e.getMessage()); + e.printStackTrace(); + throw e; } + + System.out.println(">>>>>>> fileInsert End <<<<<<<<<"); } public void fileInsertEgov(EgovMap paramMap, HttpServletRequest request, HttpSession session)throws Exception { diff --git a/src/main/java/seed/com/gtm/trublchargermng/TrublchargermngController.java b/src/main/java/seed/com/gtm/trublchargermng/TrublchargermngController.java index cebb640e..c4480c53 100644 --- a/src/main/java/seed/com/gtm/trublchargermng/TrublchargermngController.java +++ b/src/main/java/seed/com/gtm/trublchargermng/TrublchargermngController.java @@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import seed.com.gtm.seedfile.SeedFileService; -import seed.com.gtm.util.PageMaker; import seed.com.gtm.util.Criteria; +import seed.com.gtm.util.PageMaker; import seed.utils.SeedUtils; @Controller @@ -81,9 +81,26 @@ public class TrublchargermngController { paramMap.put("dataIdx", paramMap.get("seq")); - fileService.fileInsert(paramMap, request, session); - + //명함이미지 추가 + String fileFuncType = (String)paramMap.get("fileFuncType"); + if(fileFuncType.equals("trublchargermng")){ + paramMap.put("fileFuncType", fileFuncType); + paramMap.put("fileChgType", fileFuncType); + + System.out.println("=====> 명함이미지 추가"); + fileService.fileInsert(paramMap, request, session); + } + //도장이미지 추가 + String fileFuncType2 = (String)paramMap.get("fileFuncType2"); + if(fileFuncType2.equals("trublchargermng2")){ + paramMap.put("fileFuncType", fileFuncType2); + paramMap.put("fileChgType", fileFuncType2); + + System.out.println("=====> 도장이미지 추가"); + fileService.fileInsert(paramMap, request, session); + } + map.put("message", "common.message.reg"); map.put("url", "/gtm/case/trublchargermng/list.do"); @@ -182,12 +199,18 @@ public class TrublchargermngController { } } - + //명함사진 List paramMap.put("dataIdx", paramMap.get("memberNo")); paramMap.put("fileFuncType", "trublchargermng"); List> fileList = fileService.fileList(paramMap); model.addAttribute("fileList", fileList); + //도장사진 List + paramMap.put("dataIdx", paramMap.get("memberNo")); + paramMap.put("fileFuncType", "trublchargermng2"); + List> fileList2 = fileService.fileList(paramMap); + model.addAttribute("fileList2", fileList2); + return "/seed/_extra/gtm/trublchargermng/edit"; } @@ -240,10 +263,33 @@ public class TrublchargermngController { //성별은 MEMBER_ITEM_B2, 등급은 MEMBER_ITEM_C3, 비고 MEMBER_ITEM_D4 service.trublchargermngUpdate(paramMap); - + paramMap.put("dataIdx", paramMap.get("memberNo")); - fileService.fileInsert(paramMap, request, session); - fileService.fileDel(paramMap); + //명함이미지 추가 + String fileFuncType = (String)paramMap.get("fileFuncType"); + if(fileFuncType.equals("trublchargermng")){ + paramMap.put("fileFuncType", fileFuncType); + paramMap.put("fileChgType", fileFuncType); + + System.out.println("=====> 명함이미지 추가"); + fileService.fileInsert(paramMap, request, session); + fileService.fileDel(paramMap); + } + + //도장이미지 추가 + String fileFuncType2 = (String)paramMap.get("fileFuncType2"); + String uploadFileCnt2 = (String)paramMap.get("uploadFileCnt2"); + String deleteFileData2 = (String)paramMap.get("deleteFileData2"); + if(fileFuncType2.equals("trublchargermng2")){ + paramMap.put("fileFuncType", fileFuncType2); + paramMap.put("fileChgType", fileFuncType2); + paramMap.put("uploadFileCnt", uploadFileCnt2); + paramMap.put("deleteFileData", deleteFileData2); + + System.out.println("=====> 도장이미지 추가"); + fileService.fileInsert(paramMap, request, session); + fileService.fileDel(paramMap); + } map.put("message", "common.message.mod"); map.put("url", "/gtm/case/trublchargermng/list.do"); diff --git a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/edit.jsp b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/edit.jsp index b6b9fad6..9dcec0b2 100644 --- a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/edit.jsp @@ -125,7 +125,7 @@
-

* 사진

+

* 사진(명함)

  • 사진이미지
  • @@ -151,6 +151,33 @@
+
+

* 사진(도장)

+
+ +
+

+ - 본인의 도장사진을 등록해주세요.
+ - gif, jpg 파일만 등록 가능합니다. +

+ +
+ + + +
+
+

* 이메일

@@ -328,6 +355,14 @@
+ +
+ +
+ +
+
+
@@ -632,11 +667,27 @@ } + function checkFileNo2(){ + var liSize = $("#upFileHtml2 li").size(); + + if(liSize > 1){ + alert("이미지는 한개만 업로드 가능합니다. 삭제후 업로드 해 주세요."); + return false; + } + + fileTempUp2('trublchargermng2'); + + } + function deleteImg(){ $("#trubleImg").attr("src",""); } + + function deleteImg2(){ + $("#trubleImg2").attr("src",""); + } - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/write.jsp b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/write.jsp index 8a4f69ea..3767f800 100644 --- a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/write.jsp +++ b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/trublchargermng/write.jsp @@ -125,7 +125,7 @@
-

* 사진

+

* 사진(명함)

사진이미지

@@ -146,6 +146,28 @@

+
+

* 사진(도장)

+
+ 사진이미지 +

+ - 본인의 도장사진을 등록해주세요.
+ - gif, jpg 파일만 등록 가능합니다. +

+
+ +
+
    + +
+ + + + + +
+
+

* 이메일

+
+ +
+ +
+
+
@@ -547,6 +576,6 @@ - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/_common/_js/seedFileUtil.js b/src/main/webapp/WEB-INF/views/_common/_js/seedFileUtil.js index e8afb1a3..7b2e7449 100644 --- a/src/main/webapp/WEB-INF/views/_common/_js/seedFileUtil.js +++ b/src/main/webapp/WEB-INF/views/_common/_js/seedFileUtil.js @@ -39,7 +39,44 @@ function fileTempUp(fileFuncType){ return false; } - $("#fileTempUpFrm").submit(); + $("#fileTempUpFrm").submit(); +} + +function fileTempUp2(fileFuncType){ + + if($("#upFile2").val() == ""){ + alert("파일을 선택해 주세요"); + $("#upFile").focus(); + return false; + } + + var val = $("#upFile2").val().split("\\"); + var fileName = val[val.length-1]; //마지막 화일명 + var fileType = fileName.substring(fileName.lastIndexOf("."));//확장자빼오기 + + var extArray = null; + if(fileFuncType == "trublchargermng2"){ + extArray = new Array("jpeg","jpg","gif"); + }else{ + extArray = new Array("txt","jpeg","jpg","png","gif","bmp","mp3","mp4","hwp","doc","docx","xls","xlsx","ppt","pptx","pdf","zip","alz","hwpx"); + } + + + var extChk = false; + + for(var f=0; f 500){ + alert("첨부파일 크기가 500Mbyte를 넘었습니다."); + return; + } + + + var upFileLiLength = parseInt($("#uploadFileCntId2").val()); + upFileLiLength = upFileLiLength+1; + $("#uploadFileCntId2").val(upFileLiLength); + + if(fileCountFix==0){ + fileCountFix = upFileLiLength; + } + + fileCountFix = fileCountFix+1; + + var fileHtml = "
  • "; + fileHtml = fileHtml+"\"gif\"  "; + fileHtml = fileHtml+fileName+"  ("+sizeData+")"; + fileHtml = fileHtml+" "; + fileHtml = fileHtml+"\"삭제\""; + fileHtml = fileHtml+""; + fileHtml = fileHtml+""; + fileHtml = fileHtml+""; + fileHtml = fileHtml+"
  • "; + $("#upFileHtml2").append(fileHtml); +} + function jf_delete_file(deleteNum, sizeData){ var fileIdx = $("#upFileHtml > #fileUploadP"+deleteNum).children(".fileIdxClass").val(); @@ -124,3 +215,28 @@ function jf_delete_file(deleteNum, sizeData){ totFileSize = 0; } } + +function jf_delete_file2(deleteNum, sizeData){ + + var fileIdx = $("#upFileHtml2 > #fileUploadP"+deleteNum).children(".fileIdxClass").val(); + + if(fileIdx != ""){ + var deleteFileData = $("#deleteFileDataId2").val(); + if(deleteFileData != ""){ + deleteFileData = deleteFileData+","+fileIdx; + }else{ + deleteFileData = fileIdx; + } + + $("#deleteFileDataId2").val(deleteFileData); + + } + + $("#upFileHtml2 > #fileUploadP"+deleteNum).remove(); + + totFileSize = totFileSize-sizeData; + + if(totFileSize < 0){ + totFileSize = 0; + } +}