국유인 API 수정 추가

This commit is contained in:
2026-02-05 15:09:27 +09:00
parent 83e02c4498
commit 41b227de3f
8 changed files with 58 additions and 75 deletions

View File

@@ -305,8 +305,10 @@ public class GukYuinApiController {
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
@PathVariable String chnDtctId) {
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId));
@PathVariable String chnDtctId,
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
String yyyymmdd) {
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd));
}
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")

View File

@@ -518,7 +518,7 @@ public class GukYuinApiService {
return result.body();
}
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId) {
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId, String yyyymmdd) {
String url =
gukyuinCdiUrl
@@ -527,7 +527,9 @@ public class GukYuinApiService {
+ "?reqIp="
+ myip
+ "&reqEpno="
+ userUtil.getEmployeeNo();
+ userUtil.getEmployeeNo()
+ "&yyyymmdd="
+ yyyymmdd;
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
externalHttpClient.call(

View File

@@ -30,13 +30,19 @@ public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryC
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
ZoneId zone = ZoneId.of("Asia/Seoul");
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
ZonedDateTime tomorrowStart = todayStart.plusDays(1);
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
// BooleanExpression isYesterday =
// labelingAssignmentEntity
// .inspectStatDttm
// .goe(yesterdayStart)
// .and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
BooleanExpression isYesterday =
labelingAssignmentEntity
.inspectStatDttm
.goe(yesterdayStart)
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
.goe(todayStart)
.and(labelingAssignmentEntity.inspectStatDttm.lt(tomorrowStart));
return queryFactory
.select(

View File

@@ -6,6 +6,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntit
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
@@ -15,6 +16,7 @@ import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.time.ZonedDateTime;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
@@ -64,54 +66,21 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
PnuEntity pnuEt =
queryFactory
.selectFrom(pnuEntity)
.where(pnuEntity.pnu.eq(stbltDto.getPnu()), pnuEntity.chnDtctObjtId.eq(resultUid))
.fetchOne();
if (pnuEt != null) {
// update
queryFactory
.update(pnuEntity)
.set(pnuEntity.pnuDtctId, stbltDto.getPnuDtctId())
.set(pnuEntity.lrmSyncYmd, stbltDto.getLrmSyncYmd())
.set(pnuEntity.pnuSyncYmd, stbltDto.getPnuSyncYmd())
.set(pnuEntity.mpqdNo, stbltDto.getMpqdNo())
.set(pnuEntity.cprsYr, stbltDto.getCprsYr())
.set(pnuEntity.crtrYr, stbltDto.getCrtrYr())
.set(pnuEntity.chnDtctId, stbltDto.getChnDtctId())
.set(pnuEntity.chnDtctMstId, stbltDto.getChnDtctMstId())
.set(pnuEntity.chnDtctObjtId, stbltDto.getChnDtctObjtId())
.set(pnuEntity.chnDtctContId, stbltDto.getChnDtctContId())
.set(pnuEntity.chnCd, stbltDto.getChnCd())
.set(pnuEntity.chnDtctProb, stbltDto.getChnDtctProb())
.set(pnuEntity.bfClsCd, stbltDto.getBfClsCd())
.set(pnuEntity.bfClsProb, stbltDto.getBfClsProb())
.set(pnuEntity.afClsCd, stbltDto.getAfClsCd())
.set(pnuEntity.afClsProb, stbltDto.getAfClsProb())
.set(pnuEntity.pnuSqms, stbltDto.getPnuSqms())
.set(pnuEntity.pnuDtctSqms, stbltDto.getPnuDtctSqms())
.set(pnuEntity.chnDtctSqms, stbltDto.getChnDtctSqms())
.set(pnuEntity.stbltYn, stbltDto.getStbltYn())
.set(pnuEntity.incyCd, stbltDto.getIncyCd())
.set(pnuEntity.incyRsnCont, stbltDto.getIncyRsnCont())
.where(
pnuEntity.geo.geoUid.eq(geomEntity.getGeoUid()),
pnuEntity.chnDtctObjtId.eq(resultUid))
.execute();
} else {
// insert
}
}
// queryFactory
// .update(mapSheetAnalDataInferenceGeomEntity)
// .set(
// mapSheetAnalDataInferenceGeomEntity.fitState,
// stbltDto.getStbltYn().equals("Y") ? ImageryFitStatus.FIT.getId() :
// ImageryFitStatus.UNFIT.getId())
// .set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
// .set(mapSheetAnalDataInferenceGeomEntity.lockYn, stbltDto.getLockYn())
// .where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
// .execute();
.where(pnuEntity.chnDtctObjtId.eq(resultUid))
.fetchFirst();
// TODO
queryFactory
.update(mapSheetAnalDataInferenceGeomEntity)
.set(
mapSheetAnalDataInferenceGeomEntity.fitState,
pnuEt.getStbltYn().equals("Y")
? ImageryFitStatus.UNFIT.getId()
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
.set(mapSheetAnalDataInferenceGeomEntity.lockYn, stbltDto.getLockYn())
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
.execute();
}
}
@Override

View File

@@ -8,7 +8,6 @@ import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Log4j2
@@ -32,11 +31,11 @@ public class GukYuinApiLabelJobService {
}
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
@Scheduled(cron = "0 0 2 * * *")
// @Scheduled(cron = "0 0 2 * * *")
public void findLabelingCompleteSend() {
if (isLocalProfile()) {
return;
}
// if (isLocalProfile()) {
// return;
// }
List<GeomUidDto> list = gukYuinLabelJobCoreService.findYesterdayLabelingCompleteList();
if (list.isEmpty()) {
@@ -44,7 +43,7 @@ public class GukYuinApiLabelJobService {
}
for (GeomUidDto gto : list) {
ChngDetectContDto.ResultPnuDto dto =
ChngDetectContDto.ResultLabelDto dto =
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
if (dto.getSuccess()) {
// inference_geom 에 label_send_dttm 업데이트 하기

View File

@@ -12,7 +12,6 @@ import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Log4j2
@@ -36,11 +35,11 @@ public class GukYuinApiPnuJobService {
}
/** 국유인 등록 완료 후, 탐지객체 조회해서 PNU 업데이트 하는 스케줄링 하루 1번 새벽 1시에 실행 */
@Scheduled(cron = "0 * * * * *") // 0 0 1 * * *
// @Scheduled(cron = "0 0/10 * * * *") // 0 0 1 * * *
public void findGukYuinContListPnuUpdate() {
if (isLocalProfile()) {
return;
}
// if (isLocalProfile()) {
// return;
// }
List<LearnKeyDto> list =
gukYuinPnuJobCoreService.findGukyuinApplyStatusUidList(

View File

@@ -9,7 +9,6 @@ import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Log4j2
@@ -33,11 +32,11 @@ public class GukYuinApiStatusJobService {
}
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
@Scheduled(cron = "0 0/10 * * * *") // 0 0/10 * * * *
// @Scheduled(cron = "0 0/10 * * * *") // 0 0/10 * * * *
public void findGukYuinMastCompleteYn() {
if (isLocalProfile()) {
return;
}
// if (isLocalProfile()) {
// return;
// }
List<LearnKeyDto> list =
gukYuinJobCoreService.findGukyuinApplyStatusUidList(

View File

@@ -6,11 +6,13 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
import com.kamco.cd.kamcoback.postgres.core.GukYuinStbltJobCoreService;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Log4j2
@@ -34,11 +36,11 @@ public class GukYuinApiStbltJobService {
}
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
@Scheduled(cron = "0 * * * * *") // 0 0 3 * * *
// @Scheduled(cron = "0 * * * * *") // 0 0 3 * * *
public void findGukYuinEligibleForSurvey() {
if (isLocalProfile()) {
return;
}
// if (isLocalProfile()) {
// return;
// }
List<LearnKeyDto> list =
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
@@ -49,7 +51,12 @@ public class GukYuinApiStbltJobService {
for (LearnKeyDto dto : list) {
try {
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid());
String today =
LocalDate.now(ZoneId.of("Asia/Seoul")).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
// String yesterday =
// LocalDate.now(ZoneId.of("Asia/Seoul")).minusDays(1).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
RlbDtctDto result =
gukYuinApiService.findRlbDtctList(dto.getUid(), today); // todo : test 다 끝내고 어제로 바꿔야 함
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());