feat: EPost 종적추적 API 반영

dev
gitea-관리자 1 year ago
parent e8f8467527
commit 3a69834883

@ -0,0 +1,67 @@
package kr.xit.ens.epost.service;
import java.util.HashMap;
import java.util.Map;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceRequest;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResponse;
import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.ens.cmm.CmmEnsUtils;
import kr.xit.ens.kt.cmm.CmmKtMmsUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.epost.service
* fileName : EpostService
* author : limju
* date : 2023-10-04
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-10-04 limju
*
* </pre>
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class EpostService extends EgovAbstractServiceImpl implements IEpostService {
@Value("${contract.epost.host}")
private String HOST;
@Value("${contract.epost.api.postTrackInfo}")
private String POST_TRACK_INFO;
private final ApiWebClientUtil webClient;
@Override
public EpostTraceResponse postTrackInfo(final EpostTraceRequest reqDTO) {
final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(reqDTO.getSignguCode(), reqDTO.getFfnlgCode());
reqDTO.setServiceKey(ktMnsInfo.getEpostServiceKey());
final Map<String,String> headerMap = new HashMap<>();
headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
reqDTO.setSignguCode(null);
reqDTO.setFfnlgCode(null);
CmmEnsUtils.validate(reqDTO);
return webClient.exchange(
HOST + POST_TRACK_INFO + String.format("?serviceKey=%s&rgist=%s",reqDTO.getServiceKey(), reqDTO.getRgist()),
HttpMethod.GET,
reqDTO,
EpostTraceResponse.class,
headerMap
);
}
}

@ -0,0 +1,23 @@
package kr.xit.ens.epost.service;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceRequest;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResponse;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.pplus.service
* fileName : IPplusService
* author : limju
* date : 2023-10-04
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-10-04 limju
*
* </pre>
*/
public interface IEpostService {
EpostTraceResponse postTrackInfo(final EpostTraceRequest reqDTO);
}

@ -0,0 +1,44 @@
package kr.xit.ens.epost.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceRequest;
import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResponse;
import kr.xit.core.model.ApiResponseDTO;
import kr.xit.ens.epost.service.IEpostService;
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;
/**
* <pre>
* description :
*
* packageName : kr.xit.ens.epost.web
* fileName : EpostController
* author : limju
* date : 2023-10-04
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-10-04 limju
*
* </pre>
*/
@Tag(name = "EpostController", description = "EPost API")
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/ens/epost/v1")
public class EpostController {
private final IEpostService service;
@Operation(summary = "우편물 종적추적", description = "우편물 종적 추적")
@PostMapping(value = "/postTrackInfo", produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponseDTO<?> postTrackInfo(@RequestBody final EpostTraceRequest paramDTO) {
EpostTraceResponse resDTO = service.postTrackInfo(paramDTO);
return ApiResponseDTO.success(resDTO);
}
}

@ -88,3 +88,7 @@ contract:
accept: /po/api/postplusPstMsrApi.do
# 우편 제작 상태 조회
status: /po/api/postplusPstStatusApi.do
epost:
host: http://openapi.epost.go.kr
api:
postTrackInfo: /trace/retrieveLongitudinalCombinedService/retrieveLongitudinalCombinedService/getLongitudinalCombinedList

@ -49,6 +49,7 @@
kt_company_cd, /* KT company code */
DATE_ADD(from_unixtime(kt_token_expires_in, '%Y%m%d%H%i%s'), INTERVAL -1 HOUR) AS ktTokenExpiresIn, /* KT 토큰 유효기간 */
kt_token_jti, /* KT 토큰 식별자 */
epost_service_key, /* epost service key */
pplus_api_key, /* postplus api key */
sender_nm, /* 발송인 명 */
sender_zip_no, /* 발송인 우편 번호 */

@ -90,6 +90,12 @@ public class CmmEnsRlaybsnmDTO extends AuditFields implements Serializable {
* postplus apiKey
*/
private String pplusApiKey;
/**
* EPost service key
*/
private String epostServiceKey;
/**
*
*/

@ -3,29 +3,27 @@ package kr.xit.biz.ens.model.epost;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.List;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpAcceptRequest;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpCommonResponse;
import kr.xit.core.model.IApiResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile;
/**
* <pre>
* description : EPost DTO
* -
* Request : {@link PpAcceptRequest}
* Response : {@link PpCommonResponse}
* -
* Request : {@link PpStatusRequest}
* Response : {@link PpStatusResponse}
* -
* Request : {@link EpostTraceRequest}
* Response : {@link EpostTraceResponse}
* packageName : kr.xit.biz.ens.model.epost
* fileName : EPostDTO
* author : limju
@ -40,9 +38,9 @@ import org.springframework.web.multipart.MultipartFile;
public class EPostDTO {
/**
* <pre>
* Postplus DTO
* Request: PpAcceptRequest
* Response: PpCommonResponse
* EPost DTO
* Request: EpostTraceRequest
* Response: EpostTraceResponse
* </pre>
*/
@Schema(name = "EpostTraceRequest", description = "EPost 종적추적 요청 DTO")
@ -67,25 +65,44 @@ public class EPostDTO {
* - 13
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "등기번호", example = " ")
@Schema(requiredMode = RequiredMode.REQUIRED, title = "등기번호", example = "1900472677718|1900472677695")
@Size(min = 13, max = 13, message = "등기번호는 필수 입니다(13자리)")
private MultipartFile rgist;
private String rgist;
}
/**
* <pre>
* Postplus DTO
* : - "OK"
* EPost DTO
* </pre>
*/
@Schema(name = "EpostTraceResponse", description = "EPost 종적추적 요청 결과 DTO")
@Getter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "response")
public static class EpostTraceResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@XmlElement(name = "header")
private EpostTraceResHeader header;
@Schema(requiredMode = RequiredMode.REQUIRED)
@XmlElement(name = "trackInfo")
private EpostTraceResTrackInfo trackInfo;
}
/**
* <pre>
* EPost header DTO
* </pre>
*/
@Schema(name = "EpostTraceResHeader", description = "EPost 종적추적 요청 결과 header DTO")
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "header")
public static class EpostTraceResHeader {
/**
* <pre>
* API : - 13
@ -111,6 +128,27 @@ public class EPostDTO {
@Schema(requiredMode = RequiredMode.REQUIRED, title = "성공여부")
private String successYN;
/**
* <pre>
* : max 100
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "에러메세지")
private String errorMessage;
}
/**
* <pre>
* EPost trackInfo DTO
* </pre>
*/
@Schema(name = "EpostTraceResTrackInfo", description = "EPost 종적추적 요청 결과 trackInfo DTO")
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "trackInfo")
public static class EpostTraceResTrackInfo {
/**
* <pre>
* : - 13
@ -164,6 +202,29 @@ public class EPostDTO {
@Schema(requiredMode = RequiredMode.REQUIRED, title = "배달 상태")
private String trackState;
/**
* <pre>
* : - max 10
* : EMS
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "서비스 종류")
private String expressType;
@Schema(requiredMode = RequiredMode.REQUIRED)
private List<EpostTraceResDtlTrack> detaileTrackList;
/**
* <pre>
* EPost detaileTrackList DTO
* </pre>
*/
@Schema(name = "EpostTraceResDtlTrack", description = "EPost 종적추적 요청 결과 detaileTrackList DTO")
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "detaileTrackList")
private static class EpostTraceResDtlTrack {
/**
* <pre>
* : - 1
@ -200,544 +261,24 @@ public class EPostDTO {
@Schema(requiredMode = RequiredMode.REQUIRED, title = "처리 상태")
private String status;
/**
* <pre>
* : max 100
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "에러메세지")
private String errorMessage;
}
/**
* <pre>
* Postplus Data Master DTO
* </pre>
*/
@Schema(name = "PpAcceptReqDataMst", description = "Postplus 우편제작 접수 요청 Data master DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PpAcceptReqDataMst {
//-----------------------------------------------------------------------
// 필수
//-----------------------------------------------------------------------
/**
* <pre>
* : v1.10
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "버전", example = "v1.10")
@NotEmpty(message = "버전은 필수 입니다")
private final String = "v1.10";
/**
* <pre>
* : default "N" -
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "테스트여부", example = "N")
@NotEmpty(message = "테스트여부는 필수 입니다(Y|N)")
private final String = "N";
/**
* <pre>
* : PST - , SMS - , KKO -
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "서비스", example = "PST")
@NotEmpty(message = "서비스 코드는 필수 입니다(PST)")
private final String = "PST";
/**
* <pre>
* : unique key
* max : 40byte
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "연계식별키", example = " ")
@Size(min = 5, max = 40, message = "연계식별키는 필수입니다(max:40)")
private String ;
/**
* <pre>
* : |||
* / A4(210*297)
* '' 'Y .
* 릿 data .
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "봉투", example = "소봉투")
@NotEmpty(message = "봉투는 필수입니다(소봉투|대봉투|접착시|엽서)")
private String ;
/**
* <pre>
* : ||
* (,) (,) (), ()
* .
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "봉투창", example = "이중창")
@NotEmpty(message = "봉투창은 필수입니다(이중창|단창|무창)")
private String ;
/**
* <pre>
* : |
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "흑백칼라", example = "흑백")
@NotEmpty(message = "흑백칼라는 필수입니다(흑백|칼라)")
private String ;
/**
* <pre>
* : |
* 2 .
* :
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "단면양면", example = "단면")
@NotEmpty(message = "단면양면은 필수입니다(단면|양면)")
private String ;
@Schema(requiredMode = RequiredMode.REQUIRED, title = "처리 장소")
private String location;
/**
* <pre>
* : ||||
* : - max 500
* -
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "배달", example = "일반")
@NotEmpty(message = "배달은 필수입니다(일반|등기|준등기|악일특급|선택등기)")
private String ;
@Schema(requiredMode = RequiredMode.REQUIRED, title = "상세 설명")
private String remark;
/**
* <pre>
* 릿 : 릿 Y
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "템플릿코드", example = "N")
@NotEmpty(message = "템플릿출력여부는 필수입니다(Y|N)")
private final String 릿 = StringUtils.isEmpty(this.릿) ? "N" : "Y";
/**
* <pre>
*
* Y:
*
* margin
* - 8mm, 5mm margin
* - 8mm, 5mm, 17mm margin
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "여백생성유무", example = "N")
@NotEmpty(message = "여백생성유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* Y
* N
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "여백생성유무", example = "N")
@NotEmpty(message = "주소페이지유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "맞춤자제유무", example = "N")
@NotEmpty(message = "맞춤자제유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* Y 릿
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "메일머지유무", example = "N")
@NotEmpty(message = "메일머지유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* Y 릿
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "동봉물유무", example = "N")
@NotEmpty(message = "동봉물유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* : N
* : Y ( )
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "반송여부유무", example = "N")
@NotEmpty(message = "반송여부는 필수입니다(Y|N)")
//private final String 반송여부 = "N";
private final String[] = new String[]{"Y", "N"};
/**
* <pre>
*
* .
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "스테이플러유무", example = "N")
@NotEmpty(message = "스테이플러유무는 필수입니다(Y|N)")
private final String = "N";
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송인명", example = "포스토피아")
@NotEmpty(message = "발송인명은 필수입니다")
private String ;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송인우편번호", example = "05048")
@NotEmpty(message = "발송인우편번호는 필수입니다")
private String ;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송인주소", example = "서울특별시 광진구 강변로역2")
@NotEmpty(message = "발송인주소는 필수입니다")
private String ;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송인상세주소", example = "구의동, 서울광진우체국")
@NotEmpty(message = "발송인상세주소는 필수입니다")
private String ;
//-----------------------------------------------------------------------
/**
* <pre>
* 릿 : 릿 ,
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "템플릿코드", example = " ")
private String 릿;
/**
* <pre>
*
*
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "수취인수", example = " ")
private Integer ;
/**
* <pre>
*
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "동봉물페이지수", example = " ")
private Integer ;
/**
* <pre>
*
* 릿
* .
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "로고파일", example = " ")
private String ;
/**
* <pre>
*
* ///
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "발송인전화번호", example = "010-XXXX-XXXX")
private String ;
}
/**
* <pre>
* Postplus Data Detail DTO
* </pre>
*/
@Schema(name = "PpAcceptReqDataDtl", description = "Postplus 우편제작 접수 요청 Data detail DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PpAcceptReqDataDtl {
//-----------------------------------------------------------------------
// 필수
//-----------------------------------------------------------------------
/**
* <pre>
* : "1"
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "순번", example = "1")
@NotEmpty(message = "순번은 필수입니다")
private String ;
/**
* <pre>
* :
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "이름", example = "홍길동")
@NotEmpty(message = "이름은 필수입니다")
private String ;
/**
* <pre>
* :
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "우편번호", example = "05048")
@NotEmpty(message = "우편번호는 필수입니다")
private String ;
/**
* <pre>
* :
* 200
* 100
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "주소", example = "서울특별시 광진구 강변역로2")
@Size(min = 5, max = 200, message = "주소는 필수입니다(max:200)")
private String ;
//-----------------------------------------------------------------------
/**
* <pre>
* :
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "상세주소", example = "서울광진우체국 B동 4층")
private String ;
/**
* <pre>
* : (/// )
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "전화번호", example = " ")
private String ;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "첨부파일", example = " ")
private String ;
/**
* <pre>
* :
*
* 1 ZIP pstFile
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "이미지갯수", example = " ")
private Integer ;
/**
* <pre>
* 1
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "이미지1", example = " ")
private String 1;
/**
* <pre>
* 2
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "이미지2", example = " ")
private String 2;
/**
* <pre>
* 3
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "이미지3", example = " ")
private String 3;
/**
* <pre>
* : 200
* </pre>
*/
}
/**
* <pre>
* Postplus DTO
* Request: PpStatusRequest
* Response: PpStatusResponse
* </pre>
*/
@Schema(name = "PpStatusRequest", description = "Postplus 우편제작 상태 조회 요청 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PpStatusRequest extends CmmEnsRequestDTO {
/**
* <pre>
* apiKey
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "apiKey", example = " ")
@NotEmpty(message = "apiKey는 필수 입니다.")
private String apiKey;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "우편제작요청연계식별키", example = "TEST20230221_000001")
@NotEmpty(message = "우편 제작 요청 연계 식별키는 필수 입니다.")
private String inputCode;
}
/**
* <pre>
* Postplus DTO
* :
* </pre>
*/
@Schema(name = "PpStatusResponse", description = "Postplus 우편제작 상태 조회 결과 DTO")
@Getter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PpStatusResponse extends PpCommonResponse {
//---------------------------------------------------------
// 필수
//---------------------------------------------------------
/**
* <pre>
* : YYYYMMDD0000
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
* : |||
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
* : ||||
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
* : |
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
* : |
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
*
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private Integer ;
/**
* <pre>
* : ||||||
* -> msg
* ->
* // ->
* -> ,
* ->
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
/**
* <pre>
* :
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private String ;
//---------------------------------------------------------
/**
* <pre>
* :
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO)
private String ;
/**
* <pre>
* :
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO)
private String ;
}
}

Loading…
Cancel
Save