feat: 차량기본정보 request 구성 변경

noneDB
박성영 4 weeks ago
parent 3bad417598
commit 785528218a

@ -111,13 +111,13 @@ public class VehicleInterfaceController {
name = "기본사항조회 예제", name = "기본사항조회 예제",
value = """ value = """
{ {
"data": [ "data": [{
{ "record": [{
"VHRNO": "12가3456",
"LEVY_STDDE": "20250101", "LEVY_STDDE": "20250101",
"VIN": "KMHAB812345678901" "VHRNO": "12가3456",
} "VIN": null
] }]
}]
} }
""" """
) )

@ -43,21 +43,9 @@ public class BasicRequest {
@JsonProperty("CHARGER_NM") @JsonProperty("CHARGER_NM")
private String chargerNm; private String chargerNm;
@Schema(description = "부과기준일", example = "20250101") @Schema(description = "조회 대상 record 배열")
@JsonProperty("LEVY_STDDE") @JsonProperty("record")
private String levyStdde; private java.util.List<Record> record;
@Schema(description = "조회구분코드 (자동설정: VHRNO not null → 3:자동차번호, VIN not null → 2:차대번호)")
@JsonProperty("INQIRE_SE_CODE")
private String inqireSeCode;
@Schema(description = "자동차등록번호", example = "12가3456")
@JsonProperty("VHRNO")
private String vhrno;
@Schema(description = "차대번호", example = "KMHAB812345678901")
@JsonProperty("VIN")
private String vin;
/* /*
// 추가 항목 (명세 샘플 기준) // 추가 항목 (명세 샘플 기준)
@ -87,4 +75,26 @@ public class BasicRequest {
private String detailExpression; private String detailExpression;
*/ */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter
@Schema(name = "BasicRequest.Record", description = "기본사항 요청 record 항목")
public static class Record {
@Schema(description = "부과기준일", example = "20250101")
@JsonProperty("LEVY_STDDE")
private String levyStdde;
@Schema(description = "조회구분코드 (자동설정: VHRNO not null → 3:자동차번호, VIN not null → 2:차대번호)")
@JsonProperty("INQIRE_SE_CODE")
private String inqireSeCode;
@Schema(description = "자동차등록번호", example = "12가3456")
@JsonProperty("VHRNO")
private String vhrno;
@Schema(description = "차대번호", example = "KMHAB812345678901")
@JsonProperty("VIN")
private String vin;
}
} }

@ -23,6 +23,10 @@ public class CarBassMatterInqireVO {
// ==== Static factory/mapping methods (moved from Service) ==== // ==== Static factory/mapping methods (moved from Service) ====
public static CarBassMatterInqireVO fromRequest(BasicRequest request) { public static CarBassMatterInqireVO fromRequest(BasicRequest request) {
BasicRequest.Record first = null;
if (request != null && request.getRecord() != null && !request.getRecord().isEmpty()) {
first = request.getRecord().get(0);
}
return CarBassMatterInqireVO.builder() return CarBassMatterInqireVO.builder()
.infoSysId(request.getInfoSysId()) .infoSysId(request.getInfoSysId())
.infoSysIp(request.getInfoSysIp()) .infoSysIp(request.getInfoSysIp())
@ -31,10 +35,10 @@ public class CarBassMatterInqireVO {
.chargerId(request.getChargerId()) .chargerId(request.getChargerId())
.chargerIp(request.getChargerIp()) .chargerIp(request.getChargerIp())
.chargerNm(request.getChargerNm()) .chargerNm(request.getChargerNm())
.dmndLevyStdde(request.getLevyStdde()) .dmndLevyStdde(first != null ? first.getLevyStdde() : null)
.dmndInqireSeCode(request.getInqireSeCode()) .dmndInqireSeCode(first != null ? first.getInqireSeCode() : null)
.dmndVhrno(request.getVhrno()) .dmndVhrno(first != null ? first.getVhrno() : null)
.dmndVin(request.getVin()) .dmndVin(first != null ? first.getVin() : null)
.rgtr(ApiConstant.DEFAULT_REGISTRANT) .rgtr(ApiConstant.DEFAULT_REGISTRANT)
.build(); .build();
} }

@ -34,6 +34,7 @@ public class RequestEnricher {
String cntc = props.getGov().getServices().getBasic().getCntcInfoCode(); String cntc = props.getGov().getServices().getBasic().getCntcInfoCode();
for (BasicRequest req : envelope.getData()) { for (BasicRequest req : envelope.getData()) {
if (req == null) continue; if (req == null) continue;
// 메타 필드 보강 (data level)
req.setInfoSysId(sys.getInfoSysId()); req.setInfoSysId(sys.getInfoSysId());
req.setInfoSysIp(sys.getInfoSysIp()); req.setInfoSysIp(sys.getInfoSysIp());
req.setSigunguCode(sys.getSigunguCode()); req.setSigunguCode(sys.getSigunguCode());
@ -42,12 +43,23 @@ public class RequestEnricher {
req.setChargerIp(sys.getChargerIp()); req.setChargerIp(sys.getChargerIp());
req.setChargerNm(sys.getChargerNm()); req.setChargerNm(sys.getChargerNm());
// record 배열이 없으면 생성 (최소 1개)
java.util.List<BasicRequest.Record> records = req.getRecord();
if (records == null || records.isEmpty()) {
BasicRequest.Record r = new BasicRequest.Record();
java.util.ArrayList<BasicRequest.Record> list = new java.util.ArrayList<>();
list.add(r);
req.setRecord(list);
records = list;
}
// 자동차 기본사항 조회 시 INQIRE_SE_CODE 자동 설정 // 자동차 기본사항 조회 시 INQIRE_SE_CODE 자동 설정
// VHRNO(차량번호) not null → 3:자동차번호, VIN(차대번호) not null → 2:차대번호 // VHRNO(차량번호) not null → 3:자동차번호, VIN(차대번호) not null → 2:차대번호
if (req.getVhrno() != null && !req.getVhrno().trim().isEmpty()) { BasicRequest.Record first = records.get(0);
req.setInqireSeCode("3"); if (first.getVhrno() != null && !first.getVhrno().trim().isEmpty()) {
} else if (req.getVin() != null && !req.getVin().trim().isEmpty()) { first.setInqireSeCode("3");
req.setInqireSeCode("2"); } else if (first.getVin() != null && !first.getVin().trim().isEmpty()) {
first.setInqireSeCode("2");
} }
} }
log.debug("[ENRICH] basic: applied INFO_SYS_ID={}, INFO_SYS_IP={}, SIGUNGU_CODE={}, CNTC_INFO_CODE={}", log.debug("[ENRICH] basic: applied INFO_SYS_ID={}, INFO_SYS_IP={}, SIGUNGU_CODE={}, CNTC_INFO_CODE={}",

Loading…
Cancel
Save