From 18aa732d901a606746433576dcdb43577f1a97ba Mon Sep 17 00:00:00 2001 From: kjh Date: Thu, 17 Oct 2024 14:58:26 +0900 Subject: [PATCH] =?UTF-8?q?doc:=20=EC=9E=90=EB=A3=8C=EC=9D=B4=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/mens_traffic_transfer.sql | 124 ++++++++++ db/mens_traffic_transfer_oracle.sql | 362 ++++++++++++++++++++++++++++ 2 files changed, 486 insertions(+) create mode 100644 db/mens_traffic_transfer.sql create mode 100644 db/mens_traffic_transfer_oracle.sql diff --git a/db/mens_traffic_transfer.sql b/db/mens_traffic_transfer.sql new file mode 100644 index 0000000..0140fc3 --- /dev/null +++ b/db/mens_traffic_transfer.sql @@ -0,0 +1,124 @@ +insert into tb_ens_mobile_page_manage +select concat('KKO', send_detail_id) + , 'KKO-MY-DOC' + , details + , regist_dt + , 'system' +from ens_snd_dtl_mbl_page; + + +insert into tb_ens_unity_sndng_mastr +select (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id limit 1) + , '51110' + , '11' + , tmplt_cd + , 'ENS' + , send_cnt + , 'send_ok' -- stat_cd + , date_format(send_dt, '%Y%m%d%H%i%S') + , '' + , '' + , 'KKO-MY-DOC' + , '' + , '' + , '1' + , date_format(close_dt, '%Y%m%d%H%i%S') + , '' + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt'); + + +insert into tb_ens_unity_sndng_detail +select (select b.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail b where a.prop_external_document_uuid=b.external_document_uuid) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id limit 1) + , '51110' + , '11' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , (select mobile_page_cn from tb_ens_mobile_page_manage b where b.sndng_detail_id=concat('KKO', a.send_detail_id)) + , '' + , prop_external_document_uuid + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_dtl_kko_md a +where send_mast_id in (select send_mast_id from ens_snd_mast where stat_cd IN ('open', 'sendcmplt')); + + +insert into tb_ens_sndng_mastr +select concat('KKO', send_mast_id) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id limit 1) + , '51110' + , '11' + , tmplt_cd + , 'ENS' + , 'KKO-MY-DOC' + , send_cnt + , '1' + , '1' + , 'send_ok' -- stat_cd + , date_format(send_dt, '%Y%m%d%H%i%S') + , date_format(close_dt, '%Y%m%d%H%i%S') + , '' + , '' + , '' + , null + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt'); + + +insert into tb_ens_kakao_my_doc +select concat('KKO', send_detail_id) + , (select b.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail b where a.prop_external_document_uuid=b.external_document_uuid) + , concat('KKO', send_mast_id) + , '51110' + , '11' + , title + , hash + , common_categories + , read_expiread_at + , recv_ci + , '' + , '' + , '' + , recv_is_require_vfy_name + , prop_link + , prop_payload + , prop_message + , prop_cs_number + , prop_cs_name + , prop_external_document_uuid + , document_binder_uuid + , error_code + , error_message + , kko_doc_stat + , unix_timestamp(kko_doc_sent_dt) + , unix_timestamp(kko_doc_received_dt) + , unix_timestamp(kko_doc_auth_frst_dt) + , unix_timestamp(kko_doc_token_vrfy_frst_dt) + , unix_timestamp(kko_doc_read_frst_dt) + , unix_timestamp(kko_doc_user_notied_dt) + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_dtl_kko_md a +where send_mast_id in (select send_mast_id from ens_snd_mast where stat_cd IN ('open', 'sendcmplt')); \ No newline at end of file diff --git a/db/mens_traffic_transfer_oracle.sql b/db/mens_traffic_transfer_oracle.sql new file mode 100644 index 0000000..b0c84a7 --- /dev/null +++ b/db/mens_traffic_transfer_oracle.sql @@ -0,0 +1,362 @@ +create table TB_ENS_KT_GBS +( + SNDNG_MASTR_ID VARCHAR2(20) not null, + SNDNG_DETAIL_ID VARCHAR2(20) not null, + UNITY_SNDNG_DETAIL_ID VARCHAR2(20), + SIGNGU_CODE CHAR(5), + FFNLG_CODE VARCHAR2(2), + SERVICE_CD VARCHAR2(5), + MSG_CD VARCHAR2(5), + MAKE_DT VARCHAR2(14), + DATA_CNT NUMBER(8), + SNDN_EX_TIME VARCHAR2(14), + EX_TIME VARCHAR2(14), + SND_TEL_NO VARCHAR2(20), + M_TYPE VARCHAR2(10), + MSG_TYPE VARCHAR2(1), + OPT_TYPE VARCHAR2(1), + SRC_KEY VARCHAR2(50), + SRC_SEQ VARCHAR2(8), + SCI VARCHAR2(88), + MMS_DTL_CNTS VARCHAR2(4000), + MMS_TITLE VARCHAR2(40), + RCS_DTL_CNTS VARCHAR2(4000), + URL VARCHAR2(1000), + DOC_HASH VARCHAR2(100), + MDN VARCHAR2(11), + MMS_SNDG_RSLT_SQNO VARCHAR2(8), + PRCS_DT VARCHAR2(8), + MMS_BSNS_DVCD VARCHAR2(5), + MBL_BZOWR_DVCD VARCHAR2(2), + RL_MMS_SNDG_TELNO VARCHAR2(20), + MMS_RSLT_DVCD VARCHAR2(20), + MMS_SNDG_TMST VARCHAR2(14), + MMS_RCV_TMST VARCHAR2(14), + MMS_RDG_TMST VARCHAR2(14), + PREV_APPROVE_YN VARCHAR2(4), + RESULT_CD VARCHAR2(2), + RESULT_DT VARCHAR2(14), + ERROR_MSG VARCHAR2(255), + REGIST_DT DATE, + REGISTER VARCHAR2(20), + UPDT_DT DATE, + UPDUSR VARCHAR2(20), + constraint PK_TB_ENS_KT_BC_GBS + primary key (SNDNG_MASTR_ID, SNDNG_DETAIL_ID) +); + +comment on table TB_ENS_KT_GBS is 'GBS 공인 알림 문자'; +comment on column TB_ENS_KT_GBS.SNDNG_MASTR_ID is '발송 마스터 ID'; +comment on column TB_ENS_KT_GBS.SNDNG_DETAIL_ID is '발송 상세 ID'; +comment on column TB_ENS_KT_GBS.UNITY_SNDNG_DETAIL_ID is '통합 발송 상세 ID'; +comment on column TB_ENS_KT_GBS.SIGNGU_CODE is '시군구 코드'; +comment on column TB_ENS_KT_GBS.FFNLG_CODE is '과태료 코드'; +comment on column TB_ENS_KT_GBS.SERVICE_CD is '기관코드'; +comment on column TB_ENS_KT_GBS.MSG_CD is '문서코드'; +comment on column TB_ENS_KT_GBS.MAKE_DT is '생성일시'; +comment on column TB_ENS_KT_GBS.DATA_CNT is '회차전체데이터건수'; +comment on column TB_ENS_KT_GBS.SNDN_EX_TIME is '발송마감시간'; +comment on column TB_ENS_KT_GBS.EX_TIME is '열람마감시간'; +comment on column TB_ENS_KT_GBS.SND_TEL_NO is '발신번호(서비스기관)(발송전화번호)'; +comment on column TB_ENS_KT_GBS.M_TYPE is '문서종류(sms,lms,mms)'; +comment on column TB_ENS_KT_GBS.MSG_TYPE is '발송메세지타입'; +comment on column TB_ENS_KT_GBS.OPT_TYPE is '메시지 발송구분'; +comment on column TB_ENS_KT_GBS.SRC_KEY is '관리키'; +comment on column TB_ENS_KT_GBS.SRC_SEQ is 'SRC_SEQ'; +comment on column TB_ENS_KT_GBS.SCI is 'CI'; +comment on column TB_ENS_KT_GBS.MMS_DTL_CNTS is 'MMS상세내용'; +comment on column TB_ENS_KT_GBS.MMS_TITLE is 'MMS제목'; +comment on column TB_ENS_KT_GBS.RCS_DTL_CNTS is 'RCS 메시지 상세내용'; +comment on column TB_ENS_KT_GBS.URL is '연결URL'; +comment on column TB_ENS_KT_GBS.DOC_HASH is '문서해시'; +comment on column TB_ENS_KT_GBS.MDN is '개인휴대전화번호'; +comment on column TB_ENS_KT_GBS.MMS_SNDG_RSLT_SQNO is 'MMS발송결과상태순번 (1:수신,2:열람)'; +comment on column TB_ENS_KT_GBS.PRCS_DT is '처리일자'; +comment on column TB_ENS_KT_GBS.MMS_BSNS_DVCD is '문서코드'; +comment on column TB_ENS_KT_GBS.MBL_BZOWR_DVCD is '모바일사업자구분 (01:KT,02:SKT,03:LGT)'; +comment on column TB_ENS_KT_GBS.RL_MMS_SNDG_TELNO is '실제발송번호(일부)'; +comment on column TB_ENS_KT_GBS.MMS_RSLT_DVCD is '발송결과코드'; +comment on column TB_ENS_KT_GBS.MMS_SNDG_TMST is '발송 타임 스탬프'; +comment on column TB_ENS_KT_GBS.MMS_RCV_TMST is '수신 타임 스탬프'; +comment on column TB_ENS_KT_GBS.MMS_RDG_TMST is '열람 타임 스탬프'; +comment on column TB_ENS_KT_GBS.PREV_APPROVE_YN is '기동의발송여부'; +comment on column TB_ENS_KT_GBS.RESULT_CD is '처리결과'; +comment on column TB_ENS_KT_GBS.RESULT_DT is '응답처리일자'; +comment on column TB_ENS_KT_GBS.ERROR_MSG is '오류 메시지'; +comment on column TB_ENS_KT_GBS.REGIST_DT is '등록 일시'; +comment on column TB_ENS_KT_GBS.REGISTER is '등록자'; +comment on column TB_ENS_KT_GBS.UPDT_DT is '수정 일시'; +comment on column TB_ENS_KT_GBS.UPDUSR is '수정자'; + +-- 자료 이관 + +insert into tb_ens_mobile_page_manage +select concat('KKO', send_detail_id) + , 'KKO-MY-DOC' + , details + , to_char(regist_dt, 'yyyymmddhh24miss') + , 'system' +from ens_snd_dtl_mbl_page +where post_se='kkoMydoc'; + +insert into tb_ens_mobile_page_manage +select concat('KTG', send_detail_id) + , 'KT-GBS' + , details + , to_char(regist_dt, 'yyyymmddhh24miss') + , 'system' +from ens_snd_dtl_mbl_page +where post_se='ktGibis'; + +insert into tb_ens_unity_sndng_mastr +select (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum = 1) + , org_cd + , '11' + , tmplt_cd + , 'ENS' + , send_cnt + , 'send_ok' -- stat_cd + , to_char(send_dt, 'yyyymmddhh24miss') + , '' + , '' + , 'KKO-MY-DOC' + , '' + , '' + , '1' + , to_char(close_dt, 'yyyymmddhh24miss') + , '' + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt') + and tmplt_cd like '%2'; + + +insert into tb_ens_unity_sndng_mastr +select (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kt_gbs b inner join tb_elctrn_ntic_sndng_detail c on b.LINKED_UUID=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum = 1) + , org_cd + , '11' + , tmplt_cd + , 'ENS' + , send_cnt + , 'send_ok' -- stat_cd + , to_char(send_dt, 'yyyymmddhh24miss') + , '' + , '' + , 'KT-GBS' + , '' + , '' + , '1' + , to_char(close_dt, 'yyyymmddhh24miss') + , '' + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt') + and tmplt_cd like '%3'; + + +insert into tb_ens_unity_sndng_detail +select (select b.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail b where a.prop_external_document_uuid=b.external_document_uuid) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum= 1) + , bb.org_cd + , '11' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , (select mobile_page_cn from tb_ens_mobile_page_manage c where c.sndng_detail_id=concat('KKO', a.send_detail_id)) + , '' + , a.prop_external_document_uuid + , a.regist_dt + , 'system' + , a.last_updt_dt + , 'system' +from ens_snd_dtl_kko_md a + inner join ens_snd_mast bb on (a.SEND_MAST_ID=bb.send_mast_id) +where bb.stat_cd IN ('open', 'sendcmplt') and bb.tmplt_cd like '%2'; + + +insert into tb_ens_unity_sndng_detail +select (select b.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail b where a.LINKED_UUID=b.external_document_uuid) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kt_gbs b inner join tb_elctrn_ntic_sndng_detail c on b.LINKED_UUID=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum= 1) + , bb.org_cd + , '11' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , '' + , (select mobile_page_cn from tb_ens_mobile_page_manage c where c.sndng_detail_id=concat('KTG', a.send_detail_id)) + , '' + , a.LINKED_UUID + , null + , 'system' + , null + , 'system' +from ens_snd_dtl_kt_gbs a + inner join ens_snd_mast bb on (a.SEND_MAST_ID=bb.send_mast_id) +where bb.stat_cd IN ('open', 'sendcmplt') and bb.tmplt_cd like '%3'; + + + +insert into tb_ens_sndng_mastr +select concat('KKO', send_mast_id) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kko_md b inner join tb_elctrn_ntic_sndng_detail c on b.prop_external_document_uuid=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum=1) + , org_cd + , '11' + , tmplt_cd + , 'ENS' + , 'KKO-MY-DOC' + , send_cnt + , '1' + , '1' + , 'send_ok' + , to_char(send_dt, 'yyyymmddhh24miss') + , to_char(close_dt, 'yyyymmddhh24miss') + , '' + , '' + , '' + , null + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt') + and tmplt_cd like '%2'; + + +insert into tb_ens_sndng_mastr +select concat('KTG', send_mast_id) + , (select c.elctrn_ntic_sndng_id from ens_snd_dtl_kt_gbs b inner join tb_elctrn_ntic_sndng_detail c on b.LINKED_UUID=c.external_document_uuid where a.send_mast_id = b.send_mast_id and rownum=1) + , org_cd + , '11' + , tmplt_cd + , 'ENS' + , 'KT-GBS' + , send_cnt + , '1' + , '1' + , 'send_ok' + , to_char(send_dt, 'yyyymmddhh24miss') + , to_char(close_dt, 'yyyymmddhh24miss') + , '' + , '' + , '' + , null + , '' + , regist_dt + , 'system' + , last_updt_dt + , 'system' +from ens_snd_mast a +where stat_cd IN ('open', 'sendcmplt') + and tmplt_cd like '%3'; + + +insert into tb_ens_kakao_my_doc +select concat('KKO', a.send_detail_id) + , (select b.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail b where a.prop_external_document_uuid=b.external_document_uuid) + , concat('KKO', a.send_mast_id) + , bb.org_cd + , '11' + , a.title + , a.hash + , a.common_categories + , a.read_expiread_at + , a.recv_ci + , '' + , '' + , '' + , a.recv_is_require_vfy_name + , a.prop_link + , a.prop_payload + , a.prop_message + , a.prop_cs_number + , a.prop_cs_name + , a.prop_external_document_uuid + , a.document_binder_uuid + , a.error_code + , a.error_message + , a.kko_doc_stat + , FN_GET_DATETOUNIXTIME(a.kko_doc_sent_dt) + , FN_GET_DATETOUNIXTIME(a.kko_doc_received_dt) + , FN_GET_DATETOUNIXTIME(a.kko_doc_auth_frst_dt) + , FN_GET_DATETOUNIXTIME(a.kko_doc_token_vrfy_frst_dt) + , FN_GET_DATETOUNIXTIME(a.kko_doc_read_frst_dt) + , FN_GET_DATETOUNIXTIME(a.kko_doc_user_notied_dt) + , a.regist_dt + , 'system' + , a.last_updt_dt + , 'system' +from ens_snd_dtl_kko_md a + inner join ens_snd_mast bb on (a.SEND_MAST_ID=bb.send_mast_id) +where bb.stat_cd IN ('open', 'sendcmplt') and bb.tmplt_cd like '%2'; + + +insert into tb_ens_kt_gbs +select concat('KTG', b.SEND_MAST_ID) + , concat('KTG', b.send_detail_id) + , (select bb.elctrn_ntic_sndng_detail_id from tb_elctrn_ntic_sndng_detail bb where b.LINKED_UUID=bb.external_document_uuid) + , E.ORG_CD + , '11' + , E.KT_ST_SERVICE_CD + , '' + , '' + , A.SEND_CNT + , TO_CHAR(A.CLOSE_DT, 'YYYYMMDDHH24MISS') + , TO_CHAR(A.CLOSE_DT, 'YYYYMMDDHH24MISS') + , '' + , D.M_TYPE + , D.MSG_TYPE + , D.OPT_TYPE + , B.SRC_KEY + , B.SRC_SEQ + , B.CI + , B.MMS_DTL_CNTS + , B.MMS_TITLE + , '' + , B.URL + , B.HASH + , '' + , '' + , '' + , '' + , '' + , '' + , B.DOC_STAT + , B.DOC_SENT_DT + , B.DOC_RECEIVED_DT + , B.DOC_READ_FRST_DT + , '' + , '' + , '' + , '' + , sysdate + , '' + , '' + , '' +FROM ENS_SND_MAST A + INNER JOIN ENS_SND_DTL_KT_GBS B ON (A.SEND_MAST_ID=B.SEND_MAST_ID) + INNER JOIN ENS_TMPLT_MNG C ON (A.TMPLT_CD=C.TMPLT_CD) + INNER JOIN ENS_TMPLT_MNG_KT_GBS D ON (A.TMPLT_CD=D.TMPLT_CD) + INNER JOIN ENS_ORG_MNG E ON (A.ORG_CD=E.ORG_CD) +where a.STAT_CD in ('open', 'sendcmplt'); +