라벨링작업 관리 목록조회 수정
This commit is contained in:
@@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -113,7 +114,7 @@ public class InnopamApiController {
|
|||||||
return detectMastService.selectDetectMast(dtctMstId);
|
return detectMastService.selectDetectMast(dtctMstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 PNU 리스트 조회", description = "탐지객체 PNU 리스트 조회")
|
@Operation(summary = "탐지객체 랜덤 PNU 리스트 조회", description = "탐지객체 PNU 랜덤값을 생성해서 보여준다")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -149,4 +150,29 @@ public class InnopamApiController {
|
|||||||
detectMastSearch.setFeatureId(featureId);
|
detectMastSearch.setFeatureId(featureId);
|
||||||
return new FeaturePnuDto();
|
return new FeaturePnuDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "탐지객체 랜덤 PNU GEOM 업데이트(이노펨에 없는 API)",
|
||||||
|
description = "탐지객체 랜덤 PNU GEOM 업데이트(이노펨에 없는 API)")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "pnu 업데이트 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Integer.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PutMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
|
||||||
|
public Integer updatePnuList(
|
||||||
|
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable String dtctSno) {
|
||||||
|
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
||||||
|
detectMastSearch.setCprsAdYr(cprsAfYr);
|
||||||
|
detectMastSearch.setCprsBfYr(cprsBfYr);
|
||||||
|
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
|
||||||
|
return detectMastService.updatePnuData(detectMastSearch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto;
|
|||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastReq;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastReq;
|
||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||||
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||||
import com.kamco.cd.kamcoback.Innopam.postgres.repository.DetectMastRepository;
|
import com.kamco.cd.kamcoback.Innopam.postgres.repository.DetectMastRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -59,4 +60,8 @@ public class DetectMastCoreService {
|
|||||||
DetectMastEntity detectMastEntity = detectMastRepository.findPnuData(detectMast);
|
DetectMastEntity detectMastEntity = detectMastRepository.findPnuData(detectMast);
|
||||||
return detectMastEntity.getPathNm();
|
return detectMastEntity.getPathNm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer updatePnu(List<FeaturePnuDto> list) {
|
||||||
|
return detectMastRepository.updateGeomPnu(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||||
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -9,4 +10,6 @@ public interface DetectMastRepositoryCustom {
|
|||||||
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast);
|
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast);
|
||||||
|
|
||||||
public DetectMastEntity findPnuData(DetectMastSearch detectMast);
|
public DetectMastEntity findPnuData(DetectMastSearch detectMast);
|
||||||
|
|
||||||
|
Integer updateGeomPnu(List<FeaturePnuDto> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.Innopam.postgres.entity.QDetectMastEntity.detectMastEntity;
|
import static com.kamco.cd.kamcoback.Innopam.postgres.entity.QDetectMastEntity.detectMastEntity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||||
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -15,7 +19,9 @@ import org.springframework.stereotype.Repository;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DetectMastRepositoryImpl implements DetectMastRepositoryCustom {
|
public class DetectMastRepositoryImpl implements DetectMastRepositoryCustom {
|
||||||
|
|
||||||
|
private final EntityManager em;
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast) {
|
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast) {
|
||||||
@@ -56,4 +62,33 @@ public class DetectMastRepositoryImpl implements DetectMastRepositoryCustom {
|
|||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateGeomPnu(List<FeaturePnuDto> list) {
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
String sql =
|
||||||
|
"""
|
||||||
|
UPDATE tb_map_sheet_anal_data_inference_geom g
|
||||||
|
SET pnu = j.pnu
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
(elem->>'featureId')::uuid AS feature_uuid,
|
||||||
|
(elem->>'pnu')::bigint AS pnu
|
||||||
|
FROM jsonb_array_elements(CAST(:json AS jsonb)) AS elem
|
||||||
|
) j
|
||||||
|
WHERE g.uuid = j.feature_uuid;
|
||||||
|
""";
|
||||||
|
|
||||||
|
String json = "";
|
||||||
|
try {
|
||||||
|
json = objectMapper.writeValueAsString(list);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException("PNU 업데이트 실패", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return em.createNativeQuery(sql).setParameter("json", json).executeUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,12 +57,34 @@ public class DetectMastService {
|
|||||||
|
|
||||||
String dirPath =
|
String dirPath =
|
||||||
"local".equals(profile)
|
"local".equals(profile)
|
||||||
? "/Users/bokmin/detect/result/2023_2024/4"
|
? "/Users/bokmin/detect/result/"
|
||||||
|
+ detectMast.getCprsBfYr()
|
||||||
|
+ "_"
|
||||||
|
+ detectMast.getCprsAdYr()
|
||||||
|
+ "/"
|
||||||
|
+ detectMast.getDtctSno()
|
||||||
: detectMastCoreService.findPnuData(detectMast);
|
: detectMastCoreService.findPnuData(detectMast);
|
||||||
|
|
||||||
return extractFeaturePnusRandom(dirPath);
|
return extractFeaturePnusRandom(dirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Integer updatePnuData(DetectMastSearch detectMast) {
|
||||||
|
|
||||||
|
String dirPath =
|
||||||
|
"local".equals(profile)
|
||||||
|
? "/Users/bokmin/detect/result/"
|
||||||
|
+ detectMast.getCprsBfYr()
|
||||||
|
+ "_"
|
||||||
|
+ detectMast.getCprsAdYr()
|
||||||
|
+ "/"
|
||||||
|
+ detectMast.getDtctSno()
|
||||||
|
: detectMastCoreService.findPnuData(detectMast);
|
||||||
|
|
||||||
|
List<FeaturePnuDto> list = extractFeaturePnusRandom(dirPath);
|
||||||
|
return detectMastCoreService.updatePnu(list);
|
||||||
|
}
|
||||||
|
|
||||||
/** 하위 폴더까지 .geojson 파일들에서 polygon_id만 뽑음 병렬처리(parallel) 제거: IO + parallel은 거의 항상 느려짐 */
|
/** 하위 폴더까지 .geojson 파일들에서 polygon_id만 뽑음 병렬처리(parallel) 제거: IO + parallel은 거의 항상 느려짐 */
|
||||||
private List<FeaturePnuDto> extractFeaturePnusRandom(String dirPath) {
|
private List<FeaturePnuDto> extractFeaturePnusRandom(String dirPath) {
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -16,8 +15,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final EntityManager em;
|
||||||
@PersistenceContext private final EntityManager em;
|
|
||||||
|
|
||||||
/** tb_map_sheet_anal_data_inference */
|
/** tb_map_sheet_anal_data_inference */
|
||||||
private final QMapSheetAnalDataInferenceEntity inferenceEntity =
|
private final QMapSheetAnalDataInferenceEntity inferenceEntity =
|
||||||
|
|||||||
@@ -124,7 +124,15 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
mapSheetAnalInferenceEntity.stage,
|
mapSheetAnalInferenceEntity.stage,
|
||||||
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
new CaseBuilder()
|
||||||
|
.when(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
|
.pnu
|
||||||
|
.isNotNull()
|
||||||
|
.and(mapSheetAnalDataInferenceGeomEntity.pnu.ne(0L)))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise(0L)
|
||||||
|
.sum(),
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
||||||
.then(1L)
|
.then(1L)
|
||||||
|
|||||||
Reference in New Issue
Block a user