def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入单证重打交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通信后处理' ) try: names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType or type(value) is ListType) : setattr( TradeContext, name, value ) if(TradeContext.errorCode=='0000'): #第三方返回成功后更新原保单印刷号 update_sql = "update afa_maintransdtl set " update_sql = update_sql + " userno = '" + TradeContext.userno1 + "'" #user1新保单印刷号 update_sql = update_sql + " where userno = '" + TradeContext.userno + "'" #user原保单印刷号 update_sql = update_sql + " and workdate = '" + TradeContext.workDate + "'" #日期 update_sql = update_sql + " and agentserialno = '" + TradeContext.PreSerialno + "'" #缴费成功的中间业务流水号 #更新并提交数据 if AfaDBFunc.UpdateSqlCmt(update_sql)<0: return AfaFlowControl.ExitThisFlow("A999","更新投保单号失败") #第三方返回成功后生成现金价值文件 if not YbtFunc.createFile( ): return False AfaLoggerFunc.tradeInfo('退出单证重打[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) return True except Exception, e: AfaFlowControl.exitMainFlow(str(e))
def SubModuleDoTrd( ): AfaLoggerFunc.tradeInfo('进入缴费交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) #AfaLoggerFunc.tradeInfo(str(name) + ":" + str(value)) if ( not name.startswith( '__' ) and type(value) is StringType or type(value) is ListType) : setattr( TradeContext,name, value ) # AfaLoggerFunc.tradeInfo(name + ":" + value) if( TradeContext.errorCode == '0000' ): TradeContext.errorMsg = '交易成功' #第三方返回成功后生成现金价值文件 if not YbtFunc.createFile( ): return False #第三方返回成功后更新主流水表的note字段 if not AfaYbtdb.ADBUpdateTransdtl( ): return False else: AfaLoggerFunc.tradeInfo('与第三方交易失败') return False AfaLoggerFunc.tradeInfo('退出缴费交易与第三方通讯后处理' ) return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: Party3Context.unitno = TradeContext.unitno Party3Context.ProCode = TradeContext.ProCode names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) setattr( TradeContext, name, value ) #AfaLoggerFunc.tradeInfo("字段名称 ["+str(name)+"] = "+str(value)) if( TradeContext.errorCode == '0000' ): # if( TradeContext.existVariable( "ProCodeStr" ) ): # if (TradeContext.ProCodeStr == "EL5601"): # TradeContext.ProCode = "0" #安贷宝A # elif (TradeContext.ProCodeStr == "EL5602"): # TradeContext.ProCode = "1" #安贷宝B # elif (TradeContext.ProCodeStr == "211610"): # TradeContext.ProCode = "2" #华夏借款人意外伤害保险 if not AfaAhAdb.AdbInsertQueDtl( ): raise AfaFlowControl.accException() AfaLoggerFunc.tradeInfo('退出查询交易与第三方通讯后处理' ) return True except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( str(e) )
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入续期查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) if(TradeContext.errorCode=='0000'): TradeContext.errorMsg="续期查询成功" #TradeContext.syr_name1 = '' #syr_name = [] #if TradeContext.existVariable('syr_name1'): # syr_name.append('xiaozhang') # syr_name.append('xig') TradeContext.O1ACUR = '1' # TradeContext.syr_name = syr_name AfaLoggerFunc.tradeInfo('退出续期查询交易与第三方通讯后处理' ) return True except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( str(e) )
def SubModuleDoTrd( ): AfaLoggerFunc.tradeInfo('进入缴费交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) # try: #AfaLoggerFunc.tradeInfo('status='+TradeContext.__status__+'autoRevTranCtl='+TradeContext.__autoRevTranCtl__) Party3Context.agentSerialno = TradeContext.agentSerialno Party3Context.workDate = TradeContext.workDate Party3Context.workTime = TradeContext.workTime Party3Context.amount = TradeContext.amount Party3Context.ProCode = TradeContext.ProCode Party3Context.ProCodeStr = TradeContext.ProCodeStr Party3Context.PlanName = TradeContext.PlanName if not Party3Context.existVariable('CpicTeller'): AfaLoggerFunc.tradeInfo( '>>>保险公司未返回业务员编号,系统自动冲正' ) TradeContext.errorCode, TradeContext.errorMsg = 'A0100', '保险公司未返回业务员编号' return False names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) #AfaLoggerFunc.tradeInfo("字段名称 ["+str(name)+"] = "+str(value)) if( TradeContext.errorCode == '0000' ): TradeContext.errorMsg = '交易成功' if ( TradeContext.existVariable( "EffDate" ) and len(str(TradeContext.EffDate)) == 14): TradeContext.EffDate = TradeContext.EffDate[0:4] + TradeContext.EffDate[6:8] + TradeContext.EffDate[10:12] if ( TradeContext.existVariable( "TermDate" ) and len(str(TradeContext.TermDate)) == 14): TradeContext.TermDate = TradeContext.TermDate[0:4] + TradeContext.TermDate[6:8] + TradeContext.TermDate[10:12] if not AfaAhAdb.ADBUpdateTransdtl( ): #raise AfaFlowControl.accException() return False else: AfaLoggerFunc.tradeInfo('与第三方交易失败') return False #AfaLoggerFunc.tradeInfo("贷款合同和凭证编号 "+TradeContext.CreBarNo+"$$$$$$$"+TradeContext.CreVouNo) #AfaLoggerFunc.tradeInfo("核心流水"+ str(TradeContext.bankSerno)) #TradeContext.CreBarNo = TradeContext.CreBarNo #TradeContext.CreVouNo = TradeContext.CreVouNo #TradeContext.bankSerno = TradeContext.bankSerno AfaLoggerFunc.tradeInfo('退出缴费交易与第三方通讯后处理' ) return True
def clearParty3Context( ): nameList=[] names = Party3Context.getNames( ) for name in names: if ( not name.startswith( '__' ) ) : value = getattr( Party3Context, name ) if( ( type( value ) is StringType ) or ( type( value ) is ListType ) ): nameList.append( name ) for name in nameList: delattr( Party3Context, name )
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: Party3Context.agentSerialno = TradeContext.agentserialno Party3Context.workDate = TradeContext.workDate Party3Context.workTime = TradeContext.workTime Party3Context.amount = TradeContext.amount Party3Context.hostserialno = TradeContext.hostserialno Party3Context.CreBarNo = TradeContext.CreBarNo Party3Context.CreVouNo = TradeContext.CreVouNo Party3Context.LoanDate = TradeContext.LoanDate Party3Context.LoanEndDate = TradeContext.LoanEndDate Party3Context.ProCode = TradeContext.ProCode Party3Context.ProCodeStr = TradeContext.ProCodeStr Party3Context.PlanName = TradeContext.PlanName Party3Context.AccType = TradeContext.AccType names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) setattr( TradeContext, name, value ) #AfaLoggerFunc.tradeInfo("字段名称 ["+str(name)+"] = "+str(value)) if( TradeContext.errorCode == '0000' ): #if( TradeContext.existVariable( "ProCodeStr" ) ): # if (TradeContext.ProCodeStr == "EL5602"): # TradeContext.ProCode == "1" # else: # TradeContext.ProCode == "0" #责任起始日期日期 if ( TradeContext.existVariable( "EffDate" )): if ( len(str(TradeContext.EffDate)) == 14 ): TradeContext.EffDate = TradeContext.EffDate[0:4]+TradeContext.EffDate[6:8]+TradeContext.EffDate[10:12] if ( TradeContext.existVariable( "TermDate" )): if ( len(str(TradeContext.TermDate)) == 14 ): TradeContext.TermDate = TradeContext.TermDate[0:4]+TradeContext.TermDate[6:8]+TradeContext.TermDate[10:12] update_sql = "update afa_maintransdtl set " update_sql = update_sql + " userno = '" + TradeContext.NCpicNo + "'" update_sql = update_sql + " where userno = '" + TradeContext.OCpicNo + "'" if not AfaDBFunc.UpdateSqlCmt(update_sql): return AfaFlowControl.exitThisFlow("A999","更新投保单号失败") AfaLoggerFunc.tradeInfo('退出查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) return True except Exception, e: AfaFlowControl.exitMainFlow(str(e))
def sendParty3Response( appendFlag = True ): # 初始化TradeContext.tradeResponse if( appendFlag ): # 在原来TradeContext.tradeResponse基础上添加 if( not hasattr( TradeContext, "tradeResponse" ) ): TradeContext.tradeResponse = [] else: # 清除原来的TradeContext.tradeResponse返回,并只添加第三方返回结果到结果集 TradeContext.tradeResponse = [] # 拼装第三方返回数据到TradeContext.tradeResponse names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) ) : if( type( value ) is StringType ) : TradeContext.tradeResponse.append( [name, value] ) elif( type( value ) is ListType ) : for elem in value: TradeContext.tradeResponse.append( [name, elem] )
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) #AfaLoggerFunc.tradeInfo("name:" + str(name) + " value:" + str(value)) if( TradeContext.errorCode == '0000' ): if not AfaYbtdb.AdbSelectQueDtl( ): #根据投保单号和日期查询YBT_INFO表,有记录更新,无记录插入 raise AfaFlowControl.flowException() AfaLoggerFunc.tradeInfo('退出查询交易与第三方通讯后处理' ) return True except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( str(e) )
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('进入安徽交罚查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) if(TradeContext.errorCode=='0000'): TradeContext.errorMsg="安徽交罚查询成功" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) AfaLoggerFunc.tradeInfo('退出安徽交罚查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) return True except Exception, e: AfaFlowControl.ExitThisFlow( "E0001", str(e) )
def SubModuleDoTrd( ): AfaLoggerFunc.tradeInfo('进入缴费交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType or type(value) is ListType) : setattr( TradeContext,name, value ) if( TradeContext.errorCode == '0000' ): TradeContext.errorMsg = '交易成功' else: AfaLoggerFunc.tradeInfo('与第三方交易失败') return False AfaLoggerFunc.tradeInfo('退出缴费交易与第三方通讯后处理' ) return True
def SubModuleDoTrd( ): AfaLoggerFunc.tradeInfo('进入续期缴费交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) if( TradeContext.errorCode == '0000' ): TradeContext.errorMsg = '交易成功' if not AfaYbtdb.ADBUpdateTransdtl( ): #缴费成功后更新主流水表的note字段值 return False else: AfaLoggerFunc.tradeInfo('与第三方交易失败') return False AfaLoggerFunc.tradeInfo('退出续期缴费交易与第三方通讯后处理' ) return True
def SubModuleDoSnd( ): AfaLoggerFunc.tradeInfo('进入缴费反交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: Party3Context.preAgentSerno = TradeContext.preAgentSerno Party3Context.Amount = TradeContext.amount Party3Context.workDate = TradeContext.workDate names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) setattr( TradeContext, name, value ) #AfaLoggerFunc.tradeInfo("字段名称 ["+str(name)+"] = "+str(value)) if( TradeContext.errorCode != '0000' ): AfaLoggerFunc.tradeInfo("太保返回错误代码 ["+TradeContext.errorCode+"]") AfaLoggerFunc.tradeInfo("太保返回错误信息 ["+TradeContext.errorMsg+"]") #第三方交易失败后记录错误码和错误信息 if not AfaAhAdb.ADBUpdateTransdtlRev( ): raise AfaFlowControl.accException() return True except Exception, e: AfaFlowControl.exitMainFlow(str(e))
def SubModuleDoSnd( ): AfaLoggerFunc.tradeInfo('进入缴费反交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' ) try: names = Party3Context.getNames( ) for name in names: value = getattr( Party3Context, name ) if ( not name.startswith( '__' ) and type(value) is StringType) : setattr( TradeContext, name, value ) if( TradeContext.errorCode != '0000' ): AfaLoggerFunc.tradeInfo("银保通返回错误代码 ["+TradeContext.errorCode+"]") AfaLoggerFunc.tradeInfo("银保通返回错误信息 ["+TradeContext.errorMsg+"]") #第三方交易失败后记录错误码和错误信息 if not AfaYbtdb.ADBUpdateTransdtlRev( ): raise AfaFlowControl.accException() return True except Exception, e: AfaFlowControl.exitMainFlow(str(e))
def AfeParseRet( ): #========================数据转储====================== if( Party3Context.existVariable( "afe_appendFlag" ) ): TradeContext.afe_appendFlag = Party3Context.afe_appendFlag if( Party3Context.existVariable( "afe_appendData1" ) ): TradeContext.afe_appendData1 = Party3Context.afe_appendData1 if( Party3Context.existVariable( "afe_appendData2" ) ): TradeContext.afe_appendData2 = Party3Context.afe_appendData2 if( Party3Context.existVariable( "afe_billData" ) ): TradeContext.billData = Party3Context.afe_billData if( Party3Context.existVariable( "afe_corpSerno" ) ): TradeContext.corpSerno = Party3Context.afe_corpSerno if( Party3Context.existVariable( "afe_corpTime" ) ): TradeContext.corpTime = Party3Context.afe_corpTime if( Party3Context.existVariable( "afe_unitno" ) ): TradeContext.unitno = Party3Context.afe_unitno if( Party3Context.existVariable( "afe_note1" ) ): TradeContext.note1 = Party3Context.afe_note1 if( Party3Context.existVariable( "afe_note2" ) ): TradeContext.note2 = Party3Context.afe_note2 if( Party3Context.existVariable( "afe_note3" ) ): TradeContext.note3 = Party3Context.afe_note3 if( Party3Context.existVariable( "afe_note4" ) ): TradeContext.note4 = Party3Context.afe_note4 if( Party3Context.existVariable( "afe_note5" ) ): TradeContext.note5 = Party3Context.afe_note5 if( Party3Context.existVariable( "afe_note6" ) ): TradeContext.note6 = Party3Context.afe_note6 if( Party3Context.existVariable( "afe_note7" ) ): TradeContext.note7 = Party3Context.afe_note7 if( Party3Context.existVariable( "afe_note8" ) ): TradeContext.note8 = Party3Context.afe_note8 if( Party3Context.existVariable( "afe_note9" ) ): TradeContext.note9 = Party3Context.afe_note9 if( Party3Context.existVariable( "afe_note10" ) ): TradeContext.note10 = Party3Context.afe_note10 # 要求AFE返回错误代表errorCode,无论是正常流程还是错误流程 if( not Party3Context.existVariable( 'errorCode' ) ): TradeContext.errorCode='A0001' TradeContext.errorMsg ='第三方返回码[errorCode]不存在' TradeContext.__status__='1' TradeContext.tradeResponse = [[ 'errorCode', TradeContext.errorCode ], [ 'errorMsg', TradeContext.errorMsg]] return False #判断是否使用返回码转换 if TradeContext.sysId != 'RCC01' and TradeContext.__respFlag__=='1' : # AFE返回错误情况 #默认为异常状态 TradeContext.__status__='2' #返回码转换 result = AfaFunc.GetRespMsg(Party3Context.errorCode) if not result : return False if TradeContext.errorCode == '0000': TradeContext.__status__='0' return True else: if TradeContext.errorCode != '9999': TradeContext.__status__='1' else: TradeContext.__status__='2' return False else: # AFE返回错误情况 if( Party3Context.errorCode != '0000' ): if Party3Context.errorCode != '9999': TradeContext.__status__='1' else: TradeContext.__status__='2' TradeContext.errorCode=Party3Context.errorCode if( Party3Context.existVariable( 'errorMsg' ) ): TradeContext.errorMsg =Party3Context.errorMsg else: TradeContext.errorMsg ='与第三方通讯失败,错误未知' return False # 成功返回 TradeContext.__status__='0' TradeContext.errorCode ='0000' TradeContext.errorMsg ='与第三方通讯成功' return True