|
|
@ -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()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//동일파일 삭제후 정보 저장
|
|
|
|
//동일파일 삭제후 정보 저장
|
|
|
|