diff --git a/src/main/java/seed/com/gtm/board/CaseBoardController.java b/src/main/java/seed/com/gtm/board/CaseBoardController.java index 49c3a90c..d3a36d71 100644 --- a/src/main/java/seed/com/gtm/board/CaseBoardController.java +++ b/src/main/java/seed/com/gtm/board/CaseBoardController.java @@ -14,14 +14,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - import seed.com.gtm.seedfile.SeedFileService; import seed.com.gtm.util.Criteria; import seed.com.gtm.util.PageMaker; import seed.common.service.InnorixFileService; -import seed.common.service.InnorixFileVO; @Controller @RequestMapping("/gtm/case") @@ -56,24 +52,32 @@ public class CaseBoardController { paramMap.put("memberId", session.getAttribute("memberId")); paramMap.put("boardIdx", boardIdx); service.boardInsert(paramMap); - + //현제 등록된 게시글의 시퀀스 불러와 맵에 저장 paramMap.put("dataIdx", paramMap.get("seq")); fileService.fileInsert(paramMap, request, session); //이노릭스 대용량 업로드 - String innorixFileListVO = (String) paramMap.get("innorixFileListVO"); - if("".equals(innorixFileListVO)) { + String innorixFileListStr = (String) paramMap.get("innorixFileListVO"); + if(!"".equals(innorixFileListStr)) { + try { + innorixFileService.innorixExtraFileInsert(innorixFileListStr, paramMap); + }catch(Exception e) { + System.out.println("이노릭스에러"); + e.printStackTrace(); + } + } +/* if(!"".equals(innorixFileListVO)) { ObjectMapper objectMapper = new ObjectMapper(); try { List innorixFileList = objectMapper.readValue(innorixFileListVO, new TypeReference>() {}); - innorixFileService.innorixFileInsert(innorixFileList); + innorixFileService.innorixExtraFileInsert(innorixFileList, paramMap); }catch (Exception e) { e.printStackTrace(); } } - +*/ map.put("message", "common.message.reg"); map.put("url", "/gtm/case/board/"+boardIdx+"/list.do"); diff --git a/src/main/java/seed/common/service/InnorixFileService.java b/src/main/java/seed/common/service/InnorixFileService.java index cebd6366..095f3a00 100644 --- a/src/main/java/seed/common/service/InnorixFileService.java +++ b/src/main/java/seed/common/service/InnorixFileService.java @@ -1,9 +1,11 @@ package seed.common.service; -import java.util.List; +import java.util.Map; + +import org.springframework.web.bind.annotation.RequestParam; public interface InnorixFileService { - public void innorixFileInsert(List innorixFileList) throws Exception; + public void innorixExtraFileInsert(String innorixFileListStr, @RequestParam Map paramMap) throws Exception; } diff --git a/src/main/java/seed/common/service/InnorixFileServiceImpl.java b/src/main/java/seed/common/service/InnorixFileServiceImpl.java index 09257dcb..91a631fa 100644 --- a/src/main/java/seed/common/service/InnorixFileServiceImpl.java +++ b/src/main/java/seed/common/service/InnorixFileServiceImpl.java @@ -1,10 +1,15 @@ package seed.common.service; import java.util.List; +import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import seed.dao.InnorixFileDAO; @@ -15,10 +20,20 @@ public class InnorixFileServiceImpl extends EgovAbstractServiceImpl implements I @Resource(name="innorixFileDAO") public InnorixFileDAO innorixFileDAO; - public void innorixFileInsert(List innorixFileList) throws Exception { + @Override + public void innorixExtraFileInsert(String innorixFileListStr, @RequestParam Map paramMap) throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + List innorixFileList = objectMapper.readValue(innorixFileListStr, new TypeReference>() {}); + for(InnorixFileVO innorixFileVO : innorixFileList) { - innorixFileDAO.innorixFileInsert(innorixFileVO); + innorixFileVO.setDataIdx((Integer) paramMap.get("dataIdx")); + innorixFileVO.setFileFuncType((String)paramMap.get("fileFuncType")); + + String fileName = innorixFileVO.getClientFileName(); + String fileType = fileName.substring(fileName.lastIndexOf(".")+1, fileName.length()); + innorixFileVO.setFileType(fileType); + innorixFileDAO.innorixExtraFileInsert(innorixFileVO); } } diff --git a/src/main/java/seed/common/service/InnorixFileVO.java b/src/main/java/seed/common/service/InnorixFileVO.java index 80e0479b..2ab4d44b 100644 --- a/src/main/java/seed/common/service/InnorixFileVO.java +++ b/src/main/java/seed/common/service/InnorixFileVO.java @@ -68,7 +68,12 @@ public class InnorixFileVO extends ComDefaultVO implements Serializable { private String lastUpdtPnttm; private String lastUpdusrId; - + + private int dataIdx; + + private String fileFuncType; + + private String fileType; public List getInnorixFileListVO() { @@ -185,6 +190,24 @@ public class InnorixFileVO extends ComDefaultVO implements Serializable { public void setLastUpdusrId(String lastUpdusrId) { this.lastUpdusrId = lastUpdusrId; } + public int getDataIdx() { + return dataIdx; + } + public void setDataIdx(int dataIdx) { + this.dataIdx = dataIdx; + } + public String getFileFuncType() { + return fileFuncType; + } + public void setFileFuncType(String fileFuncType) { + this.fileFuncType = fileFuncType; + } + public String getFileType() { + return fileType; + } + public void setFileType(String fileType) { + this.fileType = fileType; + } diff --git a/src/main/java/seed/dao/InnorixFileDAO.java b/src/main/java/seed/dao/InnorixFileDAO.java index 0afe5572..d356982d 100644 --- a/src/main/java/seed/dao/InnorixFileDAO.java +++ b/src/main/java/seed/dao/InnorixFileDAO.java @@ -1,5 +1,7 @@ package seed.dao; +import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import egovframework.rte.psl.dataaccess.EgovAbstractDAO; @@ -8,7 +10,10 @@ import seed.common.service.InnorixFileVO; @Repository("innorixFileDAO") public class InnorixFileDAO extends EgovAbstractDAO { - public void innorixFileInsert(InnorixFileVO innorixFileVO) throws Exception { - insert("com.seed.innorixFile.extraInsert", innorixFileVO); + @Autowired + private SqlSession sqlSession; + + public void innorixExtraFileInsert(InnorixFileVO innorixFileVO) throws Exception { + sqlSession.insert("com.seed.innorixFile.extraInsert", innorixFileVO); } } diff --git a/src/main/resources/egovframework/sqlmap/config/mappers/innorixFIle/innorixfile_sql.xml b/src/main/resources/egovframework/sqlmap/config/mappers/innorixFIle/innorixfile_sql.xml index 307be913..9accb7c1 100644 --- a/src/main/resources/egovframework/sqlmap/config/mappers/innorixFIle/innorixfile_sql.xml +++ b/src/main/resources/egovframework/sqlmap/config/mappers/innorixFIle/innorixfile_sql.xml @@ -18,8 +18,8 @@ ) VALUES ( SEQ_EXTRA_FILE.NEXTVAL, 'N', - #{uploadFileNameData}, - #{reFileName}, + #{clientFileName}, + #{serverFileName}, SYSDATE, #{fileSize}, '', diff --git a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/edit.jsp b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/edit.jsp index b0440c6a..19142319 100644 --- a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/edit.jsp @@ -1,6 +1,7 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> @@ -8,7 +9,13 @@ - + + + + + + + @@ -56,6 +63,21 @@

첨부자료

+
+ + + + +
+ +

+ + + + + +
+ <%--
@@ -71,7 +93,7 @@ -
+
--%>

내용

@@ -124,6 +146,12 @@ }); + /* innorix-1 + 첨부파일 업로드 경로 전역 변수 선언 + */ + var directory = ""; + var fileList = ""; + $(window).load(function(){ $("#idx_toolbar_webnote_content_imagecenter").hide(); @@ -156,6 +184,61 @@ return false; } */ }); + + + /* 이노릭스 대용량 업로드 솔루션 */ + + /* innorix-2 + 첨부파일 업로드 경로 설정 + fileFuncType와 세션의 siteId등의 정보를 이용해 업로드 경로 설정 + */ + var fileFuncType = $("#fileTempUpFrm").find("input[name='fileFuncType']").val(); + var url = "" + getFileDirectory(fileFuncType, url, function(result){ + directory = result; + }); + + fileList = '${fileList}' + fileList = JSON.stringify(fileList); + + + /* innorix-3 + 이노릭스 업로드 컨트롤 생성 + control 객체는 innorixCommon.js에서 생성 + */ + control = innorix.create({ + el: '#fileControl', // 컨트롤 출력 HTML 객체 ID + transferMode: 'both', // 업로드, 다운로드 혼합사용 + agent : false, + installUrl: "", // Agent 설치 페이지 + uploadUrl: "", // 업로드 URL + allowExtension : ["txt","jpeg","jpg","png","gif","bmp","mp3","mp4","hwp","doc","docx","xls","xlsx","ppt","pptx","pdf","zip","alz"] + }); + + + // 파일전송 컨트롤 로딩 완료 + control.on('loadComplete', function (p) { + alert("1234"); + // 다운로드 목록 + downFileArr = + [{ + printFileName: "INNORIX WP 브로셔.pdf", + fileSize: 1433885, + }, + { + printFileName: "INNORIX WP Brochure.pdf", + fileSize: 1433885, + }, + { + printFileName: "INNORIX WP パンフレット.pdf", + fileSize: 1433885, + }]; + + resetFileArr = downFileArr; // 다운로드 정보 초기화 정보 생성 + resetFileArr = resetFileArr.slice(0); // 배열 깊은 복사 + control.presetDownloadFiles(resetFileArr); // 다운로드 파일 추가 + }); + }); function goList(){ diff --git a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/write.jsp b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/write.jsp index 31f2ceb2..42f747b8 100644 --- a/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/write.jsp +++ b/src/main/webapp/WEB-INF/jsp/seed/_extra/gtm/board/write.jsp @@ -64,7 +64,6 @@
-
@@ -73,27 +72,8 @@ - -
-

내용

@@ -184,6 +164,33 @@ /* 이노릭스 대용량 업로드 솔루션 */ + + /* + 선언 항목 + 1. spring 태그 + 2. 개발or운영 구분을 위한 global 상수 받아오기 - license + 3. js, css + + html + 1. 첨부파일 업로드 버튼(단일 -openFileDialogSingle / 멀티 - openFileDialog) + 2. 첨부파일 목록 및 드래그앤 드랍 영역 선언 - div fileControl + + javascript + 1. 첨부파일 업로드 경로 변수 - var directory + 2. 첨부파일 경로 설정 - getFileDirectory 함수 + 3. 컨트롤(업로드 및 드래그앤 드랍 영역 생성) - innorix.create + 4. 이벤트 생성(업로드 후, 파일 삭제 버튼 클릭 등등) - control.on('uploadComplete', function (p) {} + + 게시글 등록 처리과정 + 1. 첨부파일 O + 1-1. 파일 업로드 후 파일들 정보를 innorixFileListVO에 담기 + 1-2. 게시글 등록 폼에 업로드 한 파일들 정보를 담아서 submit 후 첨부파일 DB insert 처리 + 2. 첨부파일 X + 2-1. 게시글 등록 폼 submit, 첨부파일 DB insert 생략 + */ + + + /* innorix-2 첨부파일 업로드 경로 설정 fileFuncType와 세션의 siteId등의 정보를 이용해 업로드 경로 설정 @@ -207,7 +214,7 @@ allowExtension : ["txt","jpeg","jpg","png","gif","bmp","mp3","mp4","hwp","doc","docx","xls","xlsx","ppt","pptx","pdf","zip","alz"] }); - // 업로드 완료 후 temp 파일 저장 + // 업로드 완료 후 temp 파일 저장 - 사용X //control.on('afterAddFiles', function (p) { //console.log('afterAddFiles : ', p); //var postObj = new Object(); @@ -250,7 +257,6 @@ */ function fn_callBackInnorix(data){ $("input[name='innorixFileListVO']").val(JSON.stringify(data)); - /* $("input[name='innorixFileListVO']").val(data); */ $("button[type='submit']").click(); }