📄 cms516.sqc
字号:
/******************************************************************** * 源码文件名称 : cms516.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 "dpscode.h"#include "cmscardinfo.h"#include "dpssaveaccdyninfo.h"#include "dpssaveprdinfo.h"#include "cmsacctm.h"#include "dpscontractreg.h"EXEC SQL INCLUDE SQLCA;int cmsFinanceMagPro( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct dpssaveaccdyninfo stSaveDynInfo; /* 活期动态表 */ struct dpssaveprdinfo stSavePrdInfo; /* 活期产品表 */ struct cmsacctm stCmsAcctm; /* 卡帐户对照表 */ struct dpscontractreg stDpsReg; /* 预定转存登记表 */ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ char acPasswd[ PASSWD_LEN + 1]; /* 新密码 */ char acTranMode[ FLAG_LEN+1 ]; /* 转存类型 */ char acBusiKind[ FLAG_LEN+1 ]; /* 处理类型 */ /* 1-约定 2-撤消 */ long lTerm1 = 0; /* 存期1 */ char acTermUnit1[ FLAG_LEN+1]; /* 存期单位 */ long lNum = 0; /* 转存次数 */ char acTermUnit[ FLAG_LEN+1]; /* 转存处理间隔单位 */ long lSeqNo = 0; /* 预约编号 */ long lTerm = 0; /* 转存处理间隔 */ double dAmt1 = 0.00; /* 理财触发金额 */ double dAmt2 = 0.00; /* 理财单位金额 */ char acCustomName[ CUSTNAME_LEN+1 ]; /* 姓名*/ char acCustomId[ CUSTNO_LEN+1 ]; /* 客户号码*/ char acIdType[ IDTYPE_LEN+1 ]; /* 开户人证件类型 */ char acIdNo[ IDNO_LEN+1 ]; /* 开户人号码 */ EXEC SQL BEGIN DECLARE SECTION; char acSeqNo[21]; /* 预约编号 */ char acAcctNo[ ACCT_LEN+1 ]; /* 约定卡号 */ char acSubAcct[ ACCT_LEN+1 ]; /* 约定款项 */ short id000 = 0; EXEC SQL END DECLARE SECTION; strcpy( g_acTrcMsg, "子交易: 智能小管家签约、撤销处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stSaveDynInfo, 0x00, sizeof( struct dpssaveaccdyninfo ) ); memset( &stSavePrdInfo, 0x00, sizeof( struct dpssaveprdinfo ) ); memset( &stCmsAcctm, 0x00, sizeof( struct cmsacctm ) ); memset( &stDpsReg, 0x00, sizeof( struct dpscontractreg ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); memset( acIdNo, 0x00, sizeof( acIdNo ) ); memset( acIdType, 0x00, sizeof( acIdType ) ); memset( acCustomId, 0x00, sizeof( acCustomId ) ); memset( acCustomName, 0x00, sizeof( acCustomName ) ); memset( acTranMode, 0x00, sizeof( acTranMode ) ); memset( acBusiKind, 0x00, sizeof( acBusiKind ) ); memset( acTermUnit1, 0x00, sizeof( acTermUnit1 ) ); memset( acTermUnit, 0x00, sizeof( acTermUnit ) ); memset( acSeqNo, 0x00, sizeof( acSeqNo ) ); memset ( acAcctNo, 0x00, sizeof ( acAcctNo)); memset ( acSubAcct, 0x00, sizeof ( acSubAcct)); /* 卡检查状态数组全置未不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) acCardStat[iNumx][iNumy] = CHECK_NO; /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); /* 获取卡片信息表 */ iRtn = pubReadCmscardinfo( &stCmsCardInfo ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡号[%s]不存在", stCmsCardInfo.cardno ); ERRLOG goto Exit; } /* 从字典获取其他数据 */ getstring( "Passwd", acPasswd ); getstring( "IdType", acIdType ); getstring( "IdNo", acIdNo ); getstring( "CustomName", acCustomName ); getstring( "CustomId", acCustomId ); getstring( "TranMode", acTranMode ); getstring( "BusiKind", acBusiKind ); getstring( "TermUnit", acTermUnit ); getstring( "TermUnit1", acTermUnit1 ); getlong( "Term1", &lTerm1 ); getlong( "Term", &lTerm ); getlong( "Num", &lNum ); getdouble( "Amt1", &dAmt1 ); getdouble( "Amt2", &dAmt2 ); getstring( "BookSeq", acSeqNo ); /* 检查卡状态是否正常 */ acCardStat[ BIT1_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查销卡 */ acCardStat[ BIT2_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查挂失 */ acCardStat[ BIT3_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查密挂 */ acCardStat[ BIT4_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[ BIT11_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查银行止付 */ acCardStat[ BIT12_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; } /* 检查卡是否为主卡 */ iRtn = cmsApiChkCardNoIsMain( &stCmsCardInfo ); if ( iRtn ) { ERRLOG goto Exit; } /* 获取卡帐户对照表 */ strcpy( stCmsAcctm.cardno, stCmsCardInfo.cardno ); strcpy( stCmsAcctm.acctseqno, MAINACCTSEQNO ); iRtn = pubReadCmsacctm( &stCmsAcctm ); if ( iRtn ) { ERRLOG goto Exit; } /* 获取活期存款动态表 */ strcpy( stSaveDynInfo.subacct, stCmsCardInfo.subacct ); iRtn = pubReadDpssaveaccdyninfo( &stSaveDynInfo ); if ( iRtn ) { ERRLOG goto Exit; } /* 如果是预约,判断该账户是否已预约过,如有,报错退出*/ if ( acBusiKind[0] == DPSPRETRNDEPMGR_MODE1 ) { strcpy( acSubAcct, stCmsCardInfo.subacct ); EXEC SQL SELECT acctno INTO :acAcctNo:id000 FROM dpscontractreg WHERE subacct = :acSubAcct AND rolltype= '6' AND substr(memo,10,1) = '0' ; if ( SQLCODE && SQLCODE != SQLNOTFOUND && SQLCODE != SQLDUP ) { sprintf ( g_acRspCode, "999996"); pubCrtRspInfo( "dpscontractreg",SQLCODE ); ERRLOG goto Exit; } else if ( SQLCODE == SQLDUP || !SQLCODE ) { sprintf ( g_acRspCode, "999996"); sprintf ( g_acRspMsg, "该账户已预约!"); ERRLOG goto Exit; } } /* 撤销或修改预约时将原记录预约到期日期置为1899-01-01 并将备注第10位预约有效标志置为'1'无效*/ if ( acBusiKind[0] == DPSPRETRNDEPMGR_MODE2 || acBusiKind[0] == DPSPRETRNDEPMGR_MODE3) { strcpy( acAcctNo, stCmsCardInfo.cardno ); EXEC SQL UPDATE dpscontractreg SET bskduedate = '1899-01-01' , memo=substr(memo,1,9)||'1'||substr(memo,11) WHERE acctno = :acAcctNo AND seqno = :acSeqNo; if ( SQLCODE == SQLNOTFOUND) { sprintf ( g_acRspCode, "999997"); sprintf ( g_acRspMsg, "预约转存登记簿无此记录!"); ERRLOG goto Exit; } SQLERR_PROC } /* 新约定及修改时生成全行唯一预约编号 */ if ( acBusiKind[0] == DPSPRETRNDEPMGR_MODE1 || acBusiKind[0] == DPSPRETRNDEPMGR_MODE3) { lSeqNo = pubGetMaxNum ( "000000000", PRE_BUSSTYPE ); if ( lSeqNo < 0 ) { ERRLOG goto Exit; } sprintf ( acSeqNo, "%d", lSeqNo); /*检查账户状态*/ if ( stSaveDynInfo.accstat[0] != '0' || stSaveDynInfo.stoppayflg[0] != '0'|| stSaveDynInfo.frozenflg[0] != '0' || stSaveDynInfo.mortflg[0] != '0' || stSaveDynInfo.certiflg[0] != '0' || stSaveDynInfo.certiflg[1] != '0' ) { strcpy ( g_acRspCode, "DPS305"); pubCrtRspInfo ( stSaveDynInfo.subacct ); ERRLOG goto Exit; } /* 检查转出账户是否为活期产品 */ strcpy ( stSavePrdInfo.prdcode, stSaveDynInfo.prdcode); if ( pubReadDpssaveprdinfo ( &stSavePrdInfo) ) { ERRLOG; goto Exit; } if ( stSavePrdInfo.prdtype[PRDFLAG_STAT] != SAVEPRDCODE1) { strcpy ( g_acRspCode, "DPS375"); pubCrtRspInfo (); ERRLOG goto Exit; } /* 添加预约转存表 */ strcpy( stDpsReg.subacct, stCmsCardInfo.subacct); strcpy( stDpsReg.acctno, stCmsCardInfo.cardno ); strcpy( stDpsReg.seqno, acSeqNo); strcpy( stDpsReg.bskdate, pstPubcom->acTranDate); strcpy( stDpsReg.bskname, acCustomName); strcpy( stDpsReg.idtype, acIdType); strcpy( stDpsReg.idno, acIdNo); strcpy( stDpsReg.bskduedate, "2999-12-31" ); strcpy( stDpsReg.rolltype, acTranMode); strcpy( stDpsReg.lmttermunit, acTermUnit); stDpsReg.lmtterm = lTerm; strcpy( stDpsReg.savebskdate, pstPubcom->acTranDate); stDpsReg.savebskamt = dAmt2; stDpsReg.saversvamt = dAmt1; strcpy( stDpsReg.inacctno1, stCmsCardInfo.cardno); strcpy ( stDpsReg.prdcode1, "1040001" ); strcpy ( stDpsReg.termunit1, acTermUnit1); stDpsReg.term1 = lTerm1; strcpy ( stDpsReg.tranbrc, pstPubcom->acBrc ); strcpy ( stDpsReg.teller1, pstPubcom->acTeller); strcpy ( stDpsReg.teller2, ""); strcpy ( stDpsReg.teller3, ""); sprintf ( stDpsReg.memo, "%c%c%03d00000", acTranMode[0],'0', lNum); if ( pubInstDpscontractreg ( &stDpsReg ) ) { ERRLOG goto Exit; } } /* 是否写子交易流水 */ iRtn = cmsApiInsTranLog( pstPubcom, &stCmsCardInfo, &stCmsAcctm, "签约", "智能小管家签约、撤销" ); if ( iRtn ) { ERRLOG goto Exit; } /* 子交易出口 */ setstring( "BookSeq", acSeqNo ); Exit: strcpy( g_acTrcMsg, "子交易: 智能小管家签约、撤销处理结束.." ); TRCLOG4 if( !strcmp( g_acRspCode, RSP_OK ) ) return SUCCESS; else return FAILED ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -