국유인 API 수정 추가 #51
@@ -305,8 +305,10 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
||||||
@PathVariable String chnDtctId) {
|
@PathVariable String chnDtctId,
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId));
|
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
||||||
|
String yyyymmdd) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId) {
|
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId, String yyyymmdd) {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
gukyuinCdiUrl
|
gukyuinCdiUrl
|
||||||
@@ -527,7 +527,9 @@ public class GukYuinApiService {
|
|||||||
+ "?reqIp="
|
+ "?reqIp="
|
||||||
+ myip
|
+ myip
|
||||||
+ "&reqEpno="
|
+ "&reqEpno="
|
||||||
+ userUtil.getEmployeeNo();
|
+ userUtil.getEmployeeNo()
|
||||||
|
+ "&yyyymmdd="
|
||||||
|
+ yyyymmdd;
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
|
|||||||
@@ -30,13 +30,19 @@ public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryC
|
|||||||
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
ZoneId zone = ZoneId.of("Asia/Seoul");
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime tomorrowStart = todayStart.plusDays(1);
|
||||||
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
// BooleanExpression isYesterday =
|
||||||
|
// labelingAssignmentEntity
|
||||||
|
// .inspectStatDttm
|
||||||
|
// .goe(yesterdayStart)
|
||||||
|
// .and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
BooleanExpression isYesterday =
|
BooleanExpression isYesterday =
|
||||||
labelingAssignmentEntity
|
labelingAssignmentEntity
|
||||||
.inspectStatDttm
|
.inspectStatDttm
|
||||||
.goe(yesterdayStart)
|
.goe(todayStart)
|
||||||
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(tomorrowStart));
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
|
|||||||
@@ -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.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
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.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
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 com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@@ -64,54 +66,21 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
|
|||||||
PnuEntity pnuEt =
|
PnuEntity pnuEt =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(pnuEntity)
|
.selectFrom(pnuEntity)
|
||||||
.where(pnuEntity.pnu.eq(stbltDto.getPnu()), pnuEntity.chnDtctObjtId.eq(resultUid))
|
.where(pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
.fetchOne();
|
.fetchFirst();
|
||||||
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();
|
|
||||||
|
|
||||||
// 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
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@@ -32,11 +31,11 @@ public class GukYuinApiLabelJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
||||||
@Scheduled(cron = "0 0 2 * * *")
|
// @Scheduled(cron = "0 0 2 * * *")
|
||||||
public void findLabelingCompleteSend() {
|
public void findLabelingCompleteSend() {
|
||||||
if (isLocalProfile()) {
|
// if (isLocalProfile()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<GeomUidDto> list = gukYuinLabelJobCoreService.findYesterdayLabelingCompleteList();
|
List<GeomUidDto> list = gukYuinLabelJobCoreService.findYesterdayLabelingCompleteList();
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
@@ -44,7 +43,7 @@ public class GukYuinApiLabelJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (GeomUidDto gto : list) {
|
for (GeomUidDto gto : list) {
|
||||||
ChngDetectContDto.ResultPnuDto dto =
|
ChngDetectContDto.ResultLabelDto dto =
|
||||||
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
|
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
|
||||||
if (dto.getSuccess()) {
|
if (dto.getSuccess()) {
|
||||||
// inference_geom 에 label_send_dttm 업데이트 하기
|
// inference_geom 에 label_send_dttm 업데이트 하기
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.List;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@@ -36,11 +35,11 @@ public class GukYuinApiPnuJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 등록 완료 후, 탐지객체 조회해서 PNU 업데이트 하는 스케줄링 하루 1번 새벽 1시에 실행 */
|
/** 국유인 등록 완료 후, 탐지객체 조회해서 PNU 업데이트 하는 스케줄링 하루 1번 새벽 1시에 실행 */
|
||||||
@Scheduled(cron = "0 * * * * *") // 0 0 1 * * *
|
// @Scheduled(cron = "0 0/10 * * * *") // 0 0 1 * * *
|
||||||
public void findGukYuinContListPnuUpdate() {
|
public void findGukYuinContListPnuUpdate() {
|
||||||
if (isLocalProfile()) {
|
// if (isLocalProfile()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinPnuJobCoreService.findGukyuinApplyStatusUidList(
|
gukYuinPnuJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.List;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@@ -33,11 +32,11 @@ public class GukYuinApiStatusJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
||||||
@Scheduled(cron = "0 0/10 * * * *") // 0 0/10 * * * *
|
// @Scheduled(cron = "0 0/10 * * * *") // 0 0/10 * * * *
|
||||||
public void findGukYuinMastCompleteYn() {
|
public void findGukYuinMastCompleteYn() {
|
||||||
if (isLocalProfile()) {
|
// if (isLocalProfile()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
|
|||||||
@@ -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.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinStbltJobCoreService;
|
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 java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@@ -34,11 +36,11 @@ public class GukYuinApiStbltJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
||||||
@Scheduled(cron = "0 * * * * *") // 0 0 3 * * *
|
// @Scheduled(cron = "0 * * * * *") // 0 0 3 * * *
|
||||||
public void findGukYuinEligibleForSurvey() {
|
public void findGukYuinEligibleForSurvey() {
|
||||||
if (isLocalProfile()) {
|
// if (isLocalProfile()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
||||||
@@ -49,7 +51,12 @@ public class GukYuinApiStbltJobService {
|
|||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
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()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
|
|||||||
Reference in New Issue
Block a user