refactor : 파일 테이블 변경

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

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

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

@ -98,11 +98,11 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
CmmFileDTO.FileDtl fileDtlDTO = CmmFileDTO.FileDtl.builder()
.fileMastrId(dto.getFileMastrId())
.fileId(CommUtils.getStringFromUUID())
.fileCours(dto.getFileCours())
.fileCntntsTy(mf.getContentType())
.filePath(dto.getFilePath())
.mimeType(mf.getContentType())
.orginlFileNm(orgFileName)
.fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase())
.fileCpcty(mf.getSize())
.fileSize(mf.getSize())
.rgtr(getUserUniqId())
.build();
@ -113,12 +113,12 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName));
}
if (fileDtlDTO.getFileCpcty() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileCpcty());
if (fileDtlDTO.getFileSize() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileSize());
//TODO : 에러처리
//return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize()));
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);
// 파일 전송
mf.transferTo(new File(this.uploadRoot + dto.getFileCours() + "/" + fileDtlDTO.getFileId()));
mf.transferTo(new File(this.uploadRoot + dto.getFilePath() + "/" + fileDtlDTO.getFileId()));
cmmFileDtls.add(fileDtlDTO);
// inputStream을 가져와서
@ -200,7 +200,7 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
CmmFileDTO.FileDtl selectDTO = mapper.selectCmmFileDetail(dtlDto);
if(Checks.isNotEmpty(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()
.fileMastrId(fileMstDTO.getFileMastrId())
.fileId(CommUtils.getStringFromUUID())
.fileCours(makePath)
.fileCntntsTy(mf.getContentType())
.filePath(makePath)
.mimeType(mf.getContentType())
.orginlFileNm(orgFileName)
.fileExtsn(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase())
.fileCpcty(mf.getSize())
.fileSize(mf.getSize())
.rgtr(getUserUniqId())
.build();
@ -240,12 +240,12 @@ public class CmmFileServiceBean extends AbstractServiceBean implements CmmFileSe
throw BizRuntimeException.create(
MessageKey.CUSTOM_MSG, String.format("Not support extention :: %s", orgFileName));
}
if (fileDtlDTO.getFileCpcty() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileCpcty());
if (fileDtlDTO.getFileSize() > (maxSize * 1024)) {
log.error("Over size :: {}[{}]", orgFileName, fileDtlDTO.getFileSize());
//TODO : 에러처리
//return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize()));
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);
CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder()
.fileMastrId(dto.getFileMastrId())
.fileCours(dto.getFileCours())
.filePath(dto.getFilePath())
.orginlFileNm(dto.getOrginlFileNm())
.build();
cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(dto.getFile()), false);
@ -78,7 +78,7 @@ public class CmmFileMgtController extends AbstractController {
StringBuilder sb = new StringBuilder();
sb.append(uploadRoot)
.append(fileDtlDTO.getFileCours())
.append(fileDtlDTO.getFilePath())
.append("/")
.append(fileDtlDTO.getFileId());
downloadExec(sb.toString(), fileDtlDTO.getOrginlFileNm(), response);

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

@ -83,14 +83,14 @@ public class BoardBasicMgtServiceBean extends AbstractServiceBean implements Boa
public void modifyBoardBasic(final XitBasicBbsMngVO vo) {
//삭제여부 없는 경우 업데이트
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()));
vo.setAtchFileId(fm.getFileMastrId());
}else{
//파일 추가 기능
CmmFileDTO.FileDtl cmmFileDtl = CmmFileDTO.FileDtl.builder()
.fileMastrId(vo.getAtchFileId())
.fileCours(vo.getFileCours())
.filePath(vo.getFilePath())
.build();
cmmFileService.saveAddFileDtl(cmmFileDtl, Arrays.asList(vo.getFiles()), false);
}

@ -199,7 +199,7 @@ public class ExtnlInterfaceUtils {
// TODO :: 파일선별 필요
for (CmmFileDTO.FileDtl dtl : fileDtlList) {
if (Checks.isEmpty(tgtPath)) {
tgtPath = uploadRootPath + tempPath + "/" + dtl.getFileCours().split("/")[1];
tgtPath = uploadRootPath + tempPath + "/" + dtl.getFilePath().split("/")[1];
}
try {
if(isFileCreate) {
@ -222,7 +222,7 @@ public class ExtnlInterfaceUtils {
File tgtFile = org.apache.commons.io.FileUtils.getFile(tgtPath, fileNm);
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
, true
);
@ -249,7 +249,7 @@ public class ExtnlInterfaceUtils {
});
//FileUtils.removeDirectyAndFiles(tgtPath);
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());
}

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

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

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

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

@ -172,12 +172,12 @@
fileList.innerHTML +=
"<p id='" + cmmFileDtls[i].fileId + "'>" +
"<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);'>" +
cmmFileDtls[i].orginlFileNm + "</a>" +
"<button type='button' onclick='fnBiz.fileDelete(this);' class='file-delete'>X</button> <br/>" +
"</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");
}
,downloadFile: (e) => {
const fileCours = e.dataset.file_cours
const filePath = e.dataset.file_path
const fileId = e.dataset.file_id
const orginlFileNm = e.dataset.orginl_file_nm
const data = {fileCours, fileId, orginlFileNm}
const data = {filePath, fileId, orginlFileNm}
if (confirm(orginlFileNm + ' 파일을 다운로드 하시겠습니까?')) {
fetch(frwkApiUrl.DOWNLOAD
,{

@ -26,7 +26,7 @@ function cmmImgDownload(divImgListElementId, cmmFileDtls, fnBizPagePopup = fnBiz
}
//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 x = document.createElement("img");
@ -43,8 +43,8 @@ function cmmImgDownload(divImgListElementId, cmmFileDtls, fnBizPagePopup = fnBiz
x.setAttribute("name", dtl.orginlFileNm);
x.setAttribute("data-file-mastr-id", dtl.fileMastrId);
x.setAttribute("data-file-id", dtl.fileId);
x.setAttribute("data-file-cours", dtl.fileCours);
x.setAttribute("data-file-cpcty", dtl.fileCpcty);
x.setAttribute("data-file-path", dtl.filePath);
x.setAttribute("data-file-size", dtl.fileSize);
x.addEventListener('dblclick', (e)=>{
if(isEditor) {

Loading…
Cancel
Save