국유인 어제완료된 라벨전송, 전송완료된 리스트 기능 추가
This commit is contained in:
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
||||
@@ -35,14 +36,16 @@ public class GukYuinApiJobService {
|
||||
return "local".equalsIgnoreCase(profile);
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 * * * * *") // 0 0/10 * * * *
|
||||
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
||||
@Scheduled(cron = "0 0/10 * * * *")
|
||||
public void findGukYuinMastCompleteYn() {
|
||||
// if (isLocalProfile()) {
|
||||
// return;
|
||||
// }
|
||||
if (isLocalProfile()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<LearnKeyDto> list =
|
||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.IN_PROGRESS);
|
||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
||||
List.of(GukYuinStatus.IN_PROGRESS.getId()));
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -70,6 +73,7 @@ public class GukYuinApiJobService {
|
||||
}
|
||||
}
|
||||
|
||||
/** 국유인 등록 완료 후, 탐지객체 조회해서 PNU 업데이트 하는 스케줄링 하루 1번 새벽 1시에 실행 */
|
||||
@Scheduled(cron = "0 0 1 * * *")
|
||||
public void findGukYuinContListPnuUpdate() {
|
||||
if (isLocalProfile()) {
|
||||
@@ -77,16 +81,22 @@ public class GukYuinApiJobService {
|
||||
}
|
||||
|
||||
List<LearnKeyDto> list =
|
||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.GUK_COMPLETED);
|
||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
||||
List.of(GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_FAILED.getId()));
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (LearnKeyDto dto : list) {
|
||||
try {
|
||||
processUid(dto.getChnDtctMstId(), dto.getUid());
|
||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
||||
long succCnt = processUid(dto.getChnDtctMstId(), dto.getUid());
|
||||
if (succCnt > 0) {
|
||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
||||
} else {
|
||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||
dto.getId(), GukYuinStatus.PNU_FAILED);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||
@@ -95,16 +105,17 @@ public class GukYuinApiJobService {
|
||||
}
|
||||
}
|
||||
|
||||
private void processUid(String chnDtctMstId, String uid) {
|
||||
private long processUid(String chnDtctMstId, String uid) {
|
||||
long succCnt = 0;
|
||||
ResultDto result = gukYuinApiService.detail(chnDtctMstId);
|
||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||
return;
|
||||
return succCnt;
|
||||
}
|
||||
|
||||
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
||||
String chnDtctCnt = basic.getChnDtctCnt();
|
||||
if (chnDtctCnt == null || chnDtctCnt.isEmpty()) {
|
||||
return;
|
||||
return succCnt;
|
||||
}
|
||||
|
||||
// page 계산
|
||||
@@ -113,24 +124,49 @@ public class GukYuinApiJobService {
|
||||
int totalPages = (totalCount + pageSize - 1) / pageSize;
|
||||
|
||||
for (int page = 0; page < totalPages; page++) {
|
||||
processPage(uid, page, pageSize);
|
||||
succCnt += processPage(uid, page, pageSize);
|
||||
}
|
||||
|
||||
return succCnt;
|
||||
}
|
||||
|
||||
private void processPage(String uid, int page, int pageSize) {
|
||||
private long processPage(String uid, int page, int pageSize) {
|
||||
long result = 0;
|
||||
ResultContDto cont = gukYuinApiService.findChnContList(uid, page, pageSize);
|
||||
if (cont == null || cont.getResult().isEmpty()) {
|
||||
return; // 외부 API 이상 방어
|
||||
return result; // 외부 API 이상 방어
|
||||
}
|
||||
|
||||
// pnuList 업데이트
|
||||
|
||||
for (ChngDetectContDto.ContBasic contBasic : cont.getResult()) {
|
||||
if (contBasic.getPnuList() == null) {
|
||||
return;
|
||||
if (contBasic.getPnuList() == null || contBasic.getChnDtctObjtId() == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
gukYuinJobCoreService.upsertMapSheetDataAnalGeomPnu(
|
||||
contBasic.getChnDtctObjtId(), contBasic.getPnuList());
|
||||
long upsertCnt =
|
||||
gukYuinJobCoreService.upsertMapSheetDataAnalGeomPnu(
|
||||
contBasic.getChnDtctObjtId(), contBasic.getPnuList());
|
||||
result += upsertCnt;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
||||
@Scheduled(cron = "0 0 1 * * *")
|
||||
public void findLabelingCompleteSend() {
|
||||
|
||||
List<GeomUidDto> list = gukYuinJobCoreService.findYesterdayLabelingCompleteList();
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (GeomUidDto dto : list) {
|
||||
gukYuinApiService.updateChnDtctObjtLabelingYn(dto.getResultUid(), "Y");
|
||||
|
||||
// inference_geom 에 label_send_dttm 업데이트 하기
|
||||
gukYuinJobCoreService.updateAnalDataInferenceGeomSendDttm(dto.getGeoUid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user