다양화: 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
|
|
@ -1,14 +1,27 @@
|
|||
/* @tier easy @module rc @transform reconciliation-online */
|
||||
/*
|
||||
* rc_ol_0014.pgc - 대사 온라인 서비스 (RC_OL_0014) [tier=easy]
|
||||
* rc_ol_0014.pgc - 미대사(접수 'R') 추출 조회 (CURSOR) 온라인 서비스 (RC_OL_0014)
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 지정 영업일(BIZDATE) 의 아직 대사되지 않은 접수건('R') 을 커서로
|
||||
* 순회하여 최대 LIMITN 건까지 응답에 실어 반환한다.
|
||||
* - 각 건은 KEY0/AMT0, KEY1/AMT1 ... 형태로 번호를 붙여 push
|
||||
* - 실제 push 한 건수(UNRECCNT) 와 금액합계(SUMAMT) 를 집계
|
||||
* 순수 조회 서비스이므로 상태전이/커밋 없이 읽기만 수행한다.
|
||||
*
|
||||
* 입력 TXBUF:
|
||||
* BIZDATE (필수) 대상 영업일 YYYYMMDD
|
||||
* LIMITN (선택) 최대 추출 건수, 미지정/비정상 시 기본 10
|
||||
* 출력 TXBUF:
|
||||
* UNRECCNT / SUMAMT / KEY0..KEYn / AMT0..AMTn
|
||||
*
|
||||
* 주의: 커서는 반드시 CLOSE 하며, FETCH 오류 시에도 그때까지 집계한
|
||||
* 결과를 정상 응답으로 돌려준다(부분 성공 허용).
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "txcore.h"
|
||||
#include "txcore_dbio.h"
|
||||
#include "acq_util.h"
|
||||
#include "rc_core.h"
|
||||
|
||||
|
|
@ -16,32 +29,96 @@ EXEC SQL INCLUDE sqlca;
|
|||
|
||||
TX_SERVICE(RC_OL_0014, ctx)
|
||||
{
|
||||
rc_rec_t rec;
|
||||
char key[16];
|
||||
int rc;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_biz_date[9];
|
||||
char h_key[16];
|
||||
long h_amount;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0014] 대사 단건조회 서비스 진입");
|
||||
char bizdate[16];
|
||||
char fname[16];
|
||||
long limitn = 0;
|
||||
long pushed = 0;
|
||||
long sumamt = 0;
|
||||
int opened = 0;
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[RC_OL_0014] KEY 누락");
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0014] 미대사 추출 조회(커서) 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "BIZDATE", bizdate, sizeof(bizdate)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[RC_OL_0014] BIZDATE 누락");
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&rec, 0, sizeof(rec));
|
||||
rc = rc_rec_select(key, &rec);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_WARN, "[RC_OL_0014] 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
if (!date_is_valid(bizdate)) {
|
||||
tx_log(TX_LOG_WARN, "[RC_OL_0014] 영업일 형식 오류 date=%s", bizdate);
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
/* 추출 상한(선택). 미지정/비정상이면 기본 10건, 과대 요청은 상한 clamp */
|
||||
if (tx_buf_getlong(ctx->in, "LIMITN", &limitn) != TX_OK || limitn <= 0)
|
||||
limitn = 10;
|
||||
if (limitn > 100) {
|
||||
tx_log(TX_LOG_WARN, "[RC_OL_0014] 추출상한 초과 요청 %ld → 100 clamp",
|
||||
limitn);
|
||||
limitn = 100;
|
||||
}
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0014] 추출조건 date=%s 상한=%ld", bizdate, limitn);
|
||||
|
||||
strncpy(h_biz_date, bizdate, sizeof(h_biz_date) - 1);
|
||||
h_biz_date[sizeof(h_biz_date) - 1] = '\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, "[RC_OL_0014] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
|
||||
EXEC SQL DECLARE cur_rc_ol_0014 CURSOR FOR
|
||||
SELECT key, amount
|
||||
FROM rc_ledger
|
||||
WHERE biz_date = :h_biz_date
|
||||
AND status = 'R'
|
||||
ORDER BY key;
|
||||
|
||||
EXEC SQL OPEN cur_rc_ol_0014;
|
||||
if (sqlca.sqlcode != TX_SQL_OK) {
|
||||
TX_DBIO_LOG_ERR("OPEN cur_rc_ol_0014");
|
||||
tx_return(ctx, TX_EDB, ctx->out);
|
||||
return;
|
||||
}
|
||||
opened = 1;
|
||||
|
||||
while (pushed < limitn) {
|
||||
memset(h_key, 0, sizeof(h_key));
|
||||
h_amount = 0;
|
||||
|
||||
EXEC SQL FETCH cur_rc_ol_0014 INTO :h_key, :h_amount;
|
||||
|
||||
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
|
||||
break;
|
||||
if (sqlca.sqlcode != TX_SQL_OK) {
|
||||
TX_DBIO_LOG_ERR("FETCH cur_rc_ol_0014");
|
||||
break;
|
||||
}
|
||||
|
||||
snprintf(fname, sizeof(fname), "KEY%ld", pushed);
|
||||
tx_buf_sets(ctx->out, fname, h_key);
|
||||
snprintf(fname, sizeof(fname), "AMT%ld", pushed);
|
||||
tx_buf_setlong(ctx->out, fname, h_amount);
|
||||
|
||||
sumamt += h_amount;
|
||||
pushed++;
|
||||
}
|
||||
|
||||
if (opened)
|
||||
EXEC SQL CLOSE cur_rc_ol_0014;
|
||||
|
||||
if (pushed == 0)
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0014] 미대사 접수건 없음 date=%s", bizdate);
|
||||
else if (pushed >= limitn)
|
||||
tx_log(TX_LOG_INFO,
|
||||
"[RC_OL_0014] 추출 상한 도달(추가 지연건 존재 가능) date=%s",
|
||||
bizdate);
|
||||
|
||||
tx_buf_setlong(ctx->out, "UNRECCNT", pushed);
|
||||
tx_buf_setlong(ctx->out, "SUMAMT", sumamt);
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0014] 추출완료 date=%s 건수=%ld 합계=%ld",
|
||||
bizdate, pushed, sumamt);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue