|
|
@ -131,16 +131,19 @@ public class CtgyFileService implements ICtgyFileService {
|
|
|
|
public void removePublicBoardFile(Long inCode) {
|
|
|
|
public void removePublicBoardFile(Long inCode) {
|
|
|
|
|
|
|
|
|
|
|
|
MinInfoBoard680 savedEntity = repository.findById(inCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
|
|
|
|
MinInfoBoard680 savedEntity = repository.findById(inCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
|
|
|
|
|
|
|
|
repository.delete(savedEntity);
|
|
|
|
|
|
|
|
|
|
|
|
File file = null;
|
|
|
|
// 정보 삭제후 파일 삭제 : 에러 발생시 skip
|
|
|
|
if(Checks.isNotEmpty(savedEntity.getInFilename())){
|
|
|
|
if(Checks.isNotEmpty(savedEntity.getInFilename())){
|
|
|
|
String absFile = rootPath + savedEntity.getInFileurl().split(serviceUrl)[1]+File.separator + savedEntity.getInFilename();
|
|
|
|
String absFile = rootPath + savedEntity.getInFileurl().split(serviceUrl)[1]+File.separator + savedEntity.getInFilename();
|
|
|
|
file = new File(absFile);
|
|
|
|
try {
|
|
|
|
|
|
|
|
File file = new File(absFile);
|
|
|
|
|
|
|
|
if (Checks.isNotEmpty(file) && file.exists()) file.delete();
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 정보 삭제후 파일 삭제
|
|
|
|
|
|
|
|
repository.deleteById(inCode);
|
|
|
|
|
|
|
|
if(file.exists()) file.delete();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setEntity(MinInfoBoard680 savedEntity, MinInfoBoard680 entity){
|
|
|
|
private void setEntity(MinInfoBoard680 savedEntity, MinInfoBoard680 entity){
|
|
|
|