feat: NICE CI 인증톡 진행

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

@ -293,3 +293,20 @@ SELECT
WHERE
send_type = 'NI'
AND prcs_cd = 'IPCP';
SELECT tidx.data_id
, tix.SEND_TYPE
, tix.RUN_DT
, tix.EXPIRES_DT
, '' AS prcsYn
, tnssr.IHIDNUM
FROM tb_nice_sms_sndng_requst tnssr
JOIN TB_INPUT_DATA_XIT tidx
ON tnssr.DATA_ID = tidx.data_id
JOIN TB_INPUT_XIT tix
ON tidx.LNK_INPUT_ID = tix.LNK_INPUT_ID
WHERE 1=1
AND tnssr.ihidnum = '8312181111111' -- #{ihidnum} -- 응답받은 주민번호
-- AND REGEXP_REPLACE(tnssr.sndng_mssage, '[[:space:]]+', '') = REGEXP_REPLACE(#{sndngMssage}, '[[:space:]]+', '') -- 응답받은 발송메시지

@ -26,6 +26,8 @@ public interface INiceCiMapper {
List<NiceCiDTO.InputXit> selectInputXits(final NiceCiDTO.NiceCiParam niceCiParam);
List<NiceCiDTO.InputDataXit> selectInputDataXits(final NiceCiDTO.NiceCiParam niceCiParam);
// accept //////////////////////////////////////////////////////////
int insertBill(final NiceCiDTO.BillDTO billDTO);
int updateBill(final NiceCiDTO.BillDTO billDTO);
@ -34,16 +36,17 @@ public interface INiceCiMapper {
int updatePrcsCdAndErrorOfInputXit(final NiceCiDTO.InputXit inputXit);
Optional<OrgMng> selectKkoBpApiUrlFromEnsOrgMng(final String orgCd);
// send ///////////////////////////////////////////////////////
Optional<String> selectNiceCiRequestId();
Optional<NiceCiDTO.TmpltMngDTO> selectTmpltMsg(final String tmpltId);
int insertNiceSmsSndngRequest(final NiceCiApiSendDTO.Request requestDTO);
int insertNiceSmsSndngResponse(final NiceCiApiSendDTO.Response responseDTO);
// status /////////////////////////////////////////////////////////////////////////////
Optional<NiceCiApiStatusDTO.Request> selectFromAndToOfStatusParam(final NiceCiDTO.NiceCiParam niceCiParam);
Optional<String> selectNiceCiInqireId();
int insertNiceSmsSndngInquireRequest(final NiceCiApiStatusDTO.Request requestDTO);
int insertNiceSmsSndngInquireResponse(final NiceCiApiStatusDTO.Response responseDTO);
int insertNiceSmsSndngInquireResponseRepeat(final List<NiceCiApiResult> resultList);
int mergeSendResult(final NiceCiDTO.SendResult sendResult);
}

@ -1,12 +1,14 @@
package cokr.xit.ens.modules.nice.mapper;
import java.util.*;
import org.apache.ibatis.annotations.*;
import cokr.xit.ens.modules.nice.model.*;
/**
* <pre>
* description :
* description : NICE CI mapper
* packageName : cokr.xit.ens.modules.nice.mapper
* fileName : INiceMapper
* author : limju
@ -19,7 +21,13 @@ import cokr.xit.ens.modules.nice.model.*;
* </pre>
*/
@Mapper
public interface INiceCiBillHistoryMapper {
public interface INiceCiNewTransactionMapper {
// accept
int insertBillHistory(final NiceCiDTO.BillHistDTO billHistDTO);
int updateBillHistory(final NiceCiDTO.BillHistDTO billHistDTO);
// status
int insertNiceSmsSndngInquireResponseRepeats(final List<NiceCiApiResult> resultList);
Optional<NiceCiDTO.SendResult> selectDataIdFromSendResult(final NiceCiApiResult result);
int insertSendResults(final List<NiceCiDTO.SendResult> sendResults);
}

@ -529,5 +529,7 @@ public class NiceCiDTO {
private String regId;
private LocalDateTime regDt;
private String ihidnum;
}
}

@ -55,7 +55,7 @@ public class NiceCiAcceptService {
private String BILL_PAYREUSLT_URL;
private final KeySequenceService keySequenceService;
private final NiceCiBillHistoryService billHistoryService;
private final NiceCiNewTransactionService billHistoryService;
private final INiceCiMapper niceCiMapper;
private final BillKkoPayApiSpec billKkoPayApi;

@ -1,40 +0,0 @@
package cokr.xit.ens.modules.nice.service;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import lombok.*;
import lombok.extern.slf4j.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.service
* fileName : NiceCiBillHistoryService
* author : limju
* date : 2024 9 27
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 27 limju
*
* </pre>
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class NiceCiBillHistoryService {
private final INiceCiBillHistoryMapper mapper;
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void insertBillHistory(final NiceCiDTO.BillHistDTO histDTO){
mapper.insertBillHistory(histDTO);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateBillHistory(final NiceCiDTO.BillHistDTO histDTO){
mapper.updateBillHistory(histDTO);
}
}

@ -0,0 +1,61 @@
package cokr.xit.ens.modules.nice.service;
import java.util.*;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import lombok.*;
import lombok.extern.slf4j.*;
/**
* <pre>
* description : NICE CI
* packageName : cokr.xit.ens.modules.nice.service
* fileName : NiceCiNewTransactionService
* author : limju
* date : 2024 9 27
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 27 limju
*
* </pre>
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class NiceCiNewTransactionService {
private final INiceCiNewTransactionMapper mapper;
// accept /////////////////////////////////////////////////////
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void insertBillHistory(final NiceCiDTO.BillHistDTO histDTO){
mapper.insertBillHistory(histDTO);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateBillHistory(final NiceCiDTO.BillHistDTO histDTO){
mapper.updateBillHistory(histDTO);
}
// accept /////////////////////////////////////////////////////
// status /////////////////////////////////////////////////////
@Transactional(readOnly = true)
public Optional<NiceCiDTO.SendResult> findDataIdFromSendResult(final NiceCiApiResult result){
return mapper.selectDataIdFromSendResult(result);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public int insertNiceSmsSndngInquireResponseRepeats(final List<NiceCiApiResult> resultList){
return mapper.insertNiceSmsSndngInquireResponseRepeats(resultList);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public int insertSendResults(final List<NiceCiDTO.SendResult> sendResults){
return mapper.insertSendResults(sendResults);
}
// status /////////////////////////////////////////////////////
}

@ -1,7 +1,6 @@
package cokr.xit.ens.modules.nice.service;
import java.util.*;
import java.util.stream.*;
import org.apache.commons.lang3.*;
import org.springframework.beans.factory.annotation.Value;
@ -43,6 +42,7 @@ public class NiceCiStatBulkService {
private boolean IS_STATUS_FAIL;
private final NiceCiApiService niceCiApiService;
private final NiceCiNewTransactionService niceCiNewTransactionService;
private final INiceCiMapper niceCiMapper;
@ -64,40 +64,19 @@ public class NiceCiStatBulkService {
* </pre>
*/
public EnsResponseVO<?> findBulkStatus() {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode())
.build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);
if(list.isEmpty()){
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR404)
.errMsg(EnsErrCd.ERR404.getCodeNm())
.build();
}
list.forEach(d -> {
niceCiParam.setLnkInputId(d.getLnkInputId());
d.setInputDataXits(niceCiMapper.selectInputDataXits(niceCiParam));
});
for(NiceCiDTO.InputXit xit : list) {
try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
NiceCiDTO.SendResult sendResult = null;
for (NiceCiDTO.InputDataXit data : inputDataXits) {
// 기관전문관리번호, TB_NICE_SMS_SNDNG_REQUEST - NICE_SMS_SNDNG_REQUST_ID
final String niceSmsInqId = niceCiMapper.selectNiceCiInqireId().orElseThrow(
() -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm())
);
// 검색기간 (from ~ to) 조회 및 SET
NiceCiApiStatusDTO.Request ciRequest = niceCiMapper.selectFromAndToOfStatusParam(niceCiParam)
NiceCiApiStatusDTO.Request ciRequest = niceCiMapper.selectFromAndToOfStatusParam(
NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode())
.build()
)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, "검색기간 설정 조회 실패"));
NiceCiApiCommon nCommon = new NiceCiApiCommon();
@ -113,37 +92,27 @@ public class NiceCiStatBulkService {
do {
ciRequest.setAccmltRecptnCo(Integer.toString(repeat));
NiceCiApiStatusDTO.Response resDTO = repeatStatusBulk(
ciRequest,
xit,
data
//sendResult
ciRequest
);
if(totCo == 0) totCo = Integer.parseInt(resDTO.getTotCo());
if (totCo == 0)
totCo = Integer.parseInt(resDTO.getTotCo());
repeat += 100;
} while (totCo > 100 && totCo > repeat);
}
} catch (EnsException e) {
// FIXME : API 통신에러 인경우 skip - 재시도 되어야
if(EnsErrCd.API_COMM_ERROR.equals(e.getErrCd())){
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
log.error("NICE CI Status 조회 ERROR::{}[{}]", e.getMessage(), e.getErrCd());
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errCode(EnsErrCd.ERR999)
.errMsg(e.getMessage())
.build();
}
if(IS_STATUS_FAIL) xit.setPrcsCd(IupPrcsCd.FAIL.getCode());
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
} catch (Exception e) {
if(IS_STATUS_FAIL) xit.setPrcsCd(IupPrcsCd.FAIL.getCode());
xit.setErrMsg(ObjectUtils.isNotEmpty(e.getCause())? e.getCause().getMessage() : e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
log.error("NICE CI Status 조회 ERROR::{}", e.getMessage());
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR999)
.errMsg(e.getMessage())
.build();
}
return EnsResponseVO.okBuilder()
//.resultInfo(niceCiMapper.selectAcceptTgts(null))
@ -176,7 +145,8 @@ public class NiceCiStatBulkService {
//----------------------------------------------------------
nCommon.setDelngSecode("31893"); // 거래구분코드
nCommon.setPartcptInsttId(ORG_ID); // 참가기관ID - property 에서
nCommon.setInsttSpcltyManageno(niceSmsReqId); // 기관전문관리번호 - LPAD(SEQ_NICE_SMS_SNDNG_REQUST_ID, 10, '0')
nCommon.setInsttSpcltyManageno(
niceSmsReqId); // 기관전문관리번호 - LPAD(SEQ_NICE_SMS_SNDNG_REQUST_ID, 10, '0')
nCommon.setInsttSpcltyTrnsmistime(DateUtil.getTodayAndNowTime("yyyyMMddHHmmss")); // 기관전문전송시간
nCommon.setBlnk(StringUtils.rightPad(StringUtils.EMPTY, 17, StringUtils.SPACE)); // 공란 16자리
////////////////////////////////////////////////////////////
@ -184,7 +154,6 @@ public class NiceCiStatBulkService {
////////////////////////////////////////////////////////////
}
/**
* set
* @param ciRequest NiceCiApiDTO.Request
@ -231,34 +200,21 @@ public class NiceCiStatBulkService {
}
private NiceCiApiStatusDTO.Response repeatStatusBulk(
NiceCiApiStatusDTO.Request ciRequest,
NiceCiDTO.InputXit xit,
NiceCiDTO.InputDataXit data){
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())
final String niceSmsInqId = niceCiMapper.selectNiceCiInqireId()
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm())
);
//----------------------------------------------------------
// API Call 전처리 START - request & 결과테이블 저장
// 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 & 결과테이블 저장
// API Call 전처리 END - request
//----------------------------------------------------------
//----------------------------------------------------------
@ -281,17 +237,33 @@ public class NiceCiStatBulkService {
niceCiMapper.insertNiceSmsSndngInquireResponse(resDTO);
// API response 반복부 저장
niceCiMapper.insertNiceSmsSndngInquireResponseRepeat(
resDTO.getNiceCiResults()
.stream().peek(d -> d.setNiceSmsSndngInqireId(niceSmsInqId))
.collect(Collectors.toList()));
List<NiceCiApiResult> results = resDTO.getNiceCiResults();
List<NiceCiDTO.SendResult> sendResults = new ArrayList<>();
for (NiceCiApiResult result : results) {
result.setNiceSmsSndngInqireId(niceSmsInqId);
try {
NiceCiDTO.SendResult sendResult = niceCiNewTransactionService.findDataIdFromSendResult(result)
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "상태조회 발송결과응답 데이타로 API 요청 데이타 조회 결과 데이타 미존재"));
// FIXME: 아래 값으로 set
// mssageSndngResultSe 1 -> TALK_SEND, 2 -> SMS_SEND, FAIL
// 결과 테이블 데이타 update
sendResult.setSendSttusCd("");
niceCiMapper.mergeSendResult(sendResult);
sendResult.setSendSttusCd(
"1".equals(result.getMssageSndngResultSe()) ? "TALK_SEND" :
("2".equals(result.getMssageSndngResultSe()) ? "SMS_SEND"
: "FAIL"));
sendResults.add(sendResult);
// error 처리
} catch (Exception e) {
if (e instanceof EnsException) {
EnsException ens = (EnsException)e;
log.error("NICE CI Status 조회 ERROR::{}[{}]", ens.getMessage(), ens.getErrCd());
} else {
log.error("NICE CI Status 조회 ERROR::{}", e.getMessage());
}
}
}
niceCiNewTransactionService.insertNiceSmsSndngInquireResponseRepeats(results);
if(!sendResults.isEmpty()) niceCiNewTransactionService.insertSendResults(sendResults);
//----------------------------------------------------------
// API Call 후처리 END - response & 결과테이블 저장
//----------------------------------------------------------

@ -162,6 +162,7 @@ public class NiceCiApiService {
throw new EnsException(EnsErrCd.API_COMM_ERROR, "NICE CI Socket 서버 응답 시간 초과");
} catch (IOException e) {
log.error("NICE CI Socket 서버 응답 시간 초과: " + e.getMessage());
throw new EnsException(EnsErrCd.API_COMM_ERROR, e.getMessage());
}
return rtnMsg;

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.ens.modules.nice.mapper.INiceCiBillHistoryMapper">
<insert id="insertBillHistory" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillHistDTO">
/** iup-niceci-bill-history-mapper|insertBillHistory-Bill API(NICE CI) call history save|julim */
<selectKey keyProperty="id" resultType="long" order="BEFORE">
SELECT NVL(MAX(id), 0) + 1
FROM ens_bill_his
</selectKey>
INSERT INTO ens_bill_his (
id,
linked_uuid,
org_cd,
req_se,
bill_se,
request_data,
regist_dt
) VALUES (
#{id},
#{linkedUuid},
#{orgCd},
#{reqSe},
#{billSe},
#{requestData},
sysdate
)
</insert>
<update id="updateBillHistory" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillHistDTO">
/** iup-niceci-bill-history-mapper|updateBillHistory-Bill API(NICE CI) call history save|julim */
UPDATE ens_bill_his
SET bill_uid = #{billUid}
, response_data = #{responseData}
, error_code = #{errorCode}
, error_message = #{errorMessage}
, last_updt_dt = sysdate
WHERE id = #{id}
</update>
</mapper>

@ -377,6 +377,7 @@
WHERE send_type = #{sendType}
AND prcs_cd = #{prcsCd}
</select>
<select id="selectNiceCiInqireId" resultType="string">
/** iup-niceci-mapper|selectNiceCiInqireId-select nice ci Inquire Id|julim */
SELECT LPAD(SEQ_NICE_SMS_SNDNG_INQIRE_ID.nextval, 10, '0')
@ -484,99 +485,6 @@
'ENS_SYS'
)
</insert>
<!-- FIXME: oracle인 경우 Insert ALL -->
<insert id="insertNiceSmsSndngInquireResponseRepeat" parameterType="java.util.List">
/** iup-niceci-mapper|insertNiceSmsSndngInquireResponseRepeat-nice ci Send response 반복부 생성|julim */
<!-- //FIXME: oracle인 경우 Insert ALL SELECT ... DUAL 사용해야 함 -->
<foreach collection="list" item="item" index="index" open="INSERT ALL" close="SELECT 1 FROM DUAL">
INTO tb_nice_sms_sndng_inqire_repti (
nice_sms_sndng_inqire_id,
sn,
inqire_dt,
indvdl_bsnm_cpr_se,
ihidnum,
nm,
rank_cttpc_1,
rank_cttpc_2,
rank_cttpc_3,
result_se,
sms_sndng_requst_se,
sndng_mssage,
dsptch_no,
sms_sndng_cttpc_rank,
sms_sndng_cttpc_no,
sms_sndng_dt,
opetr_id,
cttpc_inqire_se,
mssage_sndng_result_se,
rspns_reptit_blnk,
creat_dt,
crtr
) VALUES (
#{item.niceSmsSndngInqireId},
(#{index} + 1),
#{item.inqireDt},
#{item.indvdlBsnmCprSe},
#{item.ihidnum},
#{item.nm},
#{item.rankCttpc_1},
#{item.rankCttpc_2},
#{item.rankCttpc_3},
#{item.resultSe},
#{item.smsSndngRequstSe},
#{item.sndngMssage},
#{item.dsptchNo},
#{item.smsSndngCttpcRank},
#{item.smsSndngCttpcNo},
#{item.smsSndngDt},
#{item.opetrId},
#{item.cttpcInqireSe},
#{item.mssageSndngResultSe},
#{item.rspnsReptitBlnk},
sysdate,
'ENS_SYS'
)
</foreach>
</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 =========================================== -->
<!-- =================================================================================== -->

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.ens.modules.nice.mapper.INiceCiNewTransactionMapper">
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- =================================================================================== -->
<insert id="insertBillHistory" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillHistDTO">
/** iup-niceci-new-transaction-mapper|insertBillHistory-Bill API(NICE CI) call history save|julim */
<selectKey keyProperty="id" resultType="long" order="BEFORE">
SELECT NVL(MAX(id), 0) + 1
FROM ens_bill_his
</selectKey>
INSERT INTO ens_bill_his (
id,
linked_uuid,
org_cd,
req_se,
bill_se,
request_data,
regist_dt
) VALUES (
#{id},
#{linkedUuid},
#{orgCd},
#{reqSe},
#{billSe},
#{requestData},
sysdate
)
</insert>
<update id="updateBillHistory" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillHistDTO">
/** iup-niceci-new-transaction-mapper|updateBillHistory-Bill API(NICE CI) call history save|julim */
UPDATE ens_bill_his
SET bill_uid = #{billUid}
, response_data = #{responseData}
, error_code = #{errorCode}
, error_message = #{errorMessage}
, last_updt_dt = sysdate
WHERE id = #{id}
</update>
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- =================================================================================== -->
<!-- =================================================================================== -->
<!-- ================================ status =========================================== -->
<!-- =================================================================================== -->
<insert id="insertNiceSmsSndngInquireResponseRepeats" parameterType="list">
/** iup-new-transaction-mapper|insertNiceSmsSndngInquireResponseRepeats-nice ci Send response 반복부 생성|julim */
<!-- //FIXME: oracle인 경우 Insert ALL SELECT ... DUAL 사용해야 함 -->
<foreach collection="list" item="item" index="index" open="INSERT ALL" close="SELECT 1 FROM DUAL">
INTO tb_nice_sms_sndng_inqire_repti (
nice_sms_sndng_inqire_id,
sn,
inqire_dt,
indvdl_bsnm_cpr_se,
ihidnum,
nm,
rank_cttpc_1,
rank_cttpc_2,
rank_cttpc_3,
result_se,
sms_sndng_requst_se,
sndng_mssage,
dsptch_no,
sms_sndng_cttpc_rank,
sms_sndng_cttpc_no,
sms_sndng_dt,
opetr_id,
cttpc_inqire_se,
mssage_sndng_result_se,
rspns_reptit_blnk,
creat_dt,
crtr
) VALUES (
#{item.niceSmsSndngInqireId},
(#{index} + 1),
#{item.inqireDt},
#{item.indvdlBsnmCprSe},
#{item.ihidnum},
#{item.nm},
#{item.rankCttpc_1},
#{item.rankCttpc_2},
#{item.rankCttpc_3},
#{item.resultSe},
#{item.smsSndngRequstSe},
#{item.sndngMssage},
#{item.dsptchNo},
#{item.smsSndngCttpcRank},
#{item.smsSndngCttpcNo},
#{item.smsSndngDt},
#{item.opetrId},
#{item.cttpcInqireSe},
#{item.mssageSndngResultSe},
#{item.rspnsReptitBlnk},
sysdate,
'ENS_SYS'
)
</foreach>
</insert>
<select id="selectDataIdFromSendResult" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiResult" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$SendResult">
/** iup-new-transaction-mapper|selectDataIdFromSendResult-상태조회 발송결과응답 데이타로 API 요청 데이타 조회|julim */
SELECT tix.lnk_input_id
, tidx.data_id
, tix.send_type
, tix.run_dt
, tix.expires_dt
, 'N' AS prcsYn
, tnssr.ihidnum
FROM tb_nice_sms_sndng_requst tnssr
JOIN tb_input_data_xit tidx
ON tnssr.data_id = tidx.data_id
JOIN tb_input_xit tix
ON tidx.lnk_input_id = tix.lnk_input_id
WHERE tnssr.ihidnum = #{ihidnum} -- 응답받은 주민번호
AND REGEXP_REPLACE(tnssr.sndng_mssage, '[[:space:]]+', '') = REGEXP_REPLACE(#{sndngMssage}, '[[:space:]]+', '') -- 응답받은 발송메시지
</select>
<insert id="insertSendResults" parameterType="list">
/** iup-new-transaction-mapper|insertSendResults-nice ci 전송 상태 조회 결과 생성|julim */
<!-- //FIXME: oracle인 경우 Insert ALL SELECT ... DUAL 사용해야 함 -->
<foreach collection="list" item="item" index="index" open="INSERT ALL" close="SELECT 1 FROM DUAL">
INTO tb_send_result (
lnk_input_id,
data_id,
run_dt,
send_type,
expires_dt,
biz_err_msg,
prcs_yn,
reg_dt,
reg_id
) VALUES (
#{lnkInputId}
, #{dataId}
, #{runDt}
, #{sendType}
, #{expiresDt}
, #{bizErrMsg}
, #{prcsYn}
, sysdate
, 'ENS_SYS'
)
</foreach>
</insert>
<!-- =================================================================================== -->
<!-- ================================ status =========================================== -->
<!-- =================================================================================== -->
</mapper>
Loading…
Cancel
Save