refactor : 파일 테이블 변경

main
이범준 1 year ago
parent c0de4097d0
commit 6e71c943a4

@ -341,7 +341,7 @@ public class FimsCrackdownMgtServiceBean extends AbstractServiceBean implements
.fileJobId(interfaceSeqN+"01") .fileJobId(interfaceSeqN+"01")
.build()); .build());
String tgtPath = uploadResPath + fileDtlList.get(0).getFileCours(); String tgtPath = uploadResPath + fileDtlList.get(0).getFilePath();
final String fileName = interfaceSeqN + ".xml"; final String fileName = interfaceSeqN + ".xml";
CtznStmtDTO.Ans ansDTO = mapper.selectEcCtznSttemntAnswer(interfaceSeqN); CtznStmtDTO.Ans ansDTO = mapper.selectEcCtznSttemntAnswer(interfaceSeqN);

@ -167,7 +167,7 @@ public class EcCtznSttemntServiceBean extends AbstractServiceBean implements EcC
.fileJobId(dto.getInterfaceSeqN()+"01") .fileJobId(dto.getInterfaceSeqN()+"01")
.build()); .build());
String tgtPath = uploadResPath + fileDtlList.get(0).getFileCours(); String tgtPath = uploadResPath + fileDtlList.get(0).getFilePath();
final String fileName = dto.getInterfaceSeqN() + ".xml"; final String fileName = dto.getInterfaceSeqN() + ".xml";
CtznStmtAnsSendDTO sendDto = CtznStmtDTO.Ans.getCtznStmtAnsDTO(dto); CtznStmtAnsSendDTO sendDto = CtznStmtDTO.Ans.getCtznStmtAnsDTO(dto);
@ -252,14 +252,14 @@ public class EcCtznSttemntServiceBean extends AbstractServiceBean implements EcC
String tgtPath = null; String tgtPath = null;
for (CmmFileDTO.FileDtl dtl : fileDtlList) { for (CmmFileDTO.FileDtl dtl : fileDtlList) {
if (Checks.isEmpty(tgtPath)) if (Checks.isEmpty(tgtPath))
tgtPath = uploadResPath + dtl.getFileCours(); tgtPath = uploadResPath + dtl.getFilePath();
try { try {
// 대상폴더 미 존재시 생성 // 대상폴더 미 존재시 생성
File tgtFile = FileUtils.getFile(tgtPath, dtl.getOrginlFileNm()); File tgtFile = FileUtils.getFile(tgtPath, dtl.getOrginlFileNm());
FileUtils.copyFile( FileUtils.copyFile(
FileUtils.getFile(uploadRoot + dtl.getFileCours(), dtl.getFileId()) FileUtils.getFile(uploadRoot + dtl.getFilePath(), dtl.getFileId())
, tgtFile , tgtFile
, true , true
); );

@ -81,7 +81,7 @@ public class CmmFileDTO {
/** /**
* *
*/ */
private String fileCntntsTy; private String mimeType;
/** /**
* *
@ -91,12 +91,12 @@ public class CmmFileDTO {
/** /**
* *
*/ */
private Long fileCpcty; private Long fileSize;
/** /**
* *
*/ */
private String fileCours; private String filePath;
private String rgtr; private String rgtr;
private String regDt; private String regDt;
@ -162,7 +162,7 @@ public class CmmFileDTO {
private String fileId; private String fileId;
private String orginlFileNm; private String orginlFileNm;
private String fileCours; private String filePath;
private String downloadUrl; private String downloadUrl;
private String rgtr; private String rgtr;

@ -98,11 +98,11 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
CmmFileDTO.FileDtl fileDtlDTO = CmmFileDTO.FileDtl.builder() CmmFileDTO.FileDtl fileDtlDTO = CmmFileDTO.FileDtl.builder()
.fileMastrId(dto.getFileMastrId()) .fileMastrId(dto.getFileMastrId())
.fileId(CommUtils.getStringFromUUID()) .fileId(CommUtils.getStringFromUUID())
.fileCours(dto.getFileCours()) .filePath(dto.getFilePath())
.fileCntntsTy(mf.getContentType()) .mimeType(mf.getContentType())
.orginlFileNm(orgFileName) .orginlFileNm(orgFileName)
.fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase()) .fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase())
.fileCpcty(mf.getSize()) .fileSize(mf.getSize())
.rgtr(getUserUniqId()) .rgtr(getUserUniqId())
.build(); .build();
@ -113,12 +113,12 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
throw BizRuntimeException.create( throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName)); MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName));
} }
if (fileDtlDTO.getFileCpcty() > (maxSize * 1024)) { if (fileDtlDTO.getFileSize() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileCpcty()); log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileSize());
//TODO : 에러처리 //TODO : 에러처리
//return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize())); //return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize()));
throw BizRuntimeException.create( throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Over size :: %s[%d]", orgFileName, fileDtlDTO.getFileCpcty())); MessageKey.CUSTOM_MSG, String.format("Over size :: %s[%d]", orgFileName, fileDtlDTO.getFileSize()));
} }
//동일파일 삭제후 정보 저장 //동일파일 삭제후 정보 저장
@ -126,7 +126,7 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
mapper.insertCmmFileDetail(fileDtlDTO); mapper.insertCmmFileDetail(fileDtlDTO);
// 파일 전송 // 파일 전송
mf.transferTo(new File(this.uploadRoot + dto.getFileCours() + "/" + fileDtlDTO.getFileId())); mf.transferTo(new File(this.uploadRoot + dto.getFilePath() + "/" + fileDtlDTO.getFileId()));
cmmFileDtls.add(fileDtlDTO); cmmFileDtls.add(fileDtlDTO);
// inputStream을 가져와서 // inputStream을 가져와서
@ -200,7 +200,7 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
CmmFileDTO.FileDtl selectDTO = mapper.selectCmmFileDetail(dtlDto); CmmFileDTO.FileDtl selectDTO = mapper.selectCmmFileDetail(dtlDto);
if(Checks.isNotEmpty(selectDTO)){ if(Checks.isNotEmpty(selectDTO)){
mapper.deleteCmmFileDetail(selectDTO); mapper.deleteCmmFileDetail(selectDTO);
new File(this.uploadRoot + selectDTO.getFileCours() + "/" + selectDTO.getFileId()).delete(); new File(this.uploadRoot + selectDTO.getFilePath() + "/" + selectDTO.getFileId()).delete();
}; };
} }
@ -225,11 +225,11 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
CmmFileDTO.FileDtl fileDtlDTO = CmmFileDTO.FileDtl.builder() CmmFileDTO.FileDtl fileDtlDTO = CmmFileDTO.FileDtl.builder()
.fileMastrId(fileMstDTO.getFileMastrId()) .fileMastrId(fileMstDTO.getFileMastrId())
.fileId(CommUtils.getStringFromUUID()) .fileId(CommUtils.getStringFromUUID())
.fileCours(makePath) .filePath(makePath)
.fileCntntsTy(mf.getContentType()) .mimeType(mf.getContentType())
.orginlFileNm(orgFileName) .orginlFileNm(orgFileName)
.fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase()) .fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase())
.fileCpcty(mf.getSize()) .fileSize(mf.getSize())
.rgtr(getUserUniqId()) .rgtr(getUserUniqId())
.build(); .build();
@ -240,12 +240,12 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
throw BizRuntimeException.create( throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName)); MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName));
} }
if (fileDtlDTO.getFileCpcty() > (maxSize * 1024)) { if (fileDtlDTO.getFileSize() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileCpcty()); log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileSize());
//TODO : 에러처리 //TODO : 에러처리
//return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize())); //return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize()));
throw BizRuntimeException.create( throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Over size :: %s[%d]", orgFileName, fileDtlDTO.getFileCpcty())); MessageKey.CUSTOM_MSG, String.format("Over size :: %s[%d]", orgFileName, fileDtlDTO.getFileSize()));
} }
//동일파일 삭제후 정보 저장 //동일파일 삭제후 정보 저장

@ -65,7 +65,7 @@ public class CmmFileMgtController extends AbstractController {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder() CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder()
.fileMastrId(dto.getFileMastrId()) .fileMastrId(dto.getFileMastrId())
.fileCours(dto.getFileCours()) .filePath(dto.getFilePath())
.orginlFileNm(dto.getOrginlFileNm()) .orginlFileNm(dto.getOrginlFileNm())
.build(); .build();
cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(dto.getFile()), false); cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(dto.getFile()), false);
@ -78,7 +78,7 @@ public class CmmFileMgtController extends AbstractController {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(uploadRoot) sb.append(uploadRoot)
.append(fileDtlDTO.getFileCours()) .append(fileDtlDTO.getFilePath())
.append("/") .append("/")
.append(fileDtlDTO.getFileId()); .append(fileDtlDTO.getFileId());
downloadExec(sb.toString(), fileDtlDTO.getOrginlFileNm(), response); downloadExec(sb.toString(), fileDtlDTO.getOrginlFileNm(), response);

@ -179,7 +179,7 @@ public class XitBasicBbsMngVO {
/** /**
* *
*/ */
private String fileCours; private String filePath;
//--------------------------------- //---------------------------------
// 2009.06.29 : 2단계 기능 추가 // 2009.06.29 : 2단계 기능 추가

@ -83,14 +83,14 @@ public class BoardBasicMgtServiceBean extends AbstractServiceBean implements Boa
public void modifyBoardBasic(final XitBasicBbsMngVO vo) { public void modifyBoardBasic(final XitBasicBbsMngVO vo) {
//삭제여부 없는 경우 업데이트 //삭제여부 없는 경우 업데이트
if(Checks.isEmpty(vo.getUseYn()) && Checks.isNotEmpty(vo.getFiles())){ if(Checks.isEmpty(vo.getUseYn()) && Checks.isNotEmpty(vo.getFiles())){
if(Checks.isEmpty(vo.getFileCours())){ if(Checks.isEmpty(vo.getFilePath())){
CmmFileDTO.FileMst fm = cmmFileService.saveFiles(getFileMst(vo.getBbsId()+"_"+vo.getNttId()), Arrays.asList(vo.getFiles())); CmmFileDTO.FileMst fm = cmmFileService.saveFiles(getFileMst(vo.getBbsId()+"_"+vo.getNttId()), Arrays.asList(vo.getFiles()));
vo.setAtchFileId(fm.getFileMastrId()); vo.setAtchFileId(fm.getFileMastrId());
}else{ }else{
//파일 추가 기능 //파일 추가 기능
CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder() CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder()
.fileMastrId(vo.getAtchFileId()) .fileMastrId(vo.getAtchFileId())
.fileCours(vo.getFileCours()) .filePath(vo.getFilePath())
.build(); .build();
cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(vo.getFiles()), false); cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(vo.getFiles()), false);
} }

@ -199,7 +199,7 @@ public class ExtnlInterfaceUtils {
// TODO :: 파일선별 필요 // TODO :: 파일선별 필요
for (CmmFileDTO.FileDtl dtl : fileDtlList) { for (CmmFileDTO.FileDtl dtl : fileDtlList) {
if (Checks.isEmpty(tgtPath)) { if (Checks.isEmpty(tgtPath)) {
tgtPath = uploadRootPath + tempPath + "/" + dtl.getFileCours().split("/")[1]; tgtPath = uploadRootPath + tempPath + "/" + dtl.getFilePath().split("/")[1];
} }
try { try {
if(isFileCreate) { if(isFileCreate) {
@ -222,7 +222,7 @@ public class ExtnlInterfaceUtils {
File tgtFile = org.apache.commons.io.FileUtils.getFile(tgtPath, fileNm); File tgtFile = org.apache.commons.io.FileUtils.getFile(tgtPath, fileNm);
org.apache.commons.io.FileUtils.copyFile( org.apache.commons.io.FileUtils.copyFile(
org.apache.commons.io.FileUtils.getFile(uploadRootPath + dtl.getFileCours(), dtl.getFileId()) org.apache.commons.io.FileUtils.getFile(uploadRootPath + dtl.getFilePath(), dtl.getFileId())
, tgtFile , tgtFile
, true , true
); );
@ -249,7 +249,7 @@ public class ExtnlInterfaceUtils {
}); });
//FileUtils.removeDirectyAndFiles(tgtPath); //FileUtils.removeDirectyAndFiles(tgtPath);
return new NtriDTO.PhotoFileError(paramDTO.getVhrno(), return new NtriDTO.PhotoFileError(paramDTO.getVhrno(),
String.format("%s%s", uploadRootPath + dtl.getFileCours(), dtl.getFileId()), String.format("%s%s", uploadRootPath + dtl.getFilePath(), dtl.getFileId()),
dtl.getOrginlFileNm()); dtl.getOrginlFileNm());
} }

@ -445,10 +445,10 @@
select #{fileMastrId}, select #{fileMastrId},
file_id, file_id,
orginl_file_nm, orginl_file_nm,
file_cntnts_ty, mime_type,
file_extsn, file_extsn,
file_cpcty, file_size,
file_cours, file_path,
reg_dt, reg_dt,
rgtr rgtr
from tb_cmm_file_detail from tb_cmm_file_detail

@ -461,10 +461,10 @@
SELECT tcfd.file_mastr_id SELECT tcfd.file_mastr_id
, tcfd.file_id , tcfd.file_id
, tcfd.orginl_file_nm , tcfd.orginl_file_nm
, tcfd.file_cntnts_ty , tcfd.mime_type
, tcfd.file_extsn , tcfd.file_extsn
, tcfd.file_cpcty , tcfd.file_size
, tcfd.file_cours , tcfd.file_path
, tcfd.reg_dt , tcfd.reg_dt
, tcfd.rgtr , tcfd.rgtr
, tcfm.file_job_id , tcfm.file_job_id

@ -61,10 +61,10 @@
SELECT tcfd.file_mastr_id SELECT tcfd.file_mastr_id
, tcfd.file_id , tcfd.file_id
, tcfd.orginl_file_nm , tcfd.orginl_file_nm
, tcfd.file_cntnts_ty , tcfd.mime_type
, tcfd.file_extsn , tcfd.file_extsn
, tcfd.file_cpcty , tcfd.file_size
, tcfd.file_cours , tcfd.file_path
, tcfd.reg_dt , tcfd.reg_dt
, tcfd.rgtr , tcfd.rgtr
</sql> </sql>
@ -107,20 +107,20 @@
file_mastr_id file_mastr_id
, file_id , file_id
, orginl_file_nm , orginl_file_nm
, file_cntnts_ty , mime_type
, file_extsn , file_extsn
, file_cpcty , file_size
, file_cours , file_path
, reg_dt , reg_dt
, rgtr , rgtr
) VALUE ( ) VALUE (
#{fileMastrId} #{fileMastrId}
, #{fileId} , #{fileId}
, #{orginlFileNm} , #{orginlFileNm}
, #{fileCntntsTy} , #{mimeType}
, #{fileExtsn} , #{fileExtsn}
, #{fileCpcty} , #{fileSize}
, #{fileCours} , #{filePath}
, DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') , DATE_FORMAT(NOW(), '%Y%m%d%H%i%s')
, #{rgtr} , #{rgtr}
) )

@ -52,7 +52,7 @@
if(!confirm('편집한 단속이미지를 저장하시겠습니까?')) return; if(!confirm('편집한 단속이미지를 저장하시겠습니까?')) return;
} }
const {fileMastrId, fileId, fileCours} = srcImg.dataset; const {fileMastrId, fileId, filePath} = srcImg.dataset;
// 삭제 // 삭제
if(isDelete){ if(isDelete){
@ -76,7 +76,7 @@
const formData = new FormData(); const formData = new FormData();
formData.append('fileMastrId', fileMastrId); formData.append('fileMastrId', fileMastrId);
formData.append('fileId', fileId); formData.append('fileId', fileId);
formData.append('fileCours', fileCours); formData.append('filePath', filePath);
formData.append('file', file); formData.append('file', file);
cmmAjax({ cmmAjax({

@ -172,12 +172,12 @@
fileList.innerHTML += fileList.innerHTML +=
"<p id='" + cmmFileDtls[i].fileId + "'>" + "<p id='" + cmmFileDtls[i].fileId + "'>" +
"<a href='#' data-file_mastr_id='" + cmmFileDtls[i].fileMastrId + "'" + "<a href='#' data-file_mastr_id='" + cmmFileDtls[i].fileMastrId + "'" +
"data-file_cours='" + cmmFileDtls[i].fileCours + "' data-file_id='" + cmmFileDtls[i].fileId + "'" + "data-file_path='" + cmmFileDtls[i].filePath + "' data-file_id='" + cmmFileDtls[i].fileId + "'" +
"data-orginl_file_nm='" + cmmFileDtls[i].orginlFileNm + "' onclick='fnBiz.downloadFile(this);'>" + "data-orginl_file_nm='" + cmmFileDtls[i].orginlFileNm + "' onclick='fnBiz.downloadFile(this);'>" +
cmmFileDtls[i].orginlFileNm + "</a>" + cmmFileDtls[i].orginlFileNm + "</a>" +
"<button type='button' onclick='fnBiz.fileDelete(this);' class='file-delete'>X</button> <br/>" + "<button type='button' onclick='fnBiz.fileDelete(this);' class='file-delete'>X</button> <br/>" +
"</p>"; "</p>";
if(i === 0) fileList.innerHTML += "<input name='fileCours' type='hidden' value='"+ cmmFileDtls[i].fileCours + "' />"; if(i === 0) fileList.innerHTML += "<input name='filePath' type='hidden' value='"+ cmmFileDtls[i].filePath + "' />";
} }
} }
}) })
@ -224,10 +224,10 @@
fnBiz.fileArray(fileInput.files, "remove"); fnBiz.fileArray(fileInput.files, "remove");
} }
,downloadFile: (e) => { ,downloadFile: (e) => {
const fileCours = e.dataset.file_cours const filePath = e.dataset.file_path
const fileId = e.dataset.file_id const fileId = e.dataset.file_id
const orginlFileNm = e.dataset.orginl_file_nm const orginlFileNm = e.dataset.orginl_file_nm
const data = {fileCours, fileId, orginlFileNm} const data = {filePath, fileId, orginlFileNm}
if (confirm(orginlFileNm + ' 파일을 다운로드 하시겠습니까?')) { if (confirm(orginlFileNm + ' 파일을 다운로드 하시겠습니까?')) {
fetch(frwkApiUrl.DOWNLOAD fetch(frwkApiUrl.DOWNLOAD
,{ ,{

@ -26,7 +26,7 @@ function cmmImgDownload(divImgListElementId, cmmFileDtls, fnBizPagePopup = fnBiz
} }
//const params = `?filename=${dtl.orginlFileNm}&` + $.param(dtl); //const params = `?filename=${dtl.orginlFileNm}&` + $.param(dtl);
const params = `?fileId=${dtl.fileId}&fileCours=${dtl.fileCours}&orginlFileNm=${dtl.orginlFileNm}`; const params = `?fileId=${dtl.fileId}&filePath=${dtl.filePath}&orginlFileNm=${dtl.orginlFileNm}`;
const title = dtl.orginlFileNm; const title = dtl.orginlFileNm;
const x = document.createElement("img"); const x = document.createElement("img");
@ -43,8 +43,8 @@ function cmmImgDownload(divImgListElementId, cmmFileDtls, fnBizPagePopup = fnBiz
x.setAttribute("name", dtl.orginlFileNm); x.setAttribute("name", dtl.orginlFileNm);
x.setAttribute("data-file-mastr-id", dtl.fileMastrId); x.setAttribute("data-file-mastr-id", dtl.fileMastrId);
x.setAttribute("data-file-id", dtl.fileId); x.setAttribute("data-file-id", dtl.fileId);
x.setAttribute("data-file-cours", dtl.fileCours); x.setAttribute("data-file-path", dtl.filePath);
x.setAttribute("data-file-cpcty", dtl.fileCpcty); x.setAttribute("data-file-size", dtl.fileSize);
x.addEventListener('dblclick', (e)=>{ x.addEventListener('dblclick', (e)=>{
if(isEditor) { if(isEditor) {

Loading…
Cancel
Save