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

180 lines
8.5 KiB
MySQL

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;
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;
/* **********************************************
* 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'
/* **********************************************
* 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');