Merge pull request '[KC-108] 분석도엽 ai api호출 테스트중, 모델타입 조회 컬럼 추가' (#194) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/194
This commit is contained in:
@@ -134,11 +134,13 @@ public class InferenceResultApiController {
|
||||
LocalDate endDttm,
|
||||
@Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false)
|
||||
String searchVal,
|
||||
@Parameter(description = "타입", example = "M1") @RequestParam(required = false)
|
||||
String modelType,
|
||||
@RequestParam(defaultValue = "0") int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
ModelMngDto.searchReq searchReq = new ModelMngDto.searchReq(page, size, null);
|
||||
Page<ModelMngDto.ModelList> result =
|
||||
modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, null, searchVal);
|
||||
modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, modelType, searchVal);
|
||||
return ApiResponseDto.ok(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,13 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Detail;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto.PredRequestsAreas;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.Basic;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
@@ -22,7 +24,10 @@ import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.Search5kReq;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -65,53 +70,112 @@ public class InferenceResultService {
|
||||
*/
|
||||
@Transactional
|
||||
public UUID saveInferenceInfo(InferenceResultDto.RegReq req) {
|
||||
// TODO tif 없으면 전년도 파일 조회 쿼리 추가해야함
|
||||
// 전체일때 5k도협 가져오기
|
||||
List<MapSheetNumDto> mapSheetNum = new ArrayList<>();
|
||||
List<MapSheetNumDto> mapSheetTargetNum = new ArrayList<>();
|
||||
List<MapSheetNumDto> mapSheetCompareNum = new ArrayList<>();
|
||||
|
||||
// 분석대상 도엽이 전체일때
|
||||
if (MapSheetScope.ALL.getId().equals(req.getMapSheetScope())) {
|
||||
Search5kReq mapReq = new Search5kReq();
|
||||
mapReq.setUseInference("USE");
|
||||
|
||||
MapSheetNumDto mapSheetNumDto = new MapSheetNumDto();
|
||||
inferenceResultCoreService
|
||||
.findByMapidList(mapReq)
|
||||
.forEach(
|
||||
mapInkx5kEntity -> {
|
||||
mapSheetNumDto.setMapSheetNum(mapInkx5kEntity.getMapidcdNo());
|
||||
mapSheetNumDto.setMapSheetName(mapInkx5kEntity.getMapidNm());
|
||||
mapSheetNum.add(mapSheetNumDto);
|
||||
});
|
||||
List<String> mapTargetIds = new ArrayList<>();
|
||||
// 기준년도 조회
|
||||
List<MngListDto> targetList = mapSheetMngCoreService.getHstMapSheetList(req.getTargetYyyy());
|
||||
|
||||
targetList.forEach(
|
||||
hstMapSheet -> {
|
||||
// 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기
|
||||
mapTargetIds.add(hstMapSheet.getMapSheetNum());
|
||||
//
|
||||
// mapSheetNumDto.setMapSheetNum(hstMapSheet.getMapSheetNum());
|
||||
// mapSheetNumDto.setMapSheetName(hstMapSheet.getMapSheetName());
|
||||
// mapSheetTargetNum.add(mapSheetNumDto);
|
||||
});
|
||||
|
||||
// 비교년도 조회
|
||||
List<String> mapCompareIds = new ArrayList<>();
|
||||
List<MngListCompareDto> compareList =
|
||||
mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds);
|
||||
|
||||
for (MngListCompareDto dto : compareList) {
|
||||
// 추론 제외일때 이전년도 파일이 없으면 제외
|
||||
if (req.getDetectOption().equals(DetectOption.EXCL.getId())) {
|
||||
int targetYear = req.getTargetYyyy() - 1;
|
||||
if (dto.getBeforeYear() != targetYear) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 비교년도는 target 년도 기준으로 가져옴
|
||||
mapCompareIds.add(dto.getMapSheetNum());
|
||||
}
|
||||
|
||||
Set<String> compareSet =
|
||||
mapCompareIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim) // 공백/개행 방지
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<String> commonIds =
|
||||
mapTargetIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.filter(compareSet::contains)
|
||||
.toList();
|
||||
|
||||
System.out.println("mapTargetIds size=" + mapTargetIds.size());
|
||||
System.out.println("mapCompareIds size=" + mapCompareIds.size());
|
||||
System.out.println("commonIds size=" + commonIds.size());
|
||||
System.out.println(commonIds);
|
||||
|
||||
Set<String> commonIdSet =
|
||||
commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet());
|
||||
|
||||
List<MapSheetNumDto> mapSheetNum =
|
||||
targetList.stream()
|
||||
.filter(dto -> dto.getMapSheetNum() != null)
|
||||
.filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim()))
|
||||
.map(
|
||||
dto -> {
|
||||
MapSheetNumDto mapSheetNumDto = new MapSheetNumDto();
|
||||
mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum());
|
||||
mapSheetNumDto.setMapSheetName(dto.getMapSheetName());
|
||||
return mapSheetNumDto;
|
||||
})
|
||||
.toList();
|
||||
|
||||
} else {
|
||||
// 부분ㄹ
|
||||
}
|
||||
|
||||
// 추론 테이블 저장
|
||||
UUID uuid = inferenceResultCoreService.saveInferenceInfo(req);
|
||||
// UUID uuid = inferenceResultCoreService.saveInferenceInfo(req);
|
||||
//
|
||||
// List<String> mapSheetNumList = new ArrayList<>();
|
||||
// for (MapSheetNumDto mapSheetDto : mapSheetNum) {
|
||||
// mapSheetNumList.add(mapSheetDto.getMapSheetNum());
|
||||
// }
|
||||
//
|
||||
// String modelComparePath =
|
||||
// this.getSceneInference(String.valueOf(req.getCompareYyyy()), mapSheetNumList);
|
||||
// String modelTargetPath =
|
||||
// this.getSceneInference(String.valueOf(req.getTargetYyyy()), mapSheetNumList);
|
||||
//
|
||||
// PredRequestsAreas predRequestsAreas = new PredRequestsAreas();
|
||||
// predRequestsAreas.setInput1_year(req.getCompareYyyy());
|
||||
// predRequestsAreas.setInput2_year(req.getTargetYyyy());
|
||||
// predRequestsAreas.setInput1_scene_path(modelComparePath);
|
||||
// predRequestsAreas.setInput2_scene_path(modelTargetPath);
|
||||
//
|
||||
// InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||
// InferenceSendDto m2 = this.getModelInfo(req.getModel2Uuid());
|
||||
// InferenceSendDto m3 = this.getModelInfo(req.getModel3Uuid());
|
||||
//
|
||||
// m1.setPredRequestsAreas(predRequestsAreas);
|
||||
// m2.setPredRequestsAreas(predRequestsAreas);
|
||||
// m3.setPredRequestsAreas(predRequestsAreas);
|
||||
|
||||
List<String> mapSheetNumList = new ArrayList<>();
|
||||
for (MapSheetNumDto mapSheetDto : mapSheetNum) {
|
||||
mapSheetNumList.add(mapSheetDto.getMapSheetNum());
|
||||
}
|
||||
|
||||
String modelComparePath =
|
||||
this.getSceneInference(String.valueOf(req.getCompareYyyy()), mapSheetNumList);
|
||||
String modelTargetPath =
|
||||
this.getSceneInference(String.valueOf(req.getTargetYyyy()), mapSheetNumList);
|
||||
|
||||
PredRequestsAreas predRequestsAreas = new PredRequestsAreas();
|
||||
predRequestsAreas.setInput1_year(req.getCompareYyyy());
|
||||
predRequestsAreas.setInput2_year(req.getTargetYyyy());
|
||||
predRequestsAreas.setInput1_scene_path(modelComparePath);
|
||||
predRequestsAreas.setInput2_scene_path(modelTargetPath);
|
||||
|
||||
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||
InferenceSendDto m2 = this.getModelInfo(req.getModel2Uuid());
|
||||
InferenceSendDto m3 = this.getModelInfo(req.getModel3Uuid());
|
||||
|
||||
m1.setPredRequestsAreas(predRequestsAreas);
|
||||
m2.setPredRequestsAreas(predRequestsAreas);
|
||||
m3.setPredRequestsAreas(predRequestsAreas);
|
||||
|
||||
ensureAccepted(m1);
|
||||
// ensureAccepted(m1);
|
||||
// ensureAccepted(m2);
|
||||
// ensureAccepted(m3);
|
||||
|
||||
|
||||
@@ -95,16 +95,22 @@ public class MapSheetMngDto {
|
||||
|
||||
public String getSyncState() {
|
||||
|
||||
if (this.syncStateDoneCnt == 0) return "NOTYET";
|
||||
else if (this.syncStateDoneCnt < this.syncTotCnt) return "PROCESSING";
|
||||
if (this.syncStateDoneCnt == 0) {
|
||||
return "NOTYET";
|
||||
} else if (this.syncStateDoneCnt < this.syncTotCnt) {
|
||||
return "PROCESSING";
|
||||
}
|
||||
|
||||
return "DONE";
|
||||
}
|
||||
|
||||
public String getDataCheckState() {
|
||||
|
||||
if (this.syncDataCheckDoneCnt == 0) return "NOTYET";
|
||||
else if (this.syncDataCheckDoneCnt < this.syncTotCnt) return "PROCESSING";
|
||||
if (this.syncDataCheckDoneCnt == 0) {
|
||||
return "NOTYET";
|
||||
} else if (this.syncDataCheckDoneCnt < this.syncTotCnt) {
|
||||
return "PROCESSING";
|
||||
}
|
||||
|
||||
return "DONE";
|
||||
}
|
||||
@@ -135,11 +141,15 @@ public class MapSheetMngDto {
|
||||
|
||||
String mngState = "DONE";
|
||||
|
||||
if (this.syncStateDoneCnt == 0) mngState = "NOTYET";
|
||||
else if (this.syncStateDoneCnt < this.syncTotCnt) mngState = "PROCESSING";
|
||||
if (this.syncStateDoneCnt == 0) {
|
||||
mngState = "NOTYET";
|
||||
} else if (this.syncStateDoneCnt < this.syncTotCnt) {
|
||||
mngState = "PROCESSING";
|
||||
}
|
||||
|
||||
if ((this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt) > 0)
|
||||
if ((this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt) > 0) {
|
||||
mngState = "TAKINGERROR";
|
||||
}
|
||||
|
||||
return mngState;
|
||||
}
|
||||
@@ -406,4 +416,28 @@ public class MapSheetMngDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "MngListDto", description = "영상파일내역 검색 목록")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngListDto {
|
||||
|
||||
private int mngYyyy;
|
||||
private String mapSheetNum;
|
||||
private String mapSheetName;
|
||||
}
|
||||
|
||||
@Schema(name = "MngListDto", description = "영상파일내역 검색 목록")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngListCompareDto {
|
||||
|
||||
private String mngYyyy;
|
||||
private String mapSheetNum;
|
||||
private Integer beforeYear;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetAnalDataInfe
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearn5kRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx5kRepository;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.Search5kReq;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -218,8 +216,4 @@ public class InferenceResultCoreService {
|
||||
.map(MapInkx5kEntity::toEntity)
|
||||
.toList();
|
||||
}
|
||||
|
||||
public List<MapInkxMngDto.MapInkList> findByMapidList(Search5kReq req) {
|
||||
return mapInkx5kRepository.findByMapidList(req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.kamco.cd.kamcoback.postgres.core;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
@@ -235,4 +237,12 @@ public class MapSheetMngCoreService {
|
||||
|
||||
return outputPath;
|
||||
}
|
||||
|
||||
public List<MngListDto> getHstMapSheetList(int mngYyyy) {
|
||||
return mapSheetMngRepository.findByHstMapSheetTargetList(mngYyyy);
|
||||
}
|
||||
|
||||
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
||||
return mapSheetMngRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_map_sheet_years_map")
|
||||
public class MapSheetYearsMapEntity {
|
||||
|
||||
@Id
|
||||
@Size(max = 30)
|
||||
@Column(name = "map_sheet_num", nullable = false, length = 30)
|
||||
private String mapSheetNum;
|
||||
|
||||
@Size(max = 20)
|
||||
@Column(name = "ref_map_sheet_num", length = 20)
|
||||
private String refMapSheetNum;
|
||||
|
||||
@Column(name = "map_years", length = Integer.MAX_VALUE)
|
||||
private String mapYears;
|
||||
|
||||
@Column(name = "lvl")
|
||||
private Integer lvl;
|
||||
|
||||
@Column(name = "max_year")
|
||||
private Integer maxYear;
|
||||
|
||||
@Column(name = "min_year")
|
||||
private Integer minYear;
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
||||
@@ -59,6 +61,10 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findByHstUidMapSheetFileList(Long hstUid);
|
||||
|
||||
List<MngListDto> findByHstMapSheetTargetList(int mngYyyy);
|
||||
|
||||
List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapId);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
|
||||
@@ -8,6 +8,8 @@ import static com.kamco.cd.kamcoback.postgres.entity.QYearEntity.yearEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QYearEntity;
|
||||
@@ -476,6 +478,64 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MngListDto> findByHstMapSheetTargetList(int mngYyyy) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MngListDto.class,
|
||||
mapSheetMngHstEntity.mngYyyy,
|
||||
mapSheetMngHstEntity.mapSheetNum,
|
||||
mapSheetMngHstEntity.mapSheetName))
|
||||
.from(mapSheetMngHstEntity)
|
||||
.where(
|
||||
mapSheetMngHstEntity
|
||||
.mngYyyy
|
||||
.eq(mngYyyy)
|
||||
.and(mapSheetMngHstEntity.dataState.eq("DONE"))
|
||||
.and(mapSheetMngHstEntity.syncState.eq("DONE"))
|
||||
.and(mapSheetMngHstEntity.useInference.eq("USE")))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapIds) {
|
||||
|
||||
String sql =
|
||||
"""
|
||||
SELECT
|
||||
t.map_sheet_num,
|
||||
t.map_years,
|
||||
COALESCE(s.target_year, 0) AS before_year
|
||||
FROM public.tb_map_sheet_years_map t
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT x::int AS target_year
|
||||
FROM unnest(string_to_array(t.map_years, '>')) AS x
|
||||
WHERE x::int <= :mngYyyy
|
||||
ORDER BY x::int DESC
|
||||
LIMIT 1
|
||||
) s ON true
|
||||
WHERE t.map_sheet_num = ANY(:mapIds)
|
||||
""";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object[]> rows =
|
||||
em.createNativeQuery(sql)
|
||||
.setParameter("mngYyyy", mngYyyy)
|
||||
.setParameter("mapIds", mapIds.toArray(new String[0]))
|
||||
.getResultList();
|
||||
|
||||
return rows.stream()
|
||||
.map(
|
||||
r ->
|
||||
new MngListCompareDto(
|
||||
(String) r[1], // map_years
|
||||
(String) r[0], // map_sheet_num
|
||||
((Number) r[2]).intValue() // before_year
|
||||
))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapList;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.Search5kReq;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.searchReq;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -26,6 +25,4 @@ public interface MapInkx5kRepositoryCustom {
|
||||
|
||||
List<MapInkx5kEntity> findByMapSheetNumInAndUseInference(
|
||||
List<String> mapSheetNums, CommonUseStatus use);
|
||||
|
||||
List<MapInkxMngDto.MapInkList> findByMapidList(Search5kReq search5kReq);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapList;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.Search5kReq;
|
||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.searchReq;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
@@ -18,7 +16,6 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -145,35 +142,6 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapInkxMngDto.MapInkList> findByMapidList(Search5kReq search5kReq) {
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(search5kReq.getMapidcdNo())) {
|
||||
builder.and(mapInkx5kEntity.mapidcdNo.eq(search5kReq.getMapidcdNo()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search5kReq.getUseInference())) {
|
||||
builder.and(
|
||||
mapInkx5kEntity.useInference.eq(
|
||||
CommonUseStatus.getEnumById(search5kReq.getUseInference())));
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapInkxMngDto.MapInkList.class,
|
||||
mapInkx5kEntity.fid,
|
||||
mapInkx5kEntity.mapidcdNo,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapInkx5kEntity.useInference))
|
||||
.from(mapInkx5kEntity)
|
||||
.where(builder)
|
||||
// TODO limit 제거 필요
|
||||
.limit(100)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
private BooleanExpression searchUseInference(CommonUseStatus useInference) {
|
||||
if (Objects.isNull(useInference)) {
|
||||
return null;
|
||||
|
||||
@@ -58,19 +58,6 @@ public class MapInkxMngDto {
|
||||
private ZonedDateTime updatedDttm;
|
||||
}
|
||||
|
||||
@Schema(name = "MapInkList", description = "5k 리스트")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MapInkList {
|
||||
|
||||
private Integer fid;
|
||||
private String mapidcdNo;
|
||||
private String mapidNm;
|
||||
private CommonUseStatus useInference;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Schema(name = "MapListEntity", description = "목록 항목")
|
||||
public static class MapListEntity {
|
||||
|
||||
Reference in New Issue
Block a user