영상관리 파일 업로드 수정
This commit is contained in:
@@ -74,10 +74,7 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public DmlReturn uploadPair(
|
||||
MultipartFile tfwFile,
|
||||
MultipartFile tifFile,
|
||||
Long hstUid) {
|
||||
public DmlReturn uploadPair(MultipartFile tfwFile, MultipartFile tifFile, Long hstUid) {
|
||||
|
||||
String rootPath = fileConfig.getRootSyncDir();
|
||||
String tmpPath = fileConfig.getTmpSyncDir();
|
||||
@@ -87,9 +84,8 @@ public class MapSheetMngService {
|
||||
return new DmlReturn("fail", "NO hstUid Data");
|
||||
}
|
||||
|
||||
//파일검증용 임시저장 폴더 확인
|
||||
if( ! FIleChecker.mkDir(tmpPath) )
|
||||
{
|
||||
// 파일검증용 임시저장 폴더 확인
|
||||
if (!FIleChecker.mkDir(tmpPath)) {
|
||||
return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR");
|
||||
}
|
||||
|
||||
@@ -100,27 +96,22 @@ public class MapSheetMngService {
|
||||
return new DmlReturn("fail", "TIF SIZE 오류");
|
||||
}
|
||||
|
||||
//확장자명 체크
|
||||
if( ! FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw") )
|
||||
{
|
||||
// 확장자명 체크
|
||||
if (!FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw")) {
|
||||
return new DmlReturn("fail", "TFW FILENAME ERROR");
|
||||
}
|
||||
else if( ! FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif") )
|
||||
{
|
||||
} else if (!FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif")) {
|
||||
return new DmlReturn("fail", "TIF FILENAME ERROR");
|
||||
}
|
||||
|
||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||
String targetYearDir = mngDto.getMngPath();
|
||||
|
||||
//중복체크
|
||||
// 중복체크
|
||||
List<FIleChecker.Basic> basicTfwList =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
targetYearDir, tfwFile.getOriginalFilename(), "tfw");
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tfwFile.getOriginalFilename(), "tfw");
|
||||
|
||||
List<FIleChecker.Basic> basicTifList =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
targetYearDir, tifFile.getOriginalFilename(), "tif");
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tifFile.getOriginalFilename(), "tif");
|
||||
|
||||
int tfwCnt =
|
||||
(int)
|
||||
@@ -138,7 +129,7 @@ public class MapSheetMngService {
|
||||
String tfwtifMsg = "";
|
||||
if (tfwCnt > 0) tfwtifMsg = tfwFile.getOriginalFilename();
|
||||
if (tifCnt > 0) {
|
||||
if( tfwCnt > 0 )tfwtifMsg = ","+tifFile.getOriginalFilename();
|
||||
if (tfwCnt > 0) tfwtifMsg = "," + tifFile.getOriginalFilename();
|
||||
else tfwtifMsg = tifFile.getOriginalFilename();
|
||||
}
|
||||
return new DmlReturn("duplicate", tfwtifMsg);
|
||||
@@ -172,7 +163,7 @@ public class MapSheetMngService {
|
||||
Path tfwTargetPath = null;
|
||||
Path tifTargetPath = null;
|
||||
|
||||
//파일이 존재하지 않을 경우(0개) 해당년도 다른 파일경로로 참조
|
||||
// 파일이 존재하지 않을 경우(0개) 해당년도 다른 파일경로로 참조
|
||||
if (uploadPath.isEmpty()) {
|
||||
MngFilesDto filesDto =
|
||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
@@ -182,9 +173,8 @@ public class MapSheetMngService {
|
||||
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
||||
}
|
||||
|
||||
//업로드 경로 확인(없으면 생성)
|
||||
if( ! FIleChecker.mkDir(uploadPath) )
|
||||
{
|
||||
// 업로드 경로 확인(없으면 생성)
|
||||
if (!FIleChecker.mkDir(uploadPath)) {
|
||||
return new DmlReturn("fail", "CREATE FOLDER ERROR");
|
||||
}
|
||||
|
||||
@@ -196,7 +186,8 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
// hst업데이트
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto updReqSyncCheckState = new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto updReqSyncCheckState =
|
||||
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
updReqSyncCheckState.setHstUid(hstUid);
|
||||
updReqSyncCheckState.setFilePath(uploadPath);
|
||||
updReqSyncCheckState.setSyncCheckTfwFileName(tfwFile.getOriginalFilename());
|
||||
@@ -234,7 +225,7 @@ public class MapSheetMngService {
|
||||
public DmlReturn deleteByFileUidMngFile(List<Long> fileUids) {
|
||||
|
||||
long hstUid = 0;
|
||||
//hstUid = 149049;
|
||||
// hstUid = 149049;
|
||||
|
||||
for (Long uid : fileUids) {
|
||||
MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findIdToMapSheetFile(uid);
|
||||
@@ -255,8 +246,8 @@ public class MapSheetMngService {
|
||||
DmlReturn dmlReturn = mapSheetMngCoreService.deleteByFileUidMngFile(uid);
|
||||
}
|
||||
|
||||
//중복제거 확인후 처리상태(DONE)변경
|
||||
if( hstUid > 0 )mapSheetMngCoreService.updateByHstUidSyncCheckState(hstUid);
|
||||
// 중복제거 확인후 처리상태(DONE)변경
|
||||
if (hstUid > 0) mapSheetMngCoreService.updateByHstUidSyncCheckState(hstUid);
|
||||
|
||||
return new DmlReturn("success", fileUids.size() + "개 파일이 삭제되었습니다.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user