국유인 실태조사 job 에 log 찍기 추가
This commit is contained in:
@@ -562,10 +562,12 @@ public class GukYuinApiService {
|
|||||||
+ "&yyyymmdd="
|
+ "&yyyymmdd="
|
||||||
+ yyyymmdd;
|
+ yyyymmdd;
|
||||||
|
|
||||||
|
log.info("##### API 호출 URL : {}", url);
|
||||||
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
||||||
|
|
||||||
|
log.info("##### API 호출 완료 : {}", result.toString());
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.LIST.getId(),
|
EventType.LIST.getId(),
|
||||||
netUtils.getLocalIP(),
|
netUtils.getLocalIP(),
|
||||||
|
|||||||
@@ -38,24 +38,26 @@ public class GukYuinApiStbltJobService {
|
|||||||
return "local".equalsIgnoreCase(profile);
|
return "local".equalsIgnoreCase(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 3 * * *")
|
|
||||||
public void runTask() {
|
public void runTask() {
|
||||||
findGukYuinEligibleForSurvey(null);
|
findGukYuinEligibleForSurvey(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
||||||
public void findGukYuinEligibleForSurvey(LocalDate baseDate) {
|
public void findGukYuinEligibleForSurvey(LocalDate baseDate) {
|
||||||
// if (isLocalProfile()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
log.info("[Step 1-1] 국유인 연동 PNU 완료된 추론 회차 정보 가져오기 ");
|
||||||
|
log.info(" learn 테이블의 apply_status : {}", GukYuinStatus.PNU_COMPLETED.getId());
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
||||||
GukYuinStatus.PNU_COMPLETED.getId());
|
GukYuinStatus.PNU_COMPLETED.getId());
|
||||||
|
|
||||||
|
log.info("[Step 1-2] 국유인 연동 PNU 완료된 추론 회차 갯수 : {}", list.size());
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
log.info("[Step 1-3] 국유인 연동 PNU 완료된 추론 회차 갯수 없어서 return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("[Step 2-1] 추론 회차 list 로 for문 실행하기 ");
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
String targetDate =
|
String targetDate =
|
||||||
@@ -63,19 +65,30 @@ public class GukYuinApiStbltJobService {
|
|||||||
.minusDays(1)
|
.minusDays(1)
|
||||||
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
|
||||||
|
log.info("[Step 2-2] 실태조사 적합여부 조회 날짜 확인 : {}", targetDate);
|
||||||
if (baseDate != null) { // 파라미터가 있으면
|
if (baseDate != null) { // 파라미터가 있으면
|
||||||
targetDate = baseDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
targetDate = baseDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
log.info("[Step 2-3] 수동호출 baseDate 가 있을 경우, 실태조사 적합여부 조회 날짜 확인 : {}", targetDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("[Step 3-1] 국유인 실태조사 적합여부 API 호출 시작 ");
|
||||||
|
log.info(" === 값 확인 - uid : {}", dto.getUid());
|
||||||
|
log.info(" === 값 확인 - targetDate : {}", targetDate);
|
||||||
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), targetDate, "Y");
|
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), targetDate, "Y");
|
||||||
|
|
||||||
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.info("[GUKYUIN] empty result chnDtctId={}", dto.getUid());
|
||||||
|
log.info("=== 국유인 API 조회 결과 없어서 continue");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("[Step 4-1] 국유인 실태조사 적합여부 result 값으로 데이터 업데이트");
|
||||||
|
log.info(" === 데이터 갯수 : {}", result.getResult().size());
|
||||||
|
|
||||||
for (RlbDtctMastDto stbltDto : result.getResult()) {
|
for (RlbDtctMastDto stbltDto : result.getResult()) {
|
||||||
|
log.info("[Step 4-2] 국유인 실태조사 적합여부 결과 가져오기");
|
||||||
String resultUid = stbltDto.getChnDtctObjtId();
|
String resultUid = stbltDto.getChnDtctObjtId();
|
||||||
|
log.info(" == 테이블 tb_pnu 에 적합여부 리턴 결과를 upsert 진행, 객체 uid : {}", resultUid);
|
||||||
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +103,7 @@ public class GukYuinApiStbltJobService {
|
|||||||
e -> {
|
e -> {
|
||||||
List<RlbDtctMastDto> pnuList = e.getValue();
|
List<RlbDtctMastDto> pnuList = e.getValue();
|
||||||
|
|
||||||
|
log.info("[Step 4-3] 국유인 실태조사 적합여부 업데이트 값을 객체 uid 기준으로 DTO 생성");
|
||||||
boolean hasY = pnuList.stream().anyMatch(v -> "Y".equals(v.getStbltYn()));
|
boolean hasY = pnuList.stream().anyMatch(v -> "Y".equals(v.getStbltYn()));
|
||||||
|
|
||||||
String fitYn = hasY ? "Y" : "N";
|
String fitYn = hasY ? "Y" : "N";
|
||||||
@@ -105,7 +119,9 @@ public class GukYuinApiStbltJobService {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
|
log.info(" === selected DTO : {}", selected);
|
||||||
if (selected == null) {
|
if (selected == null) {
|
||||||
|
log.info(" === selected NULL");
|
||||||
return null; // 방어 코드
|
return null; // 방어 코드
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,10 +129,11 @@ public class GukYuinApiStbltJobService {
|
|||||||
fitYn, selected.getIncyCd(), selected.getIncyRsnCont());
|
fitYn, selected.getIncyCd(), selected.getIncyRsnCont());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
log.info("[Step 4-4] 국유인 실태조사 적합여부, 사유, 내용을 inference_geom 테이블에 update");
|
||||||
resultMap.forEach(gukYuinStbltJobCoreService::updateGukYuinObjectStbltYn);
|
resultMap.forEach(gukYuinStbltJobCoreService::updateGukYuinObjectStbltYn);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user