feat: 외부연계데이타 처리후 파일 백업

main
minuk926 2 years ago
parent 639cbdf66b
commit 052eb970ab

@ -11,6 +11,7 @@ import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.FileExistsException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
@ -194,7 +195,7 @@ public class EcCctvCrackdownService implements IEcCctvCrackdownService {
cmmFileService.saveFiles(fileMstDTO, busOnlyDTO.getBusonlyImgList()); cmmFileService.saveFiles(fileMstDTO, busOnlyDTO.getBusonlyImgList());
}); });
// FIXME: src file backup // FIXME: src file backup - rollback이 필요한 경우 BizException throw 필요
// rollback시 파일이 move 않되도록 모든 데이타 처리후 file move // rollback시 파일이 move 않되도록 모든 데이타 처리후 file move
dto.getFileInfoList().forEach((fi) -> { dto.getFileInfoList().forEach((fi) -> {
try { try {
@ -203,7 +204,12 @@ public class EcCctvCrackdownService implements IEcCctvCrackdownService {
, new File(rcvBackupRoot + uploadBusCctvPath + "/" + fi.getFileNm()) , new File(rcvBackupRoot + uploadBusCctvPath + "/" + fi.getFileNm())
); );
} catch (IOException ie) { } catch (NullPointerException npe){
log.error("{}[{}]", "버스전용차로 데이타 parsing 에러::처리할 파일이 부정확 합니다.", fi.getFileNm());
} catch (FileExistsException fee){
log.error("{}[{}]", "버스전용차로 데이타 parsing 에러::처리된 데이타 입니다.", fi.getFileNm());
} catch (IOException ie){
log.error("버스전용차로 데이타 parsing 에러::{}", ie.getLocalizedMessage());
ie.printStackTrace(); ie.printStackTrace();
} }
}); });

@ -15,6 +15,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.io.FileExistsException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -160,10 +161,23 @@ public class EcNatlNewspaperService implements IEcNatlNewspaperService {
}; };
}); });
// FIXME: src file backup // FIXME: src file backup - rollback이 필요한 경우 BizException throw 필요
// rollback시 파일이 move 않되도록 모든 데이타 처리후 file move // rollback시 파일이 move 않되도록 모든 데이타 처리후 file move
dto.getFileInfoList().forEach((fi) -> { dto.getFileInfoList().forEach((fi) -> {
processOrgFileBackup(filePath, fi); try {
FileUtils.moveFile(
new File(filePath + "/" + fi.getFileNm())
, new File(rcvBackupRoot + uploadNewsPaperPath + "/" + fi.getFileNm())
);
} catch (NullPointerException npe){
log.error("{}[{}]", "시민신고[국민신문고] 데이타 parsing 에러::처리할 파일이 부정확 합니다.", fi.getFileNm());
} catch (FileExistsException fee){
log.error("{}[{}]", "시민신고[국민신문고] 데이타 parsing 에러::처리된 데이타 입니다.", fi.getFileNm());
} catch (IOException ie){
log.error("시민신고[국민신문고] 데이타 parsing 에러::{}", ie.getLocalizedMessage());
ie.printStackTrace();
}
}); });
} }
@ -472,16 +486,4 @@ public class EcNatlNewspaperService implements IEcNatlNewspaperService {
dateStr = dateStr.substring(0,4) + "/" + dateStr.substring(4); dateStr = dateStr.substring(0,4) + "/" + dateStr.substring(4);
return "/" + dateStr; return "/" + dateStr;
} }
private void processOrgFileBackup(String filePath, FolderReqDTO.FileInfo fi) {
try {
FileUtils.moveFile(
new File(filePath + "/" + fi.getFileNm())
, new File(rcvBackupRoot + uploadNewsPaperPath + "/" + fi.getFileNm())
);
} catch (IOException fee){
fee.printStackTrace();
}
}
} }

@ -64,6 +64,26 @@
<!-- [JS/CSS] ENS Project --> <!-- [JS/CSS] ENS Project -->
<style>
#progress {
appearance: none;
}
#progress::-webkit-progress-bar {
background:#f0f0f0;
border-radius:10px;
box-shadow: inset 3px 3px 10px #ccc;
}
#progress::-webkit-progress-value {
border-radius:10px;
background: #1D976C;
background: -webkit-linear-gradient(to right, #93F9B9, #1D976C);
background: linear-gradient(to right, #93F9B9, #1D976C);
}
</style>
<%--TODO: 보완 필요 : 공통 ajax 호출 모듈과 통합 필요 --%> <%--TODO: 보완 필요 : 공통 ajax 호출 모듈과 통합 필요 --%>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
@ -74,6 +94,7 @@
const br = '<br/>'; const br = '<br/>';
const msg = '처리중...'+br; const msg = '처리중...'+br;
const loading = '<img class="loading-bar" src="${ctx}/resources/framework/images/common/ajax-loading.gif" style="margin-left: -20px;" alt="조회 프로그래스바" />'; const loading = '<img class="loading-bar" src="${ctx}/resources/framework/images/common/ajax-loading.gif" style="margin-left: -20px;" alt="조회 프로그래스바" />';
// const loading = '<h2>진행상항</h2><progress id="progress" value="50" min="0" max="100"></progress>';
$.blockUI({ message : br+msg+br+br+loading+br+br}); $.blockUI({ message : br+msg+br+br+loading+br+br});
}).ajaxStop(function(){ }).ajaxStop(function(){
//closeBar(); //closeBar();

Loading…
Cancel
Save