You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.3 KiB
Java

package com.vmis.interfaceapp.config.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 구버전 VMIS 설정 (자동차기본사항조회)
*/
@Data
@ConfigurationProperties(prefix = "old.vmis")
@Validated
public class OldVmisProperties {
@NotNull
private SystemProps system = new SystemProps();
@NotNull
private GovProps gov = new GovProps();
@Data
public static class SystemProps {
@NotBlank
private String infoSysId;
/** INFO_SYS_IP */
private String infoSysIp;
/** 시군구코드 (SIGUNGU_CODE) */
private String sigunguCode;
private String departmentCode;
// 담당자 정보
private String chargerId;
private String chargerIp;
private String chargerNm;
}
@Data
public static class GovProps {
@NotBlank
private String scheme = "http";
@NotBlank
private String host;
@NotBlank
private String basePath;
@NotNull
private Services services = new Services();
public String buildServiceUrl(String path) {
StringBuilder sb = new StringBuilder();
sb.append(scheme).append("://").append(host);
if (basePath != null && !basePath.isEmpty()) {
if (!basePath.startsWith("/")) sb.append('/');
sb.append(basePath);
}
if (path != null && !path.isEmpty()) {
if (!path.startsWith("/")) sb.append('/');
sb.append(path);
}
return sb.toString();
}
@Data
public static class Services {
@NotNull
private Service basic = new Service();
// 구버전에는 ledger(갑부) 서비스 없음
}
@Data
public static class Service {
@NotBlank
private String path;
@NotBlank
private String cntcInfoCode;
@NotBlank
private String apiKey;
@NotBlank
private String cvmisApikey;
}
}
}