You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mens-iup/db/mens-iup-query.sql

296 lines
14 KiB
MySQL

-- A001 한국교통연구원 민자도로 관리지원센터 미납통행료 납부고지서
Insert into TB_INPUT_XIT
(LNK_INPUT_ID, ORG_CD, JOB_CD, TOT_CNT, PRCS_CD, RUN_DT, EXPIRES_DT, SEND_TYPE, REG_ID, REG_DT, PAY_EXPIRES_DT)
Values
(302400012002, '0001', 'A0001', 2, 'TGRG', SYSDATE, SYSDATE + 1
, 'NI', 'cntc', SYSDATE, SYSDATE+30);
Insert into TB_INPUT_DATA_XIT
(LNK_INPUT_ID, DATA_ID, SID, NAME, BIRTHDAY,
GENDER, MSG_DATA, REG_ID, REG_DT, UPD_ID,
UPD_DT, PAY_STATUS_CD, PAY_URL, CAR_NO)
Values
(302400012002, 'EL3004202408080439501', '8312181111111', '홍길동', '19831218',
'1', '{"~~@@!!CAR_NO!!@@~~":"24주9434","~~@@!!COMPANY!!@@~~":"수도권제1순환","~~@@!!TERM!!@@~~":"2020년 11월 16일~2021년 04월 15일","~~@@!!DEGREE!!@@~~":"24주9434","~~@@!!FEE!!@@~~":"147,400","~~@@!!COUNT!!@@~~":"69","~~@@!!METHOD!!@@~~":"가상계좌 및 카카오페이","~~@@!!BANK_ACCOUNT!!@@~~":"-(가상계좌) : 농협은행 792000-37-048721\n국민은행 731190-72-112238\n우리은행 283753-54-918171\n신한은행 562146-27-216570","~~@@!!DEADLINE!!@@~~":"2024년09월10일","~~@@!!CALL_NO!!@@~~":"044-211-3377"}', 'cephis00', SYSDATE, '',
'', '', '', '24주9434');
Insert into TB_INPUT_DATA_XIT
(LNK_INPUT_ID, DATA_ID, SID, NAME, BIRTHDAY,
GENDER, MSG_DATA, REG_ID, REG_DT, UPD_ID,
UPD_DT, PAY_STATUS_CD, PAY_URL, CAR_NO)
Values
(302400012002, 'EL3004202408080441611', '8312181111111', '홍길동', '19831218',
'1', '{"~~@@!!CAR_NO!!@@~~":"806노9066","~~@@!!COMPANY!!@@~~":"수도권제1순환","~~@@!!TERM!!@@~~":"2024년 03월 21일~2024년 06월 04일","~~@@!!DEGREE!!@@~~":"806노9066","~~@@!!FEE!!@@~~":"988,600","~~@@!!COUNT!!@@~~":"61","~~@@!!METHOD!!@@~~":"가상계좌 및 카카오페이","~~@@!!BANK_ACCOUNT!!@@~~":"-(가상계좌) : 농협은행 792000-37-100871\n국민은행 731190-72-160185\n우리은행 282376-85-718212\n신한은행 562146-27-582924","~~@@!!DEADLINE!!@@~~":"2024년09월10일","~~@@!!CALL_NO!!@@~~":"044-211-3377"}', 'cephis00', SYSDATE, '',
'', '', '', '806노9066');
commit;
-- A003 통행료 미납에 따른 예금 압류 예고 안내
Insert into TB_INPUT_XIT
(LNK_INPUT_ID, ORG_CD, JOB_CD, TOT_CNT, PRCS_CD, RUN_DT, EXPIRES_DT, SEND_TYPE, REG_ID, REG_DT, PAY_EXPIRES_DT)
Values
(302400022002, '0001', 'A0003', 2, 'TGRG', SYSDATE, SYSDATE + 1
, 'NI', 'cntc', SYSDATE, SYSDATE+30);
Insert into TB_INPUT_DATA
(LNK_INPUT_ID, DATA_ID, SID, NAME, BIRTHDAY,
GENDER, MSG_DATA, REG_ID, REG_DT, UPD_ID,
UPD_DT, PAY_STATUS_CD, PAY_URL, CAR_NO)
Values
(302400022002, 'EL3004202408080431755', '8312181111111', '홍길동', '19670710',
'2', '{"~~@@!!NAME!!@@~~":"홍길동","~~@@!!CAR_NO!!@@~~":"11소5184","~~@@!!COMPANY!!@@~~":"수도권제1순환","~~@@!!TERM!!@@~~":"2023년 04월 14일~2024년 07월 03일","~~@@!!FEE!!@@~~":"538,200","~~@@!!COUNT!!@@~~":"40","~~@@!!METHOD!!@@~~":"가상계좌 및 카카오페이","~~@@!!BANK_ACCOUNT!!@@~~":"-(가상계좌) : 농협은행 792000-36-695641\n국민은행 730890-72-818540\n우리은행 282376-66-218815\n신한은행 562146-27-146150","~~@@!!DEADLINE!!@@~~":"2024년10월13일","~~@@!!CALL_NO!!@@~~":"044-211-3377"}', 'cephis00', SYSDATE, 'sender_1',
'', '', '', '11소5184');
Insert into TB_INPUT_DATA
(LNK_INPUT_ID, DATA_ID, SID, NAME, BIRTHDAY,
GENDER, MSG_DATA, REG_ID, REG_DT, UPD_ID,
UPD_DT, PAY_STATUS_CD, PAY_URL, CAR_NO)
Values
(302400022002, 'EL3004202408080441445', '8312181111111', '김길동', '19550720',
'1', '{"~~@@!!NAME!!@@~~":"김길동","~~@@!!CAR_NO!!@@~~":"46서9187","~~@@!!COMPANY!!@@~~":"수도권제1순환","~~@@!!TERM!!@@~~":"2024년 01월 11일~2024년 07월 27일","~~@@!!FEE!!@@~~":"57,700","~~@@!!COUNT!!@@~~":"62","~~@@!!METHOD!!@@~~":"가상계좌 및 카카오페이","~~@@!!BANK_ACCOUNT!!@@~~":"-(가상계좌) : 농협은행 792000-37-100706\n국민은행 731190-72-160044\n우리은행 282376-85-718059\n신한은행 562146-27-582784","~~@@!!DEADLINE!!@@~~":"2024년10월13일","~~@@!!CALL_NO!!@@~~":"044-211-3377"}', 'cephis00', SYSDATE, 'sender_1',
'', '', '', '46서9187');
COMMIT;
select * from ens_intgrn_snd_mast order by REGIST_DT desc;
select * from ens_intgrn_snd_dtl;
select * from ens_bill;
select * from ens_tmplt_mng;
select * from ens_org_mng;
select * from ens_snd_dtl_mbl_page;
/* accept : org_cd = 0001, tmplt_cd = A0008 */
select * from TB_INPUT_XIT order by REG_DT desc;
select * from TB_INPUT_DATA_XIT order by REG_DT desc;
select * from ens_tmplt_mng_kko_talk;
select * from ens_tmplt_mng_kko_md;
select * from ens_snd_mast order by REGIST_DT desc;
select * from ens_bill order by REGIST_DT desc;
select * from ens_snd_dtl_kko_talk order by REGIST_DT desc;
select * from ens_snd_dtl_kko_md order by REGIST_DT desc;
select * from ens_snd_dtl_mbl_page order by REGIST_DT desc;
select * from ENS_NICE_JID_MNG order by REGIST_DT desc;
select * from ENS_NICE_CI_MNG order by regist_dt desc;
select to_char(to_timestamp(null, 'yyyy-mm-dd"T"hh24:mi:ss'), 'yyyymmddhh24miss')
from dual;
/* **********************************************
*
********************************************** */
-- [31896] 압류예고 연락처 조회 및 SMS 요청 전문
-- NICE_SMS_SNDNG_REQUST_ID = SEQ_NICE_SMS_SNDNG_REQUST_ID (시퀀스 사용)
-- [요청] 요청 메시지가 가변이여서 1건 발송만 가능
SELECT * FROM TB_NICE_SMS_SNDNG_REQUST;
-- [응답]
SELECT * FROM TB_NICE_SMS_SNDNG_RSPNS;
-- [31893] 압류예고 연락처 조회 및 SMS 이력 조회 전문
-- NICE_SMS_SNDNG_INQIRE_ID = SEQ_NICE_SMS_SNDNG_INQIRE_ID (시퀀스 사용)
-- [요청] 검색기간(from) ~ 검색기간(to) 로 요청 / 주민번호로 요청 할 경우 2건이상 발생할 수 있어서 기간으로 검색
SELECT * FROM TB_NICE_SMS_SNDNG_INQIRE_REQUS;
-- [응답 공통]
SELECT * FROM TB_NICE_SMS_SNDNG_INQIRE_RSPNS;
-- [응답 반복] NICE_SMS_SNDNG_INQIRE_ID, SN : 요청 하나에 여러 건이 발생하여 순번 사용
SELECT * FROM TB_NICE_SMS_SNDNG_INQIRE_REPTI;
-- 검색기간 조회 쿼리
SELECT TO_CHAR(MIN(run_dt), 'YYYYMMDD')||'000000000000' AS "from"
, TO_CHAR(MAX(run_dt+1), 'YYYYMMDD')||'000000000000' AS "to"
FROM tb_input_xit tix
WHERE tix.send_type='NI'
AND tix.prcs_cd='IPCP';
-- [요청건수] 0000000100 고정
/* **********************************************
** [ ]
* 0000000000
* 100
* 259 3
* 0000000000
* 0000000100
* 0000000200
********************************************** */
-- [응답반복부에서 개별 자료 찾기]
-- 응답받은 주민번호와 발송메시지로 조회하여 DATA_ID 찾음
SELECT *
FROM TB_NICE_SMS_SNDNG_REQUST tnssr
WHERE tnssr.IHIDNUM = '' -- 응답받은 주민번호
AND REGEXP_REPLACE(tnssr.SNDNG_MSSAGE, '[[:space:]]+', '') = ''; -- 응답받은 발송메시지
/* **********************************************
* accept
********************************************** */
-- 1. 대상 조회
SELECT *
FROM tb_input_xit tix
JOIN tb_input_data_xit tidx
ON tix.lnk_input_id=tidx.lnk_input_id
WHERE 1=1
-- AND tix.send_type='NI'
AND tix.prcs_cd='TGRG';
-- 2. bill 생성
-- 3. 카카오 청구서 생성
-- 4. tb_input_data_xit 테이블 pay_url 에 청구서 URL UPDATE
-- 5. tb_input_xit 테이블 prcs_cd='GRUC' / 실패 시 prcs_cd='TGRF'
/* **********************************************
* send
********************************************** */
-- 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'
-- A001 Message 샘플
/*
.
: 8069066
: 1
: 2024 03 21~2024 06 04
: 988,600(61)
: 20240910
:
()
-() : 792000-37-100871
731190-72-160185
282376-85-718212
562146-27-582924
.
: 044-211-3377
*/
-- A003 Message 샘플
/*
.
21 6 .
, , 24 .
: 566109
: -
: 2023 09 18~2023 12 29
: 98,500(68)
:
-() : 792000-36-752211
731190-72-119419
283754-88-618368
562146-27-238987
: 20240607
: 044-211-3377
: 044-211-3377
*/
/* **********************************************
* status
********************************************** */
-- 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
********************************************** */
/* **********************************************
* close
********************************************** */
-- 1. 대상 조회
SELECT *
FROM tb_input_xit tix
WHERE tix.send_type='NI'
AND tix.prcs_cd='IPCP'
AND tix.expires_dt < SYSDATE - 1;
-- 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"}}
Insert into ENS_BILL
(BILL_ID, LAST_UPDT_DT, REGIST_DT, BILL_UID, BILL_SE_CD,
ORG_CD, BILLER_USER_KEY, PAID_AT)
Values
(8394718, TO_TIMESTAMP('2024/10/02 PM 1:25:02.713000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), TO_TIMESTAMP('2024/10/02 PM 1:25:02.713000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), 'intgrnNoti-1727843102-fn.x8QpG4JnaBd6psESO6l', 'privt',
'0001', 'EL3020202408060407773', 'N');
Insert into ENS_BILL_KKO
(BILL_ID, LAST_UPDT_DT, REGIST_DT, BILL_UID, BILLER_NOTICE_KEY,
BILLER_USER_KEY, CUSTOM_URL, EXPIRE_AT, URL)
Values
(4993792, TO_TIMESTAMP('2024/10/02 PM 4:45:05.328000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), TO_TIMESTAMP('2024/10/02 PM 4:45:05.167000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), 'intgrnNoti-1727843102-fn.x8QpG4JnaBd6psESO6l', 'intgrnNoti-1727843102-fn.x8QpG4JnaBd6psESO6l',
'EL3020202408060407773', '{"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"}', '20241010235900', 'https://billgates-web.kakao.com/r/platform/pages/paynow/search/1832/11/1a481760-b0da-4a77-9a7a-74951db5fa01');
Insert into ENS_BILL_HIS
(ID, LAST_UPDT_DT, REGIST_DT, BILL_SE, BILL_UID,
LINKED_UUID, REQ_SE, REQUEST_DATA, RESPONSE_DATA, ORG_CD)
Values
(40336145, TO_TIMESTAMP('2024/10/02 PM 4:45:05.331000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), TO_TIMESTAMP('2024/10/02 PM 4:45:05.331000','YYYY/MM/DD AM fmHH12fm:MI:SS.FF'), 'bpKko', 'intgrnNoti-1727843102-fn.x8QpG4JnaBd6psESO6l',
'EL3020202408060407773', 'VD_URL', '{"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/1a481760-b0da-4a77-9a7a-74951db5fa01"}}', '0001');
select nvl(max(id), 0) + 1
from IUP.ENS_BILL_HIS
where id = 99999999999999999999;;
-- eom.org_nm, etm.message, etm.ntcntalk_tmplat_code
SELECT *
FROM ens_org_mng eom
JOIN ens_tmplt_mng etm
ON eom.ORG_CD = etm.ORG_CD
WHERE etm.tmplt_cd='A0001';