diff --git a/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCtznSttemntMapper.java b/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCtznSttemntMapper.java index 458f021f..c1b705a6 100644 --- a/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCtznSttemntMapper.java +++ b/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCtznSttemntMapper.java @@ -10,7 +10,7 @@ import kr.xit.fims.biz.ec.model.CtznStmtDTO; @Mapper public interface IEcCtznSttemntMapper { - List selectEcCtznSttemnts(Map paraMap, RowBounds rowBounds); + List selectEcCtznSttemnts(final Map paraMap, final RowBounds rowBounds); CtznStmtDTO selectEcCtznSttemnt(final CtznStmtDTO.Request dto); List selectEcCtznSttemntDetails(final CtznStmtDTO.Request dto); CtznStmtDTO.CtznStmtDtl selectEcCtznSttemntDetail(final CtznStmtDTO.Request dto); @@ -18,4 +18,7 @@ public interface IEcCtznSttemntMapper { int insertEcCtznSttemnt(final CtznStmtDTO dto); int insertEcCtznSttemntDetail(final CtznStmtDTO.CtznStmtDtl dtl); + + + List selectCtznSttemnts(final Map paraMap, final RowBounds rowBounds); } diff --git a/src/main/java/kr/xit/framework/biz/cmm/FileUtil.java b/src/main/java/kr/xit/framework/biz/cmm/FileUtil.java new file mode 100644 index 00000000..cf47ba30 --- /dev/null +++ b/src/main/java/kr/xit/framework/biz/cmm/FileUtil.java @@ -0,0 +1,99 @@ +package kr.xit.framework.biz.cmm; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.multipart.MultipartFile; + +public class FileUtil { + + public void makeBasePath(String path) { + File dir = new File(path); + if (!dir.exists()) { + dir.mkdirs(); + } + } + + public String saveFile(MultipartFile file, String basePath, String fileName){ + if (file == null || file.getName().equals("") || file.getSize() < 1) { + return null; + } + + makeBasePath(basePath); + String serverFullPath = basePath + fileName; + + File file1 = new File(serverFullPath); + try { + file.transferTo(file1); + } catch (IllegalStateException ex) { + System.out.println("IllegalStateException: " + ex.toString()); + } catch (IOException ex) { + System.out.println("IOException: " + ex.toString()); + } + + return serverFullPath; + } + + public String getNewName() { + SimpleDateFormat ft = new SimpleDateFormat("yyyyMMddhhmmssSSS"); + return ft.format(new Date()) + (int) (Math.random() * 10); + } + + public String getFileExtension(String filename) { + Integer mid = filename.lastIndexOf("."); + return filename.substring(mid, filename.length()); + } + + public String getRealPath(String path, String filename) { + return path + filename.substring(0,4) + "/"; + } + + public void fileDownload(HttpServletResponse response, String path, String filename) { + String realPath = ""; + + try { + filename = URLEncoder.encode(filename, "UTF-8"); + } catch (UnsupportedEncodingException ex) { + System.out.println("UnsupportedEncodingException"); + } + + realPath = path + filename; + + File file1 = new File(realPath); + if (!file1.exists()) { + return ; + } + + response.setHeader("Content-Disposition", "attachment; filename=\""+filename+"\""); + response.setContentType("application/octet-stream;"); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache, must-revalidate"); + response.setDateHeader("Expires", 0); + + try { + OutputStream os = response.getOutputStream(); + FileInputStream fis = new FileInputStream(realPath); + + int ncount = 0; + + byte[] bytes = new byte[512]; + + while((ncount = fis.read(bytes)) != -1 ) { + os.write(bytes, 0, ncount); + } + + fis.close(); + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/kr/xit/framework/biz/cmm/ImageEditor.java b/src/main/java/kr/xit/framework/biz/cmm/ImageEditor.java new file mode 100644 index 00000000..9e0264a7 --- /dev/null +++ b/src/main/java/kr/xit/framework/biz/cmm/ImageEditor.java @@ -0,0 +1,73 @@ +package kr.xit.framework.biz.cmm; + +import java.io.DataOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.multipart.MultipartFile; + +import sun.misc.BASE64Decoder; + +@Controller +public class ImageEditor{ + private String filePath = "c:/users/xitdev/temp"; + + @RequestMapping(value = "/imageEditor") + public String imageEditor() { + + return "imageEditor"; + } + + @RequestMapping(value = "/fileUpload") + public void fileUpload(HttpServletResponse response, MultipartFile upfile) { + if(upfile==null) return; + + try { + FileUtil fu = new FileUtil(); + String filename = fu.getNewName(); + fu.saveFile(upfile, filePath, filename ); + response.getWriter().print(filename); + } catch (Exception ex) { + System.out.println("File Upload Error"); + } + } + + @RequestMapping(value = "/fileDownload") + public void fileDownload(HttpServletResponse response, String filename) { + FileUtil fu = new FileUtil(); + fu.fileDownload(response, filePath, filename ); + } + + @RequestMapping(value = "/saveImage", method = RequestMethod.POST) + public void saveImage(HttpServletRequest request, MultipartFile imageFile) { + String filename = filePath +"/"+ request.getParameter("filename"); + + try { + byte[] Filebyte = imageFile.getBytes(); + imageFile.getInputStream().read(Filebyte); + + String encString = new String(Filebyte, "ASCII"); + encString = encString.replace("data:image/png;base64,", ""); + + FileOutputStream fs = new FileOutputStream(filename); + DataOutputStream ds = new DataOutputStream(fs); + + BASE64Decoder decoder = new BASE64Decoder(); + byte[] data = decoder.decodeBuffer(encString); + + for (byte dataB : data) { + ds.writeByte(dataB); + } + ds.close(); + fs.close(); + } catch (IOException e) { + System.out.println("IOException Error"); + } + } +} diff --git a/src/main/resources/spring/mvc/mvc-resolver.xml b/src/main/resources/spring/mvc/mvc-resolver.xml index 6fda78c3..c5c6ad33 100644 --- a/src/main/resources/spring/mvc/mvc-resolver.xml +++ b/src/main/resources/spring/mvc/mvc-resolver.xml @@ -10,7 +10,14 @@ - + + + + + + + + diff --git a/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml b/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml index c28ca36e..096bb885 100644 --- a/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml @@ -120,10 +120,14 @@ + /* ec-ctzn-sttemnt-mysql-mapper|selectCtznSttemnts-민원연계(국민신문고) 목록 조회|julim */ + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCtznSttemntMgtForm.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCtznSttemntMgtForm.jsp index a40adc0a..e475bb44 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCtznSttemntMgtForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCtznSttemntMgtForm.jsp @@ -1,6 +1,15 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %> + +