첨부파일 테이블 변경작업 및 처리 방식 변경, 다운로드 보완 강화
This commit is contained in:
parent
a0a9a90b8e
commit
d10885c338
@ -7,45 +7,98 @@ import java.util.Map;
|
|||||||
|
|
||||||
import nlib.user.service.NlibLoginVO;
|
import nlib.user.service.NlibLoginVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* @Class Name : AttachFileService.java
|
||||||
|
*
|
||||||
|
* @Description : 첨부파일을 관리하는 서비스 인터페이스
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 수정일 수정자 수정내용
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 2021. 9. 16. KNKIM 최초 생성
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
|
* @since 2021. 9. 16.
|
||||||
|
* @version 1.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface AttachFileService
|
public interface AttachFileService
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 목록을 조회한다.
|
* 첨부파일 목록을 조회한다.
|
||||||
*
|
*
|
||||||
* @param
|
* @param attachFileId
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception;
|
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹 등록한다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 등록한다.
|
* 첨부파일 등록한다.
|
||||||
*
|
*
|
||||||
* @param
|
* @param attachFileVO
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
|
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹을 삭제한다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int deleteAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 삭제한다.
|
* 첨부파일 삭제한다.
|
||||||
*
|
*
|
||||||
* @param
|
* @param attachFileVO
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
|
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 다운로드 회수를 증가시킨다.
|
* 첨부파일 정보를 조회한다.
|
||||||
*
|
*
|
||||||
* @param
|
* @param attachFileVO
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int increaseDownloadCount(AttachFileVO attachFileVO) throws Exception;
|
public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다운로드 가능 여부를 확인하다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public boolean checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,164 +27,94 @@ import nlib.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class AttachFileVO {
|
public class AttachFileVO {
|
||||||
|
|
||||||
|
private String bdType; /* 첨부된 게시판 유형 : ancmnt, faq, qna */
|
||||||
|
private String mbInfoId; /* 사용자ID (권한체크 등에 사용) */
|
||||||
|
|
||||||
private String subPathKey; /* 첨부파일서브경로 */
|
private String subPathKey; /* 첨부파일서브경로 */
|
||||||
|
|
||||||
private String fileMask; /* 첨부파일아이디 */
|
private String attachFileId; /* 첨부파일아이디 */
|
||||||
private String fileId; /* 업무 아이디 */
|
private int fileSn; /* 파일 순번 */
|
||||||
private int fileSeq; /* 파일 번호 */
|
private String fileStreCours; /* 파일 저장결올 */
|
||||||
private String fileName; /* 파일 이름 */
|
private String streFileNm; /* 저장파일명 */
|
||||||
private int fileSize; /* 파일 사이즈 */
|
private String orignlFileNm; /* 원본파일명 */
|
||||||
private String fileTypeCd; /* 파일 유형(디지털화사용) */
|
|
||||||
private int downloadCount; /* 파일 다운로드 횟수 */
|
|
||||||
private String downloadExpireDate; /* 파일 만료 날짜 */
|
|
||||||
private int downloadLimitCount; /* 파일 다운로드 제한 횟수 */
|
|
||||||
|
|
||||||
private String deleteYn; /* 삭제 여부 */
|
|
||||||
private String streamingUrl; /* 스트리밍URL */
|
|
||||||
private String content; /* 내용주기 */
|
|
||||||
private String atchTypeCd; /* 첨부파일유형 (image, doc) */
|
|
||||||
|
|
||||||
private String regDd; /* 등록 날짜 */
|
|
||||||
|
|
||||||
private String fileExtsn; /* 파일확장자 */
|
private String fileExtsn; /* 파일확장자 */
|
||||||
|
private String fileCn; /* 파일내용 */
|
||||||
public void setAtchTypeCdFromFileExtsn() {
|
private int fileSize; /* 파일 사이즈 */
|
||||||
if(StringUtil.isEmpty(fileExtsn)) return;
|
private String useAt; /* 사용영부 */
|
||||||
|
|
||||||
if("|jpg|jpeg|png|gif|".contains(fileExtsn)) atchTypeCd = "image";
|
|
||||||
else if("|hwp|doc|docx|xls|xlsx|ppt|pptx|".contains(fileExtsn)) atchTypeCd = "doc";
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileMask() {
|
|
||||||
return fileMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileMask(String fileMask) {
|
|
||||||
this.fileMask = fileMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileId() {
|
|
||||||
return fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileId(String fileId) {
|
|
||||||
this.fileId = fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileName() {
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileName(String fileName) {
|
|
||||||
this.fileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileTypeCd() {
|
|
||||||
return fileTypeCd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileTypeCd(String fileTypeCd) {
|
|
||||||
this.fileTypeCd = fileTypeCd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDownloadExpireDate() {
|
|
||||||
return downloadExpireDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadExpireDate(String downloadExpireDate) {
|
|
||||||
this.downloadExpireDate = downloadExpireDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeleteYn() {
|
|
||||||
return deleteYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeleteYn(String deleteYn) {
|
|
||||||
this.deleteYn = deleteYn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStreamingUrl() {
|
|
||||||
return streamingUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStreamingUrl(String streamingUrl) {
|
|
||||||
this.streamingUrl = streamingUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAtchTypeCd() {
|
|
||||||
return atchTypeCd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtchTypeCd(String atchTypeCd) {
|
|
||||||
this.atchTypeCd = atchTypeCd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRegDd() {
|
|
||||||
return regDd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRegDd(String regDd) {
|
|
||||||
this.regDd = regDd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFileSeq() {
|
|
||||||
return fileSeq;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileSeq(int fileSeq) {
|
|
||||||
this.fileSeq = fileSeq;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFileSize() {
|
|
||||||
return fileSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileSize(int fileSize) {
|
|
||||||
this.fileSize = fileSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getDownloadCount() {
|
// GET/SET
|
||||||
return downloadCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadCount(int downloadCount) {
|
|
||||||
this.downloadCount = downloadCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDownloadLimitCount() {
|
|
||||||
return downloadLimitCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadLimitCount(int downloadLimitCount) {
|
|
||||||
this.downloadLimitCount = downloadLimitCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubPathKey() {
|
public String getSubPathKey() {
|
||||||
return subPathKey;
|
return subPathKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubPathKey(String subPathKey) {
|
public void setSubPathKey(String subPathKey) {
|
||||||
this.subPathKey = subPathKey;
|
this.subPathKey = subPathKey;
|
||||||
}
|
}
|
||||||
|
public String getAttachFileId() {
|
||||||
|
return attachFileId;
|
||||||
|
}
|
||||||
|
public void setAttachFileId(String attachFileId) {
|
||||||
|
this.attachFileId = attachFileId;
|
||||||
|
}
|
||||||
|
public int getFileSn() {
|
||||||
|
return fileSn;
|
||||||
|
}
|
||||||
|
public void setFileSn(int fileSn) {
|
||||||
|
this.fileSn = fileSn;
|
||||||
|
}
|
||||||
|
public String getFileStreCours() {
|
||||||
|
return fileStreCours;
|
||||||
|
}
|
||||||
|
public void setFileStreCours(String fileStreCours) {
|
||||||
|
this.fileStreCours = fileStreCours;
|
||||||
|
}
|
||||||
|
public String getStreFileNm() {
|
||||||
|
return streFileNm;
|
||||||
|
}
|
||||||
|
public void setStreFileNm(String streFileNm) {
|
||||||
|
this.streFileNm = streFileNm;
|
||||||
|
}
|
||||||
|
public String getOrignlFileNm() {
|
||||||
|
return orignlFileNm;
|
||||||
|
}
|
||||||
|
public void setOrignlFileNm(String orignlFileNm) {
|
||||||
|
this.orignlFileNm = orignlFileNm;
|
||||||
|
}
|
||||||
public String getFileExtsn() {
|
public String getFileExtsn() {
|
||||||
return fileExtsn;
|
return fileExtsn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileExtsn(String fileExtsn) {
|
public void setFileExtsn(String fileExtsn) {
|
||||||
this.fileExtsn = (fileExtsn == null ? null : fileExtsn.toLowerCase());
|
this.fileExtsn = (fileExtsn == null ? null : fileExtsn.toLowerCase());
|
||||||
}
|
}
|
||||||
|
public String getFileCn() {
|
||||||
|
return fileCn;
|
||||||
|
}
|
||||||
|
public void setFileCn(String fileCn) {
|
||||||
|
this.fileCn = fileCn;
|
||||||
|
}
|
||||||
|
public int getFileSize() {
|
||||||
|
return fileSize;
|
||||||
|
}
|
||||||
|
public void setFileSize(int fileSize) {
|
||||||
|
this.fileSize = fileSize;
|
||||||
|
}
|
||||||
|
public String getUseAt() {
|
||||||
|
return useAt;
|
||||||
|
}
|
||||||
|
public void setUseAt(String useAt) {
|
||||||
|
this.useAt = useAt;
|
||||||
|
}
|
||||||
|
public String getMbInfoId() {
|
||||||
|
return mbInfoId;
|
||||||
|
}
|
||||||
|
public void setMbInfoId(String mbInfoId) {
|
||||||
|
this.mbInfoId = mbInfoId;
|
||||||
|
}
|
||||||
|
public String getBdType() {
|
||||||
|
return bdType;
|
||||||
|
}
|
||||||
|
public void setBdType(String bdType) {
|
||||||
|
this.bdType = bdType;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,16 @@ public interface AttachFileDAO {
|
|||||||
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception;
|
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹을 등록한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 등록한다.
|
* 첨부파일 등록한다.
|
||||||
*
|
*
|
||||||
@ -59,6 +69,15 @@ public interface AttachFileDAO {
|
|||||||
*/
|
*/
|
||||||
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
|
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹을 삭제한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int deleteAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 삭제한다.
|
* 첨부파일 삭제한다.
|
||||||
*
|
*
|
||||||
@ -69,12 +88,20 @@ public interface AttachFileDAO {
|
|||||||
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
|
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 다운로드 회수를 증가시킨다.
|
* 첨부파일 정보를 조회한다.
|
||||||
*
|
*
|
||||||
* @param
|
* @param attachFileVO
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int increaseDownloadCount(AttachFileVO attachFileVO) throws Exception;
|
public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다운로드 가능 여부를 확인하다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,30 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import nlib.bbs.service.AttachFileService;
|
import nlib.bbs.service.AttachFileService;
|
||||||
import nlib.bbs.service.AttachFileVO;
|
import nlib.bbs.service.AttachFileVO;
|
||||||
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* @Class Name : AttachFileServiceImpl.java
|
||||||
|
*
|
||||||
|
* @Description : 첨부파일을 관리하는 서비스 클래스
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 수정일 수정자 수정내용
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 2021. 9. 16. KNKIM 최초 생성
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
|
* @since 2021. 9. 16.
|
||||||
|
* @version 1.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Service("attachFileService")
|
@Service("attachFileService")
|
||||||
public class AttachFileServiceImpl implements AttachFileService
|
public class AttachFileServiceImpl implements AttachFileService
|
||||||
{
|
{
|
||||||
@ -26,24 +49,90 @@ public class AttachFileServiceImpl implements AttachFileService
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception {
|
public List<AttachFileVO> listAttachFiles(String attachFileId) throws Exception {
|
||||||
return attachFileDAO.listAttachFiles(attachFileId);
|
return attachFileDAO.listAttachFiles(attachFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹 등록한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception {
|
||||||
|
return attachFileDAO.insertAttachFileGroup(attachFileVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일 등록한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception {
|
public int insertAttachFile(AttachFileVO attachFileVO) throws Exception {
|
||||||
|
|
||||||
return attachFileDAO.insertAttachFile(attachFileVO);
|
return attachFileDAO.insertAttachFile(attachFileVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일그룹을 삭제한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAttachFileGroup(AttachFileVO attachFileVO) throws Exception {
|
||||||
|
return attachFileDAO.deleteAttachFileGroup(attachFileVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일 삭제한다.
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception {
|
public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception {
|
||||||
return attachFileDAO.deleteAttachFile(attachFileVO);
|
return attachFileDAO.deleteAttachFile(attachFileVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int increaseDownloadCount(AttachFileVO attachFileVO) throws Exception {
|
|
||||||
return attachFileDAO.increaseDownloadCount(attachFileVO);
|
/**
|
||||||
|
* 첨부파일 정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception {
|
||||||
|
|
||||||
|
if(attachFileVO == null) return null;
|
||||||
|
if(StringUtil.isEmpty(attachFileVO.getAttachFileId())) return null;
|
||||||
|
if(attachFileVO.getFileSn() < 1) return null;
|
||||||
|
|
||||||
|
return attachFileDAO.selectAttachFile(attachFileVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다운로드 가능 여부를 확인하다.
|
||||||
|
*
|
||||||
|
* @param attachFileVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public boolean checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception {
|
||||||
|
String ret = attachFileDAO.checkAttachFileDownload(attachFileVO);
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(ret)) return false;
|
||||||
|
|
||||||
|
return ret.charAt(0) == 'Y';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -46,22 +46,35 @@ public class QnaServiceImpl extends BoardServiceImpl implements QnaService
|
|||||||
}
|
}
|
||||||
|
|
||||||
articleVO.setResultCode("S001");
|
articleVO.setResultCode("S001");
|
||||||
|
articleVO.setResultMessage("정상적으로 등록되었습니다.");
|
||||||
|
|
||||||
if(articleVO.getAttachFileCnt() > 0) {
|
if(articleVO.getAttachFileCnt() > 0) {
|
||||||
int savedCnt = 0;
|
int savedCnt = 0;
|
||||||
List<AttachFileVO> attachFileList = articleVO.getAttachFiles();
|
List<AttachFileVO> attachFileList = articleVO.getAttachFiles();
|
||||||
|
|
||||||
|
// 첨부파일그룹 등록
|
||||||
|
int groupCnt = attachFileService.insertAttachFileGroup(attachFileList.get(0));
|
||||||
|
|
||||||
|
if(groupCnt > 0) {
|
||||||
|
|
||||||
|
// 첨부파일 등록
|
||||||
for(int i=0; i<attachFileList.size(); i++) {
|
for(int i=0; i<attachFileList.size(); i++) {
|
||||||
AttachFileVO attachFileVO = attachFileList.get(i);
|
AttachFileVO attachFileVO = attachFileList.get(i);
|
||||||
int retAttFile = attachFileService.insertAttachFile(attachFileVO);
|
int retAttFile = attachFileService.insertAttachFile(attachFileVO);
|
||||||
savedCnt += retAttFile;
|
savedCnt += retAttFile;
|
||||||
if(retAttFile < 1) {
|
if(retAttFile < 1) {
|
||||||
log.error("insertArticle > 첨부파일 등록에 실패하였습니다 : " + attachFileVO.getFileName());
|
log.error("insertArticle > 첨부파일 등록에 실패하였습니다 : " + attachFileVO.getOrignlFileNm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(savedCnt != articleVO.getAttachFileCnt()) {
|
if(savedCnt != articleVO.getAttachFileCnt()) {
|
||||||
articleVO.setResultMessage(String.format("총 %d개 파일 중 %개 파일만 정상등록되었습니다.", articleVO.getAttachFileCnt(), savedCnt));
|
articleVO.setResultMessage(String.format("총 %d개 파일 중 %개 파일만 정상등록되었습니다.", articleVO.getAttachFileCnt(), savedCnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
articleVO.setResultMessage("게시글은 등록되었으나, 첨부파일그룹 등록에 실패하여 첨부파일 등록처리가 수행되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return articleVO;
|
return articleVO;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package nlib.bbs.web;
|
package nlib.bbs.web;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -260,29 +261,31 @@ public class QnaController extends NlibCommonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(fileListObj != null && fileListObj.size() > 0) {
|
if(fileListObj != null && fileListObj.size() > 0) {
|
||||||
|
|
||||||
|
String attachFileId = (String)(fileListObj.get(0).get("attachFileId"));
|
||||||
|
if(StringUtil.isEmpty(attachFileId)) {
|
||||||
|
log.error("첨부파일 아이디(attachFileId) 값은 필수 항목입니다. 첨부파일 처리에 실패하였습니다. 그러나, 게시물 등록은 계속 진행됩니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isNotEmpty(attachFileId)) {
|
||||||
|
articleVO.setBdAttachFileId(attachFileId);
|
||||||
|
|
||||||
|
String fileSStreCours = NlibProperty.getProperty("fileupload.base.path") + NlibProperty.getProperty("fileupload.bbs.qna.subpath") + "/";
|
||||||
List<AttachFileVO> attachFiles = new ArrayList<AttachFileVO>();
|
List<AttachFileVO> attachFiles = new ArrayList<AttachFileVO>();
|
||||||
String fileId = null;
|
|
||||||
for(int i=0; i<fileListObj.size(); i++) {
|
for(int i=0; i<fileListObj.size(); i++) {
|
||||||
Map finfo = fileListObj.get(i);
|
Map finfo = fileListObj.get(i);
|
||||||
AttachFileVO fVO = new AttachFileVO();
|
AttachFileVO fVO = new AttachFileVO();
|
||||||
|
|
||||||
// 게시물에 첨부파일 ID 설정
|
fVO.setAttachFileId(attachFileId);
|
||||||
if(i == 0) {
|
fVO.setFileStreCours(fileSStreCours);
|
||||||
fileId = (String)finfo.get("fileId");
|
fVO.setStreFileNm((String)finfo.get("streFileNm"));
|
||||||
if(StringUtil.isEmpty(fileId)) {
|
fVO.setOrignlFileNm((String)finfo.get("orignlFileNm"));
|
||||||
log.error("첨부파일의 FILEID 값은 필수 항목입니다. 첨부파일 처리에 실패하였습니다. 그러나, 게시물 등록은 계속 진행됩니다.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
articleVO.setBdAttachFileId(fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
fVO.setFileMask((String)finfo.get("fileMask"));
|
|
||||||
fVO.setFileId(fileId);
|
|
||||||
fVO.setFileSeq(((Integer)finfo.get("fileSeq")).intValue());
|
|
||||||
fVO.setFileName((String)finfo.get("fileName"));
|
|
||||||
fVO.setFileSize(((Integer)finfo.get("fileSize")).intValue());
|
|
||||||
fVO.setAtchTypeCd((String)finfo.get("atchTypeCd"));
|
|
||||||
fVO.setFileExtsn((String)finfo.get("fileExtsn"));
|
fVO.setFileExtsn((String)finfo.get("fileExtsn"));
|
||||||
|
fVO.setFileSize(((Integer)finfo.get("fileSize")).intValue());
|
||||||
|
|
||||||
|
File f = new File(fVO.getFileStreCours() + fVO.getStreFileNm());
|
||||||
|
if(!f.exists() || !f.isFile()) continue;
|
||||||
|
|
||||||
attachFiles.add(fVO);
|
attachFiles.add(fVO);
|
||||||
}
|
}
|
||||||
@ -291,6 +294,8 @@ public class QnaController extends NlibCommonController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
// 등록처리
|
// 등록처리
|
||||||
//---------------------------
|
//---------------------------
|
||||||
|
|||||||
@ -95,7 +95,8 @@ public class FileUploadController {
|
|||||||
@RequestMapping(value="/fileupload/uploadFilesAjax.do", produces="application/json")
|
@RequestMapping(value="/fileupload/uploadFilesAjax.do", produces="application/json")
|
||||||
public ResponseEntity uploadFilesAjax(
|
public ResponseEntity uploadFilesAjax(
|
||||||
final MultipartHttpServletRequest multiRequest
|
final MultipartHttpServletRequest multiRequest
|
||||||
, @RequestParam("subPathKey") String subPathKey
|
, @RequestParam(name="subPathKey") String subPathKey
|
||||||
|
, @RequestParam(name="attachFileId", required=false) String attachFileId
|
||||||
, HttpServletResponse response) {
|
, HttpServletResponse response) {
|
||||||
|
|
||||||
String message = null;
|
String message = null;
|
||||||
@ -150,60 +151,51 @@ public class FileUploadController {
|
|||||||
String filePath = "";
|
String filePath = "";
|
||||||
FileVO fvo;
|
FileVO fvo;
|
||||||
AttachFileVO atvo;
|
AttachFileVO atvo;
|
||||||
String fileId = UUID.getNewFileId(); // J_ATTACHFILE 테이블의 FILE_ID : 첨부파일그룹코드
|
String fileId = UUID.getNewFileId();
|
||||||
|
|
||||||
|
// 첨브파일그룹ID
|
||||||
|
if(StringUtil.isEmpty(attachFileId)) {
|
||||||
|
attachFileId = UUID.getNewAttachFileId();
|
||||||
|
}
|
||||||
|
|
||||||
int fileSeq = 1;
|
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Entry<String, MultipartFile> entry = itr.next();
|
Entry<String, MultipartFile> entry = itr.next();
|
||||||
|
|
||||||
file = entry.getValue();
|
file = entry.getValue();
|
||||||
String orginFileName = file.getOriginalFilename();
|
String orignlFileNm = file.getOriginalFilename();
|
||||||
|
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// 원 파일명이 없는 경우 처리 SKIP
|
// 원 파일명이 없는 경우 처리 SKIP
|
||||||
// (첨부가 되지 않은 input file type)
|
// (첨부가 되지 않은 input file type)
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
if (orginFileName == null || "".equals(orginFileName)) {
|
if (orignlFileNm == null || "".equals(orignlFileNm)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = orginFileName.lastIndexOf(".");
|
// 파일 확장자
|
||||||
String fileExt = (index < 1 ? "" : orginFileName.substring(index + 1));
|
int index = orignlFileNm.lastIndexOf(".");
|
||||||
|
String fileExt = (index < 1 ? "" : orignlFileNm.substring(index + 1));
|
||||||
|
|
||||||
//String newName = UUID.getPhysicalFileName();
|
//String newName = UUID.getPhysicalFileName();
|
||||||
String fileMask = UUID.getNewFileMask();
|
|
||||||
|
|
||||||
int size = (int)file.getSize();
|
int size = (int)file.getSize();
|
||||||
|
String streFileNm = UUID.getNewStreFileNm();
|
||||||
|
|
||||||
if (!"".equals(orginFileName)) {
|
filePath = FILEUPLOAD_BASE_PATH + subPath + "/" + streFileNm;
|
||||||
filePath = FILEUPLOAD_BASE_PATH + subPath + "/" + fileMask;
|
|
||||||
log.debug("FILE UPLOAD : filePath=" + filePath);
|
log.debug("FILE UPLOAD : filePath=" + filePath);
|
||||||
|
|
||||||
file.transferTo(new File(FileUtil.filePathBlackList(filePath)));
|
file.transferTo(new File(FileUtil.filePathBlackList(filePath)));
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------- 삭제대상 : 시작
|
|
||||||
fvo = new FileVO();
|
|
||||||
fvo.setFileExtsn(fileExt);
|
|
||||||
fvo.setFileMg(Long.toString(size));
|
|
||||||
fvo.setOrignlFileNm(orginFileName);
|
|
||||||
fvo.setStreFileNm(fileMask);
|
|
||||||
fvo.setFileSn(String.valueOf(fileSeq));
|
|
||||||
// ---------------- 삭제대상 : 종료
|
|
||||||
|
|
||||||
atvo = new AttachFileVO();
|
atvo = new AttachFileVO();
|
||||||
atvo.setSubPathKey(subPathKey);
|
atvo.setSubPathKey(subPathKey);
|
||||||
atvo.setFileMask(fileMask);
|
atvo.setAttachFileId(attachFileId);
|
||||||
atvo.setFileId(fileId);
|
atvo.setStreFileNm(streFileNm);
|
||||||
atvo.setFileSeq(fileSeq);
|
atvo.setOrignlFileNm(orignlFileNm);
|
||||||
atvo.setFileName(orginFileName);
|
|
||||||
atvo.setFileSize(size);
|
|
||||||
atvo.setFileExtsn(fileExt);
|
atvo.setFileExtsn(fileExt);
|
||||||
atvo.setAtchTypeCdFromFileExtsn();
|
atvo.setFileSize(size);
|
||||||
|
|
||||||
result.add(atvo);
|
result.add(atvo);
|
||||||
|
|
||||||
fileSeq++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
@ -241,17 +233,38 @@ public class FileUploadController {
|
|||||||
@RequestMapping(value="/fileupload/downloadAttachFile.do")
|
@RequestMapping(value="/fileupload/downloadAttachFile.do")
|
||||||
public ModelAndView downloadAttachFile(AttachFileVO attachFileVO, ModelAndView mv) throws Exception {
|
public ModelAndView downloadAttachFile(AttachFileVO attachFileVO, ModelAndView mv) throws Exception {
|
||||||
|
|
||||||
// TODO 권한 설정 기능 추가 필요
|
//---------------------------------
|
||||||
|
// 권한체크
|
||||||
|
//---------------------------------
|
||||||
|
// 공지사항, FAQ : 모두 공개
|
||||||
|
// QnA : 공개된 글인 경우, 모두 공개
|
||||||
|
// QnA : 비밀글 (본인에 한정)
|
||||||
|
|
||||||
int ret = attachFileService.increaseDownloadCount(attachFileVO);
|
boolean hasAuth = attachFileService.checkAttachFileDownload(attachFileVO);
|
||||||
if(ret < 1) {
|
|
||||||
String message = "다운로드 가능 회수를 초과하였거나, 해당 정보를 찾을 수 없습니다.";
|
if(!hasAuth) {
|
||||||
log.error("downloadAttachFile > " + message);
|
throw new Exception("잘못된 접근입니다. 파일다운로드를 할 수 있는 권한이 없습니다.");
|
||||||
throw new Exception(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String subPath = NlibProperty.getProperty(attachFileVO.getSubPathKey());
|
AttachFileVO retAttachFileVO = attachFileService.selectAttachFile(attachFileVO);
|
||||||
String fullPath = FILEUPLOAD_BASE_PATH + "/" + subPath + "/" + attachFileVO.getFileMask();
|
|
||||||
|
if(retAttachFileVO == null || StringUtil.isEmpty(retAttachFileVO.getAttachFileId())) {
|
||||||
|
throw new Exception("잘못된 접근이므로 파일다운로드를 할 수 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(retAttachFileVO.getFileStreCours()) || StringUtil.isEmpty(retAttachFileVO.getStreFileNm())) {
|
||||||
|
throw new Exception("파일정보가 올바르지 않습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(retAttachFileVO.getOrignlFileNm())) {
|
||||||
|
retAttachFileVO.setOrignlFileNm("첨부파일." + retAttachFileVO.getFileExtsn());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(retAttachFileVO.getOrignlFileNm())) {
|
||||||
|
retAttachFileVO.setOrignlFileNm("첨부파일." + retAttachFileVO.getFileExtsn());
|
||||||
|
}
|
||||||
|
|
||||||
|
String fullPath = retAttachFileVO.getFileStreCours() + retAttachFileVO.getStreFileNm();
|
||||||
|
|
||||||
log.debug("downloadAttachFile > fullPath = " + fullPath);
|
log.debug("downloadAttachFile > fullPath = " + fullPath);
|
||||||
|
|
||||||
@ -266,7 +279,7 @@ public class FileUploadController {
|
|||||||
|
|
||||||
mv.setViewName("downloadView"); // dispatcher-servlet.xml내 BeanNameViewResolver 정의
|
mv.setViewName("downloadView"); // dispatcher-servlet.xml내 BeanNameViewResolver 정의
|
||||||
mv.addObject("downloadFile", file);
|
mv.addObject("downloadFile", file);
|
||||||
mv.addObject("fname", attachFileVO.getFileName());
|
mv.addObject("fname", attachFileVO.getOrignlFileNm());
|
||||||
|
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,8 +49,14 @@ public class UUID {
|
|||||||
return articleID;
|
return articleID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNewFileMask() {
|
public static String getNewAttachFileId() {
|
||||||
return StringUtil.getTimeStamp("yyyyMMddhhmmss") + getNewUUIDWithAlphaNum();
|
//return StringUtil.getTimeStamp("yyyyMMddhhmmss") + getNewUUIDWithAlphaNum();
|
||||||
|
return getNlibCommonID("AT", 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNewStreFileNm() {
|
||||||
|
// NQ202109300311510712
|
||||||
|
return "NQ" + StringUtil.getTimeStamp() + getNlibCommonID(null, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNewFileId() {
|
public static String getNewFileId() {
|
||||||
|
|||||||
@ -5,74 +5,114 @@
|
|||||||
|
|
||||||
<select id="listAttachFiles" parameterType="String" resultType="AttachFileVO">
|
<select id="listAttachFiles" parameterType="String" resultType="AttachFileVO">
|
||||||
SELECT
|
SELECT
|
||||||
A.FILE_MASK
|
B.ATTACH_FILE_ID
|
||||||
, A.FILE_ID
|
, B.FILE_SN
|
||||||
, A.FILE_SEQ
|
, B.FILE_STRE_COURS
|
||||||
, A.FILE_NAME
|
, B.STRE_FILE_NM
|
||||||
, A.FILE_SIZE
|
, B.ORIGNL_FILE_NM
|
||||||
, A.FILE_TYPE_CD
|
, B.FILE_EXTSN
|
||||||
, A.DOWNLOAD_COUNT
|
, B.FILE_CN
|
||||||
, A.DOWNLOAD_EXPIRE_DATE
|
, B.FILE_SIZE
|
||||||
, A.DOWNLOAD_LIMIT_COUNT
|
FROM BD_FILE A
|
||||||
, DATE_FORMAT(A.REG_DATE, '%Y-%m-%d') AS REG_DD
|
JOIN BD_FILEDETAIL B ON (A.ATTACH_FILE_ID = B.ATTACH_FILE_ID)
|
||||||
, A.DELETE_YN
|
WHERE A.ATTACH_FILE_ID = #{attachFileId}
|
||||||
, A.STREAMING_URL
|
AND A.USE_AT = 'Y'
|
||||||
, A.CONTENT
|
AND B.USE_AT = 'Y'
|
||||||
, A.ATCH_TYPE_CD
|
ORDER BY B.FILE_SN
|
||||||
FROM J_ATTACHFILE A
|
|
||||||
WHERE A.FILE_ID = #{attachFileId}
|
|
||||||
ORDER BY A.FILE_SEQ
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertAttachFile" parameterType="AttachFileVO">
|
<select id="selectAttachFile" parameterType="AttachFileVO" resultType="AttachFileVO">
|
||||||
INSERT INTO J_ATTACHFILE (
|
SELECT
|
||||||
FILE_MASK
|
B.ATTACH_FILE_ID
|
||||||
, FILE_ID
|
, B.FILE_SN
|
||||||
, FILE_SEQ
|
, B.FILE_STRE_COURS
|
||||||
, FILE_NAME
|
, B.STRE_FILE_NM
|
||||||
, FILE_SIZE
|
, B.ORIGNL_FILE_NM
|
||||||
, FILE_TYPE_CD
|
, B.FILE_EXTSN
|
||||||
, DOWNLOAD_COUNT
|
, B.FILE_CN
|
||||||
, DOWNLOAD_EXPIRE_DATE
|
, B.FILE_SIZE
|
||||||
, DOWNLOAD_LIMIT_COUNT
|
FROM BD_FILE A
|
||||||
, REG_DATE
|
JOIN BD_FILEDETAIL B ON (A.ATTACH_FILE_ID = B.ATTACH_FILE_ID)
|
||||||
, DELETE_YN
|
WHERE A.ATTACH_FILE_ID = #{attachFileId}
|
||||||
, STREAMING_URL
|
AND B.FILE_SN = #{fileSn}
|
||||||
, CONTENT
|
AND A.USE_AT = 'Y'
|
||||||
, ATCH_TYPE_CD
|
AND B.USE_AT = 'Y'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkAttachFileDownload" parameterType="AttachFileVO" resultType="String">
|
||||||
|
SELECT 'Y' AS checkResult
|
||||||
|
<if test='bdType != null and bdType.equals("QNA")'>
|
||||||
|
FROM BD_NLIB_QNA
|
||||||
|
WHERE BD_TYPE = 'QNA'
|
||||||
|
AND BD_ATTACH_FILE_ID = #{attachFileId}
|
||||||
|
AND (SECRET_YN = 'N' OR REG_ID = #{mbInfoId})
|
||||||
|
AND USE_YN = 'Y'
|
||||||
|
</if>
|
||||||
|
<if test='bdType != null and bdType.equals("FAQ")'>
|
||||||
|
FROM BD_NLIB_QNA
|
||||||
|
WHERE BD_TYPE = UPPER('FAQ')
|
||||||
|
AND BD_ATTACH_FILE_ID = #{attachFileId}
|
||||||
|
AND USE_YN = 'Y'
|
||||||
|
</if>
|
||||||
|
<if test='bdType != null and bdType.equals("ANCMNT")'>
|
||||||
|
FROM BD_NLIB_ANCMNT
|
||||||
|
WHERE BD_ATTACH_FILE_ID = #{attachFileId}
|
||||||
|
AND OPEN_YN = 'Y'
|
||||||
|
AND DELETE_YN = 'N'
|
||||||
|
AND DATE_FORMAT(NOW(), '%Y%m%d') BETWEEN IFNULL(POST_START_DATE,'00010101') AND IFNULL(POST_END_DATE, '99991231')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAttachFileGroup" parameterType="AttachFileVO">
|
||||||
|
INSERT INTO BD_FILE (
|
||||||
|
ATTACH_FILE_ID
|
||||||
|
, REG_DD
|
||||||
|
, USE_AT
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{fileMask}
|
#{attachFileId}
|
||||||
, #{fileId}
|
|
||||||
, #{fileSeq}
|
|
||||||
, #{fileName}
|
|
||||||
, #{fileSize}
|
|
||||||
, #{fileTypeCd}
|
|
||||||
, 0
|
|
||||||
, NULL
|
|
||||||
, NULL
|
|
||||||
, NOW()
|
, NOW()
|
||||||
, 'N'
|
, 'Y'
|
||||||
, NULL
|
|
||||||
, NULL
|
|
||||||
, #{atchTypeCd}
|
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="deleteAttachFile" parameterType="AttachFileVO">
|
<insert id="insertAttachFile" parameterType="AttachFileVO">
|
||||||
UPDATE J_ATTACHFILE SET DELETE_YN = 'Y'
|
<selectKey resultType="int" keyProperty="fileSn" order="BEFORE">
|
||||||
WHERE FILE_MASK = #{fileMask}
|
SELECT IFNULL(MAX(FILE_SN) + 1, 1)
|
||||||
AND FILE_ID = #{fileId}
|
FROM BD_FILEDETAIL
|
||||||
AND FILE_SEQ = #{fileSeq}
|
WHERE ATTACH_FILE_ID = #{attachFileId}
|
||||||
|
</selectKey>
|
||||||
|
INSERT INTO BD_FILEDETAIL (
|
||||||
|
ATTACH_FILE_ID
|
||||||
|
, FILE_SN
|
||||||
|
, FILE_STRE_COURS
|
||||||
|
, STRE_FILE_NM
|
||||||
|
, ORIGNL_FILE_NM
|
||||||
|
, FILE_EXTSN
|
||||||
|
, FILE_CN
|
||||||
|
, FILE_SIZE
|
||||||
|
, USE_AT
|
||||||
|
) VALUES (
|
||||||
|
#{attachFileId}
|
||||||
|
, IFNULL(#{fileSn}, 1)
|
||||||
|
, #{fileStreCours}
|
||||||
|
, #{streFileNm}
|
||||||
|
, #{orignlFileNm}
|
||||||
|
, #{fileExtsn}
|
||||||
|
, NULL
|
||||||
|
, #{fileSize}
|
||||||
|
, 'Y'
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="deleteAttachFileGroup" parameterType="AttachFileVO">
|
||||||
|
UPDATE BD_FILE SET USE_AT = 'N'
|
||||||
|
WHERE ATTACH_FILE_ID = #{attachFileId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="increaseDownloadCount" parameterType="AttachFileVO">
|
<update id="deleteAttachFile" parameterType="AttachFileVO">
|
||||||
<![CDATA[
|
UPDATE BD_FILEDETAIL SET USE_AT = 'N'
|
||||||
UPDATE J_ATTACHFILE SET DOWNLOAD_COUNT = (IFNULL(DOWNLOAD_COUNT, 0) + 1)
|
WHERE ATTACH_FILE_ID = #{attachFileId}
|
||||||
WHERE FILE_MASK = #{fileMask}
|
AND FILE_SN = #{fileSn}
|
||||||
AND FILE_ID = #{fileId}
|
|
||||||
AND FILE_SEQ = #{fileSeq}
|
|
||||||
AND IFNULL(DOWNLOAD_COUNT, 0) < IFNULL(DOWNLOAD_LIMIT_COUNT, (IFNULL(DOWNLOAD_COUNT, 0) + 1))
|
|
||||||
]]>
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -69,7 +69,7 @@ $(window.document).ready(function() {
|
|||||||
// 파일 업로드 처리 : 시작
|
// 파일 업로드 처리 : 시작
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// 파일업로드 객체 생성
|
// 파일업로드 객체 생성
|
||||||
myDropzone = new Dropzone("form#myDropzone", { url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath"});
|
myDropzone = new Dropzone("form#myDropzone", { url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath&attachFileId=${searchArticle.bdAttachFileId}"});
|
||||||
|
|
||||||
// 각 파일별 업로드 성공시 호출됨 (1th called)
|
// 각 파일별 업로드 성공시 호출됨 (1th called)
|
||||||
myDropzone.on("success", function(file, responseText) {
|
myDropzone.on("success", function(file, responseText) {
|
||||||
@ -77,13 +77,13 @@ $(window.document).ready(function() {
|
|||||||
console.log("file upload success : responseText = " + responseText);
|
console.log("file upload success : responseText = " + responseText);
|
||||||
console.log("fileUpDone count : " + fileList.length);
|
console.log("fileUpDone count : " + fileList.length);
|
||||||
var idx = fileList.length;
|
var idx = fileList.length;
|
||||||
fileList[idx] = {
|
fileList[idx++] = {
|
||||||
"fileMask" : jobj[0].fileMask,
|
"attachFileId" : jobj[0].attachFileId,
|
||||||
"fileId" : jobj[0].fileId,
|
"streFileNm" : jobj[0].streFileNm,
|
||||||
"fileSeq" : (idx+1),
|
"orignlFileNm" : jobj[0].orignlFileNm,
|
||||||
"fileName" : jobj[0].fileName,
|
"fileExtsn" : jobj[0].fileExtsn,
|
||||||
"fileSize" : jobj[0].fileSize,
|
"fileSn" : jobj[0].fileSn,
|
||||||
"atchTypeCd" : jobj[0].atchTypeCd,
|
"fileSize" : jobj[0].fileSize
|
||||||
};
|
};
|
||||||
console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm);
|
console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -58,32 +58,21 @@ function fn_delete() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 파일 다운로드
|
// 파일 다운로드
|
||||||
function fn_downloadFile(fileMask, fileId, fileSeq, fileName) {
|
function fn_downloadFile(attachFileId, fileSn) {
|
||||||
|
|
||||||
if(fileMask == null || fileMask.trim().length < 1) {
|
if(attachFileId == null || attachFileId.trim().length < 1) {
|
||||||
alert("파일정보를 확인해 주시기 바랍니다.[1]");
|
alert("파일정보를 확인해 주시기 바랍니다.[1]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fileId == null || fileId.trim().length < 1) {
|
if(fileSn < 1) {
|
||||||
alert("파일정보를 확인해 주시기 바랍니다.[2]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fileSeq < 1) {
|
|
||||||
alert("파일정보를 확인해 주시기 바랍니다.[3]");
|
alert("파일정보를 확인해 주시기 바랍니다.[3]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fileName == null || fileName.trim().length < 1) {
|
$("#attachFileId").val(attachFileId);
|
||||||
alert("파일정보를 확인해 주시기 바랍니다.[4]");
|
$("#fileSn").val(fileSn);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#fileMask").val(fileMask);
|
|
||||||
$("#fileId").val(fileId);
|
|
||||||
$("#fileSeq").val(fileSeq);
|
|
||||||
$("#fileName").val(fileName);
|
|
||||||
$("#downloadFileForm").submit();
|
$("#downloadFileForm").submit();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -153,7 +142,7 @@ function fn_downloadFile(fileMask, fileId, fileSeq, fileName) {
|
|||||||
// 파일정보 : 저장파일ID=원파일명
|
// 파일정보 : 저장파일ID=원파일명
|
||||||
%>
|
%>
|
||||||
<c:forEach var="attachFile" items="${article.attachFiles }">
|
<c:forEach var="attachFile" items="${article.attachFiles }">
|
||||||
<a href="javascript:void(0);" onclick="fn_downloadFile('${attachFile.fileMask}', '${attachFile.fileId}', ${attachFile.fileSeq}, '${attachFile.fileName}')">${attachFile.fileName} (${attachFile.fileSize} byte(s))</a><br/>
|
<a href="javascript:void(0);" onclick="fn_downloadFile('${attachFile.attachFileId}', ${attachFile.fileSn})">${attachFile.orignlFileNm} (${attachFile.fileSize} byte(s))</a><br/>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -187,11 +176,12 @@ function fn_downloadFile(fileMask, fileId, fileSeq, fileName) {
|
|||||||
<form name="downloadFileForm" id="downloadFileForm"
|
<form name="downloadFileForm" id="downloadFileForm"
|
||||||
action="${pageContext.request.contextPath}/fileupload/downloadAttachFile.do"
|
action="${pageContext.request.contextPath}/fileupload/downloadAttachFile.do"
|
||||||
method="post">
|
method="post">
|
||||||
<input type="text" name="subPathKey" id="subPathKey" value="fileupload.bbs.qna.subpath" readonly />
|
<input type="text" name="bdType" id="bdType" value="QNA" readonly />
|
||||||
<input type="text" name="fileMask" id="fileMask" value="" readonly />
|
<input type="text" name="attachFileId" id="attachFileId" value="" readonly />
|
||||||
<input type="text" name="fileId" id="fileId" value="" readonly />
|
<input type="text" name="streFileNm" id="streFileNm" value="" readonly />
|
||||||
<input type="text" name="fileSeq" id="fileSeq" value="" readonly />
|
<input type="text" name="fileSn" id="fileSn" value="" readonly />
|
||||||
<input type="text" name="fileName" id="fileName" value="" readonly />
|
<input type="text" name="orignlFileNm" id="orignlFileNm" value="" readonly />
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
<title>서비스 이동중</title>
|
<title>서비스 이동중</title>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//$("#frm").submit();
|
$("#frm").submit();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user