Merge pull request '20251216 반영' (#114) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/114
This commit is contained in:
@@ -6,7 +6,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetAnalDataRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx5kRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@RequiredArgsConstructor
|
||||
public class InferenceResultCoreService {
|
||||
|
||||
private final InferenceResultRepository inferenceResultRepository;
|
||||
private final MapSheetAnalDataRepository mapSheetAnalDataRepository;
|
||||
private final MapInkx5kRepository mapInkx5kRepository;
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
return inferenceResultRepository.getInferenceResultList(searchReq);
|
||||
return mapSheetAnalDataRepository.getInferenceResultList(searchReq);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
public InferenceResultDto.AnalResSummary getInferenceResultSummary(Long id) {
|
||||
InferenceResultDto.AnalResSummary summary =
|
||||
inferenceResultRepository
|
||||
mapSheetAnalDataRepository
|
||||
.getInferenceResultSummary(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
return summary;
|
||||
@@ -55,7 +55,7 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getDashboard(Long id) {
|
||||
return inferenceResultRepository.getDashboard(id);
|
||||
return mapSheetAnalDataRepository.getDashboard(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(
|
||||
Long id, InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(id, searchGeoReq);
|
||||
return mapSheetAnalDataRepository.getInferenceGeomList(id, searchGeoReq);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,13 +80,13 @@ public class InferenceResultCoreService {
|
||||
@NotNull Long analyId, InferenceResultDto.SearchGeoReq searchReq) {
|
||||
// 분석 ID 에 해당하는 dataids를 가져온다.
|
||||
List<Long> dataIds =
|
||||
inferenceResultRepository.listAnalyGeom(analyId).stream()
|
||||
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
|
||||
.mapToLong(MapSheetAnalDataEntity::getId)
|
||||
.boxed()
|
||||
.toList();
|
||||
// 해당데이터의 폴리곤데이터를 가져온다
|
||||
Page<MapSheetAnalDataGeomEntity> mapSheetAnalDataGeomEntities =
|
||||
inferenceResultRepository.listInferenceResultWithGeom(dataIds, searchReq);
|
||||
mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq);
|
||||
return mapSheetAnalDataGeomEntities.map(MapSheetAnalDataGeomEntity::toEntity);
|
||||
}
|
||||
|
||||
@@ -97,13 +97,13 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getSheets(Long id) {
|
||||
return inferenceResultRepository.getSheets(id);
|
||||
return mapSheetAnalDataRepository.getSheets(id);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<MapSheet> listGetScenes5k(Long analyId) {
|
||||
List<String> sceneCodes =
|
||||
inferenceResultRepository.listAnalyGeom(analyId).stream()
|
||||
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
|
||||
.mapToLong(MapSheetAnalDataEntity::getMapSheetNum)
|
||||
.mapToObj(String::valueOf)
|
||||
.toList();
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InferenceResultShpCoreService {
|
||||
|
||||
private final InferenceResultRepository repo;
|
||||
|
||||
/** inference_results -> (inference, geom) upsert */
|
||||
@Transactional
|
||||
public void buildInferenceData() {
|
||||
repo.upsertGroupsFromInferenceResults();
|
||||
repo.upsertGeomsFromInferenceResults();
|
||||
}
|
||||
|
||||
/** file_created_yn = false/null 인 data_uid 목록 */
|
||||
@Transactional(readOnly = true)
|
||||
public List<Long> findPendingDataUids(int limit) {
|
||||
return repo.findPendingDataUids(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 재생성 시작: 덮어쓰기 기준(무조건 처음부터) - inference.file_created_yn = false, file_created_dttm = null -
|
||||
* geom(file_created_yn) 전부 false 리셋
|
||||
*/
|
||||
@Transactional
|
||||
public void resetForRegenerate(Long dataUid) {
|
||||
repo.resetInferenceCreated(dataUid);
|
||||
repo.resetGeomCreatedByDataUid(dataUid);
|
||||
}
|
||||
|
||||
/** 생성 대상 geom 엔티티 로드 (file_created_yn=false/null + geom not null) */
|
||||
@Transactional(readOnly = true)
|
||||
public List<MapSheetAnalDataInferenceGeomEntity> loadGeomEntities(Long dataUid, int limit) {
|
||||
return repo.findGeomEntitiesByDataUid(dataUid, limit);
|
||||
}
|
||||
|
||||
/** 성공 마킹: - 성공 geo_uid만 geom.file_created_yn=true - inference.file_created_yn=true */
|
||||
@Transactional
|
||||
public void markSuccess(Long dataUid, List<Long> geoUids) {
|
||||
repo.markGeomCreatedByGeoUids(geoUids);
|
||||
repo.markInferenceCreated(dataUid);
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,9 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -27,8 +20,6 @@ public class MapSheetMngCoreService {
|
||||
|
||||
private final MapSheetMngRepository mapSheetMngRepository;
|
||||
|
||||
private static final String ORIGINAL_IMAGES_PATH = "/app/original-images";
|
||||
|
||||
@Value("{spring.profiles.active}")
|
||||
private String activeEnv;
|
||||
|
||||
@@ -52,10 +43,13 @@ public class MapSheetMngCoreService {
|
||||
mapSheetMngRepository.deleteByHstUidMngFile(hstUid);
|
||||
}
|
||||
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
|
||||
return mapSheetMngRepository.findByYearFileNameFileCount(mngYyyy, fileName);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn mngFileSave(@Valid MapSheetMngDto.MngFileAddReq addReq) {
|
||||
|
||||
mapSheetMngRepository.mngFileSave(addReq);
|
||||
// int hstCnt = mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(saved.getMngYyyy());
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", "파일정보저장되었습니다.");
|
||||
}
|
||||
@@ -73,102 +67,16 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetError(hstUid);
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findIdToMapSheetFileList(hstUid);
|
||||
public List<MapSheetMngDto.MngFilesDto> findByHstUidMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findByHstUidMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePathRefer(int mngYyyy) {
|
||||
return mapSheetMngRepository.findYyyyToMapSheetFilePathRefer(mngYyyy);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid) {
|
||||
return mapSheetMngRepository.findIdToMapSheetFile(fileUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||
int count = 0;
|
||||
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||
for (Long hstUid : hstUidList) {
|
||||
Optional<MapSheetMngHstEntity> entity =
|
||||
Optional.ofNullable(
|
||||
mapSheetMngRepository
|
||||
.findMapSheetMngHstInfo(hstUid)
|
||||
.orElseThrow(EntityNotFoundException::new));
|
||||
|
||||
String localPath = "";
|
||||
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.get().getMngYyyy();
|
||||
if (activeEnv.equals("local")) {
|
||||
rootDir = localPath + rootDir;
|
||||
}
|
||||
|
||||
String filename = entity.get().getMapSheetNum();
|
||||
String[] extensions = {"tif", "tfw"};
|
||||
boolean flag = allExtensionsExist(rootDir, filename, extensions);
|
||||
if (flag) {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
// 파일 크기 계산 및 저장
|
||||
try (Stream<Path> paths = Files.walk(Paths.get(rootDir))) {
|
||||
List<Path> matched =
|
||||
paths
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(
|
||||
p -> {
|
||||
String name = p.getFileName().toString();
|
||||
return name.equals(filename + ".tif") || name.equals(filename + ".tfw");
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
long tifSize =
|
||||
matched.stream()
|
||||
.filter(p -> p.getFileName().toString().endsWith(".tif"))
|
||||
.mapToLong(
|
||||
p -> {
|
||||
try {
|
||||
return Files.size(p);
|
||||
} catch (IOException e) {
|
||||
return 0L;
|
||||
}
|
||||
})
|
||||
.sum();
|
||||
|
||||
long tfwSize =
|
||||
matched.stream()
|
||||
.filter(p -> p.getFileName().toString().endsWith(".tfw"))
|
||||
.mapToLong(
|
||||
p -> {
|
||||
try {
|
||||
return Files.size(p);
|
||||
} catch (IOException e) {
|
||||
return 0L;
|
||||
}
|
||||
})
|
||||
.sum();
|
||||
|
||||
entity.get().setTifSizeBytes(tifSize);
|
||||
entity.get().setTfwSizeBytes(tfwSize);
|
||||
entity.get().setTotalSizeBytes(tifSize + tfwSize);
|
||||
|
||||
// 엔터티 저장 -> 커스텀 업데이트로 변경
|
||||
mapSheetMngRepository.updateHstFileSizes(
|
||||
entity.get().getHstUid(), tifSize, tfwSize, tifSize + tfwSize);
|
||||
} catch (IOException e) {
|
||||
// 크기 계산 실패 시 0으로 저장
|
||||
entity.get().setTifSizeBytes(0L);
|
||||
entity.get().setTfwSizeBytes(0L);
|
||||
entity.get().setTotalSizeBytes(0L);
|
||||
mapSheetMngRepository.updateHstFileSizes(entity.get().getHstUid(), 0L, 0L, 0L);
|
||||
}
|
||||
|
||||
/*
|
||||
MapSheetMngDto.DataState dataState =
|
||||
flag ? MapSheetMngDto.DataState.SUCCESS : MapSheetMngDto.DataState.FAIL;
|
||||
entity.get().updateDataState(dataState);
|
||||
*/
|
||||
}
|
||||
}
|
||||
return new MapSheetMngDto.DmlReturn("success", count + "개 업로드 성공하였습니다.");
|
||||
public MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid) {
|
||||
return mapSheetMngRepository.findByFileUidMapSheetFile(fileUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||
@@ -186,40 +94,7 @@ public class MapSheetMngCoreService {
|
||||
return new MapSheetMngDto.DmlReturn("success", hstUidList.size() + "개 추론제외 업데이트 하였습니다.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 파일명 + 여러 확장자가 모두 존재하는지 확인
|
||||
*
|
||||
* @param rootDir 검색할 최상위 디렉토리
|
||||
* @param filename 파일명 (확장자 제외)
|
||||
* @param extensions 확인할 확장자 배열 (예: {"tif", "tfw"})
|
||||
* @return 모든 확장자가 존재하면 true, 하나라도 없으면 false
|
||||
*/
|
||||
public static boolean allExtensionsExist(String rootDir, String filename, String... extensions) {
|
||||
try (Stream<Path> paths = Files.walk(Paths.get(rootDir))) {
|
||||
|
||||
// 모든 파일명을 Set으로 저장
|
||||
Set<String> fileNames =
|
||||
paths
|
||||
.filter(Files::isRegularFile)
|
||||
.map(p -> p.getFileName().toString())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 모든 확장자 파일 존재 여부 확인
|
||||
for (String ext : extensions) {
|
||||
String target = filename + "." + ext;
|
||||
if (!fileNames.contains(target)) {
|
||||
return false; // 하나라도 없으면 false
|
||||
}
|
||||
}
|
||||
|
||||
return true; // 모두 존재하면 true
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("File search error", e);
|
||||
}
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn mngDataSave(@Valid MapSheetMngDto.AddReq addReq) {
|
||||
public int mngDataSave(@Valid MapSheetMngDto.AddReq addReq) {
|
||||
|
||||
MapSheetMngEntity entity = new MapSheetMngEntity();
|
||||
entity.setMngYyyy(addReq.getMngYyyy());
|
||||
@@ -228,45 +103,31 @@ public class MapSheetMngCoreService {
|
||||
mapSheetMngRepository.deleteByMngYyyyMngAll(addReq.getMngYyyy());
|
||||
|
||||
MapSheetMngEntity saved = mapSheetMngRepository.save(entity);
|
||||
int hstCnt = mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(saved.getMngYyyy());
|
||||
int hstCnt =
|
||||
mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(
|
||||
saved.getMngYyyy(), saved.getMngPath());
|
||||
mapSheetMngRepository.updateYearState(saved.getMngYyyy(), "DONE");
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", saved.getMngYyyy().toString());
|
||||
return hstCnt;
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(Long fileUid) {
|
||||
|
||||
public void deleteByFileUidMngFile(Long fileUid) {
|
||||
mapSheetMngRepository.deleteByFileUidMngFile(fileUid);
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", fileUid + " : 삭제되었습니다.");
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn updateByHstUidSyncCheckState(Long hstUid) {
|
||||
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto =
|
||||
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
reqDto.setHstUid(hstUid);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> filesDto =
|
||||
mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid);
|
||||
for (MapSheetMngDto.MngFilesDto dto : filesDto) {
|
||||
if (dto.getFileExt().equals("tif")) reqDto.setSyncCheckTifFileName(dto.getFileName());
|
||||
else if (dto.getFileExt().equals("tfw")) reqDto.setSyncCheckTfwFileName(dto.getFileName());
|
||||
reqDto.setFilePath(dto.getFilePath());
|
||||
}
|
||||
|
||||
String fileState = "DONE";
|
||||
if (filesDto.size() > 2) fileState = "DONE";
|
||||
|
||||
reqDto.setSyncCheckState(fileState);
|
||||
|
||||
public void updateByHstUidSyncCheckState(MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto) {
|
||||
mapSheetMngRepository.updateMapSheetMngHstSyncCheckState(reqDto);
|
||||
mapSheetMngRepository.updateByHstUidMngFileState(hstUid, fileState);
|
||||
}
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", hstUid + " : 상태변경되었습니다.");
|
||||
public void updateByFileUidFileState(Long fileUid, String fileState) {
|
||||
mapSheetMngRepository.updateByFileUidMngFileState(fileUid, fileState);
|
||||
}
|
||||
|
||||
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids) {
|
||||
mapSheetMngRepository.deleteByNotInFileUidMngFile(hstUid, fileUids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "inference_results")
|
||||
public class InferenceResultEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("uuid_generate_v4()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Column(name = "stage")
|
||||
private Integer stage;
|
||||
|
||||
@Column(name = "cd_prob")
|
||||
private Float cdProb;
|
||||
|
||||
@Column(name = "input1")
|
||||
private Integer input1;
|
||||
|
||||
@Column(name = "input2")
|
||||
private Integer input2;
|
||||
|
||||
@Column(name = "map_id")
|
||||
private Long mapId;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "before_class", length = 20)
|
||||
private String beforeClass;
|
||||
|
||||
@Column(name = "before_probability")
|
||||
private Float beforeProbability;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "after_class", length = 20)
|
||||
private String afterClass;
|
||||
|
||||
@Column(name = "after_probability")
|
||||
private Float afterProbability;
|
||||
|
||||
@ColumnDefault("st_area(geometry)")
|
||||
@Column(name = "area")
|
||||
private Float area;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm", nullable = false)
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "geometry", columnDefinition = "geometry not null")
|
||||
private Geometry geometry;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_map_sheet_anal_data_inference")
|
||||
public class MapSheetAnalDataInferenceEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "data_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "data_name", length = 128)
|
||||
private String dataName;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "data_path")
|
||||
private String dataPath;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "data_type", length = 128)
|
||||
private String dataType;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "data_crs_type", length = 128)
|
||||
private String dataCrsType;
|
||||
|
||||
@Size(max = 255)
|
||||
@Column(name = "data_crs_type_name")
|
||||
private String dataCrsTypeName;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@Column(name = "compare_yyyy")
|
||||
private Integer compareYyyy;
|
||||
|
||||
@Column(name = "target_yyyy")
|
||||
private Integer targetYyyy;
|
||||
|
||||
@Column(name = "data_json", length = Integer.MAX_VALUE)
|
||||
private String dataJson;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0'")
|
||||
@Column(name = "data_state", length = 20)
|
||||
private String dataState;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "data_state_dttm")
|
||||
private ZonedDateTime dataStateDttm;
|
||||
|
||||
@Column(name = "anal_strt_dttm")
|
||||
private ZonedDateTime analStrtDttm;
|
||||
|
||||
@Column(name = "anal_end_dttm")
|
||||
private ZonedDateTime analEndDttm;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "anal_sec")
|
||||
private Long analSec;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "anal_state", length = 20)
|
||||
private String analState;
|
||||
|
||||
@Column(name = "anal_uid")
|
||||
private Long analUid;
|
||||
|
||||
@Column(name = "map_sheet_num")
|
||||
private Long mapSheetNum;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "detecting_cnt")
|
||||
private Long detectingCnt;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "pnu")
|
||||
private Long pnu;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "down_state", length = 20)
|
||||
private String downState;
|
||||
|
||||
@Column(name = "down_state_dttm")
|
||||
private ZonedDateTime downStateDttm;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "fit_state", length = 20)
|
||||
private String fitState;
|
||||
|
||||
@Column(name = "fit_state_dttm")
|
||||
private ZonedDateTime fitStateDttm;
|
||||
|
||||
@Column(name = "labeler_uid")
|
||||
private Long labelerUid;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("NULL")
|
||||
@Column(name = "label_state", length = 20)
|
||||
private String labelState;
|
||||
|
||||
@Column(name = "label_state_dttm")
|
||||
private ZonedDateTime labelStateDttm;
|
||||
|
||||
@Column(name = "tester_uid")
|
||||
private Long testerUid;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "test_state", length = 20)
|
||||
private String testState;
|
||||
|
||||
@Column(name = "test_state_dttm")
|
||||
private ZonedDateTime testStateDttm;
|
||||
|
||||
@Column(name = "fit_state_cmmnt", length = Integer.MAX_VALUE)
|
||||
private String fitStateCmmnt;
|
||||
|
||||
@Column(name = "ref_map_sheet_num")
|
||||
private Long refMapSheetNum;
|
||||
|
||||
@Column(name = "stage")
|
||||
private Integer stage;
|
||||
|
||||
@Column(name = "file_created_yn")
|
||||
private Boolean fileCreatedYn;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "m1", length = 100)
|
||||
private String m1;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "m2", length = 100)
|
||||
private String m2;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "m3", length = 100)
|
||||
private String m3;
|
||||
|
||||
@Column(name = "file_created_dttm")
|
||||
private ZonedDateTime fileCreatedDttm;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_map_sheet_anal_data_inference_geom")
|
||||
public class MapSheetAnalDataInferenceGeomEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "geo_uid")
|
||||
private Long geoUid;
|
||||
|
||||
@Column(name = "cd_prob")
|
||||
private Float cdProb;
|
||||
|
||||
@Size(max = 40)
|
||||
@Column(name = "class_before_cd", length = 40)
|
||||
private String classBeforeCd;
|
||||
|
||||
@Column(name = "class_before_prob")
|
||||
private Float classBeforeProb;
|
||||
|
||||
@Size(max = 40)
|
||||
@Column(name = "class_after_cd", length = 40)
|
||||
private String classAfterCd;
|
||||
|
||||
@Column(name = "class_after_prob")
|
||||
private Float classAfterProb;
|
||||
|
||||
@Column(name = "map_sheet_num")
|
||||
private Long mapSheetNum;
|
||||
|
||||
@Column(name = "compare_yyyy")
|
||||
private Integer compareYyyy;
|
||||
|
||||
@Column(name = "target_yyyy")
|
||||
private Integer targetYyyy;
|
||||
|
||||
@Column(name = "area")
|
||||
private Float area;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "geo_type", length = 100)
|
||||
private String geoType;
|
||||
|
||||
@Column(name = "data_uid")
|
||||
private Long dataUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "geom_cnt")
|
||||
private Long geomCnt;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "pnu")
|
||||
private Long pnu;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0'")
|
||||
@Column(name = "fit_state", length = 20)
|
||||
private String fitState;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "fit_state_dttm")
|
||||
private ZonedDateTime fitStateDttm;
|
||||
|
||||
@Column(name = "labeler_uid")
|
||||
private Long labelerUid;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0'")
|
||||
@Column(name = "label_state", length = 20)
|
||||
private String labelState;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "label_state_dttm")
|
||||
private ZonedDateTime labelStateDttm;
|
||||
|
||||
@Column(name = "tester_uid")
|
||||
private Long testerUid;
|
||||
|
||||
@Size(max = 20)
|
||||
@ColumnDefault("'0'")
|
||||
@Column(name = "test_state", length = 20)
|
||||
private String testState;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "test_state_dttm")
|
||||
private ZonedDateTime testStateDttm;
|
||||
|
||||
@Column(name = "fit_state_cmmnt", length = Integer.MAX_VALUE)
|
||||
private String fitStateCmmnt;
|
||||
|
||||
@Column(name = "ref_map_sheet_num")
|
||||
private Long refMapSheetNum;
|
||||
|
||||
@ColumnDefault("uuid_generate_v4()")
|
||||
@Column(name = "uuid")
|
||||
private UUID uuid;
|
||||
|
||||
@Column(name = "stage")
|
||||
private Integer stage;
|
||||
|
||||
@Column(name = "map_5k_id")
|
||||
private Long map5kId;
|
||||
|
||||
@Column(name = "file_created_yn")
|
||||
private Boolean fileCreatedYn;
|
||||
|
||||
@Column(name = "geom", columnDefinition = "geometry")
|
||||
private Geometry geom;
|
||||
|
||||
@Column(name = "geom_center", columnDefinition = "geometry")
|
||||
private Geometry geomCenter;
|
||||
|
||||
@Column(name = "before_geom", columnDefinition = "geometry")
|
||||
private Geometry beforeGeom;
|
||||
|
||||
@Column(name = "file_created_dttm")
|
||||
private ZonedDateTime fileCreatedDttm;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -54,4 +55,9 @@ public class MapSheetMngFileEntity {
|
||||
@Size(max = 20)
|
||||
@Column(name = "file_state", length = 20)
|
||||
private String fileState;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "file_del", nullable = false)
|
||||
private Boolean fileDel = false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface InferenceResultRepository
|
||||
extends JpaRepository<MapSheetAnalEntity, Long>, InferenceResultRepositoryCustom {}
|
||||
extends JpaRepository<com.kamco.cd.kamcoback.postgres.entity.InferenceResultEntity, Long>,
|
||||
InferenceResultRepositoryCustom {}
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq);
|
||||
int upsertGroupsFromInferenceResults();
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id);
|
||||
int upsertGeomsFromInferenceResults();
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(
|
||||
Long id, InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
List<Long> findPendingDataUids(int limit);
|
||||
|
||||
Page<MapSheetAnalDataGeomEntity> listInferenceResultWithGeom(
|
||||
List<Long> dataIds, SearchGeoReq searchReq);
|
||||
int resetInferenceCreated(Long dataUid);
|
||||
|
||||
List<Long> getSheets(Long id);
|
||||
int markInferenceCreated(Long dataUid);
|
||||
|
||||
List<Dashboard> getDashboard(Long id);
|
||||
int resetGeomCreatedByDataUid(Long dataUid);
|
||||
|
||||
List<MapSheetAnalDataEntity> listAnalyGeom(@NotNull Long id);
|
||||
int markGeomCreatedByGeoUids(List<Long> geoUids);
|
||||
|
||||
List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(Long dataUid, int limit);
|
||||
}
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.*;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Order;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.ArrayList;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@@ -29,335 +16,215 @@ import org.springframework.stereotype.Repository;
|
||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QModelMngBakEntity tmm = QModelMngBakEntity.modelMngBakEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||
QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
|
||||
/**
|
||||
* 분석결과 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@PersistenceContext private final EntityManager em;
|
||||
|
||||
private final QMapSheetAnalDataInferenceEntity i =
|
||||
QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
|
||||
private final QMapSheetAnalDataInferenceGeomEntity g =
|
||||
QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
|
||||
// ===============================
|
||||
// Upsert (Native only)
|
||||
// ===============================
|
||||
|
||||
@Override
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
if (searchReq.getStatCode() != null && !"0000".equals(searchReq.getStatCode())) {
|
||||
builder.and(mapSheetAnalEntity.analState.eq(searchReq.getStatCode()));
|
||||
}
|
||||
public int upsertGroupsFromInferenceResults() {
|
||||
|
||||
// 제목
|
||||
if (searchReq.getTitle() != null) {
|
||||
builder.and(mapSheetAnalEntity.analTitle.like("%" + searchReq.getTitle() + "%"));
|
||||
}
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_anal_data_inference (
|
||||
stage,
|
||||
compare_yyyy,
|
||||
target_yyyy,
|
||||
map_sheet_num,
|
||||
created_dttm,
|
||||
updated_dttm,
|
||||
file_created_yn,
|
||||
detecting_cnt
|
||||
)
|
||||
SELECT
|
||||
r.stage,
|
||||
r.input1 AS compare_yyyy,
|
||||
r.input2 AS target_yyyy,
|
||||
r.map_id AS map_sheet_num,
|
||||
now() AS created_dttm,
|
||||
now() AS updated_dttm,
|
||||
false AS file_created_yn,
|
||||
count(*) AS detecting_cnt
|
||||
FROM inference_results r
|
||||
GROUP BY r.stage, r.input1, r.input2, r.map_id
|
||||
ON CONFLICT (stage, compare_yyyy, target_yyyy, map_sheet_num)
|
||||
DO UPDATE SET
|
||||
updated_dttm = now(),
|
||||
detecting_cnt = EXCLUDED.detecting_cnt
|
||||
""";
|
||||
|
||||
List<InferenceResultDto.AnalResList> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
|
||||
mapSheetAnalEntity.gukyuinUsed))
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalEntity.id.desc())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
return em.createNativeQuery(sql).executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 요약정보
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id) {
|
||||
public int upsertGeomsFromInferenceResults() {
|
||||
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub =
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
// class_after_prob 컬럼 매핑 오타 주의(여기 제대로 넣음)
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
||||
uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num,
|
||||
class_before_cd, class_before_prob, class_after_cd, class_after_prob,
|
||||
geom, area, data_uid, created_dttm, updated_dttm,
|
||||
file_created_yn
|
||||
)
|
||||
SELECT
|
||||
x.uuid, x.stage, x.cd_prob, x.compare_yyyy, x.target_yyyy, x.map_sheet_num,
|
||||
x.class_before_cd, x.class_before_prob, x.class_after_cd, x.class_after_prob,
|
||||
x.geom, x.area, x.data_uid, x.created_dttm, x.updated_dttm,
|
||||
false AS file_created_yn
|
||||
FROM (
|
||||
SELECT DISTINCT ON (r.uuid)
|
||||
r.uuid,
|
||||
r.stage,
|
||||
r.cd_prob,
|
||||
r.input1 AS compare_yyyy,
|
||||
r.input2 AS target_yyyy,
|
||||
r.map_id AS map_sheet_num,
|
||||
r.before_class AS class_before_cd,
|
||||
r.before_probability AS class_before_prob,
|
||||
r.after_class AS class_after_cd,
|
||||
r.after_probability AS class_after_prob,
|
||||
CASE
|
||||
WHEN r.geometry IS NULL THEN NULL
|
||||
WHEN left(r.geometry, 2) = '01'
|
||||
THEN ST_SetSRID(ST_GeomFromWKB(decode(r.geometry, 'hex')), 5186)
|
||||
ELSE ST_GeomFromText(r.geometry, 5186)
|
||||
END AS geom,
|
||||
r.area,
|
||||
di.data_uid,
|
||||
r.created_dttm,
|
||||
r.updated_dttm
|
||||
FROM inference_results r
|
||||
JOIN tb_map_sheet_anal_data_inference di
|
||||
ON di.stage = r.stage
|
||||
AND di.compare_yyyy = r.input1
|
||||
AND di.target_yyyy = r.input2
|
||||
AND di.map_sheet_num = r.map_id
|
||||
ORDER BY r.uuid, r.updated_dttm DESC NULLS LAST, r.uid DESC
|
||||
) x
|
||||
ON CONFLICT (uuid)
|
||||
DO UPDATE SET
|
||||
stage = EXCLUDED.stage,
|
||||
cd_prob = EXCLUDED.cd_prob,
|
||||
compare_yyyy = EXCLUDED.compare_yyyy,
|
||||
target_yyyy = EXCLUDED.target_yyyy,
|
||||
map_sheet_num = EXCLUDED.map_sheet_num,
|
||||
class_before_cd = EXCLUDED.class_before_cd,
|
||||
class_before_prob = EXCLUDED.class_before_prob,
|
||||
class_after_cd = EXCLUDED.class_after_cd,
|
||||
class_after_prob = EXCLUDED.class_after_prob,
|
||||
geom = EXCLUDED.geom,
|
||||
area = EXCLUDED.area,
|
||||
data_uid = EXCLUDED.data_uid,
|
||||
updated_dttm = now()
|
||||
""";
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> content =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.resultUrl,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.accuracy,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
|
||||
.from(mapSheetAnalEntity)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnalEntity.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.fetchOne());
|
||||
return content;
|
||||
return em.createNativeQuery(sql).executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 class name별 탐지 개수
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
// ===============================
|
||||
// Jobs
|
||||
// ===============================
|
||||
|
||||
@Override
|
||||
public List<Dashboard> getDashboard(Long id) {
|
||||
public List<Long> findPendingDataUids(int limit) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd,
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalSttcEntity)
|
||||
.where(mapSheetAnalSttcEntity.id.analUid.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.select(i.id) // data_uid
|
||||
.from(i)
|
||||
.where(i.fileCreatedYn.isFalse().or(i.fileCreatedYn.isNull()))
|
||||
.orderBy(i.id.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Reset / Mark (전부 ZonedDateTime)
|
||||
// ===============================
|
||||
|
||||
@Override
|
||||
public List<MapSheetAnalDataEntity> listAnalyGeom(Long id) {
|
||||
QMapSheetAnalDataEntity analy = QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
return queryFactory.selectFrom(analy).where(analy.analUid.eq(id)).fetch();
|
||||
public int resetInferenceCreated(Long dataUid) {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, false)
|
||||
.set(i.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<MapSheetAnalDataGeomEntity> listInferenceResultWithGeom(
|
||||
List<Long> ids, SearchGeoReq searchReq) {
|
||||
public int markInferenceCreated(Long dataUid) {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
// 분석 차수
|
||||
QMapSheetAnalDataGeomEntity detectedEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
|
||||
// 검색조건
|
||||
JPAQuery<MapSheetAnalDataGeomEntity> query =
|
||||
return (int)
|
||||
queryFactory
|
||||
.selectFrom(detectedEntity)
|
||||
.where(
|
||||
detectedEntity.dataUid.in(ids),
|
||||
eqTargetClass(detectedEntity, searchReq.getTargetClass()),
|
||||
eqCompareClass(detectedEntity, searchReq.getCompareClass()),
|
||||
containsMapSheetNum(detectedEntity, searchReq.getMapSheetNum()));
|
||||
|
||||
// count
|
||||
long total = query.fetchCount();
|
||||
|
||||
// Pageable에서 정렬 가져오기, 없으면 기본 정렬(createdDttm desc) 사용
|
||||
List<OrderSpecifier<?>> orders = getOrderSpecifiers(pageable.getSort());
|
||||
if (orders.isEmpty()) {
|
||||
orders.add(detectedEntity.createdDttm.desc());
|
||||
}
|
||||
|
||||
List<MapSheetAnalDataGeomEntity> content =
|
||||
query
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(orders.toArray(new OrderSpecifier[0]))
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, true)
|
||||
.set(i.fileCreatedDttm, now)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.Geom> getInferenceGeomList(Long id, SearchGeoReq searchGeoReq) {
|
||||
Pageable pageable = searchGeoReq.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
public int resetGeomCreatedByDataUid(Long dataUid) {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
// 추론결과 id
|
||||
builder.and(mapSheetAnalEntity.id.eq(id));
|
||||
|
||||
// 기준년도 분류
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classAfterCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getTargetClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classBeforeCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getCompareClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataGeomEntity.mapSheetNum.in(mapSheetNum));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.Geom> content =
|
||||
return (int)
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataGeomEntity.geom,
|
||||
mapSheetAnalDataGeomEntity.geomCenter))
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeomEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, false)
|
||||
.set(g.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(g.updatedDttm, now) // ✅ 엔티티/Q가 ZonedDateTime이면 정상
|
||||
.where(g.dataUid.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론된 5000:1 도엽 목록
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getSheets(Long id) {
|
||||
public int markGeomCreatedByGeoUids(List<Long> geoUids) {
|
||||
if (geoUids == null || geoUids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, true)
|
||||
.set(g.fileCreatedDttm, now)
|
||||
.set(g.updatedDttm, now)
|
||||
.where(g.geoUid.in(geoUids))
|
||||
.execute();
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Export source (Entity only)
|
||||
// ===============================
|
||||
|
||||
@Override
|
||||
public List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(
|
||||
Long dataUid, int limit) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.selectFrom(g)
|
||||
.where(
|
||||
g.dataUid.eq(dataUid),
|
||||
g.geom.isNotNull(),
|
||||
g.fileCreatedYn.isFalse().or(g.fileCreatedYn.isNull()))
|
||||
.orderBy(g.geoUid.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/** Pageable의 Sort를 QueryDSL OrderSpecifier로 변환 */
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private List<OrderSpecifier<?>> getOrderSpecifiers(Sort sort) {
|
||||
List<OrderSpecifier<?>> orders = new ArrayList<>();
|
||||
|
||||
if (sort.isSorted()) {
|
||||
QMapSheetAnalDataGeomEntity entity = QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
for (Sort.Order order : sort) {
|
||||
Order direction = order.isAscending() ? Order.ASC : Order.DESC;
|
||||
String property = order.getProperty();
|
||||
|
||||
// 유효한 필드만 처리
|
||||
switch (property) {
|
||||
case "classBeforeCd" -> orders.add(new OrderSpecifier(direction, entity.classBeforeCd));
|
||||
case "classBeforeProb" ->
|
||||
orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
|
||||
case "classAfterCd" -> orders.add(new OrderSpecifier(direction, entity.classAfterCd));
|
||||
case "classAfterProb" -> orders.add(new OrderSpecifier(direction, entity.classAfterProb));
|
||||
case "mapSheetNum" -> orders.add(new OrderSpecifier(direction, entity.mapSheetNum));
|
||||
case "compareYyyy" -> orders.add(new OrderSpecifier(direction, entity.compareYyyy));
|
||||
case "targetYyyy" -> orders.add(new OrderSpecifier(direction, entity.targetYyyy));
|
||||
case "area" -> orders.add(new OrderSpecifier(direction, entity.area));
|
||||
case "createdDttm" -> orders.add(new OrderSpecifier(direction, entity.createdDttm));
|
||||
case "updatedDttm" -> orders.add(new OrderSpecifier(direction, entity.updatedDttm));
|
||||
// 유효하지 않은 필드는 무시
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orders;
|
||||
}
|
||||
|
||||
private BooleanExpression eqTargetClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String targetClass) {
|
||||
return targetClass != null && !targetClass.isEmpty()
|
||||
? detectedEntity.classAfterCd.toLowerCase().eq(targetClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression eqCompareClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String compareClass) {
|
||||
return compareClass != null && !compareClass.isEmpty()
|
||||
? detectedEntity.classBeforeCd.toLowerCase().eq(compareClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression containsMapSheetNum(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, List<Long> mapSheet) {
|
||||
if (mapSheet == null || mapSheet.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return detectedEntity.mapSheetNum.in(mapSheet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface MapSheetAnalDataInferenceGeomRepository
|
||||
extends JpaRepository<MapSheetAnalDataInferenceGeomEntity, Long>,
|
||||
MapSheetAnalDataInferenceGeomRepositoryCustom {}
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
public interface MapSheetAnalDataInferenceGeomRepositoryCustom {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MapSheetAnalDataInferenceGeomRepositoryImpl
|
||||
implements MapSheetAnalDataInferenceGeomRepositoryCustom {}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface MapSheetAnalDataInferenceRepository
|
||||
extends JpaRepository<MapSheetAnalDataInferenceEntity, Long>,
|
||||
MapSheetAnalDataInferenceRepositoryCustom {}
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
public interface MapSheetAnalDataInferenceRepositoryCustom {}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MapSheetAnalDataInferenceRepositoryImpl
|
||||
implements MapSheetAnalDataInferenceRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface MapSheetAnalDataRepository
|
||||
extends JpaRepository<MapSheetAnalEntity, Long>, MapSheetAnalDataRepositoryCustom {}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.AnalResList;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.AnalResSummary;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface MapSheetAnalDataRepositoryCustom {
|
||||
|
||||
Page<AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq);
|
||||
|
||||
Optional<AnalResSummary> getInferenceResultSummary(Long id);
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(
|
||||
Long id, InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
|
||||
Page<MapSheetAnalDataGeomEntity> listInferenceResultWithGeom(
|
||||
List<Long> dataIds, SearchGeoReq searchReq);
|
||||
|
||||
List<Long> getSheets(Long id);
|
||||
|
||||
List<Dashboard> getDashboard(Long id);
|
||||
|
||||
List<MapSheetAnalDataEntity> listAnalyGeom(@NotNull Long id);
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.AnalResList;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.AnalResSummary;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngBakEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Order;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MapSheetAnalDataRepositoryImpl implements MapSheetAnalDataRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QModelMngBakEntity tmm = QModelMngBakEntity.modelMngBakEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||
QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
|
||||
/**
|
||||
* 분석결과 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
if (searchReq.getStatCode() != null && !"0000".equals(searchReq.getStatCode())) {
|
||||
builder.and(mapSheetAnalEntity.analState.eq(searchReq.getStatCode()));
|
||||
}
|
||||
|
||||
// 제목
|
||||
if (searchReq.getTitle() != null) {
|
||||
builder.and(mapSheetAnalEntity.analTitle.like("%" + searchReq.getTitle() + "%"));
|
||||
}
|
||||
|
||||
List<AnalResList> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
|
||||
mapSheetAnalEntity.gukyuinUsed))
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalEntity.id.desc())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 요약정보
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Optional<AnalResSummary> getInferenceResultSummary(Long id) {
|
||||
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub =
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> content =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.resultUrl,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.accuracy,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
|
||||
.from(mapSheetAnalEntity)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnalEntity.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.fetchOne());
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 class name별 탐지 개수
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Dashboard> getDashboard(Long id) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd,
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalSttcEntity)
|
||||
.where(mapSheetAnalSttcEntity.id.analUid.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetAnalDataEntity> listAnalyGeom(Long id) {
|
||||
QMapSheetAnalDataEntity analy = QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
return queryFactory.selectFrom(analy).where(analy.analUid.eq(id)).fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<MapSheetAnalDataGeomEntity> listInferenceResultWithGeom(
|
||||
List<Long> ids, SearchGeoReq searchReq) {
|
||||
|
||||
// 분석 차수
|
||||
QMapSheetAnalDataGeomEntity detectedEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
|
||||
// 검색조건
|
||||
JPAQuery<MapSheetAnalDataGeomEntity> query =
|
||||
queryFactory
|
||||
.selectFrom(detectedEntity)
|
||||
.where(
|
||||
detectedEntity.dataUid.in(ids),
|
||||
eqTargetClass(detectedEntity, searchReq.getTargetClass()),
|
||||
eqCompareClass(detectedEntity, searchReq.getCompareClass()),
|
||||
containsMapSheetNum(detectedEntity, searchReq.getMapSheetNum()));
|
||||
|
||||
// count
|
||||
long total = query.fetchCount();
|
||||
|
||||
// Pageable에서 정렬 가져오기, 없으면 기본 정렬(createdDttm desc) 사용
|
||||
List<OrderSpecifier<?>> orders = getOrderSpecifiers(pageable.getSort());
|
||||
if (orders.isEmpty()) {
|
||||
orders.add(detectedEntity.createdDttm.desc());
|
||||
}
|
||||
|
||||
List<MapSheetAnalDataGeomEntity> content =
|
||||
query
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(orders.toArray(new OrderSpecifier[0]))
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
* @param searchGeoReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.Geom> getInferenceGeomList(Long id, SearchGeoReq searchGeoReq) {
|
||||
Pageable pageable = searchGeoReq.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
// 추론결과 id
|
||||
builder.and(mapSheetAnalEntity.id.eq(id));
|
||||
|
||||
// 기준년도 분류
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classAfterCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getTargetClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classBeforeCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getCompareClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataGeomEntity.mapSheetNum.in(mapSheetNum));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.Geom> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataGeomEntity.geom,
|
||||
mapSheetAnalDataGeomEntity.geomCenter))
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeomEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론된 5000:1 도엽 목록
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getSheets(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/** Pageable의 Sort를 QueryDSL OrderSpecifier로 변환 */
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private List<OrderSpecifier<?>> getOrderSpecifiers(Sort sort) {
|
||||
List<OrderSpecifier<?>> orders = new ArrayList<>();
|
||||
|
||||
if (sort.isSorted()) {
|
||||
QMapSheetAnalDataGeomEntity entity = QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
for (Sort.Order order : sort) {
|
||||
Order direction = order.isAscending() ? Order.ASC : Order.DESC;
|
||||
String property = order.getProperty();
|
||||
|
||||
// 유효한 필드만 처리
|
||||
switch (property) {
|
||||
case "classBeforeCd" -> orders.add(new OrderSpecifier(direction, entity.classBeforeCd));
|
||||
case "classBeforeProb" ->
|
||||
orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
|
||||
case "classAfterCd" -> orders.add(new OrderSpecifier(direction, entity.classAfterCd));
|
||||
case "classAfterProb" -> orders.add(new OrderSpecifier(direction, entity.classAfterProb));
|
||||
case "mapSheetNum" -> orders.add(new OrderSpecifier(direction, entity.mapSheetNum));
|
||||
case "compareYyyy" -> orders.add(new OrderSpecifier(direction, entity.compareYyyy));
|
||||
case "targetYyyy" -> orders.add(new OrderSpecifier(direction, entity.targetYyyy));
|
||||
case "area" -> orders.add(new OrderSpecifier(direction, entity.area));
|
||||
case "createdDttm" -> orders.add(new OrderSpecifier(direction, entity.createdDttm));
|
||||
case "updatedDttm" -> orders.add(new OrderSpecifier(direction, entity.updatedDttm));
|
||||
// 유효하지 않은 필드는 무시
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orders;
|
||||
}
|
||||
|
||||
private BooleanExpression eqTargetClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String targetClass) {
|
||||
return targetClass != null && !targetClass.isEmpty()
|
||||
? detectedEntity.classAfterCd.toLowerCase().eq(targetClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression eqCompareClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String compareClass) {
|
||||
return compareClass != null && !compareClass.isEmpty()
|
||||
? detectedEntity.classBeforeCd.toLowerCase().eq(compareClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression containsMapSheetNum(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, List<Long> mapSheet) {
|
||||
if (mapSheet == null || mapSheet.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return detectedEntity.mapSheetNum.in(mapSheet);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid);
|
||||
|
||||
int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy);
|
||||
int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy, String mngPath);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid);
|
||||
|
||||
@@ -43,6 +43,10 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
void updateByHstUidMngFileState(Long hstUid, String fileState);
|
||||
|
||||
void updateByFileUidMngFileState(Long fileUid, String fileState);
|
||||
|
||||
void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids);
|
||||
|
||||
void updateYearState(int yyyy, String status);
|
||||
|
||||
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
@@ -50,9 +54,11 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid);
|
||||
List<MapSheetMngDto.MngFilesDto> findByHstUidMapSheetFileList(Long hstUid);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid);
|
||||
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
|
||||
int findByYearFileNameFileCount(int mngYyyy, String fileName);
|
||||
}
|
||||
|
||||
@@ -448,10 +448,11 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid) {
|
||||
public List<MapSheetMngDto.MngFilesDto> findByHstUidMapSheetFileList(Long hstUid) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.hstUid.eq(hstUid));
|
||||
whereBuilder.and(mapSheetMngFileEntity.fileDel.eq(false));
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> foundContent =
|
||||
queryFactory
|
||||
@@ -478,6 +479,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.hstUid.eq(hstUid));
|
||||
whereBuilder.and(mapSheetMngFileEntity.fileDel.eq(false));
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> foundContent =
|
||||
queryFactory
|
||||
@@ -531,7 +533,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid) {
|
||||
public MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid) {
|
||||
|
||||
MapSheetMngDto.MngFilesDto foundContent =
|
||||
queryFactory
|
||||
@@ -636,8 +638,9 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public void deleteByHstUidMngFile(Long hstUid) {
|
||||
long deletedFileCount =
|
||||
queryFactory
|
||||
.delete(mapSheetMngFileEntity)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(hstUid))
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(mapSheetMngFileEntity.hstUid.eq(hstUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@@ -645,7 +648,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public void deleteByFileUidMngFile(Long fileUid) {
|
||||
long fileCount =
|
||||
queryFactory
|
||||
.delete(mapSheetMngFileEntity)
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||
.execute();
|
||||
}
|
||||
@@ -660,6 +664,46 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(
|
||||
mapSheetMngFileEntity
|
||||
.hstUid
|
||||
.eq(hstUid)
|
||||
.and(mapSheetMngFileEntity.fileUid.notIn(fileUids)))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByFileUidMngFileState(Long fileUid, String fileState) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileState, fileState)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
|
||||
Long execCount =
|
||||
queryFactory
|
||||
.select(mapSheetMngFileEntity.count())
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(
|
||||
mapSheetMngFileEntity
|
||||
.mngYyyy
|
||||
.eq(mngYyyy)
|
||||
.and(mapSheetMngFileEntity.fileName.eq(fileName)))
|
||||
.fetchOne();
|
||||
|
||||
return Math.toIntExact(execCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mngFileSave(@Valid MapSheetMngDto.MngFileAddReq addReq) {
|
||||
long fileCount =
|
||||
@@ -689,13 +733,14 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) {
|
||||
public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy, String mngPath) {
|
||||
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_mng_hst
|
||||
(
|
||||
mng_yyyy
|
||||
,map_sheet_path
|
||||
,map_sheet_code
|
||||
,map_sheet_num
|
||||
,map_sheet_name
|
||||
@@ -705,14 +750,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
,use_inference
|
||||
)
|
||||
select
|
||||
:mngYyyy as mng_yyyy
|
||||
,fid as map_sheet_code
|
||||
,mapidcd_no::INTEGER as map_sheet_num
|
||||
,mapid_nm as map_sheet_name
|
||||
,fid as map_sheet_code_src
|
||||
,5000 as scale_ratio
|
||||
,((mapidcd_no::INTEGER)/1000) as ref_map_sheet_num
|
||||
,use_inference
|
||||
:mngYyyy as mng_yyyy,
|
||||
:mngPath as map_sheet_path,
|
||||
fid as map_sheet_code,
|
||||
mapidcd_no as map_sheet_num,
|
||||
mapid_nm as map_sheet_name,
|
||||
fid as map_sheet_code_src,
|
||||
5000 as scale_ratio,
|
||||
((mapidcd_no::INTEGER)/1000) as ref_map_sheet_num,
|
||||
use_inference
|
||||
from
|
||||
tb_map_inkx_5k
|
||||
""";
|
||||
@@ -720,6 +766,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
// Native Query 생성 및 실행
|
||||
Query query = (Query) em.createNativeQuery(sql);
|
||||
query.setParameter("mngYyyy", mngYyyy);
|
||||
query.setParameter("mngPath", mngPath);
|
||||
|
||||
int exeCnt = query.executeUpdate(); // 실행 (영향받은 행의 개수 반환)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user