📄 cms304.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms304.SQC ** 所属子系统 : CMS ** 当前文件版本 : 4.0.0.0 ** 作者 : Feng ** 版本创建日期 : 2004/09/21 ** 功能描述 : 卡关联帐户子交易 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include "cmscardinfo.h"#include "cmsacctm.h"#include "cmscardkind.h"#include "dpssaveaccdyninfo.h"#include "dpstermaccdyninfo.h"#include "dpsacctlink.h"#include "ciscustaccinfo.h"EXEC SQL INCLUDE SQLCA;int cmsAcctAssocitCard( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct cmsacctm stCmsAcctM; /* 卡账户对照表 */ struct cmscardkind stCmsCardKind; /* 卡片种类表 */ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ char acPasswd[ PASSWD_LEN + 1 ]; /* 密码 */ char acCustomId[ CUSTNO_LEN + 1 ]; /* 卡客户号 */ char acAcctNo[ ACCT_LEN + 1 ]; /* 客户账号 */ char acSubAcct[ ACCT_LEN + 1 ]; /* 款项账号 */ char acCcy[ CCY_LEN + 1 ]; /* 币种 */ char acPrdCode[ PRDCODE_LEN + 1 ]; /* 产品代码 */ char acAcctSeqNo[ ACCTSEQNO_LEN+1 ]; /* 帐户序号 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ strcpy( g_acTrcMsg, "子交易: 卡关联帐户处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsCardKind, 0x00, sizeof( struct cmscardkind ) ); memset( acAcctNo, 0x00, sizeof( acAcctNo ) ); memset( acSubAcct, 0x00, sizeof( acSubAcct ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); memset( acCustomId, 0x00, sizeof( acCustomId ) ); memset( acCcy, 0x00, sizeof( acCcy ) ); memset( acPrdCode, 0x00, sizeof( acPrdCode ) ); memset( acAcctSeqNo, 0x00, sizeof( acAcctSeqNo ) ); /* 卡检查状态数组全置未不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) acCardStat[iNumx][iNumy] = CHECK_NO; /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); /* 从字典获取其他数据 */ getstring( "Passwd", acPasswd ); getstring( "CustomId", acCustomId ); getstring( "AcctNo", acAcctNo ); getstring( "SubAcct", acSubAcct ); /* 获取卡片信息表 */ iRtn = pubReadCmscardinfo( &stCmsCardInfo ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡号[%s]不存在", stCmsCardInfo.cardno ); ERRLOG goto Exit; } /* 获取卡片种类表 */ strcpy( stCmsCardKind.cardkind, stCmsCardInfo.cardkind ); iRtn = pubReadCmscardkind( &stCmsCardKind ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡片种类[%s]不存在", stCmsCardInfo.cardkind ); ERRLOG goto Exit; } strcpy( g_acTrcMsg, "pubReadCmscardkind finish" ); TRCLOG3 /* 检查卡状态是否正常 */ acCardStat[ BIT1_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查销卡 */ acCardStat[ BIT2_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查挂失 */ acCardStat[ BIT3_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查密挂 */ acCardStat[ BIT5_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查吞卡 */ acCardStat[ BIT6_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查拣拾 */ acCardStat[ BIT8_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查换卡 */ acCardStat[ BIT9_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查锁卡 */ acCardStat[ BIT13_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查欠费 */ acCardStat[ BIT14_LEN ][ BIT1_LEN ] = CHECK_YES; /* 换卡申请 */ iRtn = cmsApiChkCardStatIsNormal( &stCmsCardInfo, acCardStat ); if ( iRtn ) { ERRLOG goto Exit; } /* 检查卡密码 */ iRtn = cmsApiChkCardPwd( &stCmsCardInfo, acPasswd, pstPubcom->acChannelId ); if ( iRtn ) { ERRLOG goto Exit; } /* 检查卡号是否为主卡 */ if ( stCmsCardInfo.cardflg[ BIT1_LEN ] != MAIN_CARD ) { strcpy( g_acRspCode, "CMS131" ); pubCrtRspInfo( stCmsCardInfo.cardno ); ERRLOG goto Exit; } /* 帐户处理 */ iRtn = nPrAcctm( pstPubcom, stCmsCardInfo.cardno, acAcctNo, acSubAcct, acCustomId, stCmsCardInfo.cardkind, acCcy, acPrdCode, acAcctSeqNo ); if ( iRtn ) { ERRLOG goto Exit; } /* 子交易出口 */ setstring( "AcctSeqNo", acAcctSeqNo ); Exit: strcpy( g_acTrcMsg, "子交易: 卡关联帐户处理结束.." ); TRCLOG4 if( !strcmp( g_acRspCode, RSP_OK ) ) return SUCCESS; else return FAILED ;}int nPrAcctm( pstPub,pcCardNo,pcAcctNo,pcSubAcct,pcCustomId,pcCardKind, pcCcy, pcPrdCode, pcAcctSeqNo )PUBCOM *pstPub; /* 公共结构 */char *pcCardNo; /* 卡号 */char *pcAcctNo; /* 客户帐号 */char *pcSubAcct; /* 款项帐号 */char *pcCustomId; /* 客户号 */char *pcCardKind; /* 卡片种类 *//* 输出 */char *pcCcy; /* 币种 */char *pcPrdCode; /* 产品代码 */char *pcAcctSeqNo; /* 帐户序号 */{ struct cmsacctm stCmsAcctM; /* 卡帐户对照表 */ struct dpssaveaccdyninfo stDpsSaveDyn; /* 活期存款动态 */ struct dpstermaccdyninfo stDpsTermDyn; /* 定期存款动态 */ struct dpsacctlink stDpsAcctLink; /* 存款关系表 */ struct ciscustaccinfo stCisCustAcc; /* 客户号帐号对照 */ int iRtn = 0; strcpy( g_acTrcMsg, "nPrAcctm Begin " ); TRCLOG4 memset( &stCmsAcctM, 0x00, sizeof( struct cmsacctm ) ); memset( &stDpsSaveDyn, 0x00, sizeof( struct dpssaveaccdyninfo ) ); memset( &stDpsTermDyn, 0x00, sizeof( struct dpstermaccdyninfo ) ); memset( &stDpsAcctLink, 0x00, sizeof( struct dpsacctlink ) ); memset( &stCisCustAcc, 0x00, sizeof( struct ciscustaccinfo ) ); strcpy( stCisCustAcc.acctno, pcAcctNo ); /* 获取客户号帐号对照 */ iRtn = pubReadCiscustaccinfo( &stCisCustAcc ); if ( iRtn ) { ERRLOG goto Exit; } /* 检查是否为同一客户 */ if ( strcmp( stCisCustAcc.customid, pcCustomId ) ) { strcpy( g_acRspCode, "CMS1C0" ); pubCrtRspInfo( ); ERRLOG goto Exit; } /* 获取存款关系表 */ strcpy( stDpsAcctLink.acctno, pcAcctNo ); strcpy( stDpsAcctLink.subacct, pcSubAcct ); iRtn = pubReadDpsacctlink( &stDpsAcctLink ); if ( iRtn ) { ERRLOG goto Exit; } if ( stDpsAcctLink.opnflag[ 0 ] == '0' ) /* 活期存款 */ { /* 获取活期存款动态 */ strcpy( stDpsSaveDyn.subacct, pcSubAcct ); iRtn = pubReadDpssaveaccdyninfo( &stDpsSaveDyn ); if ( iRtn ) { ERRLOG goto Exit; } strcpy( pcCcy, stDpsSaveDyn.ccy ); strcpy( pcPrdCode, stDpsSaveDyn.prdcode ); } else { /* 获取定期存款动态 */ strcpy( stDpsTermDyn.subacct, pcSubAcct ); iRtn = pubReadDpstermaccdyninfo( &stDpsTermDyn ); if ( iRtn ) { ERRLOG goto Exit; } strcpy( pcCcy, stDpsTermDyn.ccy ); strcpy( pcPrdCode, stDpsTermDyn.prdcode ); } /* 检查卡内同币种同一产品代码的账户是否超限 */ iRtn = cmsApiChkCardAcctNumExceed( pcCardNo, pcCardKind, pcCcy, pcPrdCode ); if ( iRtn ) { ERRLOG goto Exit; } /* 为增加卡账户对照表准备数据 */ strcpy( stCmsAcctM.cardno, pcCardNo ); strcpy( stCmsAcctM.acctno, pcAcctNo ); strcpy( stCmsAcctM.subacct, pcSubAcct ); strcpy( stCmsAcctM.custno, pcCustomId ); strcpy( stCmsAcctM.prdcod, pcPrdCode ); strcpy( stCmsAcctM.ccy, pcCcy ); /* 生成卡内帐户序号 */ iRtn = cmsApiGetSeqNoInCard( pcCardNo, stCmsAcctM.acctseqno ); if ( iRtn ) { ERRLOG goto Exit; } /* 按产品代码获取业务种类 */ iRtn = cmsApiGetBussKindByPrdCod( stCmsAcctM.prdcod, stCmsAcctM.busskind ); if ( iRtn ) { ERRLOG goto Exit; } strcpy( stCmsAcctM.subsys, STR_DPS ); strcpy( stCmsAcctM.issuebrc, pstPub->acBrc ); strcpy( stCmsAcctM.issueteller, pstPub->acTeller ); strcpy( stCmsAcctM.issuedate, pstPub->acTranDate ); stCmsAcctM.accowner[ BIT1_LEN ] = BELONGMAINCARD; /* 属于主卡 */ stCmsAcctM.cardbookflag[ BIT1_LEN ] = ACCOPENFLG_BOOK; /* 有折 */ stCmsAcctM.status[ BIT1_LEN ] = NORMAL_STS; /* 正常 */ /* 插入卡账户对照表 */ iRtn = pubInstCmsacctm( &stCmsAcctM ); if ( iRtn ) { ERRLOG goto Exit; } /* 调用存款api修改静态文件 */ iRtn=dpsBooAddCarStaOper( pcAcctNo, "1", "", "", "", "", "", "", "", "0" ); if ( iRtn ) { ERRLOG goto Exit; } strcpy( pcAcctSeqNo, stCmsAcctM.acctseqno );Exit: strcpy( g_acTrcMsg, "nPrAcctm End " ); TRCLOG4 if( !strcmp( g_acRspCode, RSP_OK ) ) return SUCCESS; else return FAILED ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -