다양화: 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
|
|
@ -10,13 +10,18 @@
|
|||
/*
|
||||
* ac_ol_0029.pgc - 매입 온라인 서비스 (AC_OL_0029) [tier=easy]
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 ac 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 매입 청구조회(EDI): 청구번호(CLAIMNO)로 매입 청구내역(ac_claim)을
|
||||
* 단건 조회한다. EDI 연계 파일로 실제 적재된 청구건의 가맹점/영업일/
|
||||
* 금액/파일순번/상태를 확인하기 위한 조회 전용 서비스이다.
|
||||
*
|
||||
* 청구번호는 EDI 파일 헤더에서 채번되어 전달되므로, 조회 전 앞뒤
|
||||
* 공백을 제거하여 정규화한 뒤 원장 키로 사용한다.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "txcore.h"
|
||||
#include "txcore_dbio.h"
|
||||
#include "acq_util.h"
|
||||
#include "ac_core.h"
|
||||
|
||||
|
|
@ -89,37 +94,138 @@ struct sqlca_t *ECPGget_sqlca(void);
|
|||
|
||||
#endif
|
||||
|
||||
#line 15 "app/online/ac_ol_0029.pgc"
|
||||
#line 20 "app/online/ac_ol_0029.pgc"
|
||||
|
||||
|
||||
TX_SERVICE(AC_OL_0029, ctx)
|
||||
{
|
||||
ac_rec_t rec;
|
||||
char key[16];
|
||||
int rc;
|
||||
/* ---- ECPG 호스트 변수 선언부 ---- */
|
||||
/* exec sql begin declare section */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#line 26 "app/online/ac_ol_0029.pgc"
|
||||
char h_claim_no [ 16 ] ;
|
||||
|
||||
#line 27 "app/online/ac_ol_0029.pgc"
|
||||
char h_merch_id [ 16 ] ;
|
||||
|
||||
#line 28 "app/online/ac_ol_0029.pgc"
|
||||
char h_biz_date [ 9 ] ;
|
||||
|
||||
#line 29 "app/online/ac_ol_0029.pgc"
|
||||
long h_amount ;
|
||||
|
||||
#line 30 "app/online/ac_ol_0029.pgc"
|
||||
long h_file_seq ;
|
||||
|
||||
#line 31 "app/online/ac_ol_0029.pgc"
|
||||
char h_status [ 2 ] ;
|
||||
/* exec sql end declare section */
|
||||
#line 32 "app/online/ac_ol_0029.pgc"
|
||||
|
||||
tx_log(TX_LOG_INFO, "[AC_OL_0029] 매입 단건조회 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[AC_OL_0029] KEY 누락");
|
||||
char claimno[16];
|
||||
int len;
|
||||
|
||||
tx_log(TX_LOG_INFO, "[AC_OL_0029] 매입 청구조회(EDI) 서비스 진입");
|
||||
|
||||
/* ---- 1. 입력 검증 ---- */
|
||||
if (tx_buf_get(ctx->in, "CLAIMNO", claimno, sizeof(claimno)) != TX_OK ||
|
||||
claimno[0] == '\0') {
|
||||
tx_log(TX_LOG_ERROR, "[AC_OL_0029] CLAIMNO 누락");
|
||||
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 = ac_rec_select(key, &rec);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_WARN, "[AC_OL_0029] 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
/* ---- 2. 청구번호 정규화 (EDI 고정길이 전문의 트레일링 공백 제거) ---- */
|
||||
len = (int)strlen(claimno);
|
||||
while (len > 0 && claimno[len - 1] == ' ')
|
||||
claimno[--len] = '\0';
|
||||
|
||||
if (len == 0) {
|
||||
tx_log(TX_LOG_ERROR, "[AC_OL_0029] CLAIMNO 공백 전문");
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESPCODE", RESP_INVALID);
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(h_claim_no, 0, sizeof(h_claim_no));
|
||||
strncpy(h_claim_no, claimno, sizeof(h_claim_no) - 1);
|
||||
|
||||
/* ---- 3. 청구내역 단건 조회 ---- */
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select merch_id , biz_date , amount , file_seq , status from ac_claim where claim_no = $1 ",
|
||||
ECPGt_char,(h_claim_no),(long)16,(long)1,(16)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
|
||||
ECPGt_char,(h_merch_id),(long)16,(long)1,(16)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_long,&(h_file_seq),(long)1,(long)1,sizeof(long),
|
||||
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 70 "app/online/ac_ol_0029.pgc"
|
||||
|
||||
|
||||
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
|
||||
tx_log(TX_LOG_WARN, "[AC_OL_0029] 청구건 없음 claim_no=%s", claimno);
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESPCODE", RESP_INVALID);
|
||||
tx_return(ctx, TX_ENOENT, ctx->out);
|
||||
return;
|
||||
}
|
||||
if (sqlca.sqlcode != TX_SQL_OK) {
|
||||
TX_DBIO_LOG_ERR("SELECT ac_claim");
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "RESPCODE", RESP_SYSERR);
|
||||
tx_return(ctx, TX_EDB, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---- 4. EDI 연계 정합성 참고 확인 (파일순번 미채번 시 경고만 남김) ---- */
|
||||
if (h_file_seq <= 0) {
|
||||
tx_log(TX_LOG_WARN,
|
||||
"[AC_OL_0029] 파일순번 미채번 claim_no=%s file_seq=%ld",
|
||||
claimno, h_file_seq);
|
||||
}
|
||||
|
||||
/* ---- 5. 상태코드 설명 참고 로그 (응답필드는 원본 코드값 그대로 반환) ---- */
|
||||
{
|
||||
const char *statusdesc = "알수없음";
|
||||
|
||||
if (strcmp(h_status, "W") == 0)
|
||||
statusdesc = "대기";
|
||||
else if (strcmp(h_status, "S") == 0)
|
||||
statusdesc = "전송완료";
|
||||
else if (strcmp(h_status, "E") == 0)
|
||||
statusdesc = "오류";
|
||||
|
||||
tx_log(TX_LOG_DEBUG, "[AC_OL_0029] 상태설명 claim_no=%s status=%s(%s)",
|
||||
claimno, h_status, statusdesc);
|
||||
}
|
||||
|
||||
/* ---- 6. 응답 구성 ---- */
|
||||
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, "[AC_OL_0029] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
tx_buf_sets(ctx->out, "RESPCODE", RESP_OK);
|
||||
tx_buf_sets(ctx->out, "CLAIMNO", claimno);
|
||||
tx_buf_sets(ctx->out, "MERCHID", h_merch_id);
|
||||
tx_buf_sets(ctx->out, "BIZDATE", h_biz_date);
|
||||
tx_buf_setlong(ctx->out, "AMOUNT", h_amount);
|
||||
tx_buf_setlong(ctx->out, "FILESEQ", h_file_seq);
|
||||
tx_buf_sets(ctx->out, "STATUS", h_status);
|
||||
|
||||
tx_log(TX_LOG_INFO,
|
||||
"[AC_OL_0029] 청구조회완료 claim_no=%s merch=%s amount=%ld status=%s",
|
||||
claimno, h_merch_id, h_amount, h_status);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue