Merge pull request '파일설정 root 경로 반영' (#69) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/69
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MngStateType implements EnumType {
|
||||
NOTYET("미처리"),
|
||||
PROCESSING("진행중"),
|
||||
DONE("싱크완료"),
|
||||
COMPLETE("작업완료");
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import org.springframework.stereotype.Component;
|
||||
@Setter
|
||||
public class FileConfig {
|
||||
|
||||
private String rootSyncDir = "D:\\app\\original-images";
|
||||
// private String rootSyncDir = "/app/original-images";
|
||||
|
||||
// private String rootSyncDir = "D:\\app\\original-images";
|
||||
private String rootSyncDir = "/app/original-images";
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "영상 관리", description = "영상 관리 API")
|
||||
@RestController
|
||||
@@ -84,6 +86,25 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.mngDataSave(AddReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "영상관리 > 작업완료", description = "영상관리 > 작업완료")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "작업완료 처리 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PutMapping("/mng-complete")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> mngComplete(@RequestParam @Valid int mngYyyy) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.mngComplete(mngYyyy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 오류데이터 목록 조회
|
||||
*
|
||||
@@ -96,10 +117,6 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hstUidList
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "오류데이터 팝업 > 업로드 처리", description = "오류데이터 팝업 > 업로드 처리")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@@ -130,4 +147,13 @@ public class MapSheetMngApiController {
|
||||
@RequestBody @Valid List<Long> hstUidList) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.updateExceptUseInference(hstUidList));
|
||||
}
|
||||
|
||||
@Operation(summary = "페어 파일 업로드", description = "TFW/TIF 두 파일을 쌍으로 업로드 및 검증")
|
||||
@PostMapping(value = "/upload-pair", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadPair(
|
||||
@RequestPart("tfw") MultipartFile tfwFile,
|
||||
@RequestPart("tif") MultipartFile tifFile,
|
||||
@RequestParam(value = "hstUid", required = false) Long hstUid) {
|
||||
return ApiResponseDto.createOK(mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,19 +83,6 @@ public class MapSheetMngFileCheckerApiController {
|
||||
mapSheetMngFileCheckerService.uploadFile(file, targetPath, overwrite, hstUid));
|
||||
}
|
||||
|
||||
@Operation(summary = "페어 파일 업로드", description = "TFW/TIF 두 파일을 쌍으로 업로드 및 검증")
|
||||
@PostMapping(value = "/upload-pair", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ApiResponseDto<String> uploadPair(
|
||||
@RequestPart("tfw") MultipartFile tfwFile,
|
||||
@RequestPart("tif") MultipartFile tifFile,
|
||||
@RequestParam("targetPath") String targetPath,
|
||||
@RequestParam(value = "overwrite", required = false, defaultValue = "false")
|
||||
boolean overwrite,
|
||||
@RequestParam(value = "hstUid", required = false) Long hstUid) {
|
||||
return ApiResponseDto.createOK(
|
||||
mapSheetMngFileCheckerService.uploadPair(tfwFile, tifFile, targetPath, overwrite, hstUid));
|
||||
}
|
||||
|
||||
@Operation(summary = "파일 삭제", description = "중복 파일 등 파일 삭제")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponseDto<Boolean> deleteFile(@RequestBody SrchFoldersDto dto) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
import com.kamco.cd.kamcoback.common.enums.SyncStateType;
|
||||
import com.kamco.cd.kamcoback.common.utils.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
@@ -105,6 +106,14 @@ public class MapSheetMngDto {
|
||||
public long getSyncErrorExecTotCnt() {
|
||||
return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt;
|
||||
}
|
||||
|
||||
public String getMngStateName() {
|
||||
String enumId = this.mngState;
|
||||
if (enumId == null || enumId.isEmpty()) enumId = "NOTYET";
|
||||
|
||||
MngStateType type = Enums.fromId(MngStateType.class, enumId);
|
||||
return type.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "ErrorSearchReq", description = "영상관리 오류데이터 검색 요청")
|
||||
@@ -231,26 +240,6 @@ public class MapSheetMngDto {
|
||||
private String message;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MngState implements EnumType {
|
||||
COMPLETE("업로드 완료"),
|
||||
IN_PROGRESS("진행중"),
|
||||
FAILED("오류");
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DataState implements EnumType {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -220,11 +221,23 @@ public class MapSheetMngService {
|
||||
return mapSheetMngCoreService.findMapSheetMng(mngYyyy);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public MapSheetMngDto.DmlReturn mngComplete(int mngYyyy) {
|
||||
|
||||
mapSheetMngCoreService.MapSheetMngComplete(mngYyyy);
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", "작업완료 처리되었습니다.");
|
||||
}
|
||||
|
||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
||||
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid) {
|
||||
return mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public MapSheetMngDto.DmlReturn mngDataSave(MapSheetMngDto.AddReq AddReq) {
|
||||
return mapSheetMngCoreService.mngDataSave(AddReq);
|
||||
@@ -248,4 +261,35 @@ public class MapSheetMngService {
|
||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||
return mapSheetMngCoreService.updateExceptUseInference(hstUidList);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public MapSheetMngDto.DmlReturn uploadPair(
|
||||
MultipartFile tfwFile,
|
||||
MultipartFile tifFile,
|
||||
// String targetPath,
|
||||
Long hstUid) {
|
||||
|
||||
// 파일 유효성 검증
|
||||
if (tfwFile == null || tfwFile.isEmpty() || tfwFile.getSize() == 0) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "TFW 파일이(0Byte) 비어있습니다.");
|
||||
} else if (tifFile == null || tifFile.isEmpty() || tifFile.getSize() == 0) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "TIF 파일이(0Byte) 비어있습니다.");
|
||||
}
|
||||
|
||||
if (!tfwFile
|
||||
.getOriginalFilename()
|
||||
.substring(tfwFile.getOriginalFilename().lastIndexOf('.') + 1)
|
||||
.toLowerCase()
|
||||
.equals("tfw")) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "파일명이 TFW형식이 아닙니다.");
|
||||
} else if (!tifFile
|
||||
.getOriginalFilename()
|
||||
.substring(tifFile.getOriginalFilename().lastIndexOf('.') + 1)
|
||||
.toLowerCase()
|
||||
.equals("tif")) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "파일명이 TIF형식이 아닙니다.");
|
||||
}
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", "파일 업로드 완료되었습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,6 @@ public class MapSheetMngCoreService {
|
||||
@Value("{spring.profiles.active}")
|
||||
private String activeEnv;
|
||||
|
||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngDto> findMapSheetMngList() {
|
||||
return mapSheetMngRepository.findMapSheetMngList();
|
||||
}
|
||||
@@ -45,6 +40,19 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetMng(mngYyyy);
|
||||
}
|
||||
|
||||
public void MapSheetMngComplete(@Valid int mngYyyy) {
|
||||
mapSheetMngRepository.MapSheetMngComplete(mngYyyy);
|
||||
}
|
||||
|
||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid) {
|
||||
return mapSheetMngRepository.findMapSheetError(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||
int count = 0;
|
||||
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||
|
||||
@@ -15,13 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
@Table(name = "tb_audit_log")
|
||||
public class AuditLogEntity extends CommonCreateEntity {
|
||||
@Id
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "tb_audit_log_audit_log_uid_seq_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_audit_log_audit_log_uid_seq_gen",
|
||||
sequenceName = "tb_audit_log_audit_log_uid_seq",
|
||||
allocationSize = 1)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "audit_log_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -16,13 +16,7 @@ import lombok.NoArgsConstructor;
|
||||
@Table(name = "tb_error_log")
|
||||
public class ErrorLogEntity extends CommonCreateEntity {
|
||||
@Id
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "tb_error_log_error_log_uid_seq_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_error_log_error_log_uid_seq_gen",
|
||||
sequenceName = "tb_error_log_error_log_uid_seq",
|
||||
allocationSize = 1)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "error_log_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy);
|
||||
|
||||
void MapSheetMngComplete(int mngYyyy);
|
||||
|
||||
Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid);
|
||||
|
||||
int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy);
|
||||
@@ -28,5 +30,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq);
|
||||
|
||||
MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
}
|
||||
|
||||
@@ -367,6 +367,56 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngHstEntity.hstUid.eq(hstUid));
|
||||
|
||||
MapSheetMngDto.ErrorDataDto foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.ErrorDataDto.class,
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 0, 6))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
.as("map50kName"),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
.as("map5kName"),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
.as("mapSrcName"),
|
||||
mapInkx5kEntity.fid,
|
||||
mapSheetMngHstEntity.createdDate,
|
||||
mapSheetMngHstEntity.syncState,
|
||||
mapSheetMngHstEntity.syncTfwFileName,
|
||||
mapSheetMngHstEntity.syncTifFileName,
|
||||
mapSheetMngHstEntity.syncCheckState,
|
||||
mapSheetMngHstEntity.syncCheckTfwFileName,
|
||||
mapSheetMngHstEntity.syncCheckTifFileName))
|
||||
.from(mapSheetMngHstEntity)
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.where(whereBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
public void MapSheetMngComplete(int mngYyyy) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
.update(mapSheetMngEntity)
|
||||
.set(mapSheetMngEntity.mngState, "COMPLETE")
|
||||
.where(mapSheetMngEntity.mngYyyy.eq(mngYyyy))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByMngYyyyMngAll(int mngYyyy) {
|
||||
|
||||
|
||||
@@ -134,8 +134,14 @@ public class MembersRepositoryImpl implements MembersRepositoryCustom {
|
||||
.orderBy(memberEntity.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
long total = queryFactory.select(memberEntity).from(memberEntity).fetchCount();
|
||||
|
||||
long total =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(memberEntity.count())
|
||||
.from(memberEntity)
|
||||
.where(builder)
|
||||
.fetchOne())
|
||||
.orElse(0L);
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user