package com.lemon.lifecenter.controller; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FilenameUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import com.lemon.lifecenter.common.LifeCenterConfigVO; import com.lemon.lifecenter.common.LifeCenterController; import com.lemon.lifecenter.common.LifeCenterFileDownload; import com.lemon.lifecenter.common.LifeCenterFunction; import com.lemon.lifecenter.common.LifeCenterPaging; import com.lemon.lifecenter.common.LifeCenterSessionController; import com.lemon.lifecenter.dto.BoardDTO; import com.lemon.lifecenter.service.BoardService; @Controller public class BoardController extends LifeCenterController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private BoardService boardService; @Autowired private LifeCenterConfigVO config; private LifeCenterPaging paging; @RequestMapping("/notice/list") public ModelAndView boardList( @RequestParam(value="searchTxt", required=false, defaultValue="") String searchTxt, @RequestParam(value="selectState", required=false, defaultValue="") String selectState, @RequestParam(value="page", required=false, defaultValue="1") int page, HttpServletRequest request, HttpServletResponse response) { BoardDTO dto = new BoardDTO(); if (!selectState.equals("")) { if (selectState.equals("title")) { dto.setTitle(searchTxt); } else if (selectState.equals("content")) { dto.setContent(searchTxt); } } dto.setLimit( ( Integer.valueOf( page ) - 1 ) * config.pageDataSize ); dto.setLimitMax( config.pageDataSize ); List list = new ArrayList(); int total = boardService.selectNoticeBoardListCount(dto); if (total == 0) { } else { list = boardService.selectNoticeBoardList(dto); } String param = ""; paging = LifeCenterPaging.getInstance(); paging.paging(config, total, page, param); ModelAndView mv = setMV("notice/list"); mv.addObject("list", list); mv.addObject("total", total); mv.addObject("selectState", selectState); mv.addObject("searchTxt", searchTxt); mv.addObject("paging", paging); mv.addObject("page", page); mv.addObject("pageSize", dto.getLimitMax()); return mv; } @RequestMapping("/notice/new") public ModelAndView boardNew(HttpServletRequest request, HttpServletResponse response) { // String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" ); ModelAndView mv = setMV("notice/new"); // mv.addObject("groupIdx",sesGroupIdx); return mv; } @RequestMapping(value="/notice/new/insert", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String boardNewInsert( HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto, MultipartFile file) { String sesId = LifeCenterSessionController.getSession(request, "sesId"); // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '공지사항 작성 권한이 없습니다.', callBack : function(){ location.href='/notice/list'; } });" ); // return "/common/blank"; // } String noticeInsertTime = LifeCenterSessionController.getSession(request, "noticeInsertTime"); long time = LifeCenterFunction.getNowUnixTimeStamp(); if( noticeInsertTime != null && !noticeInsertTime.equals( "" ) ) { long i = Long.parseLong( noticeInsertTime ); if( ( time - i ) < 61 ) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '자동화공격방지
게시글 작성 후 60초 동안 작성이 불가능 합니다
"+( 61 - ( time - i ) )+"초 이후 작성 가능', callBack : function(){ history.back(); } });" ); return "/common/blank"; } } if (file.isEmpty() == false) { UUID uuid = UUID.randomUUID(); String fileName = file.getOriginalFilename(); int fileSize = (int) file.getSize(); //단위는 byte String ext = FilenameUtils.getExtension(fileName); String saveFileName = uuid + "." + ext; final String[] PERMISSION_FILE_EXT_ARR = {"gif","png","jpg","jpeg","doc","docx","xls","xlsx","hwp","pdf", "txt"}; boolean extFlag = false; for( int i = 0; i < PERMISSION_FILE_EXT_ARR.length; i++ ) { if( PERMISSION_FILE_EXT_ARR[i].equals( ext.toLowerCase() ) ) { extFlag = true; } } if( extFlag == false ) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : \"등록할수 없는 확장자입니다.
.gif, .jpg, .png, .jpeg, .doc, .docx, .xls, .xlsx, .hwp, .pdf, .txt 확장자만 등록가능\", callBack : function(){ history.back(); } });" ); return "/common/blank"; } try { String tempPath = config.filePath; File saveFile = new File(tempPath, saveFileName); FileCopyUtils.copy(file.getBytes(),saveFile); } catch (IOException e) { e.printStackTrace(); LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '파일 업로드에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } dto.setFileOriginalName(fileName); dto.setFileName(saveFileName); dto.setFileExtension(ext); dto.setFileSize(fileSize); dto.setBoardType("N"); } String title = dto.getTitle().trim(); String content = dto.getContent().trim(); dto.setTitle(title); dto.setContent(content); dto.setCreateBy(sesId); boardService.noticeInsert(dto); int postSeq = dto.getPostSeq(); if (postSeq == 0) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '게시물 등록에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } else { if (file.isEmpty() == false) { boardService.fileUploadDataInsert(dto); int fileIdx = dto.getFileIdx(); if (fileIdx == 0) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '게시물 등록에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } } } LifeCenterSessionController.setSession( request, "noticeInsertTime", String.valueOf( time ) ); return "redirect:/notice/content?postSeq=" + dto.getPostSeq(); } @RequestMapping("/notice/content") public ModelAndView boardContent( @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq, HttpServletRequest request, HttpServletResponse response) { String referer = request.getHeader("referer"); // String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" ); int total = boardService.selectNoticeBoardCountOne(postSeq); BoardDTO dto = new BoardDTO(); if (total > 0) { boardService.updateNoticeView(postSeq); dto = boardService.selectNoticeBoardInfoOne(postSeq); } int prePostCnt = boardService.selectPrePostCount(postSeq); int nextPostCnt = boardService.selectNextPostCount(postSeq); BoardDTO preDto = new BoardDTO(); BoardDTO nextDto = new BoardDTO(); if (prePostCnt > 0) { preDto = boardService.selectPrePost(postSeq); } if (nextPostCnt > 0) { nextDto = boardService.selectNextPost(postSeq); } ModelAndView mv = setMV("notice/content"); mv.addObject("filePath", config.filePath); mv.addObject("content", dto); // mv.addObject("groupIdx", sesGroupIdx); mv.addObject("prePostCnt", prePostCnt); mv.addObject("nextPostCnt", nextPostCnt); mv.addObject("prePost", preDto); mv.addObject("nextPost", nextDto); mv.addObject("referer", referer); return mv; } @RequestMapping(value="/notice/content/file", method=RequestMethod.GET) public void boardFile(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq) { BoardDTO dto = new BoardDTO(); dto.setPostSeq(postSeq); dto.setBoardType("N"); int total = boardService.selectFileCount(dto); if (total > 0) { dto.setPostSeq(postSeq); dto.setBoardType("N"); dto = boardService.selectFile(dto); String filePath = config.filePath + "/" + dto.getFileName(); String fileName = dto.getFileOriginalName(); LifeCenterFileDownload.download(request, response, filePath, fileName); } } @RequestMapping(value="/notice/content/delete", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String contentDelete(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq, @RequestParam(value="fileName", required=false, defaultValue="") String fileName) { // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '해당 글을 삭제할 수 없습니다.', callBack : function(){ location.href='/notice/list'; } });" ); // return "/common/blank"; // } BoardDTO dto = new BoardDTO(); dto.setPostSeq(postSeq); dto.setBoardType("N"); boardService.deleteNoticeIfno(postSeq); String path = config.filePath + "/" + fileName.trim(); File rFile = new File(path); rFile.delete(); boardService.deleteFile(dto); LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '게시글이 삭제되었습니다. ', callBack : function(){ location.href='/notice/list'; } });" ); return "/common/blank"; } @RequestMapping("/notice/edit") public ModelAndView boardEdit(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq) { ModelAndView mv = setMV("notice/edit"); String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '공지사항 작성 권한이 없습니다.', callBack : function(){ location.href='./list'; } });" ); // return "/common/blank"; // } BoardDTO dto = new BoardDTO(); int cnt = boardService.selectNoticeBoardCountOne(postSeq); if (cnt == 0) { } else { dto = boardService.selectNoticeBoardInfoOne(postSeq); } mv.addObject("groupIdx", sesGroupIdx); mv.addObject("item", dto); return mv; } @RequestMapping(value="/notice/edit/update", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String boardEditUpdate( HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto, MultipartFile file) { String sesId = LifeCenterSessionController.getSession(request, "sesId"); // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '공지사항 수정 권한이 없습니다.', callBack : function(){ location.href='./list'; } });" ); // return "/common/blank"; // } int postSeq = dto.getPostSeq(); if (file.isEmpty() == false) { UUID uuid = UUID.randomUUID(); String fileName = file.getOriginalFilename(); int fileSize = (int) file.getSize(); //단위는 byte String ext = FilenameUtils.getExtension(fileName); String saveFileName = uuid + "." + ext; try { File saveFile = new File(config.filePath, saveFileName); FileCopyUtils.copy(file.getBytes(),saveFile); String path = config.filePath + "/" + dto.getFileName().trim(); File rFile = new File(path); rFile.delete(); } catch (IOException e) { e.printStackTrace(); LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '파일 업로드에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } dto.setFileOriginalName(fileName); dto.setFileName(saveFileName); dto.setFileExtension(ext); dto.setFileSize(fileSize); dto.setBoardType("N"); int cnt = boardService.selectFileCount(dto); if (cnt > 0) { boardService.updateFile(dto); } else { boardService.fileUploadDataInsert(dto); } } else { if (dto.getFileOriginalName().equals("")) { String path = config.filePath + "/" + dto.getFileName().trim(); File rFile = new File(path); rFile.delete(); dto.setBoardType("N"); boardService.deleteFile(dto); } } dto.setUpdateBy(sesId); boardService.updateNoticeBoard(dto); return "redirect:/notice/content?postSeq=" + dto.getPostSeq(); } @RequestMapping(value="/qna/content/file", method=RequestMethod.GET) public void boardFileQna(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq) { BoardDTO dto = new BoardDTO(); dto.setPostSeq(postSeq); dto.setBoardType("Q"); int total = boardService.selectFileCount(dto); if (total > 0) { dto.setPostSeq(postSeq); dto.setBoardType("Q"); dto = boardService.selectFile(dto); String filePath = config.filePath + "/" + dto.getFileName(); String fileName = dto.getFileOriginalName(); LifeCenterFileDownload.download(request, response, filePath, fileName); } } @RequestMapping("/qna/list") public ModelAndView qnsList(@RequestParam(value="searchTxt", required=false, defaultValue="") String searchTxt, @RequestParam(value="selectState", required=false, defaultValue="") String selectState, @RequestParam(value="page", required=false, defaultValue="1") int page, HttpServletRequest request, HttpServletResponse response) { String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" ); BoardDTO dto = new BoardDTO(); if (!selectState.equals("")) { if (selectState.equals("title")) { dto.setTitle(searchTxt); } else if (selectState.equals("createBy")) { dto.setCreateBy(searchTxt); } else if (selectState.equals("content")) { dto.setContent(searchTxt); } } dto.setLimit( ( Integer.valueOf( page ) - 1 ) * config.pageDataSize ); dto.setLimitMax( config.pageDataSize ); List list = new ArrayList(); int total = boardService.selectQnaListCount(dto); if (total == 0) { } else { list = boardService.selectQnaList(dto); } String param = ""; paging = LifeCenterPaging.getInstance(); paging.paging(config, total, page, param); ModelAndView mv = setMV("qna/list"); mv.addObject("sesGroupIdx", sesGroupIdx); mv.addObject("list", list); mv.addObject("total", total); mv.addObject("selectState", selectState); mv.addObject("searchTxt", searchTxt); mv.addObject("paging", paging); mv.addObject("page", page); mv.addObject("pageSize", dto.getLimitMax()); return mv; } @RequestMapping("/qna/new") public ModelAndView boardQnaNew(HttpServletRequest request, HttpServletResponse response) { String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" ); ModelAndView mv = setMV("qna/new"); mv.addObject("groupIdx",sesGroupIdx); return mv; } @RequestMapping(value="/qna/new/insert", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String boardQnaNewInsert( HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto, MultipartFile file) { String sesId = LifeCenterSessionController.getSession(request, "sesId"); String qnaInsertTime = LifeCenterSessionController.getSession(request, "qnaInsertTime"); long time = LifeCenterFunction.getNowUnixTimeStamp(); if( qnaInsertTime != null && !qnaInsertTime.equals( "" ) ) { long i = Long.parseLong( qnaInsertTime ); if( ( time - i ) < 61 ) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '자동화공격방지
게시글 작성 후 60초 동안 작성이 불가능 합니다
"+( 61 - ( time - i ) )+"초 이후 작성 가능', callBack : function(){ history.back(); } });" ); return "/common/blank"; } } if (file.isEmpty() == false) { UUID uuid = UUID.randomUUID(); String fileName = file.getOriginalFilename(); int fileSize = (int) file.getSize(); //단위는 byte String ext = FilenameUtils.getExtension(fileName); String saveFileName = uuid + "." + ext; try { String tempPath = config.filePath; File saveFile = new File(tempPath, saveFileName); FileCopyUtils.copy(file.getBytes(),saveFile); } catch (IOException e) { e.printStackTrace(); LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '파일 업로드에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } dto.setFileOriginalName(fileName); dto.setFileName(saveFileName); dto.setFileExtension(ext); dto.setFileSize(fileSize); dto.setBoardType("Q"); } String title = dto.getTitle().trim(); String content = dto.getContent().trim(); dto.setTitle(title); dto.setContent(content); dto.setCreateBy(sesId); boardService.qnaInsert(dto); int postSeq = dto.getPostSeq(); if (postSeq == 0) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '게시물 등록에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } else { if (file.isEmpty() == false) { boardService.fileUploadDataInsert(dto); int fileIdx = dto.getFileIdx(); if (fileIdx == 0) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '게시물 등록에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } } } LifeCenterSessionController.setSession( request, "qnaInsertTime", String.valueOf( time ) ); return "redirect:/qna/content?postSeq=" + dto.getPostSeq(); } @RequestMapping("/qna/content") public ModelAndView boardQnaContent( @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq, HttpServletRequest request, HttpServletResponse response) { String referer = request.getHeader("referer"); String sesId = LifeCenterSessionController.getSession(request, "sesId"); String sesName = LifeCenterSessionController.getSession(request, "sesName"); String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" ); String sesPermissions = LifeCenterSessionController.getSession( request, "sesPermissions" ); int total = boardService.selectQnaBoardCountOne(postSeq); BoardDTO dto = new BoardDTO(); if (total > 0) { boardService.updateQnaView(postSeq); dto = boardService.selectQnaBoardInfoOne(postSeq); } int prePostCnt = boardService.selectQnaPrePostCount(postSeq); int nextPostCnt = boardService.selectQnaNextPostCount(postSeq); BoardDTO preDto = new BoardDTO(); BoardDTO nextDto = new BoardDTO(); if (prePostCnt > 0) { preDto = boardService.selectQnaPrePost(postSeq); } if (nextPostCnt > 0) { nextDto = boardService.selectQnaNextPost(postSeq); } ModelAndView mv = setMV("qna/content"); mv.addObject("filePath", config.filePath); mv.addObject("content", dto); mv.addObject("sesId", sesId); mv.addObject("sesName", sesName); mv.addObject("groupIdx", sesGroupIdx); mv.addObject("prePostCnt", prePostCnt); mv.addObject("nextPostCnt", nextPostCnt); mv.addObject("prePost", preDto); mv.addObject("nextPost", nextDto); mv.addObject("referer", referer); mv.addObject( "sesPermissions", sesPermissions ); return mv; } @RequestMapping(value="/qna/content/answer", method = RequestMethod.POST) public String boardQnaAnswer(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto) { // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '권한이 없습니다.', callBack : function(){ location.href='./list'; } });" ); // return "/common/blank"; // } boardService.qnaAnswerInsert(dto); return "redirect:/qna/content?postSeq=" + dto.getPostSeq(); } @RequestMapping(value="/qna/content/answerDelete", method = RequestMethod.POST) public String boardQnaAnswerDelete(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto) { // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); // // if (!sesGroupIdx.equals("1")) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '권한이 없습니다.', callBack : function(){ location.href='./list'; } });" ); // return "/common/blank"; // } dto.setAnswerContent(""); boardService.qnaAnswerInsert(dto); return "redirect:/qna/content?postSeq=" + dto.getPostSeq(); } @RequestMapping("/qna/edit") public ModelAndView boarQnadEdit(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq) { ModelAndView mv = setMV("qna/edit"); BoardDTO dto = new BoardDTO(); int cnt = boardService.selectQnaBoardCountOne(postSeq); if (cnt == 0) { } else { dto = boardService.selectQnaBoardInfoOne(postSeq); } mv.addObject("item", dto); return mv; } @RequestMapping(value="/qna/edit/update", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String boardQnaEditUpdate( HttpServletRequest request, HttpServletResponse response, @ModelAttribute("dto") final BoardDTO dto, MultipartFile file) { String sesId = LifeCenterSessionController.getSession(request, "sesId"); if (!sesId.equals(dto.getCreateBy())) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '해당글의 수정 권한이 없습니다.', callBack : function(){ location.href='./list'; } });" ); return "/common/blank"; } int postSeq = dto.getPostSeq(); if (file.isEmpty() == false) { UUID uuid = UUID.randomUUID(); String fileName = file.getOriginalFilename(); int fileSize = (int) file.getSize(); //단위는 byte String ext = FilenameUtils.getExtension(fileName); String saveFileName = uuid + "." + ext; try { File saveFile = new File(config.filePath, saveFileName); FileCopyUtils.copy(file.getBytes(),saveFile); String path = config.filePath + "/" + dto.getFileName().trim(); File rFile = new File(path); rFile.delete(); } catch (IOException e) { e.printStackTrace(); LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '파일 업로드에 실패하였습니다.', callBack : function(){ history.back(); } });" ); return "/common/blank"; } dto.setFileOriginalName(fileName); dto.setFileName(saveFileName); dto.setFileExtension(ext); dto.setFileSize(fileSize); dto.setBoardType("Q"); int cnt = boardService.selectFileCount(dto); if (cnt > 0) { boardService.updateFile(dto); } else { boardService.fileUploadDataInsert(dto); } } else { if (dto.getFileOriginalName().equals("")) { String path = config.filePath + "/" + dto.getFileName().trim(); File rFile = new File(path); rFile.delete(); dto.setBoardType("Q"); boardService.deleteFile(dto); } } dto.setUpdateBy(sesId); boardService.updateQnaBoard(dto); return "redirect:/qna/content?postSeq=" + postSeq; } @RequestMapping(value="/qna/content/delete", method = RequestMethod.POST) @Transactional(propagation=Propagation.REQUIRED) public String contentQnaDelete(HttpServletRequest request, HttpServletResponse response, @RequestParam(value="postSeq", required=false, defaultValue="") int postSeq, @RequestParam(value="createBy", required=false, defaultValue="") String createBy, @RequestParam(value="fileName", required=false, defaultValue="") String fileName) { String sesId = LifeCenterSessionController.getSession(request, "sesId"); // String sesGroupIdx = LifeCenterSessionController.getSession(request, "sesGroupIdx"); if (!sesId.equals(createBy)) { LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '해당 글을 삭제할 수 없습니다.', callBack : function(){ location.href='/qna/list'; } });" ); return "/common/blank"; } // if (!sesGroupIdx.equals("1")) { // if (!sesId.equals(createBy)) { // LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '해당 글을 삭제할 수 없습니다.', callBack : function(){ location.href='/qna/list'; } });" ); // return "/common/blank"; // } // } BoardDTO dto = new BoardDTO(); dto.setPostSeq(postSeq); dto.setBoardType("Q"); boardService.deleteQnaIfno(postSeq); String path = config.filePath + "/" + fileName.trim(); File rFile = new File(path); rFile.delete(); boardService.deleteFile(dto); LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '게시글이 삭제되었습니다. ', callBack : function(){ location.href='/qna/list'; } });" ); return "/common/blank"; } }