feat: NICE CI 인증톡 진행

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

@ -201,7 +201,7 @@ ALTER TABLE TB_NICE_SMS_SNDNG_INQIRE_REPTI
CREATE TABLE TB_NICE_SMS_SNDNG_INQIRE_REQUS
(
NICE_SMS_SNDNG_INQIRE_ID CHAR(10) NOT NULL ,
TRNSC_ID VARCHAR2(9) NULL ,
TRNSC_ID VARCHAR2(10) NULL ,
SPCLTY_GROUPCODE VARCHAR2(9) NULL ,
DELNG_ASORTCODE NUMBER(4) NULL ,
DELNG_SECODE NUMBER(5) NULL ,
@ -236,7 +236,7 @@ ALTER TABLE TB_NICE_SMS_SNDNG_INQIRE_REQUS
CREATE TABLE TB_NICE_SMS_SNDNG_INQIRE_RSPNS
(
NICE_SMS_SNDNG_INQIRE_ID CHAR(10) NOT NULL ,
TRNSC_ID VARCHAR2(9) NULL ,
TRNSC_ID VARCHAR2(10) NULL ,
SPCLTY_GROUPCODE VARCHAR2(9) NULL ,
DELNG_ASORTCODE NUMBER(4) NULL ,
DELNG_SECODE NUMBER(5) NULL ,
@ -266,7 +266,7 @@ CREATE TABLE TB_NICE_SMS_SNDNG_REQUST
(
NICE_SMS_SNDNG_REQUST_ID CHAR(10) NOT NULL ,
DATA_ID VARCHAR2(30) NULL ,
TRNSC_ID VARCHAR2(9) NULL ,
TRNSC_ID VARCHAR2(10) NULL ,
SPCLTY_GROUPCODE VARCHAR2(9) NULL ,
DELNG_ASORTCODE NUMBER(4) NULL ,
DELNG_SECODE NUMBER(5) NULL ,
@ -311,7 +311,7 @@ ALTER TABLE TB_NICE_SMS_SNDNG_REQUST
CREATE TABLE TB_NICE_SMS_SNDNG_RSPNS
(
NICE_SMS_SNDNG_REQUST_ID CHAR(10) NOT NULL ,
TRNSC_ID VARCHAR2(9) NULL ,
TRNSC_ID VARCHAR2(10) NULL ,
SPCLTY_GROUPCODE VARCHAR2(9) NULL ,
DELNG_ASORTCODE NUMBER(4) NULL ,
DELNG_SECODE NUMBER(5) NULL ,

@ -241,18 +241,6 @@ WHERE tix.send_type='NI'
-- 2. tb_input_xit 테이블 prcs_cd='CLOS' / 실패 시 prcs_cd='FAIL'
INSERT
INTO
ens_bill
( bill_id, bill_uid, biller_user_key, BILL_SE_CD, org_cd, regist_dt )
VALUES
( 7, 'billUid', 'billerUserKey', 'kkk', '0002', sysdate );
commit;
-- 요청 전문 : {"data":{"biller_user_key":"EL3020202408060407773","expire_at":"20241010235900","parameters":{"orgCd":"0001"},"custom_url":{"notice_url":"https://phts-manager.koti.re.kr/iup/kakao/notice","prepay_url":"https://phts-manager.koti.re.kr/iup/kakao/prepay","pay_result_url":"https://phts-manager.koti.re.kr/iup/kakao/pay-result"}}}
-- 응답 전문 : {"res_code":"OK","message":"정상응답","data":{"url":"https://billgates-web.kakao.com/r/platform/pages/paynow/search/1832/11/0b7bc3fa-4845-40eb-9b23-62b0eb806655"}}
@ -288,8 +276,10 @@ where id = 99999999999999999999;;
-- eom.org_nm, etm.message, etm.ntcntalk_tmplat_code
SELECT *
SELECT etm.*
FROM ens_org_mng eom
JOIN ens_tmplt_mng etm
ON eom.ORG_CD = etm.ORG_CD
WHERE etm.tmplt_cd='A0001';

@ -530,7 +530,7 @@ public class DateUtil {
public static String getNowTimeMicrosecond() {
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));
// 6자리 나노초까지 포함된 포맷 지정
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSSS");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSS");
return now.format(formatter);
}

@ -31,12 +31,18 @@ public interface INiceCiMapper {
//int saveBill(final NiceCiDTO.BillDTO billDTO);
int saveBillKko(final NiceCiDTO.BillKkoDTO billKkoDTO);
int updatePayUrlOfDataInput(final NiceCiDTO.InputDataXit inputDataXit);
int updatePrcsCdOfInputXit(final NiceCiDTO.InputXit inputXit);
int updatePrcsCdAndErrorOfInputXit(final NiceCiDTO.InputXit inputXit);
Optional<OrgMng> selectKkoBpApiUrlFromEnsOrgMng(final String orgCd);
Optional<String> selectNiceCiRequestId();
Optional<NiceCiDTO.TmpltMngDTO> selectTmpltMsg(final String tmpltId);
int insertNiceSmsSndngRequest(final NiceCiApiDTO.Request requestDTO);
int insertNiceSmsSndngResponse(final NiceCiApiDTO.Response responseDTO);
int insertNiceSmsSndngRequest(final NiceCiApiSendDTO.Request requestDTO);
int insertNiceSmsSndngResponse(final NiceCiApiSendDTO.Response responseDTO);
Optional<String> selectNiceCiInqireId();
int insertNiceSmsSndngInquireRequest(final NiceCiApiStatusDTO.Request requestDTO);
int insertNiceSmsSndngInquireResponse(final NiceCiApiStatusDTO.Response responseDTO);
int insertNiceSmsSndngInquireResponseRepeat(final List<NiceCiApiResult> resultList);
}

@ -199,7 +199,7 @@ public class NiceCiApiCommon {
@Size(min = 1, max = 1, message = "조회동의사유는 1자리 입니다")
private String inqireAgreResn = "4";
public String ofString() {
public String ofString(boolean isSend) {
StringBuilder sb = new StringBuilder();
sb.append(spcltyGroupcode);
sb.append(delngAsortcode);
@ -213,7 +213,7 @@ public class NiceCiApiCommon {
sb.append(niceSpcltyManageno);
sb.append(niceSpcltyTrnsmistime);
sb.append(blnk);
sb.append(inqireAgreResn);
if(isSend) sb.append(inqireAgreResn);
return sb.toString();
}

@ -10,7 +10,7 @@ import lombok.*;
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.model
* fileName : NiceCiResult
* fileName : NiceCiApiResult
* author : limju
* date : 2024 9 25
* ======================================================================
@ -29,15 +29,20 @@ public class NiceCiApiResult {
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/**
* nice sms ID - PK
*/
private String niceSmsSndngInqireId;
/**
* <pre>
* - - 20
* YYYYMMDDHHMMSS(14)+microSecond(6)
* </pre>
*/
private String queryDt;
public void setQueryDt(String queryDt) {
this.queryDt = StringUtils.trim(queryDt);
private String inqireDt;
public void setInqireDt(String inqireDt) {
this.inqireDt = StringUtils.trim(inqireDt);
}
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
@ -49,7 +54,7 @@ public class NiceCiApiResult {
* 1()
* </pre>
*/
private String indvdlBsnmCprSe = "1";
private String indvdlBsnmCprSe;
/**
* <pre>
@ -128,9 +133,9 @@ public class NiceCiApiResult {
* 4: (31894)
* </pre>
*/
private String smsSndReqCode;
private String smsSndngRequstSe;
public void setSmsSndReq(String smsSndReqCode) {
this.smsSndReqCode = StringUtils.trim(smsSndReqCode);
this.smsSndngRequstSe = StringUtils.trim(smsSndReqCode);
}
/**
@ -140,9 +145,9 @@ public class NiceCiApiResult {
* NiceCiUtils.leftKr, substringKr
* </pre>
*/
private String sndMessage;
public void setSndMessage(String sndMessage) {
this.sndMessage = StringUtils.trim(sndMessage);
private String sndngMssage;
public void setSndngMssage(String sndngMssage) {
this.sndngMssage = StringUtils.trim(sndngMssage);
}
/**
@ -151,9 +156,9 @@ public class NiceCiApiResult {
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
private String sndPhoneNo;
public void setSndPhoneNo(String sndPhoneNo) {
this.sndPhoneNo = StringUtils.trim(sndPhoneNo);
private String dsptchNo;
public void setDsptchNo(String dsptchNo) {
this.dsptchNo = StringUtils.trim(dsptchNo);
}
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
@ -168,7 +173,7 @@ public class NiceCiApiResult {
* 3: 3
* </pre>
*/
private String smsSndngCttpcRank = "1";
private String smsSndngCttpcRank;
/**
* <pre>
@ -198,9 +203,9 @@ public class NiceCiApiResult {
* - ID : 9
* </pre>
*/
private String procId;
public void setProcId(String procId) {
this.procId = StringUtils.trim(procId);
private String opetrId;
public void setOpetrId(String opetrId) {
this.opetrId = StringUtils.trim(opetrId);
}
/**
@ -212,7 +217,7 @@ public class NiceCiApiResult {
* 3: 3
* </pre>
*/
private String contactSearchCode = "3";
private String cttpcInqireSe;
/**
* <pre>
@ -221,7 +226,7 @@ public class NiceCiApiResult {
* , 0
* </pre>
*/
private String msgSndRsltDivCode;
private String mssageSndngResultSe;
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
@ -292,7 +297,7 @@ public class NiceCiApiResult {
return null;
}
public static NiceCiApiResult parseHistory(String tgtString) {
public static NiceCiApiResult parseStatus(String tgtString) {
// 1150
final int[] parseLength = {
20, // 조회일시 - 이력조회시만 사용
@ -320,7 +325,7 @@ public class NiceCiApiResult {
int idx = 0;
// 이력조회시만 사용 ////////////////////////////////////////////////////////
result.setQueryDt(StringUtils.left(tgtString, parseLength[idx]));
result.setInqireDt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
@ -346,9 +351,9 @@ public class NiceCiApiResult {
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
result.setSmsSndReqCode(StringUtils.left(tgtString, parseLength[idx]));
result.setSmsSndngRequstSe(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
result.setSndMessage(NiceCiUtils.leftKr(tgtString, parseLength[idx]));
result.setSndngMssage(NiceCiUtils.leftKr(tgtString, parseLength[idx]));
tgtString = NiceCiUtils.substringKr(tgtString, parseLength[idx++]);
result.setSmsSndngCttpcNo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
@ -364,9 +369,9 @@ public class NiceCiApiResult {
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
result.setProcId(StringUtils.left(tgtString, parseLength[idx]));
result.setOpetrId(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
result.setContactSearchCode(StringUtils.left(tgtString, parseLength[idx]));
result.setCttpcInqireSe(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
result.setResultSe(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);

@ -19,7 +19,7 @@ import lombok.*;
* Builder X
* -> setter
* packageName : cokr.xit.ens.modules.nice.model
* fileName : NiceDTO
* fileName : NiceCiApiSendDTO
* author : limju
* date : 2024 9 23
* ======================================================================
@ -29,9 +29,9 @@ import lombok.*;
*
* </pre>
*/
public class NiceCiApiDTO {
public class NiceCiApiSendDTO {
@Schema(name = "Request(Nice CI) API DTO", description = "NICE CI API 요청 전문 DTO")
@Schema(name = "Request(Nice CI Send) API DTO", description = "NICE CI API Send 요청 전문 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -224,7 +224,7 @@ public class NiceCiApiDTO {
StringBuilder sb = new StringBuilder();
//sb.append(trCode);
// 공통부
sb.append(niceCommon.ofString());
sb.append(niceCommon.ofString(true));
// 개별요청부
sb.append(inqireResn);

@ -20,7 +20,7 @@ import lombok.*;
* Builder X
* -> setter
* packageName : cokr.xit.ens.modules.nice.model
* fileName : NiceDTO
* fileName : NiceCiApiStatusDTO
* author : limju
* date : 2024 9 23
* ======================================================================
@ -30,7 +30,7 @@ import lombok.*;
*
* </pre>
*/
public class NiceCiApiHistoryDTO {
public class NiceCiApiStatusDTO {
@Schema(name = "Request(Nice CI History) API DTO", description = "NICE CI API 이력 요청 전문 DTO")
@Data
@ -51,10 +51,15 @@ public class NiceCiApiHistoryDTO {
*/
//@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "TR Code", example = " ")
//@Size(min = 10, max = 10, message = "트랜잭션 코드는 10자리 입니다.")
private String trCode = StringUtils.EMPTY;
public void setTrCode(String trCode) {
this.trCode = StringUtils.leftPad(nvl(trCode), 10, StringUtils.SPACE);
private String trnscId = StringUtils.EMPTY;
public void setTrnscId(String trnscId) {
this.trnscId = StringUtils.leftPad(nvl(trnscId), 10, StringUtils.SPACE);
}
/**
* nice sms ID - PK
*/
private String niceSmsSndngInqireId;
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
@ -63,15 +68,6 @@ public class NiceCiApiHistoryDTO {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
NiceCiApiCommon niceCommon;
/**
* <pre>
* - 17
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 17, max = 17, message = "공란(16자리)")
private String commonEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 17, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
@ -88,9 +84,9 @@ public class NiceCiApiHistoryDTO {
*/
@Schema(title = "검색기간 from", example = " ")
@Size(min = 20, max = 20, message = "검색기간 from")
private String fromDt = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setFromDt(String fromDt) {
this.fromDt = StringUtils.rightPad(nvl(fromDt), 20, StringUtils.SPACE);
private String searchPdFrom = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setSearchPdFrom(String searchPdFrom) {
this.searchPdFrom = StringUtils.rightPad(nvl(searchPdFrom), 20, StringUtils.SPACE);
}
/**
@ -101,9 +97,9 @@ public class NiceCiApiHistoryDTO {
*/
@Schema(title = "검색기간 to", example = " ")
@Size(min = 20, max = 20, message = "검색기간 to")
private String toDt = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setToDt(String toDt) {
this.toDt = StringUtils.rightPad(nvl(toDt), 20, StringUtils.SPACE);
private String searchPdTo = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setSearchPdTo(String searchPdTo) {
this.searchPdTo = StringUtils.rightPad(nvl(searchPdTo), 20, StringUtils.SPACE);
}
/**
@ -114,7 +110,7 @@ public class NiceCiApiHistoryDTO {
*/
@Schema(title = "개인/사업자/법인구분", example = "1")
@Size(min = 1, max = 1, message = "개인/사업자/법인구분은 1자리 입니다.")
private String idDiv = "1";
private String indvdlBsnmCprSe = "1";
/**
* <pre>
@ -122,26 +118,26 @@ public class NiceCiApiHistoryDTO {
* </pre>
*/
@Schema(title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
private String jumin = StringUtils.rightPad(StringUtils.EMPTY, 13, StringUtils.SPACE);
public void setJumin(String jumin) {
this.jumin = StringUtils.rightPad(nvl(jumin), 13, StringUtils.SPACE);
//@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
private String ihidnum = StringUtils.rightPad(StringUtils.EMPTY, 13, StringUtils.SPACE);
public void setIhidnum(String ihidnum) {
this.ihidnum = StringUtils.rightPad(nvl(ihidnum), 13, StringUtils.SPACE);
}
/**
* <pre>
* - 2
* " " -
* 00 - (SMS , SMS )
* 00 - (SMS , SMS )
* 01 - (// )
* 10 - ( SMS )
* </pre>
*/
@Schema(title = "결과구분코드", example = " ", allowableValues = {" ", "00", "01", "10"})
@Size(min = 2, max = 2, message = "결과구분코드는 2자리 입니다.")
private String rsltDivCode = " ";
public void setRsltDivCode(String rsltDivCode) {
this.rsltDivCode = StringUtils.rightPad(nvl(rsltDivCode), 2, StringUtils.SPACE);
private String resultSe = " ";
public void setResultSe(String resultSe) {
this.resultSe = StringUtils.rightPad(nvl(resultSe), 2, StringUtils.SPACE);
}
/**
@ -156,7 +152,7 @@ public class NiceCiApiHistoryDTO {
*/
@Schema(title = "SMS발송요청구분", example = " ", allowableValues = {"0", "1", "2", "3", "4"})
@Size(min = 1, max = 1, message = "SMS발송요청구분은 1자리 입니다.")
private String smsSndReqCode = "0";
private String smsSndngRequstSe = "0";
/**
* <pre>
@ -165,10 +161,10 @@ public class NiceCiApiHistoryDTO {
* </pre>
*/
@Schema(title = "요청건수", example = " ")
@Pattern(regexp = "^\\s{10}$|\\d{10}", message = "요청건수는 10자리(max 100)입니다")
private String reqCnt = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE);
public void setReqCnt(String reqCnt){
this.reqCnt = StringUtils.rightPad(nvl(reqCnt), 10, StringUtils.SPACE);
@Pattern(regexp = "^[\\s\\S]{10}$", message = "요청건수는 10자리(max 100)입니다")
private String requstCo = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE);
public void setRequstCo(String requstCo){
this.requstCo = StringUtils.rightPad(nvl(requstCo), 10, StringUtils.SPACE);
}
/**
@ -178,10 +174,11 @@ public class NiceCiApiHistoryDTO {
* </pre>
*/
@Schema(title = "누적수신건수", example = " ")
@Max(value = 100, message = "누적수신건수는 최대 10자리 입니다.")
private String accRecvCnt = "0000000000";
public void setAccRecvCnt(String accRecvCnt) {
this.accRecvCnt = StringUtils.rightPad(nvl(accRecvCnt), 10, StringUtils.SPACE);
@Size(min = 10, max = 10, message = "누적수신건수는 10자리 입니다.")
@Pattern(regexp = "^\\d{10}$", message = "요청건수는 10자리(max 100)입니다")
private String accmltRecptnCo = "0000000000";
public void setAccmltRecptnCo(String accmltRecptnCo) {
this.accmltRecptnCo = StringUtils.rightPad(nvl(accmltRecptnCo), 10, StringUtils.SPACE);
}
/**
@ -191,35 +188,38 @@ public class NiceCiApiHistoryDTO {
*/
@Schema(title = "공란", example = " ")
@Size(min = 23, max = 23, message = "공란(23자리)")
private String privateEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 23, StringUtils.SPACE);
private String indvdlzRequstBlnk = StringUtils.rightPad(StringUtils.EMPTY, 23, StringUtils.SPACE);
public void setIndvdlzRequstBlnk(String indvdlzRequstBlnk) {
this.indvdlzRequstBlnk = StringUtils.rightPad(nvl(indvdlzRequstBlnk), 23, StringUtils.SPACE);
}
//----------------------------------------------------------------------------------------------
// 개별요청부 : 100 자리
//----------------------------------------------------------------------------------------------
public String ofString() {
StringBuilder sb = new StringBuilder();
sb.append(trCode);
sb.append(trnscId);
// 공통부
sb.append(niceCommon.ofString());
sb.append(commonEmptyField);
sb.append(niceCommon.ofString(false));
// 개별요청부
sb.append(fromDt);
sb.append(toDt);
sb.append(idDiv);
sb.append(jumin);
sb.append(rsltDivCode);
sb.append(smsSndReqCode);
sb.append(reqCnt);
sb.append(accRecvCnt);
sb.append(privateEmptyField);
sb.append(searchPdFrom);
sb.append(searchPdTo);
sb.append(indvdlBsnmCprSe);
sb.append(ihidnum);
sb.append(resultSe);
sb.append(smsSndngRequstSe);
sb.append(requstCo);
sb.append(accmltRecptnCo);
sb.append(indvdlzRequstBlnk);
// FIXME: 인코딩확인후 적용
return new String(sb.toString().getBytes(), StandardCharsets.UTF_8);
}
}
@Schema(name = "Response(Nice CI History) DTO", description = "NICE CI 이력 응답 전문 DTO")
@Schema(name = "Response(Nice CI Status) DTO", description = "NICE CI 상태(이력) 응답 전문 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -235,25 +235,20 @@ public class NiceCiApiHistoryDTO {
* - max: 9
* </pre>
*/
private String trCode;
public void setTrCode(String trCode) {
this.trCode = StringUtils.trim(trCode);
private String trnscId;
public void setTrnscId(String trnscId) {
this.trnscId = StringUtils.trim(trnscId);
}
/**
* nice sms ID - PK
*/
private String niceSmsSndngInqireId;
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
NiceCiApiCommon niceCommon;
/**
* <pre>
* - 16
* </pre>
*/
private String commonEmptyField;
public void setCommonEmptyField(String commonEmptyField) {
this.commonEmptyField = StringUtils.trim(commonEmptyField);
}
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
@ -266,9 +261,9 @@ public class NiceCiApiHistoryDTO {
* : 10
* </pre>
*/
private String totalCnt;
public void setTotalCnt(String totalCnt) {
this.totalCnt = StringUtils.trim(totalCnt);
private String totCo;
public void setTotCo(String totCo) {
this.totCo = StringUtils.trim(totCo);
}
/**
@ -276,9 +271,9 @@ public class NiceCiApiHistoryDTO {
* : 10
* </pre>
*/
private String accCnt;
public void setAccCnt(String accCnt) {
this.accCnt = StringUtils.trim(accCnt);
private String accmltCo;
public void setAccmltCo(String accmltCo) {
this.accmltCo = StringUtils.trim(accmltCo);
}
/**
@ -287,9 +282,9 @@ public class NiceCiApiHistoryDTO {
* 100
* </pre>
*/
private String resCnt;
public void setResCnt(String resCnt) {
this.resCnt = StringUtils.trim(resCnt);
private String rspnsCo;
public void setRspnsCo(String rspnsCo) {
this.rspnsCo = StringUtils.trim(rspnsCo);
}
//----------------------------------------------------------------------------------------------
// 개별응답부 : 30 자리
@ -307,8 +302,7 @@ public class NiceCiApiHistoryDTO {
final int repeatLength = 1150;
final int[] parseLength = {
10, // tr-code
83, // 공통부
17, // 공란
100, // 공통부
10, // 총건수
10, // 누적건수
10, // 응답건수
@ -319,22 +313,19 @@ public class NiceCiApiHistoryDTO {
if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 1290) {
Response nr = new Response();
int idx = 0;
nr.setTrCode(StringUtils.left(tgtString, parseLength[idx]));
nr.setTrnscId(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setNiceCommon(NiceCiApiCommon.parse(tgtString));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setCommonEmptyField(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setTotalCnt(StringUtils.left(tgtString, parseLength[idx]));
nr.setTotCo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setAccCnt(StringUtils.left(tgtString, parseLength[idx]));
nr.setAccmltCo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setResCnt(StringUtils.left(tgtString, parseLength[idx]));
nr.setRspnsCo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
if(NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){
@ -343,7 +334,7 @@ public class NiceCiApiHistoryDTO {
List<NiceCiApiResult> resResults = IntStream.range(0, repeat)
.mapToObj(i -> {
String currentString = NiceCiUtils.substringKr(finalTgtString, i * repeatLength);
return NiceCiApiResult.parseHistory(currentString);
return NiceCiApiResult.parseStatus(currentString);
})
.collect(Collectors.toList());
nr.setNiceCiResults(resResults);

@ -448,6 +448,8 @@ public class NiceCiDTO {
private String ntcntalkTmplatCode;
private String orgNm;
private String registId;
private LocalDateTime registDt;

@ -158,19 +158,21 @@ public class NiceCiAcceptService {
}
xit.setPrcsCd(IupPrcsCd.GRUC.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
// FIXME: API 호출 에러
} catch (EnsException e) {
if(EnsErrCd.API_COMM_ERROR.equals(e.getErrCd())){
xit.setPrcsCd(IupPrcsCd.TGRF.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
} catch (Exception e){
xit.setPrcsCd(IupPrcsCd.TGRF.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
}

@ -13,7 +13,6 @@ import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import cokr.xit.ens.modules.nice.service.support.*;
@ -68,13 +67,8 @@ public class NiceCiSendBulkService {
for(NiceCiDTO.InputXit xit : list) {
final NiceCiDTO.TmpltMngDTO tmpltMngDTO = niceCiMapper.selectTmpltMsg(xit.getJobCd())
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm()));
final String sndMsg = tmpltMngDTO.getMessage();//.replace("~~@@!!", "#{").replace("!!@@~~", "}");
final String ntcntalkTmplatCode = tmpltMngDTO.getNtcntalkTmplatCode();
final OrgMng orgMng = niceCiMapper.selectKkoBpApiUrlFromEnsOrgMng(xit.getOrgCd())
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm()));
NiceCiDTO.BillHistDTO billHistDTO = null;
try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
for (NiceCiDTO.InputDataXit data : inputDataXits) {
@ -84,16 +78,15 @@ public class NiceCiSendBulkService {
() -> new EnsException(EnsErrCd.MAKE521, EnsErrCd.MAKE521.getCodeNm())
);
NiceCiApiDTO.Request ciRequest = new NiceCiApiDTO.Request();
NiceCiApiSendDTO.Request ciRequest = new NiceCiApiSendDTO.Request();
NiceCiApiCommon nCommon = new NiceCiApiCommon();
NiceCiApiDTO.QueryRequest queryRequest = new NiceCiApiDTO.QueryRequest();
NiceCiApiDTO.ButtonRequest btnRequest = new NiceCiApiDTO.ButtonRequest();
NiceCiApiSendDTO.QueryRequest queryRequest = new NiceCiApiSendDTO.QueryRequest();
NiceCiApiSendDTO.ButtonRequest btnRequest = new NiceCiApiSendDTO.ButtonRequest();
// 공통부 set
setNiceCiApiRequestCommon(nCommon, niceSmsReqId);
// 개별부 set
setNiceCiApiPrivateReq(ciRequest, ntcntalkTmplatCode, sndMsg, data);
setNiceCiApiPrivateReq(ciRequest, tmpltMngDTO, data);
// 조회요청반복부 set
setQueryRequest(queryRequest, data);
// 버튼요청반복부 set
@ -103,35 +96,44 @@ public class NiceCiSendBulkService {
ciRequest.getQueryRequests().add(queryRequest);
ciRequest.getButtonRequests().add(btnRequest);
ciRequest.setNiceSmsSndngRequstId(niceSmsReqId);
ciRequest.setDataId(data.getDataId());
niceCiMapper.insertNiceSmsSndngRequest(ciRequest);
// FIXME : 연계 이후 확인 필요
EnsResponseVO<?> responseVO = niceCiApiService.requestSendBulk(ciRequest);
NiceCiApiDTO.Response resDTO = (NiceCiApiDTO.Response)responseVO.getResultInfo();
//NiceCiApiDTO.Response resDTO = new NiceCiApiDTO.Response();
if (!EnsErrCd.OK.equals(responseVO.getErrCode()))
throw new EnsException(responseVO.getErrCode(), responseVO.getErrMsg());
NiceCiApiSendDTO.Response resDTO = (NiceCiApiSendDTO.Response)responseVO.getResultInfo();
resDTO.setNiceSmsSndngRequstId(niceSmsReqId);
niceCiMapper.insertNiceSmsSndngResponse(resDTO);
log.info(responseVO.toString());
return responseVO;
}
xit.setPrcsCd(IupPrcsCd.IPCP.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
// FIXME: API 호출 에러
} catch (EnsException e) {
// FIXME : API 통신에러 인경우 skip - 재시도 되어야
if(EnsErrCd.API_COMM_ERROR.equals(e.getErrCd())){
xit.setPrcsCd(IupPrcsCd.FAIL.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
xit.setPrcsCd(IupPrcsCd.FAIL.getCode());
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
} catch (Exception e){
xit.setPrcsCd(IupPrcsCd.FAIL.getCode());
niceCiMapper.updatePrcsCdOfInputXit(xit);
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
}
return EnsResponseVO.okBuilder()
@ -175,12 +177,11 @@ public class NiceCiSendBulkService {
/**
* set
* @param ciRequest NiceCiApiDTO.Request
* @param ntcntalkTmplatCode template ID
* @param sndMsg 릿
* @param ciRequest NiceCiApiSendDTO.Request
* @param tmpltMngDTO NiceCiDTO.TmpltMngDTO
* @param data NiceCiDTO.InputDataXit data
*/
private void setNiceCiApiPrivateReq(final NiceCiApiDTO.Request ciRequest, final String ntcntalkTmplatCode, String sndMsg, final NiceCiDTO.InputDataXit data){
private void setNiceCiApiPrivateReq(final NiceCiApiSendDTO.Request ciRequest, NiceCiDTO.TmpltMngDTO tmpltMngDTO, final NiceCiDTO.InputDataXit data){
////////////////////////////////////////////////////////////
// 개별요청부 START
////////////////////////////////////////////////////////////
@ -200,11 +201,14 @@ public class NiceCiSendBulkService {
ciRequest.setInqireRequstCo(1); // 조회요청건수
Map<String, String> map = gson.fromJson(data.getMsgData(), Map.class);
String sndMsg = tmpltMngDTO.getMessage();
for(Map.Entry<String, String> entry : map.entrySet()){
sndMsg = sndMsg.replace(entry.getKey(), entry.getValue());
}
sndMsg = sndMsg.replace("~~@@!!ORG_NM!!@@~~", tmpltMngDTO.getOrgNm());
sndMsg = sndMsg.replace("~~@@!!TARGET_NAME!!@@~~", data.getName());
ciRequest.setSndngMssage(sndMsg); // 발송메세지
ciRequest.setNtcntalkTmplatCode(ntcntalkTmplatCode); // 알림톡 템플릿 코드
ciRequest.setNtcntalkTmplatCode(tmpltMngDTO.getNtcntalkTmplatCode()); // 알림톡 템플릿 코드
////////////////////////////////////////////////////////////
// 개별요청부 END
////////////////////////////////////////////////////////////
@ -212,10 +216,10 @@ public class NiceCiSendBulkService {
/**
* set
* @param queryRequest NiceCiApiDTO.QueryRequest
* @param queryRequest NiceCiApiSendDTO.QueryRequest
* @param data NiceCiDTO.InputDataXit
*/
private void setQueryRequest(final NiceCiApiDTO.QueryRequest queryRequest, final NiceCiDTO.InputDataXit data) {
private void setQueryRequest(final NiceCiApiSendDTO.QueryRequest queryRequest, final NiceCiDTO.InputDataXit data) {
//---------------------------------------------------------
// 조회요청 반복부 : default START
//---------------------------------------------------------
@ -229,10 +233,10 @@ public class NiceCiSendBulkService {
/**
* set
* @param btnRequest NiceCiApiDTO.ButtonRequest
* @param btnRequest NiceCiApiSendDTO.ButtonRequest
* @param data NiceCiDTO.InputDataXit
*/
private void setBtnRequest(final NiceCiApiDTO.ButtonRequest btnRequest, final NiceCiDTO.InputDataXit data) {
private void setBtnRequest(final NiceCiApiSendDTO.ButtonRequest btnRequest, final NiceCiDTO.InputDataXit data) {
//---------------------------------------------------------
// 버튼요청 반복부 : default START
//---------------------------------------------------------

@ -1,6 +1,7 @@
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;
@ -8,8 +9,9 @@ import org.springframework.stereotype.*;
import cokr.xit.ens.biz.iup.code.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.modules.nice.cmm.*;
import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import cokr.xit.ens.modules.nice.service.support.*;
@ -37,35 +39,14 @@ public class NiceCiStatBulkService {
@Value("${contract.niceCi.orgId}")
private String ORG_ID;
@Value("${contract.niceCi.clientId}")
private String CLIENT_ID;
@Value("${contract.niceCi.isStatusFail}")
private boolean IS_STATUS_FAIL;
private final NiceCiApiService niceCiApiService;
private final INiceCiMapper niceCiMapper;
final String msg = "민자도로 관리지원센터에서 김해찬님께 발송한 미납통행료 고지서가 도착했습니다.\n"
+ "\n"
+ "민자도로 미납통행료 고지서\n"
+ "\n"
+ "□ 차량번호 : 19너0914\n"
+ "□ 미납발생 노선 : 서울-문산\n"
+ "□ 미납발생 기간 : 2021년 04월 12일~2023년 08월 30일\n"
+ "□ 납부금액 : 819,500원(42건)\n"
+ "□ 납부기한 : 2024년10월01일\n"
+ "□ 납부방법 : \n"
+ "① 하단의 (납부하기) 클릭\n"
+ "② 가상계좌 납부\n"
+ "-(가상계좌) : 농협은행 792000-36-986609\n"
+ "국민은행 731190-72-253083\n"
+ "우리은행 283752-73-918780\n"
+ "신한은행 562146-27-470101\n"
+ "\n"
+ "※ 알림톡 수신 시 종이고지서는 발송되지 않습니다.\n"
+ "\n"
+ "문의처 : 044-211-3377";
public EnsResponseVO<?> findBulkStatus() {
public EnsResponseVO<?> findBulkStatus() {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode())
@ -79,46 +60,157 @@ public class NiceCiStatBulkService {
.build();
}
NiceCiApiHistoryDTO.Request ciRequest = new NiceCiApiHistoryDTO.Request();
//ciRequest.setTrCode("0000006150");
// // 공통부
//
// // 개별요청부
// nr.setQueryReason(StringUtils.EMPTY);
// nr.setQueryReqCnt(46);
// nr.setSmsSndReqCode("1");
String tmp = NiceCiUtils.rightPadKr(msg, 2000, StringUtils.SPACE);
System.out.println(
String.format("[%s] kr length - %d, utf-8 length - %d", tmp, NiceCiUtils.lengthKr(tmp), tmp.length()));
// nr.setSndPhoneNo("010");
// nr.setContactSearchCode("1");
// 공통부
NiceCiApiCommon nc = new NiceCiApiCommon();
// nc.setGrpCode("grpCode");
//nc.setTrType("Type");
nc.setTrClassification("31895"); // 거래구분
nc.setOrgId(ORG_ID); // 참가기관Id - property 에서
nc.setOrgMngNo("0000000103"); // 기관관리번호
nc.setOrgSndDt("20240919");
NiceCiApiDTO.QueryRequest qr = new NiceCiApiDTO.QueryRequest();
NiceCiApiDTO.ButtonRequest br = new NiceCiApiDTO.ButtonRequest();
ciRequest.setNiceCommon(nc);
// nc.setNiceMngNo(StringUtils.EMPTY);
// nc.setNiceSndDt(StringUtils.EMPTY);
String ciTxt = ciRequest.ofString();
String ft = String.format("%s%s", StringUtils.leftPad(String.valueOf(NiceCiUtils.lengthKr(ciTxt)), 10, "0"),
ciTxt);
System.out.println(
String.format("[%s] kr length - %d, utf-8 length - %d", ft, NiceCiUtils.lengthKr(ft), ft.length()));
// String rtnMsg = niceCiApiService.requestSendBulk(ciRequest);
// NiceCiDTO.Response resDTO = NiceCiDTO.Response.parse(rtnMsg);
EnsResponseVO<?> responseVO = niceCiApiService.findBulkStatus(ciRequest);
log.info(responseVO.toString());
return responseVO;
list.forEach(d -> {
niceCiParam.setLnkInputId(d.getLnkInputId());
d.setInputDataXits(niceCiMapper.selectNiceCiAcceptDatas(niceCiParam));
});
for(NiceCiDTO.InputXit xit : list) {
try {
List<NiceCiDTO.InputDataXit> inputDataXits = xit.getInputDataXits();
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())
);
NiceCiApiStatusDTO.Request ciRequest = new NiceCiApiStatusDTO.Request();
NiceCiApiCommon nCommon = new NiceCiApiCommon();
// 공통부 set
setNiceCiApiRequestCommon(nCommon, niceSmsInqId);
ciRequest.setNiceCommon(nCommon);
// 개별요청부 set
setNiceCiApiPrivateReq(ciRequest);
// API request 저장
ciRequest.setNiceSmsSndngInqireId(niceSmsInqId);
niceCiMapper.insertNiceSmsSndngInquireRequest(ciRequest);
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();
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) {
// FIXME : API 통신에러 인경우 skip - 재시도 되어야
if(EnsErrCd.API_COMM_ERROR.equals(e.getErrCd())){
xit.setErrMsg(e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.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);
}
}
return EnsResponseVO.okBuilder()
//.resultInfo(niceCiMapper.selectAcceptTgts(null))
.build();
}
/**
* set
* @param nCommon NiceCiApiCommon
* @param niceSmsReqId - PK
*/
private void setNiceCiApiRequestCommon(final NiceCiApiCommon nCommon, final String niceSmsReqId) {
////////////////////////////////////////////////////////////
// 공통부 START
////////////////////////////////////////////////////////////
//---------------------------------------------------------
// 공통부 : default start
//---------------------------------------------------------
// nCommon.setGrpCode("NICEIF "); // 전문그룹코드
// nCommon.setTrType("0200"); // 거래종별코드
// nCommon.setSndAndRcvFlag("B"); // 송수신플래그
// nCommon.setDeviceClassification("503"); // 단말기구분
// nCommon.setRsltCode(" "); // 응답코드
// nCommon.setNiceMngNo(""); // NICE 전문관리번호
// nCommon.setNiceSndDt(""); // NICE 전문 전송시간
// ciRequest.setCommonEmptyField(""); // 공란 - 16자리
// ciRequest.setQueryConsentReason("1"); // 조회동의사유
//----------------------------------------------------------
// 공통부 : default end
//----------------------------------------------------------
nCommon.setDelngSecode("31893"); // 거래구분코드
nCommon.setPartcptInsttId(ORG_ID); // 참가기관ID - property 에서
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자리
////////////////////////////////////////////////////////////
// 공통부 END
////////////////////////////////////////////////////////////
}
/**
* set
* @param ciRequest NiceCiApiDTO.Request
*/
private void setNiceCiApiPrivateReq(final NiceCiApiStatusDTO.Request ciRequest){
////////////////////////////////////////////////////////////
// 개별요청부 START
////////////////////////////////////////////////////////////
//----------------------------------------------------------
// 개별요청부 : default start
//----------------------------------------------------------
// ciRequest.setIndvdlBsnmCprSe("1"); // 개인/사업자/법인구분
// ciRequest.setIhidnum(""); // 주민번호 : blank
// FIXME : 값 확인 필요
// 결과구분
// " "-전체, "00" - 정상((SMS미발송시 조회정상, SMS발송시 발송정상)
// 01 - 연락처조회 실패건(주민번호오류/데이터없음/기타오류 건)
// 10 - 진행중(연락처조회 정상건 중 SMS발송 이전)
// ciRequest.setResultSe(" ");
// FIXME : 값 확인 필요
// SMS발송요청구분
// 0 : 미요청,
// 1: 1순위연락처로 발송,
// 2: 1 ~ 2 순위중 최우선 순위로 1개 발송
// 3: 1 ~ 3 순위중 최우선 순위로 1개 발송
// 4: 1{1순위로 요청건} + 2{1~2순위로 요청건} + 3{1~3 순위로 요청건}
// ciRequest.setSmsSndngRequstSe("3"); // SMS발송요청구분코드
// FIXME : 값 확인 필요
// 누적수신건수 : 최초조회시 "0000000000"
// ciRequest.setAccmltRecptnCo("0000000000");
// ciRequest.setIndvdlzRequstBlnk(""); // 공란 - 23자리
//---------------------------------------------------------
// 개별요청부 : default end
//---------------------------------------------------------
ciRequest.setSearchPdFrom(DateUtil.getNowTimeMicrosecond()); // 검색기간 - from
ciRequest.setSearchPdTo(DateUtil.getNowTimeMicrosecond()); // 검색기간 - to
ciRequest.setRequstCo("?"); // 요청건수
//ciRequest.setAccmltRecptnCo(); // 누적수신건수
////////////////////////////////////////////////////////////
// 개별요청부 END
////////////////////////////////////////////////////////////
}
}

@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.modules.nice.cmm.*;
import cokr.xit.ens.modules.nice.model.*;
@ -49,9 +50,9 @@ public class NiceCiApiService {
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
public EnsResponseVO<?> requestSendBulk(final NiceCiApiDTO.Request reqDTO) {
public EnsResponseVO<?> requestSendBulk(final NiceCiApiSendDTO.Request reqDTO) {
List<String> errors = new ArrayList<>();
final Set<ConstraintViolation<NiceCiApiDTO.Request>> list = validator.validate(reqDTO);
final Set<ConstraintViolation<NiceCiApiSendDTO.Request>> list = validator.validate(reqDTO);
if (!list.isEmpty()) {
errors.addAll(list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
@ -65,29 +66,33 @@ public class NiceCiApiService {
.errMsg(errors.toString())
.build();
}
log.info("API call parameter :: {}", reqDTO);
String ciTxt = reqDTO.ofString();
String ft = String.format("%s%s", StringUtils.leftPad(String.valueOf(NiceCiUtils.lengthKr(ciTxt)), 10, "0"),
ciTxt);
log.info("[{}] kr length - {}, utf-8 length - {}", ft, NiceCiUtils.lengthKr(ft), ft.length());
log.info("kr length - {}, utf-8 length - {}", NiceCiUtils.lengthKr(ft), ft.length());
final String rtnMsg;
try {
rtnMsg = sendNiceCiSocket(ft, 0);
//rtnMsg = sendNiceCiSocket(ft);
// FIXME: test를 위해 임시 사용 - return msg get
rtnMsg = getTestData( 0);
} catch (Exception e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.API_COMM_ERROR)
.errMsg(e.getMessage())
.build();
}
NiceCiApiDTO.Response resDTO = NiceCiApiDTO.Response.parse(rtnMsg);
NiceCiApiSendDTO.Response resDTO = NiceCiApiSendDTO.Response.parse(rtnMsg);
return EnsResponseVO.okBuilder()
.resultInfo(resDTO)
.build();
}
public EnsResponseVO<?> findBulkStatus(final NiceCiApiHistoryDTO.Request reqDTO) {
public EnsResponseVO<?> findBulkStatus(final NiceCiApiStatusDTO.Request reqDTO) {
List<String> errors = new ArrayList<>();
final Set<ConstraintViolation<NiceCiApiHistoryDTO.Request>> list = validator.validate(reqDTO);
final Set<ConstraintViolation<NiceCiApiStatusDTO.Request>> list = validator.validate(reqDTO);
if (!list.isEmpty()) {
errors.addAll(list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
@ -101,28 +106,31 @@ public class NiceCiApiService {
.errMsg(errors.toString())
.build();
}
log.info("API call parameter :: {}", reqDTO);
String ciTxt = reqDTO.ofString();
String ft = String.format("%s%s", StringUtils.leftPad(String.valueOf(NiceCiUtils.lengthKr(ciTxt)), 10, "0"),
ciTxt);
log.info("[{}] kr length - {}, utf-8 length - {}", ft, NiceCiUtils.lengthKr(ft), ft.length());
log.info("kr length - {}, utf-8 length - {}", NiceCiUtils.lengthKr(ft), ft.length());
final String rtnMsg;
try {
rtnMsg = sendNiceCiSocket(ft, 1);
} catch (Exception e) {
//rtnMsg = sendNiceCiSocket(ft);
// FIXME: test를 위해 임시 사용 - return msg get
rtnMsg = getTestData( 1);
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.API_COMM_ERROR)
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
NiceCiApiHistoryDTO.Response resDTO = NiceCiApiHistoryDTO.Response.parse(rtnMsg);
NiceCiApiStatusDTO.Response resDTO = NiceCiApiStatusDTO.Response.parse(rtnMsg);
return EnsResponseVO.okBuilder()
.resultInfo(resDTO)
.build();
}
// FIXME: test를 위해 idx 사용 - return msg get
private String sendNiceCiSocket(final String binTxt, final int idx) {
private String sendNiceCiSocket(final String binTxt) {
String rtnMsg = "";
try (Socket socket = new Socket(HOST, PORT); // 서버에 연결
@ -131,35 +139,30 @@ public class NiceCiApiService {
//new OutputStreamWriter(socket.getOutputStream()));
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) {
try {
socket.setSoTimeout(TIMEOUT); // 읽기 타임아웃 설정
out.write(binTxt);
// FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거
out.write("\nEXIT");
out.newLine();
// FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거
out.flush();
//StringBuffer sb = new StringBuffer();
//String rtnMsg = in.readLine();
rtnMsg = getTestData(idx);
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
System.out.println(rtnMsg);
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
in.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
socket.setSoTimeout(TIMEOUT); // 읽기 타임아웃 설정
out.write(binTxt);
// FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거
out.write("\nEXIT");
out.newLine();
// FIXME: 테스트 소켓서버 통신을 위해 임시로 추가 : 테스트 완료후 제거
out.flush();
rtnMsg = in.readLine();
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
System.out.println(rtnMsg);
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
} catch (SocketTimeoutException e) {
// 타임아웃 발생 시 처리
log.error("NICE CI Socket 서버 응답 시간 초과: " + e.getMessage());
// throw BizRuntimeException.create("NICE CI Socket 서버 응답 시간 초과로 인해 통신이 종료되었습니다.");
throw new EnsException(EnsErrCd.API_COMM_ERROR, "NICE CI Socket 서버 응답 시간 초과");
} catch (IOException e) {
// throw BizRuntimeException.create(e.getMessage());
throw new EnsException(EnsErrCd.API_COMM_ERROR, e.getMessage());
}
return rtnMsg;
}

@ -145,3 +145,5 @@ contract:
clientId: 0027370001
# 운영
#clientId: 0027370002
# 상태조회중 에러 발생시 FAIL 처리 여부
isStatusFail: false

@ -159,10 +159,11 @@
WHERE lnk_input_id = #{lnkInputId}
</update>
<update id="updatePrcsCdOfInputXit" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|updatePrcsCdOfInputXit-prcsCd update|julim */
<update id="updatePrcsCdAndErrorOfInputXit" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|updatePrcsCdAndErrorOfInputXit-prcsCd and errorupdate|julim */
UPDATE tb_input_xit
SET prcs_cd = #{prcsCd}
, err_msg = SUBSTR(#{errMsg}, 0, 1000)
WHERE lnk_input_id = #{lnkInputId}
</update>
@ -184,20 +185,23 @@
<select id="selectTmpltMsg" parameterType="string" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$TmpltMngDTO">
/** iup-niceci-mapper|selectTmpltMsg-selest nice ci template message|julim */
SELECT dtype
, org_cd
, tmplt_cd
, message
, title
, ntcntalk_tmplat_code
FROM ens_tmplt_mng
WHERE tmplt_cd = #{tmpltCd}
SELECT etm.dtype
, etm.org_cd
, etm.tmplt_cd
, etm.message
, etm.title
, etm.ntcntalk_tmplat_code
, eom.org_nm
FROM ens_org_mng eom
JOIN ens_tmplt_mng etm
ON eom.org_cd = etm.org_cd
WHERE etm.tmplt_cd = #{tmpltCd}
</select>
<insert id="insertNiceSmsSndngRequest" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiDTO$Request">
/** iup-niceci-mapper|insertNiceSmsSndngRequest-selest nice ci Send request 생성|julim */
<insert id="insertNiceSmsSndngRequest" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiSendDTO$Request">
/** iup-niceci-mapper|insertNiceSmsSndngRequest-nice ci Send request data 생성|julim */
INSERT INTO tb_nice_sms_sndng_requst (
NIce_sms_sndng_requst_id,
nice_sms_sndng_requst_id,
data_id,
trnsc_id,
spclty_groupcode,
@ -277,8 +281,8 @@
)
</insert>
<insert id="insertNiceSmsSndngResponse" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiDTO$Response">
/** iup-niceci-mapper|insertNiceSmsSndngResponse-selest nice ci Send response 생성|julim */
<insert id="insertNiceSmsSndngResponse" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiSendDTO$Response">
/** iup-niceci-mapper|insertNiceSmsSndngResponse-nice ci Send response 생성|julim */
INSERT INTO tb_nice_sms_sndng_rspns (
nice_sms_sndng_requst_id,
trnsc_id,
@ -299,7 +303,7 @@
sndng_mssage,
dsptch_no,
cttpc_inqire_se,
indvdlz_requst_blnk,
indvdlz_rspns_blnk,
indvdl_bsnm_cpr_se,
ihidnum,
nm,
@ -351,4 +355,168 @@
'ENS_SYS'
)
</insert>
<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')
FROM DUAL
</select>
<insert id="insertNiceSmsSndngInquireRequest" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiStatusDTO$Request">
/** iup-niceci-mapper|insertNiceSmsSndngInquireRequest-nice ci Status request data 생성|julim */
INSERT INTO tb_nice_sms_sndng_inqire_requs (
nice_sms_sndng_inqire_id,
trnsc_id,
spclty_groupcode,
delng_asortcode,
delng_secode,
trsmrcv_at,
trmnl_se,
rspns_code,
partcpt_instt_id,
instt_spclty_manageno,
instt_spclty_trnsmistime,
nice_spclty_manageno,
nice_spclty_trnsmistime,
blnk,
search_pd_from,
search_pd_to,
indvdl_bsnm_cpr_se,
ihidnum,
result_se,
sms_sndng_requst_se,
requst_co,
accmlt_recptn_co,
indvdlz_requst_blnk,
creat_dt,
crtr
) VALUES (
#{niceSmsSndngInqireId},
#{trnscId},
#{niceCommon.spcltyGroupcode},
#{niceCommon.delngAsortcode},
#{niceCommon.delngSecode},
#{niceCommon.trsmrcvAt},
#{niceCommon.trmnlSe},
#{niceCommon.rspnsCode},
#{niceCommon.partcptInsttId},
#{niceCommon.insttSpcltyManageno},
#{niceCommon.insttSpcltyTrnsmistime},
#{niceCommon.niceSpcltyManageno},
#{niceCommon.niceSpcltyTrnsmistime},
#{niceCommon.blnk},
#{searchPdFrom},
#{searchPdTo},
#{indvdlBsnmCprSe},
#{ihidnum},
#{resultSe},
#{smsSndngRequstSe},
#{requstCo},
#{accmltRecptnCo},
#{indvdlzRequstBlnk},
sysdate,
'ENS_SYS'
)
</insert>
<insert id="insertNiceSmsSndngInquireResponse" parameterType="cokr.xit.ens.modules.nice.model.NiceCiApiStatusDTO$Response">
/** iup-niceci-mapper|insertNiceSmsSndngInquireResponse-nice ci Send response 생성|julim */
INSERT INTO tb_nice_sms_sndng_inqire_rspns (
nice_sms_sndng_inqire_id,
trnsc_id,
spclty_groupcode,
delng_asortcode,
delng_secode,
trsmrcv_at,
trmnl_se,
rspns_code,
partcpt_instt_id,
instt_spclty_manageno,
instt_spclty_trnsmistime,
nice_spclty_manageno,
nice_spclty_trnsmistime,
blnk,
tot_co,
accmlt_co,
rspns_co,
creat_dt,
crtr
) VALUES (
#{niceSmsSndngInqireId},
#{trnscId},
#{niceCommon.spcltyGroupcode},
#{niceCommon.delngAsortcode},
#{niceCommon.delngSecode},
#{niceCommon.trsmrcvAt},
#{niceCommon.trmnlSe},
#{niceCommon.rspnsCode},
#{niceCommon.partcptInsttId},
#{niceCommon.insttSpcltyManageno},
#{niceCommon.insttSpcltyTrnsmistime},
#{niceCommon.niceSpcltyManageno},
#{niceCommon.niceSpcltyTrnsmistime},
#{niceCommon.blnk},
#{totCo},
#{accmltCo},
#{rspnsCo},
sysdate,
'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>
</mapper>

Loading…
Cancel
Save