feat: NICE CI 인증톡 진행

send, status 반영
dev
Jonguk. Lim 1 month ago
parent acf7794a75
commit f5c07f7086

@ -283,3 +283,13 @@ SELECT etm.*
WHERE etm.tmplt_cd='A0001'; WHERE etm.tmplt_cd='A0001';
SELECT
TO_CHAR(MIN(run_dt),
'YYYYMMDD')||'000000000000' AS searchPdFrom ,
TO_CHAR(MAX(run_dt+1),
'YYYYMMDD')||'000000000000' AS searchPdTo
FROM
tb_input_xit
WHERE
send_type = 'NI'
AND prcs_cd = 'IPCP';

@ -23,13 +23,13 @@ import cokr.xit.ens.modules.nice.model.*;
*/ */
@Mapper @Mapper
public interface INiceCiMapper { public interface INiceCiMapper {
List<NiceCiDTO.InputXit> selectNiceCiTgts(final NiceCiDTO.NiceCiParam niceCiParam); List<NiceCiDTO.InputXit> selectInputXits(final NiceCiDTO.NiceCiParam niceCiParam);
List<NiceCiDTO.InputDataXit> selectNiceCiAcceptDatas(final NiceCiDTO.NiceCiParam niceCiParam); List<NiceCiDTO.InputDataXit> selectInputDataXits(final NiceCiDTO.NiceCiParam niceCiParam);
int insertBill(final NiceCiDTO.BillDTO billDTO); int insertBill(final NiceCiDTO.BillDTO billDTO);
int updateBill(final NiceCiDTO.BillDTO billDTO); int updateBill(final NiceCiDTO.BillDTO billDTO);
//int saveBill(final NiceCiDTO.BillDTO billDTO);
int saveBillKko(final NiceCiDTO.BillKkoDTO billKkoDTO); int mergeBillKko(final NiceCiDTO.BillKkoDTO billKkoDTO);
int updatePayUrlOfDataInput(final NiceCiDTO.InputDataXit inputDataXit); int updatePayUrlOfDataInput(final NiceCiDTO.InputDataXit inputDataXit);
int updatePrcsCdAndErrorOfInputXit(final NiceCiDTO.InputXit inputXit); int updatePrcsCdAndErrorOfInputXit(final NiceCiDTO.InputXit inputXit);
Optional<OrgMng> selectKkoBpApiUrlFromEnsOrgMng(final String orgCd); Optional<OrgMng> selectKkoBpApiUrlFromEnsOrgMng(final String orgCd);
@ -40,9 +40,10 @@ public interface INiceCiMapper {
int insertNiceSmsSndngRequest(final NiceCiApiSendDTO.Request requestDTO); int insertNiceSmsSndngRequest(final NiceCiApiSendDTO.Request requestDTO);
int insertNiceSmsSndngResponse(final NiceCiApiSendDTO.Response responseDTO); int insertNiceSmsSndngResponse(final NiceCiApiSendDTO.Response responseDTO);
Optional<NiceCiApiStatusDTO.Request> selectFromAndToOfStatusParam(final NiceCiDTO.NiceCiParam niceCiParam);
Optional<String> selectNiceCiInqireId(); Optional<String> selectNiceCiInqireId();
int insertNiceSmsSndngInquireRequest(final NiceCiApiStatusDTO.Request requestDTO); int insertNiceSmsSndngInquireRequest(final NiceCiApiStatusDTO.Request requestDTO);
int insertNiceSmsSndngInquireResponse(final NiceCiApiStatusDTO.Response responseDTO); int insertNiceSmsSndngInquireResponse(final NiceCiApiStatusDTO.Response responseDTO);
int insertNiceSmsSndngInquireResponseRepeat(final List<NiceCiApiResult> resultList); int insertNiceSmsSndngInquireResponseRepeat(final List<NiceCiApiResult> resultList);
int mergeSendResult(final NiceCiDTO.SendResult sendResult);
} }

@ -84,9 +84,9 @@ public class NiceCiApiStatusDTO {
*/ */
@Schema(title = "검색기간 from", example = " ") @Schema(title = "검색기간 from", example = " ")
@Size(min = 20, max = 20, message = "검색기간 from") @Size(min = 20, max = 20, message = "검색기간 from")
private String searchPdFrom = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE); private String searchPdFrom;
public void setSearchPdFrom(String searchPdFrom) { public void setSearchPdFrom(String searchPdFrom) {
this.searchPdFrom = StringUtils.rightPad(nvl(searchPdFrom), 20, StringUtils.SPACE); this.searchPdFrom = StringUtils.rightPad(nvl(searchPdFrom), 20, "0");
} }
/** /**
@ -97,9 +97,9 @@ public class NiceCiApiStatusDTO {
*/ */
@Schema(title = "검색기간 to", example = " ") @Schema(title = "검색기간 to", example = " ")
@Size(min = 20, max = 20, message = "검색기간 to") @Size(min = 20, max = 20, message = "검색기간 to")
private String searchPdTo = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE); private String searchPdTo;
public void setSearchPdTo(String searchPdTo) { public void setSearchPdTo(String searchPdTo) {
this.searchPdTo = StringUtils.rightPad(nvl(searchPdTo), 20, StringUtils.SPACE); this.searchPdTo = StringUtils.rightPad(nvl(searchPdTo), 20, "0");
} }
/** /**
@ -162,9 +162,9 @@ public class NiceCiApiStatusDTO {
*/ */
@Schema(title = "요청건수", example = " ") @Schema(title = "요청건수", example = " ")
@Pattern(regexp = "^[\\s\\S]{10}$", message = "요청건수는 10자리(max 100)입니다") @Pattern(regexp = "^[\\s\\S]{10}$", message = "요청건수는 10자리(max 100)입니다")
private String requstCo = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE); private String requstCo;
public void setRequstCo(String requstCo){ public void setRequstCo(String requstCo){
this.requstCo = StringUtils.rightPad(nvl(requstCo), 10, StringUtils.SPACE); this.requstCo = StringUtils.leftPad(nvl(requstCo), 10, "0");
} }
/** /**
@ -176,9 +176,9 @@ public class NiceCiApiStatusDTO {
@Schema(title = "누적수신건수", example = " ") @Schema(title = "누적수신건수", example = " ")
@Size(min = 10, max = 10, message = "누적수신건수는 10자리 입니다.") @Size(min = 10, max = 10, message = "누적수신건수는 10자리 입니다.")
@Pattern(regexp = "^\\d{10}$", message = "요청건수는 10자리(max 100)입니다") @Pattern(regexp = "^\\d{10}$", message = "요청건수는 10자리(max 100)입니다")
private String accmltRecptnCo = "0000000000"; private String accmltRecptnCo;
public void setAccmltRecptnCo(String accmltRecptnCo) { public void setAccmltRecptnCo(String accmltRecptnCo) {
this.accmltRecptnCo = StringUtils.rightPad(nvl(accmltRecptnCo), 10, StringUtils.SPACE); this.accmltRecptnCo = StringUtils.leftPad(nvl(accmltRecptnCo), 10, "0");
} }
/** /**

@ -459,4 +459,75 @@ public class NiceCiDTO {
private LocalDateTime lastUpdtDt; private LocalDateTime lastUpdtDt;
} }
@Schema(name = "SendResult DTO", description = "SendResult DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class SendResult {
/**
* - PK
*/
private Long lnkInputId;
/**
* - PK
*/
private String dataId;
/**
* - PK
*/
private String prcsOdr;
/**
*
*/
private String sendSttusCd;
/**
* : NI:, KP:
*/
private String sendType;
/**
*
*/
private LocalDateTime runDt;
/**
*
*/
private LocalDateTime bizSendDt;
/**
*
*/
private LocalDateTime bizRecvDt;
/**
*
*/
private LocalDateTime bizReadDt;
/**
*
*/
private String bizErrMsg;
/**
*
*/
private LocalDateTime expiresDt;
/**
* -
*/
private String prcsYn;
private String regId;
private LocalDateTime regDt;
}
} }

@ -78,7 +78,8 @@ public class NiceCiAcceptService {
* -- 4. KkoPayUrlService.callApi() tb_input_data_xit pay_url URL UPDATE * -- 4. KkoPayUrlService.callApi() tb_input_data_xit pay_url URL UPDATE
* KkoPayUrlServiceTest * KkoPayUrlServiceTest
* -- 5. tb_input_xit prcs_cd='GRUC' / prcs_cd='TGRF' * -- 5. tb_input_xit prcs_cd='GRUC' / prcs_cd='TGRF'
* @return *
* @return EnsResponseVO
* </pre> * </pre>
*/ */
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
@ -88,7 +89,7 @@ public class NiceCiAcceptService {
.prcsCd(IupPrcsCd.TGRG.getCode()) .prcsCd(IupPrcsCd.TGRG.getCode())
.build(); .build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiTgts(niceCiParam); final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);
if(list.isEmpty()){ if(list.isEmpty()){
return EnsResponseVO.errBuilder() return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR404) .errCode(EnsErrCd.ERR404)
@ -98,7 +99,7 @@ public class NiceCiAcceptService {
list.forEach(d -> { list.forEach(d -> {
niceCiParam.setLnkInputId(d.getLnkInputId()); niceCiParam.setLnkInputId(d.getLnkInputId());
d.setInputDataXits(niceCiMapper.selectNiceCiAcceptDatas(niceCiParam)); d.setInputDataXits(niceCiMapper.selectInputDataXits(niceCiParam));
}); });
@ -120,8 +121,18 @@ public class NiceCiAcceptService {
try { try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits(); List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
for (NiceCiDTO.InputDataXit data : inputDataXits) { for (NiceCiDTO.InputDataXit data : inputDataXits) {
//----------------------------------------------------------
// pay Url API call & Get Result START
//----------------------------------------------------------
PayApiRespDTO<Map<String, Object>> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData); PayApiRespDTO<Map<String, Object>> respDTO = getPayUrl(data, billHistDTO, orgMng, kkoPayUrlRespData);
//----------------------------------------------------------
// pay Url API call & Get Result START
//----------------------------------------------------------
//----------------------------------------------------------
// API Call 후처리 START - response 반영 & 결제 이력 생성
//----------------------------------------------------------
// FIXME: API 호출 결과 SET - 연계 설정후 확인 필요 // FIXME: API 호출 결과 SET - 연계 설정후 확인 필요
data.setPayUrl(String.valueOf(respDTO.getData())); data.setPayUrl(String.valueOf(respDTO.getData()));
niceCiMapper.updatePayUrlOfDataInput(data); niceCiMapper.updatePayUrlOfDataInput(data);
@ -143,7 +154,7 @@ public class NiceCiAcceptService {
.build() .build()
); );
// FIXME: biller_notice_key, custom_url, expire_at 설정 및 확인 필요??? // FIXME: biller_notice_key, custom_url, expire_at 설정 및 확인 필요???
niceCiMapper.saveBillKko( niceCiMapper.mergeBillKko(
NiceCiDTO.BillKkoDTO.builder() NiceCiDTO.BillKkoDTO.builder()
.billId(keySequenceService.getKeySequence("BillKko_id")) .billId(keySequenceService.getKeySequence("BillKko_id"))
.billerUserKey(data.getDataId()) .billerUserKey(data.getDataId())
@ -154,7 +165,9 @@ public class NiceCiAcceptService {
.billUid(billUid) .billUid(billUid)
.build() .build()
); );
//----------------------------------------------------------
// API Call 후처리 END - response 반영 & 결제 이력 생성
//----------------------------------------------------------
} }
xit.setPrcsCd(IupPrcsCd.GRUC.getCode()); xit.setPrcsCd(IupPrcsCd.GRUC.getCode());

@ -45,13 +45,28 @@ public class NiceCiSendBulkService {
private final INiceCiMapper niceCiMapper; private final INiceCiMapper niceCiMapper;
private Gson gson = new GsonBuilder().disableHtmlEscaping().create(); private Gson gson = new GsonBuilder().disableHtmlEscaping().create();
/**
* <pre>
* -- 1.
* SELECT *
* FROM tb_input_xit tix
* WHERE tix.send_type='NI'
* AND tix.prcs_cd='GRUC'
* AND tix.RUN_DT < SYSDATE;
*
* -- 2.
*
* -- 3. tb_input_xit prcs_cd='IPCP' / prcs_cd='FAIL'
* @return EnsResponseVO
* </pre>>
*/
public EnsResponseVO<?> requestSendBulk() { public EnsResponseVO<?> requestSendBulk() {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder() final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode()) .sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.GRUC.getCode()) .prcsCd(IupPrcsCd.GRUC.getCode())
.build(); .build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiTgts(niceCiParam); final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);
if(list.isEmpty()){ if(list.isEmpty()){
return EnsResponseVO.errBuilder() return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR404) .errCode(EnsErrCd.ERR404)
@ -61,7 +76,7 @@ public class NiceCiSendBulkService {
list.forEach(d -> { list.forEach(d -> {
niceCiParam.setLnkInputId(d.getLnkInputId()); niceCiParam.setLnkInputId(d.getLnkInputId());
d.setInputDataXits(niceCiMapper.selectNiceCiAcceptDatas(niceCiParam)); d.setInputDataXits(niceCiMapper.selectInputDataXits(niceCiParam));
}); });
for(NiceCiDTO.InputXit xit : list) { for(NiceCiDTO.InputXit xit : list) {
@ -96,17 +111,36 @@ public class NiceCiSendBulkService {
ciRequest.getQueryRequests().add(queryRequest); ciRequest.getQueryRequests().add(queryRequest);
ciRequest.getButtonRequests().add(btnRequest); ciRequest.getButtonRequests().add(btnRequest);
//----------------------------------------------------------
// API Call 전처리 START - request 저장
//----------------------------------------------------------
ciRequest.setNiceSmsSndngRequstId(niceSmsReqId); ciRequest.setNiceSmsSndngRequstId(niceSmsReqId);
ciRequest.setDataId(data.getDataId()); ciRequest.setDataId(data.getDataId());
niceCiMapper.insertNiceSmsSndngRequest(ciRequest); niceCiMapper.insertNiceSmsSndngRequest(ciRequest);
//----------------------------------------------------------
// API Call 전처리 END - request 저장
//----------------------------------------------------------
//----------------------------------------------------------
// Status API call & Get Result START
//----------------------------------------------------------
// FIXME : 연계 이후 확인 필요 // FIXME : 연계 이후 확인 필요
EnsResponseVO<?> responseVO = niceCiApiService.requestSendBulk(ciRequest); EnsResponseVO<?> responseVO = niceCiApiService.requestSendBulk(ciRequest);
if (!EnsErrCd.OK.equals(responseVO.getErrCode())) if (!EnsErrCd.OK.equals(responseVO.getErrCode()))
throw new EnsException(responseVO.getErrCode(), responseVO.getErrMsg()); throw new EnsException(responseVO.getErrCode(), responseVO.getErrMsg());
NiceCiApiSendDTO.Response resDTO = (NiceCiApiSendDTO.Response)responseVO.getResultInfo(); NiceCiApiSendDTO.Response resDTO = (NiceCiApiSendDTO.Response)responseVO.getResultInfo();
//----------------------------------------------------------
// Status API call & Get Result END
//----------------------------------------------------------
//----------------------------------------------------------
// API Call 후처리 START - response 저장
//----------------------------------------------------------
resDTO.setNiceSmsSndngRequstId(niceSmsReqId); resDTO.setNiceSmsSndngRequstId(niceSmsReqId);
niceCiMapper.insertNiceSmsSndngResponse(resDTO); niceCiMapper.insertNiceSmsSndngResponse(resDTO);
//----------------------------------------------------------
// API Call 후처리 START - response 저장
//----------------------------------------------------------
log.info(responseVO.toString()); log.info(responseVO.toString());
} }

@ -46,13 +46,30 @@ public class NiceCiStatBulkService {
private final INiceCiMapper niceCiMapper; private final INiceCiMapper niceCiMapper;
/**
* <pre>
* -- 1.
* SELECT *
* FROM tb_input_xit tix
* WHERE tix.send_type='NI'
* AND tix.prcs_cd='IPCP';
*
* -- 2. INSERT OR UPDATE tb_send_result
* SELECT * FROM tb_send_result;
* send_sttus_cd
* TALK_SEND
* SMS_SEND KT
* FAIL
* @return EnsResponseVO
* </pre>
*/
public EnsResponseVO<?> findBulkStatus() { public EnsResponseVO<?> findBulkStatus() {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder() final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode()) .sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode()) .prcsCd(IupPrcsCd.IPCP.getCode())
.build(); .build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiTgts(niceCiParam); final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);
if(list.isEmpty()){ if(list.isEmpty()){
return EnsResponseVO.errBuilder() return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR404) .errCode(EnsErrCd.ERR404)
@ -62,7 +79,7 @@ public class NiceCiStatBulkService {
list.forEach(d -> { list.forEach(d -> {
niceCiParam.setLnkInputId(d.getLnkInputId()); niceCiParam.setLnkInputId(d.getLnkInputId());
d.setInputDataXits(niceCiMapper.selectNiceCiAcceptDatas(niceCiParam)); d.setInputDataXits(niceCiMapper.selectInputDataXits(niceCiParam));
}); });
for(NiceCiDTO.InputXit xit : list) { for(NiceCiDTO.InputXit xit : list) {
@ -70,6 +87,8 @@ public class NiceCiStatBulkService {
try { try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits(); List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
NiceCiDTO.SendResult sendResult = null;
for (NiceCiDTO.InputDataXit data : inputDataXits) { for (NiceCiDTO.InputDataXit data : inputDataXits) {
// 기관전문관리번호, TB_NICE_SMS_SNDNG_REQUEST - NICE_SMS_SNDNG_REQUST_ID // 기관전문관리번호, TB_NICE_SMS_SNDNG_REQUEST - NICE_SMS_SNDNG_REQUST_ID
@ -77,7 +96,9 @@ public class NiceCiStatBulkService {
() -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm()) () -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm())
); );
NiceCiApiStatusDTO.Request ciRequest = new NiceCiApiStatusDTO.Request(); // 검색기간 (from ~ to) 조회 및 SET
NiceCiApiStatusDTO.Request ciRequest = niceCiMapper.selectFromAndToOfStatusParam(niceCiParam)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, "검색기간 설정 조회 실패"));
NiceCiApiCommon nCommon = new NiceCiApiCommon(); NiceCiApiCommon nCommon = new NiceCiApiCommon();
// 공통부 set // 공통부 set
@ -87,27 +108,21 @@ public class NiceCiStatBulkService {
// 개별요청부 set // 개별요청부 set
setNiceCiApiPrivateReq(ciRequest); setNiceCiApiPrivateReq(ciRequest);
// API request 저장 int totCo = 0;
ciRequest.setNiceSmsSndngInqireId(niceSmsInqId); int repeat = 0;
niceCiMapper.insertNiceSmsSndngInquireRequest(ciRequest); do {
ciRequest.setAccmltRecptnCo(Integer.toString(repeat));
EnsResponseVO<?> responseVO = niceCiApiService.findBulkStatus(ciRequest); NiceCiApiStatusDTO.Response resDTO = repeatStatusBulk(
if (!EnsErrCd.OK.equals(responseVO.getErrCode())) ciRequest,
throw new EnsException(responseVO.getErrCode(), responseVO.getErrMsg()); xit,
data
//sendResult
);
if(totCo == 0) totCo = Integer.parseInt(resDTO.getTotCo());
repeat += 100;
} while(totCo > 100 && totCo > repeat);
NiceCiApiStatusDTO.Response resDTO = (NiceCiApiStatusDTO.Response)responseVO.getResultInfo();
resDTO.setNiceSmsSndngInqireId(niceSmsInqId);
// API response 저장
niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO);
// API response 반복부 저장
niceCiMapper.insertNiceSmsSndngInquireResponseRepeat(
resDTO.getNiceCiResults()
.stream().peek(d -> d.setNiceSmsSndngInqireId(niceSmsInqId))
.collect(Collectors.toList()));
log.info(responseVO.toString());
} }
} catch (EnsException e) { } catch (EnsException e) {
// FIXME : API 통신에러 인경우 skip - 재시도 되어야 // FIXME : API 통신에러 인경우 skip - 재시도 되어야
@ -205,12 +220,82 @@ public class NiceCiStatBulkService {
// 개별요청부 : default end // 개별요청부 : default end
//--------------------------------------------------------- //---------------------------------------------------------
ciRequest.setSearchPdFrom(DateUtil.getNowTimeMicrosecond()); // 검색기간 - from // selectFromAndToOfStatusParam 에서 SET
ciRequest.setSearchPdTo(DateUtil.getNowTimeMicrosecond()); // 검색기간 - to // ciRequest.setSearchPdFrom(DateUtil.getNowTimeMicrosecond()); // 검색기간 - from
ciRequest.setRequstCo("?"); // 요청건수 // ciRequest.setSearchPdTo(DateUtil.getNowTimeMicrosecond()); // 검색기간 - to
//ciRequest.setAccmltRecptnCo(); // 누적수신건수 ciRequest.setRequstCo("100"); // 요청건수
ciRequest.setAccmltRecptnCo("0000000000"); // 누적수신건수
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// 개별요청부 END // 개별요청부 END
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
} }
private NiceCiApiStatusDTO.Response repeatStatusBulk(
NiceCiApiStatusDTO.Request ciRequest,
NiceCiDTO.InputXit xit,
NiceCiDTO.InputDataXit data){
// 기관전문관리번호, TB_NICE_SMS_SNDNG_REQUEST - NICE_SMS_SNDNG_REQUST_ID
final String niceSmsInqId = niceCiMapper.selectNiceCiInqireId().orElseThrow(
() -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm())
);
//----------------------------------------------------------
// API Call 전처리 START - request & 결과테이블 저장
//----------------------------------------------------------
ciRequest.setNiceSmsSndngInqireId(niceSmsInqId);
niceCiMapper.insertNiceSmsSndngInquireRequest(ciRequest);
NiceCiDTO.SendResult sendResult = NiceCiDTO.SendResult.builder()
.lnkInputId(xit.getLnkInputId())
.dataId(data.getDataId())
.prcsOdr("1")
.sendType(xit.getSendType())
.runDt(xit.getRunDt())
.expiresDt(xit.getExpiresDt())
.prcsYn("N")
.build();
// 결과 테이블 데이타 생성 or update
niceCiMapper.mergeSendResult(sendResult);
//----------------------------------------------------------
// API Call 전처리 END - request & 결과테이블 저장
//----------------------------------------------------------
//----------------------------------------------------------
// Status API call & Get Result START
//----------------------------------------------------------
EnsResponseVO<?> responseVO = niceCiApiService.findBulkStatus(ciRequest);
if (!EnsErrCd.OK.equals(responseVO.getErrCode()))
throw new EnsException(responseVO.getErrCode(), responseVO.getErrMsg());
NiceCiApiStatusDTO.Response resDTO = (NiceCiApiStatusDTO.Response)responseVO.getResultInfo();
//----------------------------------------------------------
// Status API call & Get Result END
//----------------------------------------------------------
//----------------------------------------------------------
// API Call 후처리 START - response & 결과테이블 저장
//----------------------------------------------------------
// API response 저장
resDTO.setNiceSmsSndngInqireId(niceSmsInqId);
niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO);
// API response 반복부 저장
niceCiMapper.insertNiceSmsSndngInquireResponseRepeat(
resDTO.getNiceCiResults()
.stream().peek(d -> d.setNiceSmsSndngInqireId(niceSmsInqId))
.collect(Collectors.toList()));
// FIXME: 아래 값으로 set
//mssageSndngResultSe 1 -> TALK_SEND, 2 -> SMS_SEND, FAIL
// 결과 테이블 데이타 update
sendResult.setSendSttusCd("");
niceCiMapper.mergeSendResult(sendResult);
//----------------------------------------------------------
// API Call 후처리 END - response & 결과테이블 저장
//----------------------------------------------------------
return resDTO;
}
} }

@ -6,8 +6,8 @@
<!-- ================================ accept =========================================== --> <!-- ================================ accept =========================================== -->
<!-- =================================================================================== --> <!-- =================================================================================== -->
<select id="selectNiceCiTgts" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit"> <select id="selectInputXits" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|selectNiceCiTgts-NICE CI 대상 조회|julim */ /** iup-niceci-mapper|selectInputXits-NICE CI 대상 조회|julim */
SELECT lnk_input_id SELECT lnk_input_id
, err_msg , err_msg
, expires_dt , expires_dt
@ -31,8 +31,8 @@
</if> </if>
</select> </select>
<select id="selectNiceCiAcceptDatas" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputDataXit"> <select id="selectInputDataXits" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputDataXit">
/** iup-niceci-mapper|selectNiceCiAcceptDatas-NICE CI 발송 대상 조회|julim */ /** iup-niceci-mapper|selectInputDataXits-NICE CI 발송 대상 조회|julim */
SELECT data_id SELECT data_id
, birthday , birthday
, call_center_no , call_center_no
@ -86,8 +86,8 @@
</update> </update>
<!--// FIXME: NICE CI INSERT UPDATE 항목 확인 적용 필요 --> <!--// FIXME: NICE CI INSERT UPDATE 항목 확인 적용 필요 -->
<insert id="saveBillKko" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillKkoDTO"> <insert id="mergeBillKko" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillKkoDTO">
/** iup-niceci-mapper|saveBill-NICE CI 청구서 생성|julim */ /** iup-niceci-mapper|mergeBill-NICE CI 청구서 생성|julim */
MERGE MERGE
INTO ens_bill_kko INTO ens_bill_kko
USING DUAL USING DUAL
@ -176,7 +176,13 @@
FROM ens_org_mng FROM ens_org_mng
WHERE org_cd = #{orgCd} WHERE org_cd = #{orgCd}
</select> </select>
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- =================================================================================== -->
<!-- =================================================================================== -->
<!-- ================================ send =========================================== -->
<!-- =================================================================================== -->
<select id="selectNiceCiRequestId" resultType="string"> <select id="selectNiceCiRequestId" resultType="string">
/** iup-niceci-mapper|selectNiceCiRequestId-select nice ci request Id|julim */ /** iup-niceci-mapper|selectNiceCiRequestId-select nice ci request Id|julim */
SELECT LPAD(SEQ_NICE_SMS_SNDNG_REQUST_ID.nextval, 10, '0') SELECT LPAD(SEQ_NICE_SMS_SNDNG_REQUST_ID.nextval, 10, '0')
@ -355,7 +361,22 @@
'ENS_SYS' 'ENS_SYS'
) )
</insert> </insert>
<!-- =================================================================================== -->
<!-- ================================ send =========================================== -->
<!-- =================================================================================== -->
<!-- =================================================================================== -->
<!-- ================================ status =========================================== -->
<!-- =================================================================================== -->
<select id="selectFromAndToOfStatusParam" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiApiStatusDTO$Request">
/** iup-niceci-mapper|selectFromAndToOfStatusParam-상태조회 조회시작일과 종료일 조회|julim */
SELECT TO_CHAR(MIN(run_dt), 'YYYYMMDD')||'000000000000' AS searchPdFrom
, TO_CHAR(MAX(run_dt+1), 'YYYYMMDD')||'000000000000' AS searchPdTo
FROM tb_input_xit
WHERE send_type = #{sendType}
AND prcs_cd = #{prcsCd}
</select>
<select id="selectNiceCiInqireId" resultType="string"> <select id="selectNiceCiInqireId" resultType="string">
/** iup-niceci-mapper|selectNiceCiInqireId-select nice ci Inquire Id|julim */ /** iup-niceci-mapper|selectNiceCiInqireId-select nice ci Inquire Id|julim */
SELECT LPAD(SEQ_NICE_SMS_SNDNG_INQIRE_ID.nextval, 10, '0') SELECT LPAD(SEQ_NICE_SMS_SNDNG_INQIRE_ID.nextval, 10, '0')
@ -519,4 +540,45 @@
</foreach> </foreach>
</insert> </insert>
<insert id="mergeSendResult" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$SendResult">
/** iup-niceci-mapper|mergeSendResult-nice ci 결과 반영|julim */
MERGE
INTO tb_send_result
USING DUAL
ON (
lnk_input_id = #{lnkInputId}
AND data_id = #{dataId}
)
WHEN MATCHED THEN
UPDATE
SET SEND_STTUS_CD = #{sendSttusCd}
, BIZ_SEND_DT = #{bizSendDt}
, BIZ_RECV_DT = #{bizRecvDt}
, BIZ_READ_DT = #{bizReadDt}
, BIZ_ERR_MSG = #{bizErrMsg}
WHEN NOT MATCHED THEN
INSERT (
LNK_INPUT_ID,
DATA_ID,
RUN_DT,
SEND_TYPE,
EXPIRES_DT,
PRCS_YN,
REG_DT,
REG_ID
) VALUES (
#{lnkInputId}
, #{dataId}
, #{runDt}
, #{sendType}
, #{expiresDt}
, #{prcsYn}
, sysdate
, 'ENS_SYS'
)
</insert>
<!-- =================================================================================== -->
<!-- ================================ status =========================================== -->
<!-- =================================================================================== -->
</mapper> </mapper>

Loading…
Cancel
Save