package nlib.bbs.service.impl; import java.util.List; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import nlib.bbs.service.ArticleVO; import nlib.bbs.service.AttachFileService; import nlib.bbs.service.AttachFileVO; import nlib.bbs.service.QnaService; import nlib.util.StringUtil; /** *
 * @Class Name : AttachFileServiceImpl.java
 * 
 * @Description : 첨부파일을 관리하는 서비스 클래스 
 * 
 * 
 * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
 *
 * 
* * @ ------------ -------- --------------------------- * @ 수정일 수정자 수정내용 * @ ------------ -------- --------------------------- * @ 2021. 9. 16. KNKIM 최초 생성 * * * @author 이씨플라자 * DIGITALSHIP KNKIM * @since 2021. 9. 16. * @version 1.0 * */ @Service("attachFileService") public class AttachFileServiceImpl implements AttachFileService { static Logger log = LoggerFactory.getLogger(AttachFileServiceImpl.class); @Resource(name="attachFileDAO") AttachFileDAO attachFileDAO; @Resource(name = "qnaService") private QnaService qnaService; /** * 첨부파일 목록을 조회한다. * * @param * @return * @throws Exception */ @Override public List listAttachFiles(String attachFileId) throws Exception { 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 public int insertAttachFile(AttachFileVO attachFileVO) throws Exception { return attachFileDAO.insertAttachFile(attachFileVO); } /** * 첨부파일그룹을 삭제한다. * * @param * @return * @throws Exception */ @Override public int deleteAttachFileGroup(String attachFileId) throws Exception { int ret = attachFileDAO.deleteAttachFileGroup(attachFileId); attachFileDAO.deleteAllFilesOfAttachFileGroup(attachFileId); return ret; } /** * 첨부파일 삭제한다. * * @param * @return * @throws Exception */ @Override public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception { return attachFileDAO.deleteAttachFile(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() < 0) return null; return attachFileDAO.selectAttachFile(attachFileVO); } /** * 다운로드 가능 여부를 확인하다. * * @param attachFileVO * @return * @throws Exception */ public boolean checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception { String bdType = attachFileVO.getBdType(); if(StringUtil.isEmpty(bdType)) return false; String ret = "Y"; ret = attachFileDAO.checkAttachFileDownload(attachFileVO); return StringUtil.isEmpty(ret) ? false : (ret.charAt(0) == 'Y'); } }