Merge pull request 'feat/infer_dev_260107' (#17) from feat/infer_dev_260107 into develop
Reviewed-on: #17
This commit was merged in pull request #17.
This commit is contained in:
@@ -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연동 등록")
|
||||||
|
@PostMapping("/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 = false;
|
||||||
|
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, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,4 +408,9 @@ public class LayerDto {
|
|||||||
@Schema(description = "노출여부 true, false", example = "true")
|
@Schema(description = "노출여부 true, false", example = "true")
|
||||||
private Boolean isMapYn;
|
private Boolean isMapYn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MapType {
|
||||||
|
CHANGE_MAP,
|
||||||
|
LABELING_MAP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,171 +2,46 @@ package com.kamco.cd.kamcoback.layer.dto;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/** WMS 레이어 정보를 담는 DTO 클래스 */
|
/** WMS 레이어 정보를 담는 DTO 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class WmsLayerInfo {
|
public class WmsLayerInfo {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String title;
|
private String title;
|
||||||
private String abstractText;
|
private String abstractText;
|
||||||
private List<String> keywords;
|
|
||||||
|
private List<String> keywords = new ArrayList<>();
|
||||||
private BoundingBox boundingBox;
|
private BoundingBox boundingBox;
|
||||||
private List<String> crs; // 지원하는 좌표계 목록
|
|
||||||
|
|
||||||
@Override
|
/** 지원하는 좌표계 목록 */
|
||||||
public String toString() {
|
private List<String> crs = new ArrayList<>();
|
||||||
return "WmsLayerInfo{"
|
|
||||||
+ "name='"
|
|
||||||
+ name
|
|
||||||
+ '\''
|
|
||||||
+ ", title='"
|
|
||||||
+ title
|
|
||||||
+ '\''
|
|
||||||
+ ", abstractText='"
|
|
||||||
+ abstractText
|
|
||||||
+ '\''
|
|
||||||
+ ", keywords="
|
|
||||||
+ keywords
|
|
||||||
+ ", boundingBox="
|
|
||||||
+ boundingBox
|
|
||||||
+ ", crs="
|
|
||||||
+ crs
|
|
||||||
+ '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public WmsLayerInfo() {
|
/* ===== convenience methods ===== */
|
||||||
this.keywords = new ArrayList<>();
|
|
||||||
this.crs = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAbstractText() {
|
|
||||||
return abstractText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAbstractText(String abstractText) {
|
|
||||||
this.abstractText = abstractText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getKeywords() {
|
|
||||||
return keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeywords(List<String> keywords) {
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addKeyword(String keyword) {
|
public void addKeyword(String keyword) {
|
||||||
this.keywords.add(keyword);
|
this.keywords.add(keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getBoundingBox() {
|
|
||||||
return boundingBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBoundingBox(BoundingBox boundingBox) {
|
|
||||||
this.boundingBox = boundingBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getCrs() {
|
|
||||||
return crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCrs(List<String> crs) {
|
|
||||||
this.crs = crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCrs(String crsValue) {
|
public void addCrs(String crsValue) {
|
||||||
this.crs.add(crsValue);
|
this.crs.add(crsValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** BoundingBox 정보를 담는 내부 클래스 */
|
/** BoundingBox 정보를 담는 내부 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public static class BoundingBox {
|
public static class BoundingBox {
|
||||||
|
|
||||||
private String crs;
|
private String crs;
|
||||||
private double minX;
|
private double minX;
|
||||||
private double minY;
|
private double minY;
|
||||||
private double maxX;
|
private double maxX;
|
||||||
private double maxY;
|
private double maxY;
|
||||||
|
|
||||||
public BoundingBox(String crs, double minX, double minY, double maxX, double maxY) {
|
|
||||||
this.crs = crs;
|
|
||||||
this.minX = minX;
|
|
||||||
this.minY = minY;
|
|
||||||
this.maxX = maxX;
|
|
||||||
this.maxY = maxY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getCrs() {
|
|
||||||
return crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCrs(String crs) {
|
|
||||||
this.crs = crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMinX() {
|
|
||||||
return minX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinX(double minX) {
|
|
||||||
this.minX = minX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMinY() {
|
|
||||||
return minY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinY(double minY) {
|
|
||||||
this.minY = minY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMaxX() {
|
|
||||||
return maxX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxX(double maxX) {
|
|
||||||
this.maxX = maxX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMaxY() {
|
|
||||||
return maxY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxY(double maxY) {
|
|
||||||
this.maxY = maxY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BoundingBox{"
|
|
||||||
+ "crs='"
|
|
||||||
+ crs
|
|
||||||
+ '\''
|
|
||||||
+ ", minX="
|
|
||||||
+ minX
|
|
||||||
+ ", minY="
|
|
||||||
+ minY
|
|
||||||
+ ", maxX="
|
|
||||||
+ maxX
|
|
||||||
+ ", maxY="
|
|
||||||
+ maxY
|
|
||||||
+ '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,70 +1,48 @@
|
|||||||
package com.kamco.cd.kamcoback.layer.dto;
|
package com.kamco.cd.kamcoback.layer.dto;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/** WMTS 레이어 정보를 담는 DTO 클래스 */
|
/** WMTS 레이어 정보를 담는 DTO 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class WmtsLayerInfo {
|
public class WmtsLayerInfo {
|
||||||
|
|
||||||
public String identifier;
|
private String identifier;
|
||||||
public String title;
|
private String title;
|
||||||
public String abstractText;
|
private String abstractText;
|
||||||
public List<String> keywords = new ArrayList<>();
|
|
||||||
public BoundingBox boundingBox;
|
|
||||||
public List<String> formats = new ArrayList<>();
|
|
||||||
public List<String> tileMatrixSetLinks = new ArrayList<>();
|
|
||||||
public List<ResourceUrl> resourceUrls = new ArrayList<>();
|
|
||||||
public List<Style> styles = new ArrayList<>();
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
private List<String> keywords = new ArrayList<>();
|
||||||
this.title = title;
|
private BoundingBox boundingBox;
|
||||||
|
|
||||||
|
private List<String> formats = new ArrayList<>();
|
||||||
|
private List<TileMatrixSetLink> tileMatrixSetLinks = new ArrayList<>();
|
||||||
|
private List<ResourceUrl> resourceUrls = new ArrayList<>();
|
||||||
|
private List<Style> styles = new ArrayList<>();
|
||||||
|
|
||||||
|
// add (2025-01-30)
|
||||||
|
private List<String> matrixIds = new ArrayList<>();
|
||||||
|
private String workspace;
|
||||||
|
|
||||||
|
/* ===== convenience methods ===== */
|
||||||
|
|
||||||
|
public void addMatrixId(String matrixId) {
|
||||||
|
this.matrixIds.add(matrixId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAbstractText(String abstractText) {
|
public void addKeyword(String keyword) {
|
||||||
this.abstractText = abstractText;
|
this.keywords.add(keyword);
|
||||||
}
|
|
||||||
|
|
||||||
public void setBoundingBox(BoundingBox boundingBox) {
|
|
||||||
this.boundingBox = boundingBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "WmtsLayerInfo{"
|
|
||||||
+ "identifier='"
|
|
||||||
+ identifier
|
|
||||||
+ '\''
|
|
||||||
+ ", title='"
|
|
||||||
+ title
|
|
||||||
+ '\''
|
|
||||||
+ ", abstractText='"
|
|
||||||
+ abstractText
|
|
||||||
+ '\''
|
|
||||||
+ ", keywords="
|
|
||||||
+ keywords
|
|
||||||
+ ", boundingBox="
|
|
||||||
+ boundingBox
|
|
||||||
+ ", formats="
|
|
||||||
+ formats
|
|
||||||
+ ", tileMatrixSetLinks="
|
|
||||||
+ tileMatrixSetLinks
|
|
||||||
+ ", resourceUrls="
|
|
||||||
+ resourceUrls
|
|
||||||
+ ", styles="
|
|
||||||
+ styles
|
|
||||||
+ '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addKeyword(String keywowrd) {
|
|
||||||
this.keywords.add(keywowrd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFormat(String format) {
|
public void addFormat(String format) {
|
||||||
this.formats.add(format);
|
this.formats.add(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTileMatrixSetLink(String tileMatrixSetLink) {
|
public void addTileMatrixSetLink(TileMatrixSetLink tileMatrixSetLink) {
|
||||||
this.tileMatrixSetLinks.add(tileMatrixSetLink);
|
this.tileMatrixSetLinks.add(tileMatrixSetLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,200 +55,47 @@ public class WmtsLayerInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** BoundingBox 정보를 담는 내부 클래스 */
|
/** BoundingBox 정보를 담는 내부 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public static class BoundingBox {
|
public static class BoundingBox {
|
||||||
|
private String crs;
|
||||||
public String crs;
|
private double lowerCornerX;
|
||||||
public double lowerCornerX;
|
private double lowerCornerY;
|
||||||
public double lowerCornerY;
|
private double upperCornerX;
|
||||||
public double upperCornerX;
|
private double upperCornerY;
|
||||||
public double upperCornerY;
|
|
||||||
|
|
||||||
public BoundingBox() {}
|
|
||||||
|
|
||||||
public BoundingBox(
|
|
||||||
String crs,
|
|
||||||
double lowerCornerX,
|
|
||||||
double lowerCornerY,
|
|
||||||
double upperCornerX,
|
|
||||||
double upperCornerY) {
|
|
||||||
this.crs = crs;
|
|
||||||
this.lowerCornerX = lowerCornerX;
|
|
||||||
this.lowerCornerY = lowerCornerY;
|
|
||||||
this.upperCornerX = upperCornerX;
|
|
||||||
this.upperCornerY = upperCornerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getCrs() {
|
|
||||||
return crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCrs(String crs) {
|
|
||||||
this.crs = crs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLowerCornerX() {
|
|
||||||
return lowerCornerX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLowerCornerX(double lowerCornerX) {
|
|
||||||
this.lowerCornerX = lowerCornerX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLowerCornerY() {
|
|
||||||
return lowerCornerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLowerCornerY(double lowerCornerY) {
|
|
||||||
this.lowerCornerY = lowerCornerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getUpperCornerX() {
|
|
||||||
return upperCornerX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpperCornerX(double upperCornerX) {
|
|
||||||
this.upperCornerX = upperCornerX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getUpperCornerY() {
|
|
||||||
return upperCornerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpperCornerY(double upperCornerY) {
|
|
||||||
this.upperCornerY = upperCornerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BoundingBox{"
|
|
||||||
+ "crs='"
|
|
||||||
+ crs
|
|
||||||
+ '\''
|
|
||||||
+ ", lowerCorner=["
|
|
||||||
+ lowerCornerX
|
|
||||||
+ ", "
|
|
||||||
+ lowerCornerY
|
|
||||||
+ ']'
|
|
||||||
+ ", upperCorner=["
|
|
||||||
+ upperCornerX
|
|
||||||
+ ", "
|
|
||||||
+ upperCornerY
|
|
||||||
+ ']'
|
|
||||||
+ '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ResourceURL 정보를 담는 내부 클래스 (타일 URL 템플릿) */
|
/** ResourceURL 정보를 담는 내부 클래스 (타일 URL 템플릿) */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public static class ResourceUrl {
|
public static class ResourceUrl {
|
||||||
|
|
||||||
private String format;
|
private String format;
|
||||||
private String resourceType;
|
private String resourceType;
|
||||||
private String template;
|
private String template;
|
||||||
|
|
||||||
public ResourceUrl() {}
|
|
||||||
|
|
||||||
public ResourceUrl(String format, String resourceType, String template) {
|
|
||||||
this.format = format;
|
|
||||||
this.resourceType = resourceType;
|
|
||||||
this.template = template;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getFormat() {
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFormat(String format) {
|
|
||||||
this.format = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResourceType() {
|
|
||||||
return resourceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResourceType(String resourceType) {
|
|
||||||
this.resourceType = resourceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTemplate() {
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTemplate(String template) {
|
|
||||||
this.template = template;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ResourceUrl{"
|
|
||||||
+ "format='"
|
|
||||||
+ format
|
|
||||||
+ '\''
|
|
||||||
+ ", resourceType='"
|
|
||||||
+ resourceType
|
|
||||||
+ '\''
|
|
||||||
+ ", template='"
|
|
||||||
+ template
|
|
||||||
+ '\''
|
|
||||||
+ '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Style 정보를 담는 내부 클래스 */
|
/** Style 정보를 담는 내부 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public static class Style {
|
public static class Style {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@JsonProperty("default")
|
|
||||||
private boolean isDefault;
|
private boolean isDefault;
|
||||||
|
}
|
||||||
|
|
||||||
public Style() {}
|
/** TileMatrixSetLink 정보를 담는 내부 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class TileMatrixSetLink {
|
||||||
|
private String tileMatrixSet;
|
||||||
|
private List<String> zoomLevels = new ArrayList<>();
|
||||||
|
|
||||||
public Style(String identifier, String title, boolean isDefault) {
|
public void addZoomLevel(String zoomLevel) {
|
||||||
this.identifier = identifier;
|
this.zoomLevels.add(zoomLevel);
|
||||||
this.title = title;
|
|
||||||
this.isDefault = isDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifier(String identifier) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDefault() {
|
|
||||||
return isDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefault(boolean isDefault) {
|
|
||||||
this.isDefault = isDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Style{"
|
|
||||||
+ "identifier='"
|
|
||||||
+ identifier
|
|
||||||
+ '\''
|
|
||||||
+ ", title='"
|
|
||||||
+ title
|
|
||||||
+ '\''
|
|
||||||
+ ", isDefault="
|
|
||||||
+ isDefault
|
|
||||||
+ '}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class WmtsService {
|
|||||||
List<String> titles = new ArrayList<>();
|
List<String> titles = new ArrayList<>();
|
||||||
|
|
||||||
for (WmtsLayerInfo layer : layers) {
|
for (WmtsLayerInfo layer : layers) {
|
||||||
titles.add(layer.title);
|
titles.add(layer.getTitle()); // ✅ getter로 변경
|
||||||
}
|
}
|
||||||
return titles;
|
return titles;
|
||||||
}
|
}
|
||||||
@@ -50,12 +50,19 @@ public class WmtsService {
|
|||||||
return getLayerInfoByTitle(geoserverUrl, workspace, tile);
|
return getLayerInfoByTitle(geoserverUrl, workspace, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WmtsLayerInfo> getAllLayers(String geoserverUrl, String workspace) {
|
/**
|
||||||
|
* WMTS Capabilities URL에서 모든 레이어 정보를 가져옵니다.
|
||||||
|
*
|
||||||
|
* @param geoserverUrl 예: http://localhost:8080
|
||||||
|
* @param workspace 워크스페이스 이름
|
||||||
|
* @return 모든 레이어 정보 리스트
|
||||||
|
*/
|
||||||
|
public List<WmtsLayerInfo> getAllLayers(String geoserverUrl, String workspace) {
|
||||||
List<WmtsLayerInfo> layers = new ArrayList<>();
|
List<WmtsLayerInfo> layers = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
// 1. XML 문서 로드 및 파싱
|
|
||||||
String capabilitiesUrl =
|
String capabilitiesUrl =
|
||||||
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
||||||
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
@@ -64,18 +71,16 @@ public class WmtsService {
|
|||||||
XPathFactory xPathFactory = XPathFactory.newInstance();
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
XPath xpath = xPathFactory.newXPath();
|
XPath xpath = xPathFactory.newXPath();
|
||||||
|
|
||||||
// 2. 모든 Layer 노드 검색
|
|
||||||
String expression = "//*[local-name()='Layer']";
|
String expression = "//*[local-name()='Layer']";
|
||||||
NodeList layerNodes =
|
NodeList layerNodes =
|
||||||
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
// 3. 모든 레이어를 파싱하여 리스트에 추가
|
|
||||||
for (int i = 0; i < layerNodes.getLength(); i++) {
|
for (int i = 0; i < layerNodes.getLength(); i++) {
|
||||||
Node layerNode = layerNodes.item(i);
|
Node layerNode = layerNodes.item(i);
|
||||||
String title = getChildValue(layerNode, "Title");
|
String title = getChildValue(layerNode, "Title");
|
||||||
|
|
||||||
if (title != null && !title.trim().isEmpty()) {
|
if (title != null && !title.trim().isEmpty()) {
|
||||||
WmtsLayerInfo layerInfo = parseLayerNode(layerNode, title);
|
WmtsLayerInfo layerInfo = parseLayerNode(workspace, layerNode, title);
|
||||||
layers.add(layerInfo);
|
layers.add(layerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,125 +93,117 @@ public class WmtsService {
|
|||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 특정 노드 아래의 자식 태그 값 추출 (예: <Title>값)
|
/**
|
||||||
private String getChildValue(Node parent, String childName) {
|
* WMTS Capabilities URL에서 특정 타이틀의 레이어 정보를 가져옵니다.
|
||||||
Node child = findChildNode(parent, childName);
|
*
|
||||||
return (child != null) ? child.getTextContent() : null;
|
* @param geoserverUrl 예: http://localhost:8080
|
||||||
}
|
* @param targetTitle 찾고자 하는 레이어의 Title
|
||||||
|
*/
|
||||||
|
public WmtsLayerInfo getLayerInfoByTitle(
|
||||||
|
String geoserverUrl, String workspace, String targetTitle) {
|
||||||
|
try {
|
||||||
|
String capabilitiesUrl =
|
||||||
|
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
||||||
|
|
||||||
// 이름으로 자식 노드 찾기 (Local Name 기준)
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
private Node findChildNode(Node parent, String localName) {
|
factory.setNamespaceAware(true);
|
||||||
NodeList children = parent.getChildNodes();
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
Document doc = builder.parse(new URL(capabilitiesUrl).openStream());
|
||||||
Node node = children.item(i);
|
|
||||||
// 네임스페이스 접두사(ows:, wmts:)를 무시하고 태그 이름 확인
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
if (node.getNodeName().endsWith(":" + localName) || node.getNodeName().equals(localName)) {
|
XPath xpath = xPathFactory.newXPath();
|
||||||
return node;
|
|
||||||
|
String expression = "//*[local-name()='Layer']";
|
||||||
|
NodeList layerNodes =
|
||||||
|
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
|
for (int i = 0; i < layerNodes.getLength(); i++) {
|
||||||
|
Node layerNode = layerNodes.item(i);
|
||||||
|
|
||||||
|
String title = getChildValue(layerNode, "Title");
|
||||||
|
if (title != null && title.trim().equals(targetTitle)) {
|
||||||
|
return parseLayerNode(workspace, layerNode, title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("WMTS 정보 조회 중 오류 발생: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 레이어 노드를 Java 객체로 변환
|
// 레이어 노드를 Java 객체로 변환 (2025-01-30)
|
||||||
private WmtsLayerInfo parseLayerNode(Node layerNode, String title) {
|
private WmtsLayerInfo parseLayerNode(String workspace, Node layerNode, String title) {
|
||||||
WmtsLayerInfo info = new WmtsLayerInfo();
|
WmtsLayerInfo info = new WmtsLayerInfo();
|
||||||
info.title = title;
|
|
||||||
info.identifier = getChildValue(layerNode, "Identifier");
|
info.setWorkspace(workspace); // 20250130
|
||||||
info.abstractText = getChildValue(layerNode, "Abstract");
|
info.setTitle(title);
|
||||||
|
info.setIdentifier(getChildValue(layerNode, "Identifier"));
|
||||||
|
info.setAbstractText(getChildValue(layerNode, "Abstract"));
|
||||||
|
|
||||||
// Keywords 파싱
|
// Keywords 파싱
|
||||||
// 구조: <ows:Keywords><ows:Keyword>...</ows:Keyword></ows:Keywords>
|
info.setKeywords(getChildValues(layerNode, "Keywords", "Keyword"));
|
||||||
info.keywords = getChildValues(layerNode, "Keywords", "Keyword");
|
|
||||||
|
|
||||||
// BoundingBox 파싱 (WGS84BoundingBox 기준)
|
// BoundingBox 파싱 (WGS84BoundingBox 기준)
|
||||||
info.boundingBox = parseBoundingBox(layerNode);
|
info.setBoundingBox(parseBoundingBox(layerNode));
|
||||||
|
|
||||||
// Formats 파싱
|
// Formats 파싱
|
||||||
info.formats = getChildValuesDirect(layerNode, "Format");
|
info.setFormats(getChildValuesDirect(layerNode, "Format"));
|
||||||
|
|
||||||
// TileMatrixSetLink 파싱
|
// TileMatrixSetLink 파싱 (TileMatrixSet + Zoom Levels)
|
||||||
// 구조: <TileMatrixSetLink><TileMatrixSet>...</TileMatrixSet></TileMatrixSetLink>
|
info.setTileMatrixSetLinks(parseTileMatrixSetLinks(layerNode));
|
||||||
info.tileMatrixSetLinks = getChildValues(layerNode, "TileMatrixSetLink", "TileMatrixSet");
|
|
||||||
|
// TileMatrixSetLimits에서 줌 레벨 추출
|
||||||
|
info.setMatrixIds(parseMatrixIds(layerNode)); // 20260130
|
||||||
|
|
||||||
// ResourceURL 파싱
|
// ResourceURL 파싱
|
||||||
info.resourceUrls = parseResourceUrls(layerNode);
|
info.setResourceUrls(parseResourceUrls(layerNode));
|
||||||
|
|
||||||
// Styles 파싱
|
// Styles 파싱
|
||||||
info.styles = parseStyles(layerNode);
|
info.setStyles(parseStyles(layerNode));
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 특정 노드 아래의 반복되는 자식 구조 값 추출 (예: Keywords -> Keyword)
|
// --- Helper Methods ---
|
||||||
private List<String> getChildValues(Node parent, String wrapperName, String childName) {
|
|
||||||
List<String> results = new ArrayList<>();
|
|
||||||
Node wrapper = findChildNode(parent, wrapperName);
|
|
||||||
if (wrapper != null) {
|
|
||||||
NodeList children = wrapper.getChildNodes();
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
|
||||||
Node node = children.item(i);
|
|
||||||
if (node.getNodeName().endsWith(childName)) {
|
|
||||||
results.add(node.getTextContent());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WmtsLayerInfo.BoundingBox parseBoundingBox(Node layerNode) {
|
private WmtsLayerInfo.BoundingBox parseBoundingBox(Node layerNode) {
|
||||||
// 보통 <ows:WGS84BoundingBox>를 찾음
|
|
||||||
Node bboxNode = findChildNode(layerNode, "WGS84BoundingBox");
|
Node bboxNode = findChildNode(layerNode, "WGS84BoundingBox");
|
||||||
if (bboxNode == null) bboxNode = findChildNode(layerNode, "BoundingBox");
|
if (bboxNode == null) bboxNode = findChildNode(layerNode, "BoundingBox");
|
||||||
|
|
||||||
if (bboxNode != null) {
|
if (bboxNode == null) return null;
|
||||||
WmtsLayerInfo.BoundingBox bbox = new WmtsLayerInfo.BoundingBox();
|
|
||||||
bbox.crs = getAttributeValue(bboxNode, "crs"); // WGS84는 보통 CRS 속성이 없을 수 있음(Default EPSG:4326)
|
|
||||||
|
|
||||||
String lowerCorner = getChildValue(bboxNode, "LowerCorner");
|
WmtsLayerInfo.BoundingBox bbox = new WmtsLayerInfo.BoundingBox();
|
||||||
String upperCorner = getChildValue(bboxNode, "UpperCorner");
|
|
||||||
|
|
||||||
if (lowerCorner != null) {
|
bbox.setCrs(getAttributeValue(bboxNode, "crs"));
|
||||||
String[] coords = lowerCorner.split(" ");
|
|
||||||
bbox.lowerCornerX = Double.parseDouble(coords[0]);
|
String lowerCorner = getChildValue(bboxNode, "LowerCorner");
|
||||||
bbox.lowerCornerY = Double.parseDouble(coords[1]);
|
String upperCorner = getChildValue(bboxNode, "UpperCorner");
|
||||||
}
|
|
||||||
if (upperCorner != null) {
|
if (lowerCorner != null) {
|
||||||
String[] coords = upperCorner.split(" ");
|
String[] coords = lowerCorner.trim().split("\\s+");
|
||||||
bbox.upperCornerX = Double.parseDouble(coords[0]);
|
bbox.setLowerCornerX(Double.parseDouble(coords[0]));
|
||||||
bbox.upperCornerY = Double.parseDouble(coords[1]);
|
bbox.setLowerCornerY(Double.parseDouble(coords[1]));
|
||||||
}
|
|
||||||
return bbox;
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getAttributeValue(Node node, String attrName) {
|
if (upperCorner != null) {
|
||||||
if (node.hasAttributes()) {
|
String[] coords = upperCorner.trim().split("\\s+");
|
||||||
Node attr = node.getAttributes().getNamedItem(attrName);
|
bbox.setUpperCornerX(Double.parseDouble(coords[0]));
|
||||||
if (attr != null) return attr.getNodeValue();
|
bbox.setUpperCornerY(Double.parseDouble(coords[1]));
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrapper 없이 바로 반복되는 값 추출 (예: Format)
|
return bbox;
|
||||||
private List<String> getChildValuesDirect(Node parent, String childName) {
|
|
||||||
List<String> results = new ArrayList<>();
|
|
||||||
NodeList children = parent.getChildNodes();
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
|
||||||
Node node = children.item(i);
|
|
||||||
if (node.getNodeName().endsWith(childName)) {
|
|
||||||
results.add(node.getTextContent());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WmtsLayerInfo.ResourceUrl> parseResourceUrls(Node layerNode) {
|
private List<WmtsLayerInfo.ResourceUrl> parseResourceUrls(Node layerNode) {
|
||||||
List<WmtsLayerInfo.ResourceUrl> list = new ArrayList<>();
|
List<WmtsLayerInfo.ResourceUrl> list = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().contains("ResourceURL")) { // local-name check simplification
|
if (node.getNodeName().contains("ResourceURL")) {
|
||||||
WmtsLayerInfo.ResourceUrl url = new WmtsLayerInfo.ResourceUrl();
|
WmtsLayerInfo.ResourceUrl url = new WmtsLayerInfo.ResourceUrl();
|
||||||
url.setFormat(getAttributeValue(node, "format"));
|
url.setFormat(getAttributeValue(node, "format"));
|
||||||
url.setResourceType(getAttributeValue(node, "resourceType"));
|
url.setResourceType(getAttributeValue(node, "resourceType"));
|
||||||
@@ -220,6 +217,7 @@ public class WmtsService {
|
|||||||
private List<WmtsLayerInfo.Style> parseStyles(Node layerNode) {
|
private List<WmtsLayerInfo.Style> parseStyles(Node layerNode) {
|
||||||
List<WmtsLayerInfo.Style> styles = new ArrayList<>();
|
List<WmtsLayerInfo.Style> styles = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().endsWith("Style")) {
|
if (node.getNodeName().endsWith("Style")) {
|
||||||
@@ -233,50 +231,127 @@ public class WmtsService {
|
|||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** TileMatrixSetLimits에서 줌 레벨을 추출합니다. 예: "EPSG:4326:0" → "0" */
|
||||||
* WMTS Capabilities URL에서 특정 타이틀의 레이어 정보를 가져옵니다. // * @param capabilitiesUrl 예:
|
private List<String> parseMatrixIds(Node layerNode) {
|
||||||
* http://localhost:8080/geoserver/gwc/service/wmts?REQUEST=GetCapabilities
|
List<String> matrixIds = new ArrayList<>();
|
||||||
*
|
NodeList children = layerNode.getChildNodes();
|
||||||
* @param geoserverUrl 예: http://localhost:8080
|
|
||||||
* @param targetTitle 찾고자 하는 레이어의 Title (예: "My Maps")
|
|
||||||
*/
|
|
||||||
public WmtsLayerInfo getLayerInfoByTitle(
|
|
||||||
String geoserverUrl, String workspace, String targetTitle) {
|
|
||||||
try {
|
|
||||||
// 1. XML 문서 로드 및 파싱
|
|
||||||
String capabilitiesUrl =
|
|
||||||
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
|
||||||
factory.setNamespaceAware(true); // 네임스페이스 인식
|
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
|
||||||
Document doc = builder.parse(new URL(capabilitiesUrl).openStream());
|
|
||||||
|
|
||||||
XPathFactory xPathFactory = XPathFactory.newInstance();
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
XPath xpath = xPathFactory.newXPath();
|
Node node = children.item(i);
|
||||||
|
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
||||||
|
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
||||||
|
if (limitsNode != null) {
|
||||||
|
NodeList limitsList = limitsNode.getChildNodes();
|
||||||
|
for (int j = 0; j < limitsList.getLength(); j++) {
|
||||||
|
Node limitNode = limitsList.item(j);
|
||||||
|
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
||||||
|
String identifier = getChildValue(limitNode, "TileMatrix");
|
||||||
|
if (identifier == null) identifier = getChildValue(limitNode, "Identifier");
|
||||||
|
|
||||||
// 2. 모든 Layer 노드 검색 (네임스페이스 무시하고 local-name으로 검색)
|
if (identifier != null && identifier.contains(":")) {
|
||||||
// GeoServer WMTS에서 Layer는 <Contents> -> <Layer> 구조임
|
String[] parts = identifier.split(":");
|
||||||
String expression = "//*[local-name()='Layer']";
|
String zoomLevel = parts[parts.length - 1];
|
||||||
NodeList layerNodes =
|
matrixIds.add(zoomLevel);
|
||||||
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < layerNodes.getLength(); i++) {
|
}
|
||||||
Node layerNode = layerNodes.item(i);
|
|
||||||
|
|
||||||
// 3. Title 확인
|
|
||||||
String title = getChildValue(layerNode, "Title");
|
|
||||||
|
|
||||||
// 타이틀이 일치하면 객체 매핑 시작
|
|
||||||
if (title != null && title.trim().equals(targetTitle)) {
|
|
||||||
return parseLayerNode(layerNode, title);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new RuntimeException("WMTS 정보 조회 중 오류 발생: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null; // 찾지 못한 경우
|
return matrixIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<WmtsLayerInfo.TileMatrixSetLink> parseTileMatrixSetLinks(Node layerNode) {
|
||||||
|
List<WmtsLayerInfo.TileMatrixSetLink> links = new ArrayList<>();
|
||||||
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
|
Node node = children.item(i);
|
||||||
|
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
||||||
|
|
||||||
|
String tileMatrixSet = getChildValue(node, "TileMatrixSet");
|
||||||
|
|
||||||
|
List<String> zoomLevels = new ArrayList<>();
|
||||||
|
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
||||||
|
if (limitsNode != null) {
|
||||||
|
NodeList limitsList = limitsNode.getChildNodes();
|
||||||
|
for (int j = 0; j < limitsList.getLength(); j++) {
|
||||||
|
Node limitNode = limitsList.item(j);
|
||||||
|
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
||||||
|
String identifier = getChildValue(limitNode, "TileMatrix");
|
||||||
|
if (identifier == null) identifier = getChildValue(limitNode, "Identifier");
|
||||||
|
|
||||||
|
if (identifier != null && identifier.contains(":")) {
|
||||||
|
String[] parts = identifier.split(":");
|
||||||
|
String zoomLevel = parts[parts.length - 1];
|
||||||
|
zoomLevels.add(zoomLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tileMatrixSet != null) {
|
||||||
|
WmtsLayerInfo.TileMatrixSetLink link =
|
||||||
|
new WmtsLayerInfo.TileMatrixSetLink(tileMatrixSet, zoomLevels);
|
||||||
|
links.add(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getChildValue(Node parent, String childName) {
|
||||||
|
Node child = findChildNode(parent, childName);
|
||||||
|
return (child != null) ? child.getTextContent() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getChildValues(Node parent, String wrapperName, String childName) {
|
||||||
|
List<String> results = new ArrayList<>();
|
||||||
|
Node wrapper = findChildNode(parent, wrapperName);
|
||||||
|
|
||||||
|
if (wrapper != null) {
|
||||||
|
NodeList children = wrapper.getChildNodes();
|
||||||
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
|
Node node = children.item(i);
|
||||||
|
if (node.getNodeName().endsWith(childName)) {
|
||||||
|
results.add(node.getTextContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getChildValuesDirect(Node parent, String childName) {
|
||||||
|
List<String> results = new ArrayList<>();
|
||||||
|
NodeList children = parent.getChildNodes();
|
||||||
|
|
||||||
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
|
Node node = children.item(i);
|
||||||
|
if (node.getNodeName().endsWith(childName)) {
|
||||||
|
results.add(node.getTextContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Node findChildNode(Node parent, String localName) {
|
||||||
|
NodeList children = parent.getChildNodes();
|
||||||
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
|
Node node = children.item(i);
|
||||||
|
if (node.getNodeName().endsWith(":" + localName) || node.getNodeName().equals(localName)) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getAttributeValue(Node node, String attrName) {
|
||||||
|
if (node.hasAttributes()) {
|
||||||
|
Node attr = node.getAttributes().getNamedItem(attrName);
|
||||||
|
if (attr != null) return attr.getNodeValue();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,13 +147,18 @@ public class MapLayerCoreService {
|
|||||||
.findDetailByUuid(uuid)
|
.findDetailByUuid(uuid)
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
|
||||||
if ("CHANGE_MAP".equals(isMapYn.getMapType())) {
|
LayerDto.MapType mapType;
|
||||||
entity.setIsChangeMap(isMapYn.getIsMapYn());
|
|
||||||
} else if ("LABELING_MAP".equals(isMapYn.getMapType())) {
|
try {
|
||||||
entity.setIsLabelingMap(isMapYn.getIsMapYn());
|
mapType = LayerDto.MapType.valueOf(isMapYn.getMapType());
|
||||||
} else {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (mapType) {
|
||||||
|
case CHANGE_MAP -> entity.setIsChangeMap(isMapYn.getIsMapYn());
|
||||||
|
case LABELING_MAP -> entity.setIsLabelingMap(isMapYn.getIsMapYn());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
||||||
|
public void upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
long length = pnuList.length;
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.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
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(String uid) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetLearnEntity)
|
.update(mapSheetLearnEntity)
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.PNU_COMPLETED.getId())
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetLearnEntity.uid.eq(uid))
|
.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