Compare commits
3 Commits
2cc490012e
...
3be536424a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3be536424a | |||
| a3b2fd0c73 | |||
| 9b504396bc |
@@ -15,8 +15,8 @@ public class GukYuinPnuCntUpdateJobCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public int updateGukYuinContListPnuUpdateCnt(String uid) {
|
public void updateGukYuinContListPnuUpdateCnt() {
|
||||||
return gukYuinPnuCntUpdateRepository.updateGukYuinContListPnuUpdateCnt(uid);
|
gukYuinPnuCntUpdateRepository.updateGukYuinContListPnuUpdateCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
|||||||
|
|
||||||
public interface GukYuinPnuCntUpdateJobRepositoryCustom {
|
public interface GukYuinPnuCntUpdateJobRepositoryCustom {
|
||||||
|
|
||||||
int updateGukYuinContListPnuUpdateCnt(String uid);
|
void updateGukYuinContListPnuUpdateCnt();
|
||||||
|
|
||||||
void updateGukYuinApplyStatus(String uid, String status);
|
void updateGukYuinApplyStatus(String uid, String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,30 +20,20 @@ public class GukYuinPnuCntUpdateJobRepositoryImpl
|
|||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateGukYuinContListPnuUpdateCnt(String uid) {
|
public void updateGukYuinContListPnuUpdateCnt() {
|
||||||
String sql =
|
String sql =
|
||||||
"""
|
"""
|
||||||
WITH target_geo AS (
|
update tb_map_sheet_anal_data_inference_geom p
|
||||||
SELECT DISTINCT g.geo_uid
|
set pnu = c_count.actual_count
|
||||||
FROM tb_map_sheet_anal_data_inference_geom g
|
from (
|
||||||
JOIN tb_map_sheet_anal_data_inference d ON d.data_uid = g.data_uid
|
select geo_uid, count(*) actual_count
|
||||||
JOIN tb_map_sheet_anal_inference i ON i.anal_uid = d.anal_uid
|
from tb_pnu
|
||||||
JOIN tb_map_sheet_learn l ON l.id = i.learn_id
|
group by geo_uid
|
||||||
WHERE l.uid = ?
|
) c_count
|
||||||
),
|
where p.geo_uid = c_count.geo_uid and p.pnu != c_count.actual_count;
|
||||||
pnu_cnt AS (
|
""";
|
||||||
SELECT p.geo_uid, COUNT(*)::int AS cnt
|
|
||||||
FROM tb_pnu p
|
|
||||||
JOIN target_geo t ON t.geo_uid = p.geo_uid
|
|
||||||
GROUP BY p.geo_uid
|
|
||||||
)
|
|
||||||
UPDATE tb_map_sheet_anal_data_inference_geom geo
|
|
||||||
SET pnu = pnu_cnt.cnt
|
|
||||||
FROM pnu_cnt
|
|
||||||
WHERE geo.geo_uid = pnu_cnt.geo_uid
|
|
||||||
""";
|
|
||||||
|
|
||||||
return jdbcTemplate.update(sql, uid);
|
jdbcTemplate.update(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto;
|
||||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultShpService;
|
import com.kamco.cd.kamcoback.inference.service.InferenceResultShpService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiLabelJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiLabelJobService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuCntUpdateJobService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuJobService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStatusJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStatusJobService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStbltJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStbltJobService;
|
||||||
@@ -50,7 +49,6 @@ public class SchedulerApiController {
|
|||||||
private final MapSheetMngFileJobController mapSheetMngFileJobController;
|
private final MapSheetMngFileJobController mapSheetMngFileJobController;
|
||||||
private final InferenceResultShpService inferenceResultShpService;
|
private final InferenceResultShpService inferenceResultShpService;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
private final GukYuinApiPnuCntUpdateJobService gukYuinApiPnuCntUpdateJobService;
|
|
||||||
|
|
||||||
@Operation(summary = "국유인 탐지객체 조회 PNU 업데이트 스케줄링", description = "국유인 탐지객체 조회 PNU 업데이트 스케줄링")
|
@Operation(summary = "국유인 탐지객체 조회 PNU 업데이트 스케줄링", description = "국유인 탐지객체 조회 PNU 업데이트 스케줄링")
|
||||||
@GetMapping("/gukyuin/pnu")
|
@GetMapping("/gukyuin/pnu")
|
||||||
@@ -62,7 +60,7 @@ public class SchedulerApiController {
|
|||||||
@Operation(summary = "국유인 등록 상태 체크 스케줄링", description = "국유인 등록 상태 체크 스케줄링")
|
@Operation(summary = "국유인 등록 상태 체크 스케줄링", description = "국유인 등록 상태 체크 스케줄링")
|
||||||
@GetMapping("/gukyuin/status")
|
@GetMapping("/gukyuin/status")
|
||||||
public ApiResponseDto<Void> findGukYuinMastCompleteYn() {
|
public ApiResponseDto<Void> findGukYuinMastCompleteYn() {
|
||||||
gukYuinApiStatusJobService.findGukYuinMastCompleteYn();
|
gukYuinApiStatusJobService.findGukYuinPnuCntUpdate();
|
||||||
return ApiResponseDto.ok(null);
|
return ApiResponseDto.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,11 +184,4 @@ public class SchedulerApiController {
|
|||||||
@PathVariable String uid, @PathVariable int updateCnt) {
|
@PathVariable String uid, @PathVariable int updateCnt) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.updateStbltRandomData(uid, updateCnt));
|
return ApiResponseDto.ok(gukYuinApiService.updateStbltRandomData(uid, updateCnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "pnu 연동 이후 pnu cnt, 상태 업데이트", description = "pnu 연동 이후 pnu cnt, 상태 업데이트")
|
|
||||||
@GetMapping("/gukyuin/pnu-cnt/{uid}")
|
|
||||||
public ApiResponseDto<Void> updateGukYuinContListPnuUpdateCnt(@PathVariable String uid) {
|
|
||||||
gukYuinApiPnuCntUpdateJobService.updateGukYuinContListPnuUpdateCnt(uid);
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinPnuCntUpdateJobCoreService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Log4j2
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class GukYuinApiPnuCntUpdateJobService {
|
|
||||||
|
|
||||||
private final GukYuinPnuCntUpdateJobCoreService gukYuinPnuCntUpdateJobCoreService;
|
|
||||||
|
|
||||||
public void updateGukYuinContListPnuUpdateCnt(String uid) {
|
|
||||||
int execCnt = gukYuinPnuCntUpdateJobCoreService.updateGukYuinContListPnuUpdateCnt(uid);
|
|
||||||
|
|
||||||
if (execCnt > 0) {
|
|
||||||
gukYuinPnuCntUpdateJobCoreService.updateGukYuinApplyStatus(
|
|
||||||
uid, GukYuinStatus.PNU_COMPLETED.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
|||||||
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.GukYuinJobCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinPnuCntUpdateJobCoreService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
@@ -18,6 +19,7 @@ public class GukYuinApiStatusJobService {
|
|||||||
|
|
||||||
private final GukYuinJobCoreService gukYuinJobCoreService;
|
private final GukYuinJobCoreService gukYuinJobCoreService;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
private final GukYuinPnuCntUpdateJobCoreService gukYuinPnuCntUpdateJobCoreService;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
@@ -31,12 +33,8 @@ public class GukYuinApiStatusJobService {
|
|||||||
return "local".equalsIgnoreCase(profile);
|
return "local".equalsIgnoreCase(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
/** 매일 00시에 pnu cnt 업데이트 */
|
||||||
// @Scheduled(cron = "0 0/10 * * * *")
|
public void findGukYuinPnuCntUpdate() {
|
||||||
public void findGukYuinMastCompleteYn() {
|
|
||||||
// if (isLocalProfile()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
@@ -59,8 +57,9 @@ public class GukYuinApiStatusJobService {
|
|||||||
Integer progress =
|
Integer progress =
|
||||||
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
||||||
if (progress != null && progress == 100) {
|
if (progress != null && progress == 100) {
|
||||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
gukYuinPnuCntUpdateJobCoreService.updateGukYuinContListPnuUpdateCnt();
|
||||||
dto.getId(), GukYuinStatus.GUK_COMPLETED);
|
gukYuinPnuCntUpdateJobCoreService.updateGukYuinApplyStatus(
|
||||||
|
dto.getUid(), GukYuinStatus.PNU_COMPLETED.getId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
|
|||||||
Reference in New Issue
Block a user