def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).折通兑来帐请求报文接收[TRCC006_1140]进入***' ) #初始化返回码 TradeContext.PRCCO = 'RCCI0000' TradeContext.STRINFO = "成功" #判断是否重复报文 AfaLoggerFunc.tradeInfo(">>>开始判断是否重复报文") sel_dict = {'COTRCNO':TradeContext.TRCNO,'COTRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_wtrbka.selectu(sel_dict) if record == None: AfaLoggerFunc.tradeDebug('>>>判断是否重复扣款确认报文,查询通存通兑业务登记簿相同报文异常') TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" elif len(record) > 0: AfaLoggerFunc.tradeInfo('通存通兑业务登记簿中存在相同数据,重复报文,返回拒绝应答报文') TradeContext.PRCCO = 'NN1ISO999' TradeContext.STRINFO = "重复报文" AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #登记通存通兑登记簿 AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' #=====手续费收取方式===== if float(TradeContext.CUSCHRG) > 0.001: TradeContext.CHRGTYP = '1' else: TradeContext.CHRGTYP = '0' #====开始向字典赋值==== if TradeContext.PRCCO == 'RCCI0000': wtrbka_dict = {} if not rccpsMap1140CTradeContext2Dwtrbka_dict.map(wtrbka_dict): AfaLoggerFunc.tradeDebug('>>>字典赋值出错') TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" wtrbka_dict['DCFLG'] = PL_DCFLG_DEB #借贷标识 wtrbka_dict['OPRNO'] = PL_TDOPRNO_TD #业务种类 #=====开始插入数据库==== if TradeContext.PRCCO == 'RCCI0000': if not rccpsDBFunc.insTransWtr(wtrbka_dict): AfaLoggerFunc.tradeDebug('>>>登记通存通兑业务登记簿异常') TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿") #设置业务状态为行内收妥成功 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为收妥成功") stat_dict = {} stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BCSTAT'] = PL_BCSTAT_BNKRCV stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.PRCCO == 'RCCI0000': if not rccpsState.setTransState(stat_dict): AfaLoggerFunc.tradeDebug('>>>设置业务状态收妥成功异常') TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为收妥成功") #设置业务状态为自动扣款处理中 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为自动扣款处理中") if TradeContext.PRCCO == 'RCCI0000': if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTOPAY,PL_BDWFLG_WAIT): AfaLoggerFunc.tradeDebug('>>>设置业务状态为自动扣款处理中异常') TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为自动扣款处理中") TradeContext.BCSTAT = PL_BCSTAT_AUTOPAY #状态:自动扣款 TradeContext.BCSTATNM = "自动扣款" #进行必要性检查,若校验通过,则返回成功应答报文,若校验未通过,则返回拒绝应答报文 AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #检查冲正登记簿中是否有此笔业务的冲正业务,存在则返回拒绝应答报文,并设置业务状态为冲正处理中 if TradeContext.PRCCO == 'RCCI0000': atcbka_where_dict = {} atcbka_where_dict['ORMFN'] = TradeContext.MSGFLGNO atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict) if atcbka_dict == None: AfaLoggerFunc.tradeInfo(">>>查询冲正登记簿异常") TradeContext.PRCCO = 'NN1ID999' TradeContext.STRINFO = "查询冲正登记簿异常" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: if len(atcbka_dict) <= 0: AfaLoggerFunc.tradeInfo(">>>此交易未被冲正,继续校验") else: AfaLoggerFunc.tradeInfo(">>>此交易已被冲正,返回拒绝应答报文") TradeContext.PRCCO = 'NN1IO307' TradeContext.STRINFO = "此交易已被冲正" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #解密客户密码 if TradeContext.PRCCO == 'RCCI0000': MIMA = ' ' PIN = TradeContext.CURPIN ACC = TradeContext.PYRACC AfaLoggerFunc.tradeDebug('密码[' + PIN + ']') AfaLoggerFunc.tradeDebug('账号[' + ACC + ']') ret = jiami.secDecryptPin(PIN,ACC,MIMA) if ret != 0: AfaLoggerFunc.tradeDebug("ret=[" + str(ret) + "]") AfaLoggerFunc.tradeDebug('调用加密服务器失败') TradeContext.PRCCO = 'NN1IS999' TradeContext.STRINFO = "解密密码失败" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: TradeContext.CURPIN = MIMA AfaLoggerFunc.tradeDebug('密码new[' + TradeContext.CURPIN + ']') #唐斌新增# sql = "SELECT ischkactname,ischklate FROM rcc_chlabt where transcode='"+TradeContext.TransCode+"' and channelno= '"+(TradeContext.SNDCLKNO)[6:8]+"'" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql) if (records == None): return False elif (len(records) == 0): AfaLoggerFunc.tradeDebug("查询结果为空,查询条件[" + sql + "]") return False AfaLoggerFunc.tradeDebug(str(records)) #校验账户状态是否正常和账号户名是否相符 if TradeContext.PRCCO == 'RCCI0000': #调用主机接口查询账户信息 TradeContext.HostCode = '8810' TradeContext.ACCNO = TradeContext.PYRACC AfaLoggerFunc.tradeDebug("gbj test :" + TradeContext.ACCNO) rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,TradeContext.errorMsg) AfaLoggerFunc.tradeInfo("查询账户信息异常,主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") #TradeContext.PRCCO = 'NN1IA999' TradeContext.PRCCO = rccpsDBFunc.HostErr2RccErr(TradeContext.errorCode) TradeContext.STRINFO = TradeContext.errorMsg TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: #查询成功,更新通存通兑登记簿账务机构号 AfaLoggerFunc.tradeInfo(">>>查询主机账户成功") #if( TradeContext.BESBNO != PL_BESBNO_BCLRSB ): # AfaLoggerFunc.tradeInfo(">>>" + TradeContext.BESBNO + ">>>" + TradeContext.ACCSO) # if( TradeContext.BESBNO[:6] != TradeContext.ACCSO[:6] ): # AfaLoggerFunc.tradeInfo(">>>不许跨法人做此交易") # TradeContext.PRCCO = 'NN1IO999' # TradeContext.STRINFO = "接收行与账户开户行不属于同一法人" # TradeContext.BCSTAT = PL_BCSTAT_MFERFE # TradeContext.BCSTATNM = "拒绝" #检查本机构是否有通存通兑业务权限 if not rccpsDBFunc.chkTDBESAuth(TradeContext.ACCSO): TradeContext.PRCCO = 'NN1IO999' TradeContext.STRINFO = "本账户开户机构无通存通兑业务权限" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" AfaLoggerFunc.tradeInfo(">>>开始更新机构号为开户机构") TradeContext.BESBNO = TradeContext.ACCSO wtrbka_update_dict = {'BESBNO':TradeContext.ACCSO} wtrbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} ret = rccpsDBTrcc_wtrbka.updateCmt(wtrbka_update_dict,wtrbka_where_dict) if ret <= 0: AfaLoggerFunc.tradeInfo(">>>更新机构号为开户机构异常") TradeContext.PRCCO = 'NN1ID006' TradeContext.STRINFO = "更新账务机构号异常" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: AfaLoggerFunc.tradeInfo(">>>更新机构号为开户机构成功") AfaLoggerFunc.tradeDebug("主机返回户名ACCNM :[" + TradeContext.ACCNM + "]") AfaLoggerFunc.tradeDebug("报文接收户名PYRNAM:[" + TradeContext.PYRNAM + "]") AfaLoggerFunc.tradeDebug("主机返回账户状态ACCST:[" + TradeContext.ACCST + "]") AfaLoggerFunc.tradeDebug("证件类型ACITY:[" + TradeContext.ACITY + "]") AfaLoggerFunc.tradeDebug("证件号码ACINO:[" + TradeContext.ACINO + "]") if TradeContext.ACCNM != TradeContext.PYRNAM: #唐斌新增# if(records[0][0]=='1'): AfaLoggerFunc.tradeInfo(">>>账号户名不符") TradeContext.PRCCO = 'NN1IA102' TradeContext.STRINFO = '账号户名不符' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif TradeContext.ACCST != '0' and TradeContext.ACCST != '2': AfaLoggerFunc.tradeInfo(">>>账户状态不正常") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '账户状态不正常' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif not (TradeContext.ACCCD == '0428' and TradeContext.ACCEM == '21111'): AfaLoggerFunc.tradeInfo(">>>此账户非个人结算户") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '此账户非个人结算户' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #=====交易金额判断==== chk_dict = {} chk_dict['BPARAD'] = 'TD001' #通存通兑凭证金额校验 dict = rccpsDBTrcc_pamtbl.selectu(chk_dict) AfaLoggerFunc.tradeInfo('dict='+str(dict)) if dict == None: AfaLoggerFunc.tradeInfo(">>>校验交易金额失败") TradeContext.PRCCO = 'NN1ID003' TradeContext.STRINFO = '校验交易金额失败' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" if len(dict) == 0: AfaLoggerFunc.tradeInfo(">>>查询PAMTBL校验交易金额表记录错误") TradeContext.PRCCO = 'NN1ID010' TradeContext.STRINFO = '查询PAMTBL校验交易金额表记录错误' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #=====判断农信银中心规定校验凭证上线==== if float(TradeContext.OCCAMT) > float(dict['BPADAT']): #=====交易金额大于农信银中心规定金额,需要输入证件==== if TradeContext.existVariable('CERTTYPE') and len(TradeContext.CERTTYPE) == 0: AfaLoggerFunc.tradeInfo(">>>请选择证件类型") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '请选择证件类型' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif(TradeContext.CERTTYPE == '06'): if( TradeContext.ACITY != '06' and TradeContext.ACITY != '07' and TradeContext.ACITY != '08' and TradeContext.ACITY != '09'): AfaLoggerFunc.tradeInfo(">>>证件类型错误") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '证件类型错误' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif( TradeContext.CERTTYPE != TradeContext.ACITY ): AfaLoggerFunc.tradeInfo(">>>证件类型错误") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '证件类型错误' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" if TradeContext.existVariable('CERTNO') and len(TradeContext.CERTNO) == 0: AfaLoggerFunc.tradeInfo(">>>请输入证件号码") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '请输入证件号码' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif( TradeContext.CERTNO != TradeContext.ACINO ): AfaLoggerFunc.tradeInfo(">>>证件号码错误") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '证件号码错误' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #校验交易金额是否超当日限额 if not rccpsDBFunc.chkLimited(TradeContext.BJEDTE,TradeContext.PYRACC,TradeContext.OCCAMT): AfaLoggerFunc.tradeInfo(">>>交易金额超限") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '交易金额超限' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #发起主机记账 AfaLoggerFunc.tradeInfo(">>>开始发起主机记账") TradeContext.sCertType = TradeContext.CERTTYPE TradeContext.sCertNo = TradeContext.CERTNO TradeContext.sOccamt = TradeContext.OCCAMT TradeContext.sCuschrg = TradeContext.CUSCHRG AfaLoggerFunc.tradeInfo(">>>" + TradeContext.PRCCO) if TradeContext.PRCCO == 'RCCI0000': TradeContext.HostCode = '8813' #调用8813主机接口 #TradeContext.PASSWD = TradeContext.CURPIN #来账对方现金收取手续费 if( TradeContext.CHRGTYP != '1' ): TradeContext.RCCSMCD = PL_RCCSMCD_XJTDLZ #主机摘要代码 TradeContext.SBAC = TradeContext.PYRACC #借方账户:付款人账户 TradeContext.ACNM = TradeContext.PYRNAM #借方户名 付款人户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSLZ #贷方账户:农信银待清算来账 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC, 25) TradeContext.OTNM = '农信银待清算来账' #贷方户名: TradeContext.CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.WARNTNO = '49' + TradeContext.BNKBKNO TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' TradeContext.PASSWD = TradeContext.CURPIN #密码 AfaLoggerFunc.tradeInfo( '借方账号:' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) AfaLoggerFunc.tradeInfo( '凭证号码:' + TradeContext.WARNTNO ) else: #对方转账收取手续费时s TradeContext.ACUR = '3' #记账次数 #=========交易金额============ TradeContext.RCCSMCD = PL_RCCSMCD_XJTDLZ #摘要代码 TradeContext.SBAC = TradeContext.PYRACC #借方账号 TradeContext.ACNM = TradeContext.PYRNAM #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '待解临时款项' #贷方户名 TradeContext.OCCAMT = str(TradeContext.sOccamt) #发生额 TradeContext.CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.WARNTNO = '49' + TradeContext.BNKBKNO TradeContext.PASSWD = TradeContext.CURPIN #密码 TradeContext.sCertType = TradeContext.CERTTYPE TradeContext.sCertNo = TradeContext.CERTNO TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.RBAC ) AfaLoggerFunc.tradeInfo( '凭证号码:' + TradeContext.WARNTNO ) #=========结算手续费收入户=========== TradeContext.I2SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I2SBAC = TradeContext.PYRACC #借方账号 TradeContext.I2ACNM = TradeContext.PYRNAM #借方户名 TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = '待解临时款项' #贷方户名 TradeContext.I2TRAM = str(TradeContext.sCuschrg) #发生额 TradeContext.I2CTFG = '8' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I2PKFG = 'T' #通存通兑标识 TradeContext.I2WARNTNO = '49' + TradeContext.BNKBKNO TradeContext.I2PASSWD = TradeContext.CURPIN #密码 AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:借方账号' + TradeContext.I2SBAC ) AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:贷方账号' + TradeContext.I2RBAC ) AfaLoggerFunc.tradeInfo( '凭证号码:' + TradeContext.I2WARNTNO ) #=========交易金额+手续费=================== TradeContext.I3SMCD = PL_RCCSMCD_XJTDLZ #摘要代码 TradeContext.I3SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I3SBAC = rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25) TradeContext.I3ACNM = '待解临时款项' #借方户名 TradeContext.I3RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSLZ #贷方账号 TradeContext.I3RBAC = rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25) TradeContext.I3OTNM = '农信银来账' #贷方户名 TradeContext.I3TRAM = rccpsUtilTools.AddDot(TradeContext.OCCAMT,TradeContext.CUSCHRG) #发生额 TradeContext.I3CTFG = '9' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I3PKFG = 'T' #通存通兑标识 AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.I3SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.I3RBAC ) rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束发起主机记账") #TradeContext.errorCode, TradeContext.errorMsg = '0000', '主机成功' #根据主机返回码,设置业务状态为自动入账成功或失败 AfaLoggerFunc.tradeInfo(">>>开始根据主机放回码,设置业务状态为自动扣款成功或失败") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['SBAC'] = TradeContext.SBAC stat_dict['ACNM'] = TradeContext.ACNM stat_dict['RBAC'] = TradeContext.RBAC stat_dict['OTNM'] = TradeContext.OTNM #=====modify by pgt 1129==== stat_dict['MGID'] = TradeContext.errorCode if TradeContext.existVariable('TRDT'): stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): stat_dict['TLSQ'] = TradeContext.TLSQ stat_dict['STRINFO'] = TradeContext.errorMsg AfaLoggerFunc.tradeInfo("主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") if TradeContext.errorCode == '0000': #=====发送农信银成功,设置状态为自动入账成功==== stat_dict['BCSTAT'] = PL_BCSTAT_AUTOPAY stat_dict['BDWFLG'] = PL_BDWFLG_SUCC TradeContext.PRCCO = 'RCCI0000' TradeContext.STRINFO = '成功' if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为自动入账成功异常") AfaLoggerFunc.tradeInfo(">>>设置业务状态为自动扣款成功完成") else: #=====发送农信银失败,设置状态为拒绝成功==== stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC #TradeContext.PRCCO = 'NN1CA999' TradeContext.PRCCO = rccpsDBFunc.HostErr2RccErr(TradeContext.errorCode) AfaLoggerFunc.tradeInfo(">>>>>>>>>>>>>>>>>>>>" + TradeContext.PRCCO) TradeContext.STRINFO = TradeContext.errorMsg if not rccpsState.setTransState(stat_dict): AfaLoggerFunc.tradeFatal( '设置业务状态为拒绝成功异常' ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>设置业务状态为拒绝成功完成") else: stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): AfaLoggerFunc.tradeFatal( '设置业务状态为拒绝成功异常' ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>设置业务状态为拒绝成功完成") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) TradeContext.PRCCO = "NN1ID999" TradeContext.STRINFO = "数据库其他错误" AfaLoggerFunc.tradeInfo(">>>开始根据主机放回码,设置业务状态为自动入账成功或失败") #为自动扣款应答报文赋值 TradeContext.sysType = 'rccpst' TradeContext.MSGTYPCO = 'SET007' #报文类代码 #TradeContext.RCVMBRCO = TradeContext.SNDMBRCO #接收方成员行号 TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO #收款方成员行号 TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #付款方成员行号 TradeContext.SNDBRHCO = TradeContext.BESBNO #发起行网点号 TradeContext.SNDCLKNO = TradeContext.BETELR #发起行柜员号 TradeContext.SNDTRDAT = TradeContext.BJEDTE #发起行交易日期 TradeContext.SNDTRTIM = TradeContext.BJETIM #发起行交易时间 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标识号 TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.SerialNo #报文标识号 TradeContext.NCCWKDAT = TradeContext.NCCworkDate #中心工作日期 TradeContext.OPRTYPNO = '30' #业务类型 TradeContext.ROPRTPNO = TradeContext.OPRTYPNO #参考业务类型 TradeContext.TRANTYP = '0' #传输类型 TradeContext.CERTTYPE = TradeContext.sCertType TradeContext.CERTNO = TradeContext.sCertNo TradeContext.OCCAMT = TradeContext.sOccamt TradeContext.CUSCHRG = TradeContext.sCuschrg TradeContext.CUR = 'CNY' #货币符号 AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).折通兑来帐请求报文接收[TRCC006_1140]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).卡通存请求报文接收[TRCC006_1135]进入***' ) #判断是否重复交易 AfaLoggerFunc.tradeInfo(">>>开始判断是否重复报文") sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_wtrbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询通存通兑业务登记簿相同报文异常') elif len(record) > 0: AfaLoggerFunc.tradeInfo('通存通兑业务登记簿中存在相同数据,重复报文,返回拒绝应答报文') #=====为应答报文赋值==== TradeContext.sysType = 'rccpst' TradeContext.MSGTYPCO = 'SET006' TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR #TradeContext.SNDTRDAT = TradeContext.BJEDTE #TradeContext.BJEDTE = TradeContext.SNDTRDAT #TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.ORMFN = TradeContext.MSGFLGNO #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.SNDTRDAT + TradeContext.SerialNo TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = '30' TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.TRANTYP = '0' TradeContext.CUR = 'CNY' TradeContext.PRCCO = 'NN1IM101' TradeContext.STRINFO = "重复报文" #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #登记通存通兑登记簿 AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' #=====手续费收取方式===== if float(TradeContext.CUSCHRG) > 0.001: TradeContext.CHRGTYP = '1' else: TradeContext.CHRGTYP = '0' #====开始向字典赋值==== wtrbka_dict = {} if not rccpsMap1135CTradeContext2Dwtrbka_dict.map(wtrbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') wtrbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识 wtrbka_dict['OPRNO'] = PL_TDOPRNO_TC #业务种类 #=====开始插入数据库==== if not rccpsDBFunc.insTransWtr(wtrbka_dict): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿") #设置业务状态为行内收妥成功 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为收妥成功") stat_dict = {} stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BCSTAT'] = PL_BCSTAT_BNKRCV stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态收妥成功异常') if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为收妥成功") #设置业务状态为确认入账处理中 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为确认入账处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFACC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为确认入账处理中异常') if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为确认入账处理中") #初始化返回码 TradeContext.PRCCO = 'RCCI0000' TradeContext.STRINFO = "成功" TradeContext.BCSTAT = PL_BCSTAT_CONFACC #状态:确认付款 TradeContext.BCSTATNM = "确认付款" #进行必要性检查,若校验通过,则返回成功应答报文,若校验未通过,则返回拒绝应答报文 AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #检查冲正登记簿中是否有此笔业务的冲正业务,存在则返回拒绝应答报文,并设置业务状态为冲正处理中 if TradeContext.PRCCO == 'RCCI0000': atcbka_where_dict = {} atcbka_where_dict['ORMFN'] = TradeContext.MSGFLGNO atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict) if atcbka_dict == None: #return AfaFlowControl.ExitThisFlow('S999', "查询冲正登记簿异常") AfaLoggerFunc.tradeInfo(">>>查询冲正登记簿异常") TradeContext.PRCCO = 'NN1ID003' TradeContext.STRINFO = "系统错误,查询冲正登记簿异常" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: if len(atcbka_dict) <= 0: AfaLoggerFunc.tradeInfo(">>>此交易未被冲正,继续校验") else: AfaLoggerFunc.tradeInfo(">>>此交易已被冲正,返回拒绝应答报文") TradeContext.PRCCO = 'NN1IO307' TradeContext.STRINFO = "此交易已被冲正" TradeContext.BCSTAT = PL_BCSTAT_CANC TradeContext.BCSTATNM = "冲正" #唐斌新增# sql = "SELECT ischkactname,ischklate FROM rcc_chlabt where transcode='"+TradeContext.TransCode+"' and channelno= '"+(TradeContext.SNDCLKNO)[6:8]+"'" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql) if (records == None): return False elif (len(records) == 0): AfaLoggerFunc.tradeDebug("查询结果为空,查询条件[" + sql + "]") return False AfaLoggerFunc.tradeDebug(str(records)) #校验账户状态是否正常和账号户名是否相符 if TradeContext.PRCCO == 'RCCI0000': #调用主机接口查询账户信息 TradeContext.HostCode = '8810' TradeContext.ACCNO = TradeContext.PYEACC AfaLoggerFunc.tradeDebug("ACCNO :" + TradeContext.ACCNO) rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,TradeContext.errorMsg) AfaLoggerFunc.tradeInfo("查询账户信息异常,主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") TradeContext.PRCCO = rccpsDBFunc.HostErr2RccErr(TradeContext.errorCode) TradeContext.STRINFO = "查询主机账户信息失败 " + TradeContext.errorMsg TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: #TradeContext.PYENAM = AfaUtilTools.trim(TradeContext.PYENAM) AfaLoggerFunc.tradeInfo(">>>查询主机账户成功") #if TradeContext.BESBNO != PL_BESBNO_BCLRSB: # AfaLoggerFunc.tradeInfo(">>>" + TradeContext.BESBNO + ">>>" + TradeContext.ACCSO) # if( TradeContext.BESBNO[:6] != TradeContext.ACCSO[:6] ): # AfaLoggerFunc.tradeInfo(">>>不许跨法人做此交易") # TradeContext.PRCCO = 'NN1IO999' # TradeContext.STRINFO = "接收行与账户开户行不属于同一法人" # TradeContext.BCSTAT = PL_BCSTAT_MFERFE # TradeContext.BCSTATNM = "拒绝" #检查本机构是否有通存通兑业务权限 if not rccpsDBFunc.chkTDBESAuth(TradeContext.ACCSO): TradeContext.PRCCO = 'NN1IO999' TradeContext.STRINFO = "本账户开户机构无通存通兑业务权限" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" if TradeContext.PRCCO == 'RCCI0000': #查询成功,更新通存通兑登记簿账务机构号 AfaLoggerFunc.tradeInfo(">>>开始更新机构号为开户机构") TradeContext.BESBNO = TradeContext.ACCSO wtrbka_update_dict = {'BESBNO':TradeContext.ACCSO} wtrbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} ret = rccpsDBTrcc_wtrbka.updateCmt(wtrbka_update_dict,wtrbka_where_dict) if ret <= 0: AfaLoggerFunc.tradeInfo(">>>更新机构号为开户机构异常") TradeContext.PRCCO = 'NN1ID006' TradeContext.STRINFO = "系统错误,更新账务机构号异常" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" else: AfaLoggerFunc.tradeInfo(">>>更新机构号为开户机构成功") AfaLoggerFunc.tradeDebug("主机返回户名ACCNM :[" + TradeContext.ACCNM + "]") AfaLoggerFunc.tradeDebug("报文接收户名PYENAM:[" + TradeContext.PYENAM + "]") AfaLoggerFunc.tradeDebug("主机返回账户状态ACCST:[" + TradeContext.ACCST + "]") if TradeContext.ACCNM != TradeContext.PYENAM: #唐斌新增# if(records[0][0]=='1'): AfaLoggerFunc.tradeInfo(">>>账号户名不符") TradeContext.PRCCO = 'NN1IA102' TradeContext.STRINFO = '账号户名不符' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif TradeContext.ACCST != '0' and TradeContext.ACCST != '2': AfaLoggerFunc.tradeInfo(">>>账户状态不正常") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '账户状态不正常' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" elif not (TradeContext.ACCCD == '0428' and TradeContext.ACCEM == '21111'): AfaLoggerFunc.tradeInfo(">>>此账户非个人结算户") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '此账户非个人结算户' TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #校验磁道信息 关彬捷 20081215 #唐斌新增# if TradeContext.PRCCO == 'RCCI0000': if(records[0][1]=='1'): if (TradeContext.SCTRKINF == ''.rjust(37,'0') or TradeContext.SCTRKINF == ''): AfaLoggerFunc.tradeInfo("校验磁道信息异常,该业务必须产生磁道信息") TradeContext.PRCCO = 'NN1IA141' TradeContext.STRINFO = "校验磁道信息失败 :无磁道信息" TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" if TradeContext.SCTRKINF != ''.rjust(37,'0') and TradeContext.SCTRKINF != '': #磁道信息非空或37个零,则调用主机接口校验磁道信息 TradeContext.HostCode = '0652' TradeContext.WARNTNO = TradeContext.PYEACC[6:18] AfaLoggerFunc.tradeDebug("WARNTNO :" + TradeContext.WARNTNO) AfaLoggerFunc.tradeDebug("SCTRKINF :" + TradeContext.SCTRKINF) AfaLoggerFunc.tradeDebug("THTRKINF :" + TradeContext.THTRKINF) if TradeContext.THTRKINF == ''.rjust(37,'0'): TradeContext.THTRKINF = '' AfaLoggerFunc.tradeDebug("THTRKINF :" + TradeContext.THTRKINF) rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,TradeContext.errorMsg) AfaLoggerFunc.tradeInfo("校验磁道信息异常,主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") TradeContext.PRCCO = 'NN1IA141' TradeContext.STRINFO = "校验磁道信息失败 " + TradeContext.errorMsg TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" #校验凭证状态是否正常 if TradeContext.PRCCO == 'RCCI0000': #调用主机接口查询凭证信息 TradeContext.HostCode = '8811' TradeContext.ACCNO = TradeContext.PYEACC TradeContext.WARNTNO = TradeContext.PYEACC[6:18] AfaLoggerFunc.tradeDebug("ACCNO :" + TradeContext.ACCNO) AfaLoggerFunc.tradeDebug("WARNTNO :" + TradeContext.WARNTNO) rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,TradeContext.errorMsg) AfaLoggerFunc.tradeInfo("查询凭证信息异常,主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = "查询主机凭证信息失败 " + TradeContext.errorMsg TradeContext.BCSTAT = PL_BCSTAT_MFERFE TradeContext.BCSTATNM = "拒绝" # else: # #查询成功 # AfaLoggerFunc.tradeInfo(">>>查询主机凭证信息成功") # AfaLoggerFunc.tradeInfo(">>>凭证信息ACCSTCD:[" + TradeContext.ACCSTCD + "]") # # if TradeContext.ACCSTCD != '0': # TradeContext.PRCCO = 'RCCI1000' # TradeContext.STRINFO = '账户凭证状态不正常' # TradeContext.BCSTAT = PL_BCSTAT_MFERFE # TradeContext.BCSTATNM = "拒绝" AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #AfaLoggerFunc.tradeInfo("gbj_test:SNDTRDAT=[" + TradeContext.SNDTRDAT + "]") #为应答报文赋值 TradeContext.sysType = 'rccpst' TradeContext.MSGTYPCO = 'SET006' TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR #TradeContext.SNDTRDAT = TradeContext.BJEDTE #TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.ORMFN = TradeContext.MSGFLGNO #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.SNDTRDAT + TradeContext.SerialNo TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.OPRTYPNO = '30' TradeContext.TRANTYP = '0' TradeContext.CUR = 'CNY' AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).卡通存请求报文接收[TRCC006_1135]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统: 通存通兑.本地类操作交易[RCC003_8562]进入***' ) #检查本机构是否有通存通兑业务权限 if not rccpsDBFunc.chkTDBESAuth(TradeContext.BESBNO): return AfaFlowControl.ExitThisFlow("S999","本机构无通存通兑业务权限") #=====接收行判断==== if TradeContext.SNDSTLBIN == TradeContext.RCVSTLBIN: return AfaFlowControl.ExitThisFlow('S999','同一清算行不允许做此业务') #=====账户类型判断==== if not TradeContext.existVariable('PYRTYP'): return AfaFlowControl.ExitThisFlow('S999','账户类型不存在[PYRTYP]') if TradeContext.PYRTYP == '0': #=====银行卡==== if len(TradeContext.PYRNAM) == 0: return AfaFlowControl.ExitThisFlow('S999','付款人名称[PYRNAM]不允许为空') if len(TradeContext.SCTRKINF) == 0: return AfaFlowControl.ExitThisFlow('S999','二磁道[SCTRKINF]信息不允许为空') #if len(TradeContext.THTRKINF) == 0: # return AfaFlowControl.ExitThisFlow('S999','三磁道[THTRKINF]信息不允许为空') if len(TradeContext.SCTRKINF) > 37: return AfaFlowControl.ExitThisFlow('S999','磁道信息非法') #if len(TradeContext.THTRKINF) > 104: # return AfaFlowControl.ExitThisFlow('S999','磁道信息非法') elif TradeContext.PYRTYP == '1': #=====存折==== if len(TradeContext.BNKBKNO) == 0: return AfaFlowControl.ExitThisFlow('S999','存折号码[BNKBKNO]不允许为空') if float(TradeContext.BNKBKBAL) == 0.0: return AfaFlowControl.ExitThisFlow('S999','存折余额[BNKBKBAL]不允许为空') TradeContext.SCTRKINF = ''.rjust(37,'0') TradeContext.THTRKINF = ''.rjust(37,'0') else: return AfaFlowControl.ExitThisFlow('S999','账户类型错误') #=====交易金额判断==== sel_dict = {} sel_dict['BPARAD'] = 'TD001' #通存通兑凭证金额校验 dict = rccpsDBTrcc_pamtbl.selectu(sel_dict) AfaLoggerFunc.tradeInfo('dict='+str(dict)) if dict == None: return AfaFlowControl.ExitThisFlow('S999','校验交易金额失败') if len(dict) == 0: return AfaFlowControl.ExitThisFlow('S999','查询PAMTBL校验交易金额表记录错误') #=====判断农信银中心规定校验凭证上线==== if float(TradeContext.OCCAMT) >= float(dict['BPADAT']): #=====交易金额大于农信银中心规定金额,需要输入证件==== if TradeContext.existVariable('CERTTYPE') and len(TradeContext.CERTTYPE) == 0: return AfaFlowControl.ExitThisFlow('S999','请选择证件类型!') if TradeContext.existVariable('CERTNO') and len(TradeContext.CERTNO) == 0: return AfaFlowControl.ExitThisFlow('S999','请输入证件号码!') #加密客户密码 MIMA = ' ' #PIN = '888888' #ACC = '12311111111111111111111111111111' PIN = TradeContext.CURPIN ACC = TradeContext.PYRACC AfaLoggerFunc.tradeDebug('密码[' + PIN + ']') AfaLoggerFunc.tradeDebug('账号[' + ACC + ']') ret = jiami.secEncryptPin(PIN,ACC,MIMA) if ret != 0: AfaLoggerFunc.tradeDebug("ret=[" + str(ret) + "]") return AfaFlowControl.ExitThisFlow('M9999','调用加密服务器失败') else: TradeContext.CURPIN = MIMA AfaLoggerFunc.tradeDebug('密码new[' + TradeContext.CURPIN + ']') #=====字段赋值==== TradeContext.OPRNO = PL_TDOPRNO_TD #业务种类 TradeContext.DCFLG = PL_DCFLG_DEB #借贷标识 #=====字典赋值,插入数据库==== wtrbka_dict = {} if not rccpsMap8562CTradeContext2Dwtrbka_dict.map(wtrbka_dict): return AfaFlowControl.ExitThisFlow('S999','字典赋值错误!') wtrbka_dict['MSGFLGNO'] = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo #报文标识号 #=====插入数据库表==== if not rccpsDBFunc.insTransWtr(wtrbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记通存通兑业务登记簿异常') AfaDBFunc.CommitSql( ) #=====设置业务状态为发送处理中==== AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送处理中") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 stat_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 stat_dict['BCSTAT'] = PL_BCSTAT_SND #PL_BCSTAT_SND 发送 stat_dict['BDWFLG'] = PL_BDWFLG_WAIT #PL_BDWFLG_WAIT 处理中 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置状态为发送处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送处理中") #=====发送农信银中心==== AfaLoggerFunc.tradeInfo(">>>开始发送农信银中心处理") TradeContext.MSGTYPCO = 'SET004' #报文类代码 TradeContext.OPRTYPNO = '30' #通存通兑 #=====根据手续费收取方式判断是否发送农信银中心==== TradeContext.sCuschrg = TradeContext.CUSCHRG if TradeContext.CHRGTYP != PL_CHRG_TYPE: #PL_CHRG_TYPE 1 转账 #=====转账收取手续费==== TradeContext.CUSCHRG = '0.0' AfaLoggerFunc.tradeDebug(">>>结束发送农信银中心处理") AfaLoggerFunc.tradeInfo( '***农信银系统: 通存通兑.本地类操作交易[RCC003_8562]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).个人现金通存[TRCC002_8561]进入***' ) #=================必要性检查=============================================== AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #检查本机构是否有通存通兑业务权限 if not rccpsDBFunc.chkTDBESAuth(TradeContext.BESBNO): return AfaFlowControl.ExitThisFlow("S999","本机构无通存通兑业务权限") #磁道信息 if TradeContext.PYETYP == '0': if TradeContext.SCTRKINF == '': return AfaFlowControl.ExitThisFlow("磁道信息不能为空") #if TradeContext.THTRKINF == '': # return AfaFlowControl.ExitThisFlow("磁道信息不能为空") if len(TradeContext.SCTRKINF) > 37: return AfaFlowControl.ExitThisFlow('S999','磁道信息非法') #if len(TradeContext.THTRKINF) > 104: # return AfaFlowControl.ExitThisFlow('S999','磁道信息非法') elif TradeContext.PYETYP == '2': TradeContext.SCTRKINF = ''.rjust(37,'0') TradeContext.THTRKINF = ''.rjust(37,'0') #存折号码 if TradeContext.PYETYP == '1': if TradeContext.BNKBKNO == '': return AfaFlowControl.ExitThisFlow('存折号码不能为空') elif TradeContext.PYETYP == '3': TradeContext.BNKBKNO = '' AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #=================登记通存通兑业务登记簿=================================== AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿") TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN #发送成员行号 TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN #接收成员行号 TradeContext.TRCNO = TradeContext.SerialNo #交易流水号 TradeContext.NCCWKDAT = TradeContext.NCCworkDate #中心工作日期 TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.TRCDAT + TradeContext.TRCNO #报文标识号 TradeContext.OPRNO = PL_TDOPRNO_TC #业务种类:个人现金通存 TradeContext.DCFLG = PL_DCFLG_CRE #借贷标识:贷记 TradeContext.BRSFLG = PL_BRSFLG_SND #往来标识:往账 #if TradeContext.PYITYP == '0' or '2': # TradeContext.TRCCO = '3000002' #交易代码:3000002卡现金通存 #elif TradeContext.PYITYP == '1' or '3': # TradeContext.TRCCO = '3000004' #交易代码:3000004折现金通存 #else: # return AfaFlowContorl.ExitThisFlow("S999","收款人账户类型非法") TradeContext.PYRMBRCO = TradeContext.SNDSTLBIN TradeContext.PYEMBRCO = TradeContext.RCVSTLBIN wtrbka_dict = {} if not rccpsMap8563CTradeContext2Dwtrbka_dict.map(wtrbka_dict): return AfaFlowContorl.ExitThisFlow("S999","为通存通兑业务登记簿赋值异常") if not rccpsDBFunc.insTransWtr(wtrbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记通存通兑业务登记簿异常') AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿") #=================设置业务状态为记账处理中================================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为记账处理中") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 stat_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 stat_dict['BCSTAT'] = PL_BCSTAT_ACC #PL_BCSTAT_ACC 记账 stat_dict['BDWFLG'] = PL_BDWFLG_WAIT #PL_BDWFLG_WAIT 处理中 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置状态为记账处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为记账处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为记账处理中") #=================为主机记账做准备========================================= AfaLoggerFunc.tradeInfo(">>>开始为主机记账做准备") TradeContext.HostCode = '8813' TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.CATR = '0' #现转标识:0-现金 TradeContext.RCCSMCD = PL_RCCSMCD_XJTCWZ #主机摘要码:现金通存往账 TradeContext.SBAC = '' TradeContext.ACNM = '' TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = "农信银待清算往账" TradeContext.CTFG = '7' #结转标识:结转-0 AfaLoggerFunc.tradeInfo("借方账号1:[" + TradeContext.SBAC + "]") AfaLoggerFunc.tradeInfo("贷方账号1:[" + TradeContext.RBAC + "]") if TradeContext.CHRGTYP == '0': #现金收取手续费 TradeContext.ACUR = '2' #重复次数 TradeContext.I2PKFG = 'T' #通存通兑标识 TradeContext.I2CATR = '0' #现转标识:0-现金 TradeContext.I2TRAM = TradeContext.CUSCHRG #手续费金额 TradeContext.I2SMCD = PL_RCCSMCD_SXF #主机摘要码:手续费 TradeContext.I2SBAC = '' TradeContext.I2ACNM = '' TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号:通存通兑手续费 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = "农信银手续费" TradeContext.I2CTFG = '8' #结转标识:不结转-1 elif TradeContext.CHRGTYP == '1': #现金通存无法收取本行账户手续费 return AfaFlowControl.ExitThisFlow("S999","现金通存无法转账收取手续费") elif TradeContext.CHRGTYP == '2': AfaLoggerFunc.tradeInfo(">>>不收手续费") else: return AfaFlowControl.ExitThisFlow("S999","非法手续费收取方式") if TradeContext.existVariable("I2SBAC") and TradeContext.existVariable('I2RBAC'): AfaLoggerFunc.tradeInfo("借方账号2:[" + TradeContext.I2SBAC + "]") AfaLoggerFunc.tradeInfo("贷方账号2:[" + TradeContext.I2RBAC + "]") AfaLoggerFunc.tradeInfo(">>>结束为主机记账做准备") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).个人现金通存[TRCC002_8561]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).柜台补正[TRCC003_8587]进入***' ) #=====检验变量合法性==== if not TradeContext.existVariable("BOJEDT"): return AfaFlowControl.ExitThisFlow('A099','原报单日期不能为空') if not TradeContext.existVariable("BOSPSQ"): return AfaFlowControl.ExitThisFlow('A099','原报单序号不能为空') #=====查询原交易信息==== wtr_dict = {} if rccpsDBFunc.getTransWtr(TradeContext.BOJEDT,TradeContext.BOSPSQ,wtr_dict): AfaLoggerFunc.tradeInfo(">>>通存通兑登记簿中找到原交易") else: return AfaFlowControl.ExitThisFlow('S0999','查找原交易信息失败') swtr_dict = wtr_dict #=====判断原交易是否为往账==== if( wtr_dict['BRSFLG'] != PL_BRSFLG_SND): return AfaFlowControl.ExitThisFlow('A099','此交易非往账,禁止补正') #====判断账户卡折类型==== if TradeContext.DCFLG == '0': TradeContext.CBFLG = TradeContext.PYITYP else: TradeContext.CBFLG = TradeContext.PYOTYP #====判断原交易状态==== AfaLoggerFunc.tradeInfo("开始判断原交易信息是否允许补正") if (wtr_dict['BCSTAT'] != PL_BCSTAT_CANC and wtr_dict['BDWFLG'] != PL_BDWFLG_SUCC): return AfaFlowControl.ExitThisFlow("S999","交易状态["+str(wtr_dict['BCSTAT'])+"],禁止补正") AfaLoggerFunc.tradeInfo("结束判断原交易信息是否允许补正") #=================登记通存通兑业务登记簿=================================== AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿") #=====================获取中心流水号==================================== if rccpsGetFunc.GetRccSerialno( ) == -1 : raise AfaFlowControl.flowException( ) TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN #发送成员行号 TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN #接收成员行号 TradeContext.TRCNO = TradeContext.SerialNo #交易流水号 TradeContext.NCCWKDAT = TradeContext.NCCworkDate #中心工作日期 TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.TRCDAT + TradeContext.SerialNo #报文标识号 TradeContext.OPRNO = PL_TDOPRNO_BZ #业务种类:个人现金通存 TradeContext.BRSFLG = PL_BRSFLG_SND #往来标识:往账 TradeContext.PYRMBRCO = TradeContext.SNDSTLBIN TradeContext.PYEMBRCO = TradeContext.RCVSTLBIN TradeContext.NOTE1 = TradeContext.BOJEDT TradeContext.NOTE2 = TradeContext.BOSPSQ TradeContext.TRCCO = '3000505' wtrbka_dict = {} if not rccpsMap8563CTradeContext2Dwtrbka_dict.map(wtrbka_dict): return AfaFlowContorl.ExitThisFlow("S999","为通存通兑业务登记簿赋值异常") if(TradeContext.DCFLG == '0'): wtrbka_dict['DCFLG'] = '1' elif(TradeContext.DCFLG == '1'): wtrbka_dict['DCFLG'] = '2' else: return AfaFlowControl.ExitThisFlow('S999','非法借贷标示') if not rccpsDBFunc.insTransWtr(wtrbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记通存通兑业务登记簿异常') AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿") #=====判断原交易是否为异转本或通兑==== if swtr_dict['TRCCO'] in ('3000102','3000103','3000104','3000105') and swtr_dict['CHRGTYP'] == '1': TradeContext.CUSCHRG = str(swtr_dict['CUSCHRG']) else: TradeContext.CUSCHRG = "0.00" #=====发送农信银中心,为发送柜面报文做准备==== #=====报文头==== TradeContext.MSGTYPCO = 'SET009' TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo TradeContext.ORMFN = swtr_dict['MSGFLGNO'] TradeContext.TRCCO = "3000505" TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = "30" TradeContext.ROPRTPNO = "30" TradeContext.TRANTYP = "0" #=====业务要素集==== TradeContext.CUR = "CNY" TradeContext.OCCAMT = str(TradeContext.OCCAMT) #TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) TradeContext.CUSCHRG = str(TradeContext.CUSCHRG) TradeContext.ORTRCCO = str(swtr_dict['TRCCO']) TradeContext.ORTRCNO = str(swtr_dict['TRCNO']) if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow("S999","设置原交易当前状态为发送-处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置原交易状态为发送-处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).行内账户转异地[TRCC002_8563]进入***' ) #=================必要性检查=============================================== AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #检查本机构是否有通存通兑业务权限 if not rccpsDBFunc.chkTDBESAuth(TradeContext.BESBNO): return AfaFlowControl.ExitThisFlow("S999","本机构无通存通兑业务权限") if TradeContext.PYRTYP == '1': #折,调用8811校验支付条件 AfaLoggerFunc.tradeInfo(">>>开始校验付款人账号支付条件") TradeContext.HostCode = '8811' TradeContext.ACCNO = TradeContext.PYRACC #付款人账户 if TradeContext.PYRTYP == '0': TradeContext.WARNTNO = TradeContext.PYRACC[6:18] rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow('S999','查询账户支付条件异常:' + TradeContext.errorMsg[7:]) elif TradeContext.PAYTYP != TradeContext.HPAYTYP: return AfaFlowControl.ExitThisFlow('S999','支付条件错误') AfaLoggerFunc.tradeInfo(">>>结束校验付款人账号支付条件") AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #=================登记通存通兑业务登记簿=================================== AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿") TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN #发送成员行号 TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN #接收成员行号 TradeContext.TRCNO = TradeContext.SerialNo #交易流水号 TradeContext.NCCWKDAT = TradeContext.NCCworkDate #中心工作日期 TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.TRCDAT + TradeContext.TRCNO TradeContext.OPRNO = PL_TDOPRNO_BZY #业务种类:行内账户转异地 TradeContext.DCFLG = PL_DCFLG_CRE #借贷标识:贷记 TradeContext.BRSFLG = PL_BRSFLG_SND #往来标识:往账 #if TradeContext.PYITYP == '0' or '2': # TradeContext.TRCCO = '3000003' #交易代码:3000003卡本转异 #elif TradeContext.PYITYP == '1' or '3': # TradeContext.TRCCO = '3000005' #交易代码:3000005折本转异 #else: # return AfaFlowContorl.ExitThisFlow("S999","收款人账户非法") TradeContext.PYRMBRCO = TradeContext.SNDSTLBIN TradeContext.PYEMBRCO = TradeContext.RCVSTLBIN wtrbka_dict = {} if not rccpsMap8563CTradeContext2Dwtrbka_dict.map(wtrbka_dict): return AfaFlowContorl.ExitThisFlow("S999","为通存通兑业务登记簿赋值异常") if not rccpsDBFunc.insTransWtr(wtrbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记通存通兑业务登记簿异常') AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿") #=================设置业务状态为记账处理中================================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为记账处理中") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 stat_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 stat_dict['BCSTAT'] = PL_BCSTAT_ACC #PL_BCSTAT_ACC 记账 stat_dict['BDWFLG'] = PL_BDWFLG_WAIT #PL_BDWFLG_WAIT 处理中 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置状态为记账处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为记账处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为记账处理中") #=================为主机记账做准备========================================= AfaLoggerFunc.tradeInfo(">>>开始为主机记账做准备") TradeContext.HostCode = '8813' TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.OCCAMT = str(TradeContext.OCCAMT) #出票金额 TradeContext.RCCSMCD = PL_RCCSMCD_BZYWZ #主机摘要码:本转异往账 TradeContext.SBAC = TradeContext.PYRACC #借方账号:客户账 TradeContext.ACNM = TradeContext.PYRNAM #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #贷方账号:汇出汇款 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = "农信银待清算往账" TradeContext.PASSWD = TradeContext.PASSWD #付款人密码 AfaLoggerFunc.tradeInfo("PYRTYP = [" + TradeContext.PYRTYP + "]") if TradeContext.PYRTYP == '0': TradeContext.WARNTNO = TradeContext.SBAC[6:18] TradeContext.CERTTYPE = TradeContext.CERTTYPE #证件类型 TradeContext.CERTNO = TradeContext.CERTNO #证件号码 TradeContext.CTFG = '7' #结转标识:结转-0 AfaLoggerFunc.tradeInfo("借方账号1:[" + TradeContext.SBAC + "]") AfaLoggerFunc.tradeInfo("贷方账号1:[" + TradeContext.RBAC + "]") AfaLoggerFunc.tradeInfo("凭证号码1:[" + TradeContext.WARNTNO + "]") if TradeContext.CHRGTYP == '0': #现金收取 AfaLoggerFunc.tradeInfo(">>>现金收取手续费") TradeContext.ACUR = '2' #重复次数 TradeContext.I2PKFG = 'T' #通存通兑标识 TradeContext.I2CATR = '0' #现转标识:0-现金 TradeContext.I2TRAM = str(TradeContext.CUSCHRG) #手续费金额 TradeContext.I2SMCD = PL_RCCSMCD_SXF #主机摘要码:手续费 TradeContext.I2SBAC = "" #借方账号:柜员尾箱 TradeContext.I2ACNM = "" TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号:通存通兑手续费 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = "手续费" TradeContext.I2CTFG = '8' #结转标识:不结转-1 elif TradeContext.CHRGTYP == '1': #本地账户收取 AfaLoggerFunc.tradeInfo(">>>本地账户收取手续费") TradeContext.ACUR = '2' #重复次数 TradeContext.I2PKFG = '8' #通存通兑标识 TradeContext.I2TRAM = str(TradeContext.CUSCHRG) #手续费金额 TradeContext.I2SMCD = PL_RCCSMCD_SXF #主机摘要码:手续费 TradeContext.I2SBAC = TradeContext.PYRACC #借方账号:客户账 TradeContext.I2ACNM = TradeContext.PYRNAM TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号:通存通兑手续费 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = "手续费" TradeContext.I2PSWD = TradeContext.PASSWD #付款人密码 TradeContext.I2WARNTNO = TradeContext.WARNTNO TradeContext.I2CERTTYPE = TradeContext.CERTTYPE #证件类型 TradeContext.I2CERTNO = TradeContext.CERTNO #证件号码 TradeContext.I2CTFG = 'T' #结转标识:不结转-1 else: AfaLoggerFunc.tradeInfo(">>>不收手续费") if TradeContext.existVariable("I2SBAC") and TradeContext.existVariable('I2RBAC'): AfaLoggerFunc.tradeInfo("借方账号2:[" + TradeContext.I2SBAC + "]") AfaLoggerFunc.tradeInfo("贷方账号2:[" + TradeContext.I2RBAC + "]") AfaLoggerFunc.tradeInfo(">>>结束为主机记账做准备") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).行内账户转异地[TRCC002_8563]退出***' ) return True