다양화: 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:
forge-bot 2026-07-19 01:37:54 +00:00
parent b96cf702ee
commit c3a0259e95
1027 changed files with 68915 additions and 40962 deletions

View file

@ -10,13 +10,20 @@
/*
* lg_ol_0012.pgc - (LG_OL_0012) [tier=easy]
*
* TxCore TX_SERVICE . TXBUF lg DBIO
* TXBUF . (ATMI void SVC(TPSVCINFO*) )
* : (MERCHID) .
* (status='R') /(status='U') ,
* / .
* , /
* ( ).
*
* TxCore TX_SERVICE . TXBUF lg_ledger
* SQL(singleton ) .
*/
#include <stdio.h>
#include <string.h>
#include "txcore.h"
#include "txcore_dbio.h"
#include "acq_util.h"
#include "lg_core.h"
@ -89,37 +96,129 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
#line 15 "app/online/lg_ol_0012.pgc"
#line 22 "app/online/lg_ol_0012.pgc"
TX_SERVICE(LG_OL_0012, ctx)
{
lg_rec_t rec;
char key[16];
int rc;
/* exec sql begin declare section */
#line 27 "app/online/lg_ol_0012.pgc"
char h_merch_id [ 16 ] ;
#line 28 "app/online/lg_ol_0012.pgc"
char h_status [ 2 ] ;
#line 29 "app/online/lg_ol_0012.pgc"
int h_cnt ;
#line 30 "app/online/lg_ol_0012.pgc"
long h_sum ;
/* exec sql end declare section */
#line 31 "app/online/lg_ol_0012.pgc"
tx_log(TX_LOG_INFO, "[LG_OL_0012] 원장 단건조회 서비스 진입");
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[LG_OL_0012] KEY 누락");
char merch[16];
char wonbuf[32];
long recv_cnt = 0, recv_sum = 0;
long fail_cnt = 0, fail_sum = 0;
long open_cnt = 0, open_sum = 0;
long open_avg = 0;
tx_log(TX_LOG_INFO, "[LG_OL_0012] 미결원장 조회 서비스 진입");
/* ---- 1. 요청 필드 수신 및 검증 ---- */
if (tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK ||
merch[0] == '\0') {
tx_log(TX_LOG_ERROR, "[LG_OL_0012] MERCHID 누락");
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESPCODE", RESP_INVALID);
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
memset(&rec, 0, sizeof(rec));
rc = lg_rec_select(key, &rec);
if (rc != TX_OK) {
tx_log(TX_LOG_WARN, "[LG_OL_0012] 조회 실패 key=%s rc=%d(%s)",
key, rc, tx_strerror(rc));
tx_return(ctx, rc, ctx->out);
strncpy(h_merch_id, merch, sizeof(h_merch_id) - 1);
h_merch_id[sizeof(h_merch_id) - 1] = '\0';
/* ---- 2. 접수(R) 미결 집계 ---- */
strncpy(h_status, LG_ST_RECV, sizeof(h_status) - 1);
h_status[sizeof(h_status) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) , coalesce ( sum ( amount ) , 0 ) from lg_ledger where merch_id = $1 and status = $2 ",
ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*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_EOIT,
ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 63 "app/online/lg_ol_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK && sqlca.sqlcode != TX_SQL_NOTFOUND) {
TX_DBIO_LOG_ERR("LG_OL_0012 recv");
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESPCODE", RESP_SYSERR);
tx_return(ctx, TX_EDB, ctx->out);
return;
}
recv_cnt = (long)h_cnt;
recv_sum = h_sum;
/* ---- 3. 불일치/실패(U) 미결 집계 ---- */
strncpy(h_status, LG_ST_FAIL, sizeof(h_status) - 1);
h_status[sizeof(h_status) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) , coalesce ( sum ( amount ) , 0 ) from lg_ledger where merch_id = $1 and status = $2 ",
ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*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_EOIT,
ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 83 "app/online/lg_ol_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK && sqlca.sqlcode != TX_SQL_NOTFOUND) {
TX_DBIO_LOG_ERR("LG_OL_0012 fail");
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESPCODE", RESP_SYSERR);
tx_return(ctx, TX_EDB, ctx->out);
return;
}
fail_cnt = (long)h_cnt;
fail_sum = h_sum;
/* ---- 4. 전체 미결 합산, 건당 평균, 원화 표기 ---- */
open_cnt = recv_cnt + fail_cnt;
open_sum = recv_sum + fail_sum;
if (open_cnt > 0)
open_avg = open_sum / open_cnt; /* 미결 건당 평균금액 */
amount_format_won(open_sum, wonbuf, sizeof(wonbuf));
/* ---- 5. 응답 구성 (미결 0건도 정상 응답) ---- */
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, "[LG_OL_0012] 조회완료 key=%s amount=%ld", key, rec.amount);
tx_buf_sets(ctx->out, "RESPCODE", RESP_OK);
tx_buf_sets(ctx->out, "MERCHID", merch);
tx_buf_setlong(ctx->out, "RECVCNT", recv_cnt);
tx_buf_setlong(ctx->out, "RECVSUM", recv_sum);
tx_buf_setlong(ctx->out, "FAILCNT", fail_cnt);
tx_buf_setlong(ctx->out, "FAILSUM", fail_sum);
tx_buf_setlong(ctx->out, "OPENCNT", open_cnt);
tx_buf_setlong(ctx->out, "OPENSUM", open_sum);
tx_buf_setlong(ctx->out, "OPENAVG", open_avg);
tx_buf_sets(ctx->out, "OPENWON", wonbuf);
tx_buf_sets(ctx->out, "HASOPEN", (open_cnt > 0) ? "Y" : "N");
tx_log(TX_LOG_INFO,
"[LG_OL_0012] 미결조회 merch=%s 접수=%ld건 실패=%ld건 계=%ld건 금액=%s",
merch, recv_cnt, fail_cnt, open_cnt, wonbuf);
tx_return(ctx, TX_OK, ctx->out);
}