fix: kt API 반영

dev
Jonguk. Lim 1 year ago
parent 10f58780db
commit 0d1fe7fee3

@ -25,5 +25,5 @@ import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse;
public interface IKtMmsService {
KtTokenResponse requestToken(final KtMnsRequest paramDTO);
KtCommonResponse beforeSend(final KtMnsRequest paramDTO, final KtBefSendRequest reqDTO);
KtCommonResponse beforeSend(final KtBefSendRequest reqDTO);
}

@ -46,6 +46,9 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
private String HOST;
@Value("${contract.kt.api.generate-token}")
private String API_GENERATE_TOKEN;
@Value("${contract.kt.api.before-send}")
private String API_BEFORE_SEND;
private static final String AUTH_TYPE_BEARER = "Bearer";
@ -53,7 +56,7 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
@Override
public KtTokenResponse requestToken(final KtMnsRequest paramDTO) {
CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getKtMnsInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode());
final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getKtMnsInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode());
final KtTokenRequest reqDTO = KtTokenRequest.builder()
.clientId(ktMnsInfo.getKtClientId())
.clientSecret(ktMnsInfo.getKtClientSecret())
@ -91,9 +94,27 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
* @param reqDTO
*/
@Override
public KtCommonResponse beforeSend(final KtMnsRequest paramDTO, final KtBefSendRequest reqDTO) {
public KtCommonResponse beforeSend(final KtBefSendRequest reqDTO) {
final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getKtMnsInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode());
//reqDTO.setServiceCd(ktMnsInfo.get);
//reqDTO.setServiceKey(ktMnsInfo.get);
CmmEnsUtils.validate(reqDTO);
List<ErrorMsg> errors = new ArrayList<>();
final Map<String,String> headerMap = new HashMap<>();
headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, ktMnsInfo.getKtAccessToken()));
headerMap.put("client-id", ktMnsInfo.getKtClientId());
headerMap.put("client-tp", "10");
return webClient.exchange(
HOST + API_BEFORE_SEND,
HttpMethod.POST,
JsonUtils.toJson(reqDTO),
KtCommonResponse.class,
headerMap
);
/*List<ErrorMsg> errors = new ArrayList<>();
errors.add(new ErrorMsg("error1"));
errors.add(new ErrorMsg("error2"));
@ -101,6 +122,6 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
.resultCd("00")
.resultDt(DateUtils.getTodayAndNowTime("yyyyMMddHHmmss"))
.errors(errors)
.build();
.build();*/
}
}

@ -1,6 +1,8 @@
package kr.xit.ens.kt.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.cmm.service.ICmmEnsCacheService;
import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse;
@ -11,10 +13,7 @@ import kr.xit.core.spring.annotation.JsonArg;
import kr.xit.ens.kt.service.IKtMmsService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* <pre>
@ -44,6 +43,7 @@ public class KtMmsController {
public ApiResponseDTO<?> requestToken(@RequestBody final KtMnsRequest paramDTO) {
return ApiResponseDTO.success(service.requestToken(paramDTO));
}
/*
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(
@ -52,6 +52,8 @@ public class KtMmsController {
@ExampleObject(
value = """
{
"signguCode": "",
"ffnlgCode": "11",
"service_cd": "NPS",
"service_key": "A3AD41349D759DD3",
"msg_cd": "10006",
@ -76,10 +78,8 @@ public class KtMmsController {
})*/
@Operation(summary = "사전 문자 수신 등록 요청", description = "사전 문자 수신 등록 요청(BC-AG-SN-001)")
@PostMapping(value = "/beforeSend", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> beforeSend(@RequestBody @JsonArg final KtMnsRequest paramDTO, @RequestBody @JsonArg final KtBefSendRequest reqDTO) {
//public ApiResponseDTO<?> beforeSend(@RequestBody final KtBefSendRequest reqDTO) {
KtCommonResponse dto = service.beforeSend(null, reqDTO);
public ApiResponseDTO<?> beforeSend(@RequestBody final KtBefSendRequest reqDTO) {
KtCommonResponse dto = service.beforeSend(reqDTO);
return ApiResponseDTO.success(dto);
}
}

@ -72,7 +72,7 @@ app:
url: 'http://localhost:${server.port}${server.servlet.context-path:}/'
data:
root:
path: D:/data
path: /Users/minuk/data
#---------------------------------------------------------------
# log 설정

@ -1,6 +1,7 @@
package kr.xit.biz.ens.model.kt;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.v3.oas.annotations.media.Schema;
@ -38,7 +39,7 @@ public class KtCommonDTO {
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class KtMnsRequest {
@ -48,6 +49,7 @@ public class KtCommonDTO {
@Schema(requiredMode = RequiredMode.REQUIRED, title = "시군구코드", example = "88328")
@NotEmpty(message = "시군구 코드는 필수 입니다")
@Size(max = 10)
@JsonProperty("signguCode")
private String signguCode;
/**
@ -56,13 +58,15 @@ public class KtCommonDTO {
@Schema(requiredMode = RequiredMode.REQUIRED, title = "과태료코드", example = "11")
@NotEmpty(message = "과태료 코드는 필수 입니다")
@Size(max = 2)
@JsonProperty("ffnlgCode")
private final String ffnlgCode = "11";
/**
* Id
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
@Schema(requiredMode = RequiredMode.NOT_REQUIRED, title = "주민번호", example = " ")
@Size(min = 0, max = 13, message = "주민번호는 13자리 입니다.")
@JsonProperty("juminId")
private String juminId;
}

@ -54,7 +54,7 @@ public class KtMmsSendDTO {
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class KtBefSendRequest {
public static class KtBefSendRequest extends KtCommonDTO.KtMnsRequest {
//-------------------------------------------------------------------
// 필수
//-------------------------------------------------------------------

Loading…
Cancel
Save