다양화: 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,33 @@
/*
* cl_ol_0010.pgc - (CL_OL_0010) [tier=easy]
*
* TxCore TX_SERVICE . TXBUF cl DBIO
* TXBUF . (ATMI void SVC(TPSVCINFO*) )
* . (BIZDATE) (R)/(M)/
* (U)/(S) SELECT .
* (/) . (read-only)
*
* (Contract)
* :
* BIZDATE () (YYYYMMDD)
* :
* RESPCODE 0000= / 9001= / 9999=
* BIZDATE
* CNTRECV (R)
* CNTDONE (M)
* CNTFAIL (U)
* CNTSETTLED (S)
* CNTTOTAL (R+M+U+S)
* PROGRESS (%) = / * 100
*
*
* · R/M/U/S count SELECT .
* · 0 0% (0 ).
* · .
*/
#include <stdio.h>
#include <string.h>
#include "txcore.h"
#include "txcore_dbio.h"
#include "acq_util.h"
#include "cl_core.h"
@ -89,37 +109,107 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
#line 15 "app/online/cl_ol_0010.pgc"
#line 35 "app/online/cl_ol_0010.pgc"
TX_SERVICE(CL_OL_0010, ctx)
{
cl_rec_t rec;
char key[16];
int rc;
/* exec sql begin declare section */
#line 40 "app/online/cl_ol_0010.pgc"
char h_biz_date [ 9 ] ;
#line 41 "app/online/cl_ol_0010.pgc"
char h_status [ 2 ] ;
#line 42 "app/online/cl_ol_0010.pgc"
int h_cnt ;
/* exec sql end declare section */
#line 43 "app/online/cl_ol_0010.pgc"
tx_log(TX_LOG_INFO, "[CL_OL_0010] 마감 단건조회 서비스 진입");
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[CL_OL_0010] KEY 누락");
char bizdate[16];
long cnt_r = 0, cnt_m = 0, cnt_u = 0, cnt_s = 0, total = 0;
long remain = 0;
long progress = 0;
int i;
const char *codes = "RMUS";
tx_log(TX_LOG_INFO, "[CL_OL_0010] 마감 리포트 조회 서비스 진입");
/* 1. 요청 검증 */
if (tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[CL_OL_0010] BIZDATE 누락");
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESPCODE", RESP_INVALID);
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
if (!date_is_valid(bizdate)) {
tx_log(TX_LOG_WARN, "[CL_OL_0010] 영업일 형식 오류 date=%s", bizdate);
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 = cl_rec_select(key, &rec);
if (rc != TX_OK) {
tx_log(TX_LOG_WARN, "[CL_OL_0010] 조회 실패 key=%s rc=%d(%s)",
key, rc, tx_strerror(rc));
tx_return(ctx, rc, ctx->out);
return;
strncpy(h_biz_date, bizdate, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
/* 2. 상태코드별 개별 count SELECT (R/M/U/S 순회) */
for (i = 0; i < 4; i++) {
long v;
h_status[0] = codes[i];
h_status[1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from cl_ledger where biz_date = $1 and status = $2 ",
ECPGt_char,(h_biz_date),(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_EOIT,
ECPGt_int,&(h_cnt),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 83 "app/online/cl_ol_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("CL_OL_0010 status count");
tx_buf_reset(ctx->out);
tx_buf_sets(ctx->out, "RESPCODE", RESP_SYSERR);
tx_return(ctx, TX_EDB, ctx->out);
return;
}
v = (long)h_cnt;
switch (codes[i]) {
case 'R': cnt_r = v; break;
case 'M': cnt_m = v; break;
case 'U': cnt_u = v; break;
case 'S': cnt_s = v; break;
default: break;
}
}
/* 3. 합계 / 미정산 잔여(R+M+U) / 진척률(%) 계산 */
total = cnt_r + cnt_m + cnt_u + cnt_s;
remain = cnt_r + cnt_m + cnt_u;
progress = (total > 0) ? (cnt_s * 100 / total) : 0;
/* 4. 리포트 응답 구성 */
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, "[CL_OL_0010] 조회완료 key=%s amount=%ld", key, rec.amount);
tx_buf_sets(ctx->out, "RESPCODE", RESP_OK);
tx_buf_sets(ctx->out, "BIZDATE", bizdate);
tx_buf_setlong(ctx->out, "CNTRECV", cnt_r);
tx_buf_setlong(ctx->out, "CNTDONE", cnt_m);
tx_buf_setlong(ctx->out, "CNTFAIL", cnt_u);
tx_buf_setlong(ctx->out, "CNTSETTLED", cnt_s);
tx_buf_setlong(ctx->out, "CNTTOTAL", total);
tx_buf_setlong(ctx->out, "CNTREMAIN", remain);
tx_buf_setlong(ctx->out, "PROGRESS", progress);
tx_buf_sets(ctx->out, "COMPLETED", (remain == 0 && total > 0) ? "Y" : "N");
tx_log(TX_LOG_INFO,
"[CL_OL_0010] 리포트 date=%s R=%ld M=%ld U=%ld S=%ld 진척=%ld%%",
bizdate, cnt_r, cnt_m, cnt_u, cnt_s, progress);
tx_return(ctx, TX_OK, ctx->out);
}