feat/infer_dev_260107 #17
@@ -1,6 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin;
|
package com.kamco.cd.kamcoback.gukyuin;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
@@ -51,7 +52,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/chn/mast/regist")
|
@PostMapping("/chn/mast/regist")
|
||||||
public ApiResponseDto<ChngDetectMastDto.Basic> regist(
|
public ApiResponseDto<ChngDetectMastDto.RegistResDto> regist(
|
||||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.regist(chnDetectMastReq));
|
return ApiResponseDto.ok(gukYuinApiService.regist(chnDetectMastReq));
|
||||||
}
|
}
|
||||||
@@ -133,9 +134,9 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
public ApiResponseDto<ChngDetectMastDto.ResultDto> selectChangeDetectionList(
|
public ApiResponseDto<ChngDetectMastDto.ResultDto> selectChangeDetectionDetail(
|
||||||
@PathVariable String chnDtctMstId) {
|
@PathVariable String chnDtctMstId) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.list(chnDtctMstId));
|
return ApiResponseDto.ok(gukYuinApiService.detail(chnDtctMstId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "국유in연동 가능여부 확인", description = "국유in연동 가능여부 확인")
|
@Operation(summary = "국유in연동 가능여부 확인", description = "국유in연동 가능여부 확인")
|
||||||
@@ -239,4 +240,13 @@ public class GukYuinApiController {
|
|||||||
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "국유in연동 등록", description = "국유in연동 등록")
|
||||||
|
@GetMapping("/mast/reg/{uuid}")
|
||||||
|
public ApiResponseDto<ResponseObj> connectChnMastRegist(
|
||||||
|
@Parameter(description = "uuid", example = "7a593d0e-76a8-4b50-8978-9af1fbe871af")
|
||||||
|
@PathVariable
|
||||||
|
UUID uuid) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.connectChnMastRegist(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,13 +66,30 @@ public class ChngDetectMastDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class ChnDetectMastReqDto {
|
public static class ChnDetectMastReqDto {
|
||||||
|
|
||||||
private String cprsYr; // 비교년도 2023
|
@Schema(description = "비교년도", example = "2023")
|
||||||
private String crtrYr; // 기준년도 2024
|
private String cprsYr;
|
||||||
private String chnDtctSno; // 차수 (1 | 2 | ...)
|
|
||||||
private String chnDtctId; // 탐지아이디. UUID를 기반으로 '-'를 제거하고 대문자/숫자로 구성
|
@Schema(description = "기준년도", example = "2024")
|
||||||
private String pathNm; // 탐지결과 절대경로명 /kamco_nas/export/{chnDtctId}
|
private String crtrYr;
|
||||||
private String reqEpno; // 사원번호
|
|
||||||
private String reqIp; // 사원아이피
|
@Schema(description = "차수", example = "1")
|
||||||
|
private String chnDtctSno;
|
||||||
|
|
||||||
|
@Schema(
|
||||||
|
description = "탐지아이디, UUID를 기반으로 '-'를 제거하고 대문자/숫자로 구성",
|
||||||
|
example = "D5F192EC76D34F6592035BE63A84F591")
|
||||||
|
private String chnDtctId;
|
||||||
|
|
||||||
|
@Schema(
|
||||||
|
description = "탐지결과 절대경로명 /kamco_nas/export/{chnDtctId}",
|
||||||
|
example = "/kamco-nfs/dataset/export/D5F192EC76D34F6592035BE63A84F591")
|
||||||
|
private String pathNm;
|
||||||
|
|
||||||
|
@Schema(description = "사원번호", example = "123456")
|
||||||
|
private String reqEpno;
|
||||||
|
|
||||||
|
@Schema(description = "사원아이피", example = "127.0.0.1")
|
||||||
|
private String reqIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -158,4 +175,29 @@ public class ChngDetectMastDto {
|
|||||||
private List<Basic> result;
|
private List<Basic> result;
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(name = "RegistResDto", description = "reg 등록 후 리턴 형태")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RegistResDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private Basic result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "LearnKeyDto", description = "learn 엔티티 key 정보")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class LearnKeyDto {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String uid;
|
||||||
|
private String chnDtctMstId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin.dto;
|
package com.kamco.cd.kamcoback.gukyuin.dto;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class GukYuinDto {
|
public class GukYuinDto {
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public static class GukYuinLinkableRes {
|
|
||||||
|
|
||||||
private boolean linkable;
|
|
||||||
// private GukYuinLinkFailCode code;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 실패 코드 enum */
|
/** 실패 코드 enum */
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -39,10 +31,33 @@ public class GukYuinDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class GukYuinLinkableRes {
|
||||||
|
|
||||||
|
private boolean linkable;
|
||||||
|
// private GukYuinLinkFailCode code;
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
|
|
||||||
// Repository가 반환할 Fact(조회 결과)
|
// Repository가 반환할 Fact(조회 결과)
|
||||||
public record GukYuinLinkFacts(
|
public record GukYuinLinkFacts(
|
||||||
boolean existsLearn,
|
boolean existsLearn,
|
||||||
boolean isPartScope,
|
boolean isPartScope,
|
||||||
boolean hasRunningInference,
|
boolean hasRunningInference,
|
||||||
boolean hasOtherUnfinishedGukYuin) {}
|
boolean hasOtherUnfinishedGukYuin) {}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class LearnInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private UUID uuid;
|
||||||
|
private Integer compareYyyy;
|
||||||
|
private Integer targetYyyy;
|
||||||
|
private Integer stage;
|
||||||
|
private String uid;
|
||||||
|
private String applyStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public enum GukYuinStatus implements EnumType {
|
|||||||
IN_PROGRESS("진행중"),
|
IN_PROGRESS("진행중"),
|
||||||
GUK_COMPLETED("국유인 매핑 완료"),
|
GUK_COMPLETED("국유인 매핑 완료"),
|
||||||
PNU_COMPLETED("PNU 싱크 완료"),
|
PNU_COMPLETED("PNU 싱크 완료"),
|
||||||
|
PNU_FAILED("PNU 싱크 중 에러"),
|
||||||
CANCELED("취소");
|
CANCELED("취소");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin.service;
|
package com.kamco.cd.kamcoback.gukyuin.service;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
@@ -8,22 +12,31 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Transactional(readOnly = true)
|
@Transactional
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GukYuinApiService {
|
public class GukYuinApiService {
|
||||||
|
|
||||||
@@ -31,6 +44,9 @@ public class GukYuinApiService {
|
|||||||
private final ExternalHttpClient externalHttpClient;
|
private final ExternalHttpClient externalHttpClient;
|
||||||
private final NetUtils netUtils = new NetUtils();
|
private final NetUtils netUtils = new NetUtils();
|
||||||
|
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
|
||||||
@Value("${spring.profiles.active:local}")
|
@Value("${spring.profiles.active:local}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
@@ -41,25 +57,42 @@ public class GukYuinApiService {
|
|||||||
private String gukyuinCdiUrl;
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.Basic regist(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
public ChngDetectMastDto.RegistResDto regist(
|
||||||
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
String myip = netUtils.getLocalIP();
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno("1234567"); // TODO
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
ExternalCallResult<ChngDetectMastDto.RegistResDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectMastDto.Basic.class);
|
ChngDetectMastDto.RegistResDto.class);
|
||||||
|
|
||||||
ChngDetectMastDto.Basic resultBody = result.body();
|
ChngDetectMastDto.RegistResDto resultBody = result.body();
|
||||||
gukyuinCoreService.updateGukYuinMastRegResult(resultBody);
|
Boolean success = null;
|
||||||
|
if (resultBody != null) {
|
||||||
|
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
||||||
|
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
||||||
|
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
||||||
|
|
||||||
|
// anal_inference 에도 국유인 반영여부, applyDttm 업데이트
|
||||||
|
gukyuinCoreService.updateAnalInferenceApplyDttm(registRes);
|
||||||
|
success = resultBody.getSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.ADDED.getId(),
|
||||||
|
myip,
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
chnDetectMastReq,
|
||||||
|
success);
|
||||||
return resultBody;
|
return resultBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +102,7 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
String myip = netUtils.getLocalIP();
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno("1234567"); // TODO
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -82,11 +115,18 @@ public class GukYuinApiService {
|
|||||||
ChngDetectMastDto.Basic resultBody = result.body();
|
ChngDetectMastDto.Basic resultBody = result.body();
|
||||||
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
|
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.REMOVE.getId(),
|
||||||
|
myip,
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
chnDetectMastReq,
|
||||||
|
true); // TODO : successFail 여부
|
||||||
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
|
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 등록목록 1개 확인
|
// 등록목록 1개 확인
|
||||||
public ChngDetectMastDto.ResultDto list(String chnDtctMstId) {
|
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
||||||
|
|
||||||
@@ -94,6 +134,13 @@ public class GukYuinApiService {
|
|||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +155,13 @@ public class GukYuinApiService {
|
|||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,6 +242,14 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
|
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +264,14 @@ public class GukYuinApiService {
|
|||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectContDto.ResultPnuDto.class);
|
ChngDetectContDto.ResultPnuDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
|
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +288,14 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
ChngDetectContDto.ResultPnuDto dto = result.body();
|
ChngDetectContDto.ResultPnuDto dto = result.body();
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.MODIFIED.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
|
|
||||||
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
|
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +310,13 @@ public class GukYuinApiService {
|
|||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectContDto.ResultContDto.class);
|
ChngDetectContDto.ResultContDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +327,70 @@ public class GukYuinApiService {
|
|||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
|
|
||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
|
||||||
|
public void insertGukyuinAuditLog(
|
||||||
|
String actionType,
|
||||||
|
String myIp,
|
||||||
|
Long userUid,
|
||||||
|
String requestUri,
|
||||||
|
Object requestBody,
|
||||||
|
boolean successFail) {
|
||||||
|
try {
|
||||||
|
AuditLogEntity log =
|
||||||
|
new AuditLogEntity(
|
||||||
|
userUid,
|
||||||
|
EventType.fromName(actionType),
|
||||||
|
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
|
||||||
|
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
|
||||||
|
myIp,
|
||||||
|
requestUri,
|
||||||
|
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
auditLogRepository.save(log);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseObj connectChnMastRegist(UUID uuid) {
|
||||||
|
// uuid로 추론 회차 조회
|
||||||
|
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
|
||||||
|
// if (info.getApplyStatus() != null &&
|
||||||
|
// !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId()))
|
||||||
|
// {
|
||||||
|
// return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 추론 회차입니다.");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
|
||||||
|
Integer maxStage =
|
||||||
|
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
|
||||||
|
|
||||||
|
// reqDto 셋팅
|
||||||
|
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
|
||||||
|
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
|
||||||
|
reqDto.setCrtrYr(String.valueOf(info.getTargetYyyy()));
|
||||||
|
reqDto.setChnDtctSno(String.valueOf(maxStage + 1));
|
||||||
|
reqDto.setChnDtctId(info.getUid());
|
||||||
|
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
||||||
|
|
||||||
|
// 국유인 /chn/mast/regist 전송
|
||||||
|
this.regist(reqDto);
|
||||||
|
|
||||||
|
return new ResponseObj(ApiResponseCode.OK, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.core;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -44,4 +45,16 @@ public class GukYuinCoreService {
|
|||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList);
|
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
|
return gukYuinRepository.findMapSheetLearnInfo(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
return gukYuinRepository.findMapSheetLearnYearStage(compareYyyy, targetYyyy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
gukYuinRepository.updateAnalInferenceApplyDttm(registRes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -13,11 +15,15 @@ public class GukYuinJobCoreService {
|
|||||||
this.gukYuinRepository = gukYuinRepository;
|
this.gukYuinRepository = gukYuinRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> findGukyuinApplyIngUidList() {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
return gukYuinRepository.findGukyuinApplyIngUidList();
|
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGukYuinApplyStateComplete(String uid) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus gukYuinStatus) {
|
||||||
gukYuinRepository.updateGukYuinApplyStateComplete(uid);
|
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
gukYuinRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,6 +199,9 @@ public class MapSheetLearnEntity {
|
|||||||
@Column(name = "total_jobs")
|
@Column(name = "total_jobs")
|
||||||
private Long totalJobs;
|
private Long totalJobs;
|
||||||
|
|
||||||
|
@Column(name = "chn_dtct_mst_id")
|
||||||
|
private String chnDtctMstId;
|
||||||
|
|
||||||
public InferenceResultDto.ResultList toDto() {
|
public InferenceResultDto.ResultList toDto() {
|
||||||
return new InferenceResultDto.ResultList(
|
return new InferenceResultDto.ResultList(
|
||||||
this.uuid,
|
this.uuid,
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface GukYuinRepositoryCustom {
|
public interface GukYuinRepositoryCustom {
|
||||||
|
|
||||||
@@ -15,7 +19,15 @@ public interface GukYuinRepositoryCustom {
|
|||||||
|
|
||||||
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
||||||
|
|
||||||
List<String> findGukyuinApplyIngUidList();
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
void updateGukYuinApplyStateComplete(String uid);
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus gukYuinStatus);
|
||||||
|
|
||||||
|
void upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
|
||||||
|
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
||||||
|
|
||||||
|
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
|
void updateAnalInferenceApplyDttm(Basic registRes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
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.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
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 jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -37,6 +44,7 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.set(mapSheetLearnEntity.stage, stage)
|
.set(mapSheetLearnEntity.stage, stage)
|
||||||
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -81,22 +89,103 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> findGukyuinApplyIngUidList() {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus status) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetLearnEntity.uid)
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(mapSheetLearnEntity.applyStatus.eq(GukYuinStatus.IN_PROGRESS.getId()))
|
.where(mapSheetLearnEntity.applyStatus.eq(status.getId()))
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
public void upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
public void updateGukYuinApplyStateComplete(String uid) {
|
long length = pnuList.length;
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetLearnEntity)
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.PNU_COMPLETED.getId())
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
.where(mapSheetLearnEntity.uid.eq(uid))
|
.execute();
|
||||||
|
|
||||||
|
Long geoUid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnuList[i], ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnInfo.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uuid,
|
||||||
|
mapSheetLearnEntity.compareYyyy,
|
||||||
|
mapSheetLearnEntity.targetYyyy,
|
||||||
|
mapSheetLearnEntity.stage,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.applyStatus))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
NumberExpression<Integer> stageExpr =
|
||||||
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(stageExpr.max())
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.applyStatus.isNotNull(),
|
||||||
|
mapSheetLearnEntity.applyStatus.ne(GukYuinStatus.PENDING.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
Long learnId =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(registRes.getChnDtctId()))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(id))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
|
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;
|
||||||
|
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.ChngDetectMastDto.ResultDto;
|
||||||
|
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 java.util.List;
|
import java.util.List;
|
||||||
@@ -31,23 +35,24 @@ public class GukYuinApiJobService {
|
|||||||
return "local".equalsIgnoreCase(profile);
|
return "local".equalsIgnoreCase(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/10 * * * *")
|
@Scheduled(cron = "0 * * * * *") // 0 0/10 * * * *
|
||||||
public void findGukYuinMastCompleteYn() {
|
public void findGukYuinMastCompleteYn() {
|
||||||
if (isLocalProfile()) {
|
// if (isLocalProfile()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<String> list = gukYuinJobCoreService.findGukyuinApplyIngUidList();
|
List<LearnKeyDto> list =
|
||||||
|
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.IN_PROGRESS);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String uid : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
ResultDto result = gukYuinApiService.listChnDtctId(uid);
|
ResultDto result = gukYuinApiService.detail(dto.getChnDtctMstId());
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result uid={}", uid);
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,10 +61,11 @@ public class GukYuinApiJobService {
|
|||||||
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(uid);
|
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.GUK_COMPLETED);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", uid, e);
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,5 +75,62 @@ public class GukYuinApiJobService {
|
|||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<LearnKeyDto> list =
|
||||||
|
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.GUK_COMPLETED);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (LearnKeyDto dto : list) {
|
||||||
|
try {
|
||||||
|
processUid(dto.getChnDtctMstId(), dto.getUid());
|
||||||
|
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
||||||
|
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.PNU_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processUid(String chnDtctMstId, String uid) {
|
||||||
|
ResultDto result = gukYuinApiService.detail(chnDtctMstId);
|
||||||
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
||||||
|
String chnDtctCnt = basic.getChnDtctCnt();
|
||||||
|
if (chnDtctCnt == null || chnDtctCnt.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// page 계산
|
||||||
|
int pageSize = 100;
|
||||||
|
int totalCount = Integer.parseInt(chnDtctCnt);
|
||||||
|
int totalPages = (totalCount + pageSize - 1) / pageSize;
|
||||||
|
|
||||||
|
for (int page = 0; page < totalPages; page++) {
|
||||||
|
processPage(uid, page, pageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPage(String uid, int page, int pageSize) {
|
||||||
|
ResultContDto cont = gukYuinApiService.findChnContList(uid, page, pageSize);
|
||||||
|
if (cont == null || cont.getResult().isEmpty()) {
|
||||||
|
return; // 외부 API 이상 방어
|
||||||
|
}
|
||||||
|
|
||||||
|
// pnuList 업데이트
|
||||||
|
for (ChngDetectContDto.ContBasic contBasic : cont.getResult()) {
|
||||||
|
if (contBasic.getPnuList() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gukYuinJobCoreService.upsertMapSheetDataAnalGeomPnu(
|
||||||
|
contBasic.getChnDtctObjtId(), contBasic.getPnuList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user