다양화: 530개 online/batch 프로그램을 모듈별 고유 실업무 로직으로 재작성
- 템플릿 클론(정규화 후 0줄 상이) → 전 코퍼스 530/530 고유 바디 - 11개 모듈(mg/au/ac/rc/vl/st/py/lg/mm/cm/cl) 각 파일이 distinct한 매입·대사·정산·수수료·지급·원장·마감·마스터·정합성·전문게이트웨이·공통 업무 - TxCore(ATMI 유사) + ECPG(EXEC SQL) 관용구, 프레임워크/헤더/DBIO API/파일ID·경로 유지 - 전체 docker make -j4 = EXIT 0, 958 오브젝트, 데모 바이너리 링크 - inventory.json loc 실측 갱신 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b96cf702ee
commit
c3a0259e95
1027 changed files with 68915 additions and 40962 deletions
|
|
@ -6,17 +6,20 @@
|
|||
/* End of automatic include section */
|
||||
|
||||
#line 1 "app/online/mg_ol_0023.pgc"
|
||||
/* @tier easy @module mg @transform msg-gateway-online */
|
||||
/* @tier medium @module mg @transform msg-gateway-online */
|
||||
/*
|
||||
* mg_ol_0023.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0023) [tier=easy]
|
||||
* mg_ol_0023.pgc - 전문게이트웨이 채널 세션 종료 서비스 (MG_OL_0023) [tier=medium]
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 채널이 보유한 세션토큰(SESSTOKEN)을 검증한 뒤, 채널 세션 테이블
|
||||
* (mg_chan)의 상태를 종료('C')로 전이시킨다. 이미 종료되었거나 존재하지
|
||||
* 않는 세션은 반려하고, 정상 종료 시 종료결과를 응답한다.
|
||||
* (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "txcore.h"
|
||||
#include "txcore_dbio.h"
|
||||
#include "acq_util.h"
|
||||
#include "mg_core.h"
|
||||
|
||||
|
|
@ -89,37 +92,121 @@ struct sqlca_t *ECPGget_sqlca(void);
|
|||
|
||||
#endif
|
||||
|
||||
#line 15 "app/online/mg_ol_0023.pgc"
|
||||
#line 18 "app/online/mg_ol_0023.pgc"
|
||||
|
||||
|
||||
TX_SERVICE(MG_OL_0023, ctx)
|
||||
{
|
||||
mg_rec_t rec;
|
||||
char key[16];
|
||||
int rc;
|
||||
/* exec sql begin declare section */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#line 23 "app/online/mg_ol_0023.pgc"
|
||||
char h_token [ 33 ] ;
|
||||
|
||||
#line 24 "app/online/mg_ol_0023.pgc"
|
||||
char h_chan_cd [ 9 ] ;
|
||||
|
||||
#line 25 "app/online/mg_ol_0023.pgc"
|
||||
char h_status [ 2 ] ;
|
||||
|
||||
#line 26 "app/online/mg_ol_0023.pgc"
|
||||
char h_close_st [ 2 ] ;
|
||||
/* exec sql end declare section */
|
||||
#line 27 "app/online/mg_ol_0023.pgc"
|
||||
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0023] 전문게이트웨이 단건조회 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0023] KEY 누락");
|
||||
char token[33];
|
||||
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0023] 채널 세션 종료 서비스 진입");
|
||||
|
||||
/* 1) 세션토큰 수신/검증 */
|
||||
if (tx_buf_get(ctx->in, "SESSTOKEN", token, sizeof(token)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0023] 세션토큰(SESSTOKEN) 누락");
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
if (strlen(token) < 8) {
|
||||
tx_log(TX_LOG_WARN, "[MG_OL_0023] 세션토큰 길이 오류 len=%d", (int)strlen(token));
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&rec, 0, sizeof(rec));
|
||||
rc = mg_rec_select(key, &rec);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_WARN, "[MG_OL_0023] 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
strncpy(h_token, token, sizeof(h_token) - 1);
|
||||
h_token[sizeof(h_token) - 1] = '\0';
|
||||
|
||||
/* 2) 현재 세션 상태 조회 */
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select chan_cd , status from mg_chan where sess_token = $1 ",
|
||||
ECPGt_char,(h_token),(long)33,(long)1,(33)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
|
||||
ECPGt_char,(h_chan_cd),(long)9,(long)1,(9)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_char,(h_status),(long)2,(long)1,(2)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
|
||||
#line 54 "app/online/mg_ol_0023.pgc"
|
||||
|
||||
|
||||
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
|
||||
tx_log(TX_LOG_WARN, "[MG_OL_0023] 세션 없음 token=%.8s...", token);
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_INVALID);
|
||||
tx_return(ctx, TX_ENOENT, ctx->out);
|
||||
return;
|
||||
}
|
||||
if (sqlca.sqlcode != TX_SQL_OK) {
|
||||
TX_DBIO_LOG_ERR("SELECT mg_chan(세션조회)");
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_SYSERR);
|
||||
tx_return(ctx, TX_EDB, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
/* 3) 이미 종료된 세션은 멱등 반려 */
|
||||
if (h_status[0] == 'C') {
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0023] 이미 종료된 세션 chan=%s", h_chan_cd);
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_OK);
|
||||
tx_buf_sets(ctx->out, "CHANCD", h_chan_cd);
|
||||
tx_buf_sets(ctx->out, "CLOSED", "N");
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
/* 4) 세션 종료 상태 전이 */
|
||||
strncpy(h_close_st, "C", sizeof(h_close_st));
|
||||
|
||||
if (tx_begin() != TX_OK)
|
||||
tx_log(TX_LOG_WARN, "[MG_OL_0023] tx_begin 경고");
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update mg_chan set status = $1 , closed_ts = now ( ) where sess_token = $2 ",
|
||||
ECPGt_char,(h_close_st),(long)2,(long)1,(2)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_char,(h_token),(long)33,(long)1,(33)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
|
||||
#line 92 "app/online/mg_ol_0023.pgc"
|
||||
|
||||
|
||||
if (sqlca.sqlcode != TX_SQL_OK || sqlca.sqlerrd[2] != 1) {
|
||||
TX_DBIO_LOG_ERR("UPDATE mg_chan(세션종료)");
|
||||
tx_abort();
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_SYSERR);
|
||||
tx_return(ctx, TX_EDB, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
tx_commit();
|
||||
|
||||
/* 5) 종료결과 응답 */
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "KEY", rec.key);
|
||||
tx_buf_sets(ctx->out, "MERCHID", rec.merch_id);
|
||||
tx_buf_setlong(ctx->out, "AMOUNT", rec.amount);
|
||||
tx_buf_sets(ctx->out, "STATUS", rec.status);
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0023] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
tx_buf_sets(ctx->out, "RESP", RESP_OK);
|
||||
tx_buf_sets(ctx->out, "CHANCD", h_chan_cd);
|
||||
tx_buf_sets(ctx->out, "CLOSED", "Y");
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0023] 세션 종료완료 chan=%s token=%.8s...",
|
||||
h_chan_cd, token);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue