int F820121(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_pif_phydevice aphydev; double dUniqNo=0; int ret=0; memset(&aphydev,0,sizeof(aphydev)); //从cpack中取得相应字符串 Strncpy_t(aphydev.dname,in_pack->sphone,sizeof(aphydev.dname)); Strncpy_t(aphydev.dtype,in_pack->spager,sizeof(aphydev.dtype)); Strncpy_t(aphydev.factory,in_pack->scert_no,sizeof(aphydev.factory)); Strncpy_t(aphydev.comments,(char*)in_pack->usset1,sizeof(aphydev.comments)); //设备标志从系统键值表中取得 ret=getNewUniqNo(KEYTYPE_PHYDEVICE,&dUniqNo); if(ret) { *pRetCode=E_DB_SYSKEY_R; goto L_RETU; } aphydev.phytype =D2I(dUniqNo); ret=DB_t_pif_phydevice_add(&aphydev); if(ret) { *pRetCode=E_DB_PHYDEVICE_I; goto L_RETU; } return 0; L_RETU: return -1; }
int F820122(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_pif_phydevice aphydev; int ret=0; int v_phytype=0; memset(&aphydev,0,sizeof(aphydev)); v_phytype = in_pack->lvol6; aphydev.phytype = in_pack->lvol6; Strncpy_t(aphydev.dname,in_pack->sphone,sizeof(aphydev.dname)); Strncpy_t(aphydev.dtype,in_pack->spager,sizeof(aphydev.dtype)); Strncpy_t(aphydev.factory,in_pack->scert_no,sizeof(aphydev.factory)); Strncpy_t(aphydev.comments,in_pack->usset1,sizeof(aphydev.comments)); ret=DB_t_pif_phydevice_update_by_phytype(v_phytype,&aphydev); if(ret) { if(DB_NOTFOUND == ret) *pRetCode=E_DB_PHYDEVICE_N; else *pRetCode=E_DB_PHYDEVICE_U; goto L_RETU; } return 0; L_RETU: return -1; }
int F240004(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; T_t_refno tRefno; T_t_transdtl transdtl; //卡操作流水表,用做冲正用 memset(&transdtl,0,sizeof transdtl); ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); SetCol(handle,0); SetCol(handle,F_SHOLDER_AC_NO,F_SCLOSE_EMP,F_SORDER0,F_SORDER1,F_SSERIAL1,F_LVOL0,F_LVOL1,F_SDATE0,F_STIME0,F_SDATE1,F_STIME1,F_SCUST_NO,F_SCHANGE_EMP,F_SSERIAL0,F_LVOL2,F_SCUST_AUTH,F_SSTATUS1,F_SEMP_PWD,F_SEMP_PWD2,F_SSTATION0,F_SSTATION1,F_SORDER2,0); ret = DB_t_refno_open_select_by_c1_and_status(RS_YKTREVSUCC); if(ret) { if(DB_NOTFOUND == ret) return E_DB_REFNO_N; return E_DB_REFNO_R; } while(1) { memset(&tRefno,0,sizeof tRefno); ret = DB_t_refno_fetch_select_by_c1(&tRefno); if(ret) { if(DB_NOTFOUND==ret) return 0; else return E_DB_REFNO_R; } break; } ret=DB_t_transdtl_read_by_accdate_and_termid_and_termseqno(tRefno.accdate,tRefno.termid,tRefno.termseqno,&transdtl); if(ret) { if(ret==DB_NOTFOUND) return E_DB_TRANSDTL_N; else return E_DB_TRANSDTL_R; } sprintf(out_pack->sorder0,"%-9d", int(transdtl.amount)); // 转账时 限制了金额不能有小数 Strncpy_t(out_pack->sdate0,transdtl.transdate,sizeof(out_pack->sdate0)); Strncpy_t(out_pack->stime0,transdtl.transtime,sizeof(out_pack->stime0)); sprintf(out_pack->sserial0,"%-10d",transdtl.cardno); Strncpy_t(out_pack->scust_auth,transdtl.extdata,sizeof(out_pack->scust_auth)); out_pack->lvol0=atoi(transdtl.refno+8); //out_pack->lvol1=atoi(transdtl.refno+8); out_pack->lvol2=transdtl.termid; des2src(out_pack->sholder_ac_no,transdtl.refno); // 交易参考号 des2src(out_pack->sdate1,tRefno.mac); PutRow(handle,out_pack,pRetCode,szMsg); return 0; }
int F900290(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { char hi_operator[10+1]=""; char hi_idNo[255+1]=""; int i=0; int ret=0; char * pch; // 准备处理结果中在ST_PACK中使用的字段 Strncpy_t(hi_operator, in_pack->scust_no, sizeof(hi_operator)); Strncpy_t(hi_idNo, in_pack->vsmess, sizeof(hi_idNo)); // 输入参数检查 trim(hi_operator); trim(hi_idNo); if (!strlen (hi_operator)) { *pRetCode=E_INPUT_NOOPERATOR; writelog(LOG_ERR,"Operator is null,hi_operator[%s]errcode[%d]!",hi_operator,E_INPUT_NOOPERATOR); goto L_RETU; } if (!strlen(hi_idNo)) { *pRetCode=E_INPUT_NOFUNCNO; writelog(LOG_ERR,"Shopid is null,hi_idNo[%s]errcode[%d]!",hi_operator,E_INPUT_NOFUNCNO); goto L_RETU; } pch = strtok (hi_idNo," "); while (pch != NULL) { i = atoi(pch); ret=Select_By_ShopBalance_Bet_Where_1(handle,pRetCode,szMsg,i); if(ret) { *pRetCode=ret; writelog(LOG_ALERT,"Select_By_ShopBalance_Bet_Where err,errcode[%d]",ret); goto L_RETU; } pch = strtok (NULL, " "); } return 0; L_RETU: return *pRetCode; }
int F820131(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_cardstrut acardstru; double dUniqNo=0; int scode=0; memset(&acardstru,0,sizeof(acardstru)); //从cpack中取得相应字符串 acardstru. phytype = in_pack->lvol4; acardstru. sectorno = in_pack->lvol5; acardstru. blockno = in_pack->lvol6; acardstru. begin_addr = in_pack->lvol7; acardstru. end_addr = in_pack->lvol8; acardstru. bytenum = in_pack->lvol9; Strncpy_t(acardstru.define,(char*)in_pack->usset0,sizeof(acardstru.define)); Strncpy_t(acardstru.comments,(char*)in_pack->usset1,sizeof(acardstru.comments)); //设备标志从系统键值表中取得 scode=getNewUniqNo(KEYTYPE_CARD_STRU,&dUniqNo); if(0 != scode) { *pRetCode=E_DB_SYSKEY_R; sprintf(szMsg,"820121:取系统键值表错误,RetCode=%d\n",scode); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret; } //正确,赋值给结构体 acardstru.id = D2I(dUniqNo); scode=DB_t_cardstrut_add(&acardstru); if(0 != scode) { *pRetCode=E_DB_CARDSTRUT_I; sprintf(szMsg,"卡结构信息表插入错误,SQLLCODE=%d\n",scode); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret; } return 0; L_Ret: return -1; }
int F240004(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; T_t_tif_tradeserial tradeserial; //卡操作流水表,用做冲正用 memset(&tradeserial,0,sizeof tradeserial); ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); SetCol(handle,0); SetCol(handle,F_SCLOSE_EMP,F_SORDER0,F_SORDER1,F_SSERIAL1,F_LVOL0,F_LVOL1,F_SDATE0,F_STIME0,F_SDATE1,F_STIME1,F_SCUST_NO,F_SCHANGE_EMP,F_SSERIAL0,F_LVOL2,F_SCUST_AUTH,F_SSTATUS1,F_SEMP_PWD,F_SEMP_PWD2,F_SSTATION0,F_SSTATION1,F_SORDER2,0); ret = DB_t_tif_tradeserial_next_flush(&tradeserial); if(ret) { if(ret==DB_NOTFOUND) { *pRetCode=E_DB_TRADESERIAL_N; goto L_RETU; } else { *pRetCode=E_DB_TRADESERIAL_R; writelog(LOG_ERR,"读取冲正记录失败,errcode=[%d]",ret); goto L_RETU; } } sprintf(out_pack->sorder0,"%-9d", int(tradeserial.trade_fee)); Strncpy_t(out_pack->sdate0,tradeserial.operate_date,sizeof(out_pack->sdate0)); Strncpy_t(out_pack->stime0,tradeserial.operate_time,sizeof(out_pack->stime0)); sprintf(out_pack->sserial0,"%-10d",tradeserial.cardno); Strncpy_t(out_pack->scust_auth,tradeserial.b_act_id,sizeof(out_pack->scust_auth)); out_pack->lvol0=tradeserial.reviseserial_no; out_pack->lvol1=tradeserial.serial_no; out_pack->lvol2=tradeserial.deviceid; PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_RETU: return ret; }
int F820132(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_cardstrut acardstru; int scode=0; int v_id=0; memset(&acardstru,0,sizeof(acardstru)); //从cpack中取得相应字符串 v_id = in_pack->lvol3; acardstru. id = in_pack->lvol3; acardstru. phytype = in_pack->lvol4; acardstru. sectorno = in_pack->lvol5; acardstru. blockno = in_pack->lvol6; acardstru. begin_addr = in_pack->lvol7; acardstru. end_addr = in_pack->lvol8; acardstru. bytenum = in_pack->lvol9; Strncpy_t(acardstru.define,(char*)in_pack->usset0,sizeof(acardstru.define)); Strncpy_t(acardstru.comments,(char*)in_pack->usset1,sizeof(acardstru.comments)); scode=DB_t_cardstrut_update_by_id(v_id,&acardstru); if(SC_NOTFOUND==scode){ *pRetCode=E_DB_CARDSTRUT_N; sprintf(szMsg,"卡物理结构信息表无相应记录,SQLLCODE=%d\n",scode); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret; } if(0!=scode) { *pRetCode=E_DB_CARDSTRUT_U; sprintf(szMsg,"卡物理结构信息表更新错误,SQLLCODE=%d\n",scode); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret; } return 0; L_Ret: return -1; }
int F820134(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_pif_cardstrut acardstru; int v_id=0; int nrows=0; int r=0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); SetCol(handle,F_LVOL3,F_LVOL4,F_LVOL5,F_LVOL6,F_LVOL7,F_LVOL8,F_LVOL9,F_USSET0,F_USSET1,0); memset(&acardstru,0,sizeof(acardstru)); v_id = in_pack->lvol3; if(0 == v_id) { DB_t_pif_cardstrut_open_select_by_c1(); while(1){ memset(&acardstru,0,sizeof(acardstru)); r=DB_t_pif_cardstrut_fetch_select_by_c1(&acardstru); if(0 != r) { if(SC_NOTFOUND==r) { if(0 == nrows) { *pRetCode=E_DB_CARDSTRUT_N; sprintf(szMsg,"查询卡物理结构信息表无记录,SQLCODE=%d\n",r); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_WARNING,szMsg); goto L_Ret_if; } } else { *pRetCode=E_DB_CARDSTRUT_R; sprintf(szMsg,"读取卡物理结构信息表出错,SQLCODE=%d\n",r); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_WARNING,szMsg); goto L_Ret_if; } break; } out_pack->lvol3 = acardstru.id; out_pack->lvol4 = acardstru.phytype; out_pack->lvol5 = acardstru.sectorno; out_pack->lvol6 = acardstru.blockno; out_pack->lvol7 = acardstru.begin_addr; out_pack->lvol8 = acardstru.end_addr; out_pack->lvol9 = acardstru.bytenum; Strncpy_t(out_pack->usset0,acardstru.define,sizeof(out_pack->usset0)); Strncpy_t(out_pack->usset1,acardstru.comments,sizeof(out_pack->usset1)); PutRow(handle,out_pack,pRetCode,szMsg); nrows++; if (15 == nrows) { // 这里调用AnswerDataPart是为了不让前端等待太长时间,在有15条记录的时候就给返回,至于后续数据就不用管了,BCC与前端自动会将后续数据采集回去 AnswerDataPart(handle,*pRetCode,szMsg); } }; DB_t_pif_cardstrut_close_select_by_c1(); return 0; L_Ret_if: DB_t_pif_cardstrut_close_select_by_c1(); return r; } else{ r=DB_t_pif_cardstrut_read_by_id(v_id,&acardstru); if(SC_NOTFOUND==r) { *pRetCode=E_DB_CARDSTRUT_N; sprintf(szMsg,"卡物理结构信息表不存在相应记录,SQLCODE=%d\n",r); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret_else; } else if(0!=r) { *pRetCode=E_DB_CARDSTRUT_R; sprintf(szMsg,"卡物理信息表读取错误,SQLCODE=%d\n",r); db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,szMsg); goto L_Ret_else; } out_pack->lvol3 = acardstru.id; out_pack->lvol4 = acardstru.phytype; out_pack->lvol5 = acardstru.sectorno; out_pack->lvol6 = acardstru.blockno; out_pack->lvol7 = acardstru.begin_addr; out_pack->lvol8 = acardstru.end_addr; out_pack->lvol9 = acardstru.bytenum; Strncpy_t(out_pack->usset0,acardstru.define,sizeof(out_pack->usset0)); Strncpy_t(out_pack->usset1,acardstru.comments,sizeof(out_pack->usset1)); PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_Ret_else: return r; } }
int F847106(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int i=0; int ret =0; char logicdate[11]=""; //业务日期 char sysdate[11]=""; char systime[9]=""; int type=0; InAcc IA; double dSerialNo = 0; int card_id=0; char physical_no[41]=""; char sMaxCardBalance[20]=""; char sMsg[256]=""; double dMaxCardBalance=0; T_t_tif_tradeserial tradeserial; T_t_pif_card tCard; T_t_tif_savdtl tSavdtl; T_t_cif_customer tCustomer; T_t_pif_spefee tSpeFee; T_t_aif_account tAccount; //帐户表 ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); memset(&tSavdtl,0,sizeof(tSavdtl)); memset(&tCard,0,sizeof(tCard)); memset(&tAccount,0,sizeof(tAccount)); memset(&tradeserial,0,sizeof(tradeserial)); memset(&tCustomer,0,sizeof(tCustomer)); memset(&tSpeFee,0,sizeof(tSpeFee)); memset(&IA,0,sizeof(IA)); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LSERIAL1,F_DAMT2,F_DAMT3,F_VSMESS,0); if(amtcmp(rPack->damt0,0)<=0) { *pRetCode=E_INPUT_AMT; goto L_RETU; } if(amtcmp(rPack->damt1,0)<0) { *pRetCode=E_INPUT_CARD_BALA; goto L_RETU; } if(rPack->lvol10<1) { *pRetCode=E_INPUT_CARD_TXCNT; goto L_RETU; } card_id=rPack->lvol0; tradeserial.trade_fee = rPack->damt0; //充值金额 des2src(physical_no, rPack->sbank_acc); //物理卡号 getsysdate(sysdate); getsystime(systime); ret=GetLogicDate(logicdate); //业务日期 if(ret) { *pRetCode=ret; goto L_RETU; } ret=DB_t_pif_card_read_by_card_id(card_id, &tCard); if(ret) { if(DB_NOTFOUND==ret) *pRetCode=E_CARDNO_NOT_EXIST; else *pRetCode=E_DB_CARD_R; goto L_RETU; } if(strncmp(tCard.state_id,CARDSTAT_REG,4)!=0) { if('2'==tCard.state_id[CARDSTAT_TYPE_REG]) *pRetCode = E_CARDNO_LOGOUT; else if('3'==tCard.state_id[CARDSTAT_TYPE_REG]) *pRetCode = E_CARD_CHANGE; else if(tCard.state_id[CARDSTAT_TYPE_LOST]==STATE_TRUE) *pRetCode=E_CARDNO_LOST; else if(tCard.state_id[CARDSTAT_TYPE_FREEZE]==STATE_TRUE) *pRetCode=E_CARDNO_FREEZE; else if(tCard.state_id[CARDSTAT_TYPE_WFAIL]==STATE_TRUE) *pRetCode=E_CARDNO_WFAIL; goto L_RETU; } trim(physical_no); trim(tCard.physical_no); if(strcmp(tCard.physical_no,physical_no)!=0) { writelog(LOG_ERR,"db physical_no[%s],input physical_no[%s]",tCard.physical_no,physical_no); *pRetCode= E_CARD_PHYNO_DIFFER; goto L_RETU; } //根据卡号和钱包号得到消费者账号(借方) ret=DB_t_aif_account_read_by_card_id_and_purse_id(card_id, PURSE_NO_ONE,&tAccount); if(ret) { writelog(LOG_ERR,"DB_t_aif_account_read_by_card_id_and_purse_id ret[%d]card_id[%d]",ret,card_id); if(DB_NOTFOUND==ret) *pRetCode=E_ACTNO_NOT_EXIST; else *pRetCode=E_DB_ACCOUNT_R; goto L_RETU; } ret=GetParameter(GLOBE_MAXCARDBALANCE,sMaxCardBalance); if(ret) { *pRetCode=ret; goto L_RETU; } dMaxCardBalance=atof(sMaxCardBalance); if(amtcmp(tAccount.cur_bala+tradeserial.trade_fee,dMaxCardBalance)>0) { *pRetCode= E_AMT_EXCEED_MAX; goto L_RETU; } ret=DB_t_cif_customer_read_lock_by_cur_and_cut_id(tCard.cosumer_id, &tCustomer); if(ret) { writelog(LOG_ERR,"cut_id[%d]",tCard.cosumer_id); if(DB_NOTFOUND==ret) *pRetCode= E_CUSTOMER_NOT_EXIST; else *pRetCode= E_DB_CUSTOMER_R; goto L_RETU; } //得到收费类别 if(0==tCustomer.fee_type) { ret=DB_t_pif_spefee_read_by_dept_code_and_cut_type(tCustomer.classdept_no, tCustomer.cut_type,&tSpeFee); if(ret) { if(DB_NOTFOUND==ret) { tCustomer.fee_type=tCustomer.cut_type; } else { DB_t_cif_customer_free_lock_cur(); *pRetCode=E_DB_SPEFEE_R; goto L_RETU; } } else { tCustomer.fee_type=tSpeFee.fee_type; } //更新客户表的收费类别字段 ret=DB_t_cif_customer_update_lock_by_cur(&tCustomer); if(ret) { if(DB_NOTFOUND==ret) *pRetCode= E_CUSTOMER_NOT_EXIST; else *pRetCode= E_DB_CUSTOMER_U; goto L_RETU; } } DB_t_cif_customer_free_lock_cur(); type=rPack->lvol4; //交易类型 IA.dArrInAmt[0]=tradeserial.trade_fee; switch(type) { case TYPE_CASH: //现金 IA.iArrInFeeSwitch[1]=1; break; case TYPE_BILL: //支票 IA.iArrInFeeSwitch[2]=1; break; case TYPE_FUNDBOOK: //经费本 IA.iArrInFeeSwitch[3]=1; break; default: *pRetCode=E_INPUT_DEPOSIT_TYPE; goto L_RETU; } ret = getNewUniqNo(KEYTYPE_TRADESERIAL,&dSerialNo); //获得最大流水号 if(ret) { *pRetCode = ret; writelog(LOG_ERR," ERRCODE = [%d]",ret); goto L_RETU; } tradeserial.serial_no = D2I(dSerialNo); //流水号 tradeserial.other_seri_no = 0; //上传端流水号 tradeserial.serial_type = TXCODE_SAVING_CASH; tradeserial.serial_state = SERISTAT_DEBT; //流水状态 des2src(tradeserial.operate_date,sysdate); //发生日期 des2src(tradeserial.operate_time,systime); //发生时间 des2src(tradeserial.collect_date,sysdate); //采集日期 des2src(tradeserial.collect_time,systime); //采集时间 des2src(tradeserial.enteract_date,logicdate); //处理日期 des2src(tradeserial.enteract_time,systime); //处理时间 tradeserial.maindevice_id = rPack->lvol6; //上传工作站标识 tradeserial.device_id = rPack->lvol7; //采集设备标识 tradeserial.card_id =card_id; //卡号 tradeserial.purse_id = rPack->lvol1; //钱包号 //tradeserial.customer_id = rPack->lvol2; //客户标识 tradeserial.customer_id = tCustomer.cut_id; tradeserial.in_balance=rPack->damt1; tradeserial.trade_count=rPack->lvol10+1; //交易次数 Strncpy_t(tradeserial.oper_code , rPack->scust_limit, sizeof(tradeserial.oper_code)); //操作员代码 tradeserial.sys_id = 0; //外部系统标识 switch(type) { case TYPE_CASH: //现金 break; case TYPE_BILL: //支票 case TYPE_FUNDBOOK: //经费本 case TYPE_OTHER: //其他 tSavdtl.amount=rPack->damt0; //发生额 if(amtcmp(tSavdtl.amount,0)<=0) break; des2src(tSavdtl.bill_no,rPack->sphone); //票据号码 if(strlen(tSavdtl.bill_no)<1) { *pRetCode=E_INPUT_BILLNO; goto L_RETU; } tSavdtl.card_no=tCard.card_id; //卡号 des2src(tSavdtl.oper_no,rPack->scust_limit); //操作员 tSavdtl.seqno=tradeserial.serial_no; //流水号 des2src(tSavdtl.tx_date,sysdate); //发生日期 des2src(tSavdtl.tx_time,systime); //发生时间 tSavdtl.cnt=1; //票据数量 tSavdtl.bill_type=type; //票据类型 tSavdtl.tx_code=tradeserial.serial_type; //交易码 ret=DB_t_tif_savdtl_add(&tSavdtl); if(ret) { if(DB_REPEAT==ret) *pRetCode = E_DB_SAVDTL_E; else *pRetCode = E_DB_SAVDTL_I; goto L_RETU; } break; default: *pRetCode=E_TXCODE_NOT_EXIST; goto L_RETU; } des2src(IA.sArrInActno[0],tAccount.account_id); //帐户 IA.iCardNo=tCard.card_id; IA.iFeeType=tCustomer.fee_type; IA.dArrInAmt[0]=tradeserial.trade_fee; IA.iArrInFeeSwitch[0]=rPack->lvol0; IA.iArrInFeeSwitch[5]=rPack->lvol5; IA.iArrInFeeSwitch[6]=rPack->lvol6; IA.iArrInFeeSwitch[7]=rPack->lvol7; IA.iArrInFeeSwitch[8]=rPack->lvol8; IA.iArrInFeeSwitch[9]=rPack->lvol9; IA.iArrInFeeSwitch[10]=rPack->lvol10; ret=process(&IA,&tradeserial); if(ret) { writelog(LOG_ERR,"process ret[%d]",ret); *pRetCode=ret; goto L_RETU; } sprintf(out_pack->vsmess,"流水号:%d 卡号:%d ",IA.iSerialNo,IA.iCardNo); for(i=1;i<=IA.iOutTxTypeCnt;i++) { switch(IA.iArrOutTxType[i]) { case TXTYPE_TOLL_DEPOSIT: case TXTYPE_TOLL_DEPOSIT_BILL: case TXTYPE_TOLL_DEPOSIT_FUNDBOOK: case TXTYPE_DEDUCT_DEPOSIT: case TXTYPE_RETURN_DEPOSIT: tradeserial.deposit_fee=IA.dArrOutAmt[i]; break; case TXTYPE_PRE_TOLL_BOARD: case TXTYPE_PRE_TOLL_BOARD_BILL: case TXTYPE_PRE_TOLL_BOARD_FUNDBOOK: case TXTYPE_TOLL_BOARD: case TXTYPE_DEDUCT_BOARD: case TXTYPE_RETURN_BOARD: case TXTYPE_RETURN_BOARD_BILL: case TXTYPE_RETURN_BOARD_FUNDBOOK: case TXTYPE_PRE_TOLL_MANAGE: tradeserial.boardfee=IA.dArrOutAmt[i]; break; case TXTYPE_TOLL_CHARGE: case TXTYPE_TOLL_CHARGE_BILL: case TXTYPE_TOLL_CHARGE_FUNDBOOK: tradeserial.in_fee=IA.dArrOutAmt[i]; break; case TXTYPE_TOLL_CARDCOST: case TXTYPE_TOLL_CARDCOST_BILL: case TXTYPE_TOLL_CARDCOST_FUNDBOOK: tradeserial.cost_fee=IA.dArrOutAmt[i]; break; default: break; } if(amtcmp(IA.dArrOutAmt[i],0)!=0) { sprintf(sMsg,"%s:%.2lf元 ",IA.sArrOutTxName[i],IA.dArrOutAmt[i]); strcat(out_pack->vsmess,sMsg); } } sprintf(sMsg,"充值前卡余额:%.2lf元 卡当前余额:%.2lf元",tradeserial.in_balance,tradeserial.out_balance); strcat(out_pack->vsmess,sMsg); writelog(LOG_DEBUG,out_pack->vsmess); ret = DB_t_tif_tradeserial_add(&tradeserial); if (ret) { writelog(LOG_ERR,"ret[%d]",ret); if(DB_REPEAT==ret) *pRetCode = E_DB_TRADESERIAL_E; else *pRetCode = E_DB_TRADESERIAL_I; goto L_RETU; } if(amtcmp(tradeserial.out_balance,0)<0) { *pRetCode=E_ENTER_ACCOUNT; goto L_RETU; } out_pack->damt2=tradeserial.out_balance; //出卡值 out_pack->damt3=tradeserial.boardfee; //搭伙费 out_pack->lserial1=tradeserial.serial_no; //流水号 PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_RETU: return -1; }
int Select_By_ShopBalance_Bet_Where_1(TRUSERID *handle,int *pRetCode,char *szMsg,int shop_id) { int ret=0; int nrows = 0; int i=0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); T_t_tif_report_shop_balance pv_tif_shopdeptfee; memset(&pv_tif_shopdeptfee,0,sizeof(pv_tif_shopdeptfee)); i=shop_id; ret= DB_v_tif_shopdeptfee_open_select_by_c5(); if(ret) { *pRetCode=ret; db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ALERT,"DB_v_tif_shopdeptfee_open_select_by_c5 err sqlcode[%d]",SQLCODE); goto L_RETU; } SetCol(handle,0); //SetCol(handle,F_LVOL0,F_SALL_NAME,F_LVOL1,F_LVOL2,F_DAMT0,F_DAMT1,F_DAMT2,F_SORDER0,F_STX_PWD,0); SetCol(handle,F_SCUST_NO,F_SCUST_NO2,F_SALL_NAME,F_LVOL0,F_LVOL1,F_LVOL2,F_LVOL7,F_DAMT0,F_DAMT1,F_DAMT2,F_SROOM_NO2,F_STX_PWD,F_SORDER0 ,0); while(1) { memset(out_pack,0,sizeof(ST_PACK)); // 初始化宿主变量 ret=DB_v_tif_shopdeptfee_fetch_select_by_c5(&pv_tif_shopdeptfee); if(ret) { db_chk_err(__FILE__,__LINE__,&sqlca); if(ret==DB_NOTFOUND) { if(0==nrows) { *pRetCode=E_DB_T_REPORT_SHOP_BALANCE_N; writelog(LOG_DEBUG,"fetch t_tif_report_shop_balance no data [%d]",ret); goto L_RETU; } else break; } else *pRetCode=E_DB_T_REPORT_SHOP_BALANCE_R; writelog(LOG_ALERT,"DB_v_tif_shopdeptfee_fetch_select_by_c5 err sqlcode[%d]",SQLCODE); goto L_RETU; } if(i==pv_tif_shopdeptfee.shop_id||i==pv_tif_shopdeptfee.dept_id) { out_pack->lvol0 = pv_tif_shopdeptfee.shop_id; memset(out_pack->sall_name,0,sizeof out_pack->sall_name); Strncpy_t(out_pack->sall_name, pv_tif_shopdeptfee.shop_name, sizeof(out_pack->sall_name)); out_pack->lvol1 = pv_tif_shopdeptfee.dept_id; out_pack->lvol2 = pv_tif_shopdeptfee.trade_num; out_pack->damt0 = pv_tif_shopdeptfee.trade_amt; out_pack->damt1 = pv_tif_shopdeptfee.mng_amt; out_pack->damt2 = pv_tif_shopdeptfee.trade_amt+pv_tif_shopdeptfee.mng_amt; PutRow(handle,out_pack,pRetCode,szMsg); nrows++; } } DB_v_tif_shopdeptfee_close_select_by_c5(); // EXEC SQL CLOSE C1; return 0; L_RETU: return *pRetCode;
int F847109(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { int ret = 0; char seed_key[17] = ""; //种子密钥 char logicdate[11]=""; T_t_aif_account tAccount; T_t_cif_customer tCustomer; ST_CPACK aPack; ST_PACK *pp = &(aPack.pack); ResetNormalCPack(&aPack,0,1); memset(&tAccount,0,sizeof(tAccount)); memset(&tCustomer,0,sizeof(tCustomer)); memcpy(seed_key,STATIC_SEED_KEY,sizeof(seed_key)); //读种子密钥 tCustomer.cut_id = in_pack->lvol1; //客户号 ret=GetLogicDate(logicdate); //业务日期 if(ret) { *pRetCode = ret; goto L_RETU; } ret=DB_t_cif_customer_read_by_cut_id(tCustomer.cut_id,&tCustomer); if(ret) { writelog(LOG_ERR,"cut_id[%d]",tCustomer.cut_id); if(DB_NOTFOUND==ret) *pRetCode=E_CUSTOMER_NOT_EXIST; else *pRetCode=E_DB_CUSTOMER_R; goto L_RETU; } if(CUSTSTAT_LOGOUT==tCustomer.cut_state) { *pRetCode=E_CUSTOMER_LOGOUT; goto L_RETU; } ret=DB_t_aif_account_read_by_customer_id_and_act_type(tCustomer.cut_id,ACCTYPE_SHOPMAIN, &tAccount); if(ret) { writelog(LOG_ERR,"cut_id[%d]",tCustomer.cut_id); if(DB_NOTFOUND!=ret) { *pRetCode=E_DB_ACCOUNT_R; goto L_RETU; } } else { if(tAccount.current_state!=ACCOUNTSTAT_LOGOUT) { *pRetCode=E_ACTNO_EXIST; goto L_RETU; } } memset(&tAccount,0,sizeof(tAccount)); des2src(tAccount.open_date,logicdate); //开户日期 des2src(tAccount.cut_name,in_pack->sname); //客户名称 tAccount.customer_id=tCustomer.cut_id; //客户号 tAccount.cut_type = in_pack->lvol2; //客户类别 des2src(tAccount.stuemp_no,in_pack->sname2); //客户学号或员工号 tAccount.current_state = ACCOUNTSTAT_REGIST; //当前状态 ret = getNewActno(tAccount.account_id); //获得新帐号 if (ret) { *pRetCode = ret; goto L_RETU; } tAccount.act_type = ACCTYPE_SHOPMAIN; //帐号类别 tAccount.card_id = 0; //关联卡号 tAccount.purse_id = 0; //关联卡钱包号 // tAccount.card_state = 0; //卡状态 tAccount.card_type = 0; //卡类别 des2src(tAccount.subno,SUBJECT_SHOPSAVING); //所属科目 EncodePwd(seed_key,in_pack->sserial0,tAccount.password,0); //帐户密码 Strncpy_t(tAccount.isautotra,in_pack->scust_type,sizeof(tAccount.isautotra)); //是否自动转帐 tAccount.last_bala = 0.00; //前次帐户总余额 tAccount.last_freebala = 0.00; //前次帐户可用余额 tAccount.last_frozebala = 0.00; //前次帐户冻结余额 tAccount.cur_bala = 0.00; //当前帐户总余额 tAccount.cur_freebala = 0.00; //当前帐户可用余额 tAccount.cur_frozebala = 0.00; //当前帐户冻结余额 tAccount.out_bala = 0.00; //借方发生总额 tAccount.in_bala = 0.00; //贷方发生总额 tAccount.out_count = 0; //借方发生总数 tAccount.in_count = 0; //贷方发生总数 tAccount.card_balance = 0.00; //当前卡中帐户余额 tAccount.consume_count = 0; //当前卡中帐户消费次数 // 插入帐户信息表 ret = DB_t_aif_account_add(&tAccount); if (ret) { if(DB_REPEAT==ret) *pRetCode = E_DB_ACCOUNT_E; else *pRetCode = E_DB_ACCOUNT_I; goto L_RETU; } // 返回帐号到前台 SetCol(handle,0); SetCol(handle,F_SSTATION0,0); des2src(pp->sstation0, tAccount.account_id); //帐号 PutRow(handle,pp,pRetCode,szMsg); return 0; L_RETU: return -1; }
int F930032(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { int ret = 0; //返回码 int hi_sign = 0; //挂失解挂标志 double h_temp_Serial_no = 0; //本地流水号 char logicdate[11]=""; char sysdate[11]=""; char systime[9]=""; int dev_id=0; T_t_tif_tradeserial tradeserial; memset(&tradeserial,0,sizeof(tradeserial)); hi_sign = in_pack->lvol6; //挂失解挂标志 ret=chk_dyn_key(in_pack->lcert_code,in_pack->scust_limit2); if(ret) { *pRetCode = ret; goto L_RETU; } getsysdate(sysdate); getsystime(systime); ret=GetLogicDate(logicdate); //业务日期 if(ret) { *pRetCode = ret; goto L_RETU; } switch (hi_sign) { case 0: tradeserial.serial_type = TXCODE_CARD_LOSS; //挂失 break; case 1: tradeserial.serial_type = TXCODE_CARD_COMEBACK_LOSS; //解挂 break; case 2: tradeserial.serial_type = TXCODE_MODIFICATIONPW; //修改密码 break; default: *pRetCode = -1; writelog(LOG_ERR,"挂失解挂修改密码标志出错。ERRCODE[%d] ",*pRetCode); goto L_RETU; break; } /* 读取设备ID */ ret = GetDevIdByDevPhyId(&dev_id,in_pack->sdate1); if (ret) { *pRetCode = ret; writelog(LOG_ERR,"GetDevIdByDevPhyId err[%d] ",ret); goto L_RETU; } tradeserial.serial_state = SERISTAT_NODEBT; //流水状态 ret = getNewUniqNo(KEYTYPE_TRADESERIAL,&h_temp_Serial_no); if(ret) { *pRetCode = ret; writelog(LOG_ERR,"获取最大流水号错误: ERRCODE = [%d]",ret); goto L_RETU; } tradeserial.serial_no = D2I(h_temp_Serial_no); //流水号 snprintf(tradeserial.operate_date,9,"20%s",in_pack->spost_code); //发生日期(格式化输入的日期) des2src(tradeserial.operate_time,in_pack->spost_code2); //发生时间(格式化输入的时间) des2src(tradeserial.collect_date,sysdate); //采集日期 des2src(tradeserial.collect_time,systime); //采集时间 des2src(tradeserial.enteract_date,logicdate); //处理日期 des2src(tradeserial.enteract_time,systime); //处理时间 tradeserial.other_seri_no = in_pack->lvol4; //上传端流水号 tradeserial.serial_state = SERISTAT_DEBT; //流水状态 tradeserial.maindeviceid = in_pack->lcert_code; //上传工作站标识 tradeserial.deviceid = dev_id; //采集设备标识 tradeserial.cardno = in_pack->lvol5; //卡号 Strncpy_t(tradeserial.showid,in_pack->sstation0,sizeof(tradeserial.showid)); //显示卡号 Strncpy_t(tradeserial.oldpwd,in_pack->sstock_code,sizeof(tradeserial.oldpwd)); //原始密码 Strncpy_t(tradeserial.newpwd,in_pack->sstock_code2,sizeof(tradeserial.newpwd)); //更新密码 des2src(tradeserial.opercode,"system"); ret = DB_t_tif_tradeserial_add(&tradeserial); if (ret) { writelog(LOG_ERR,"ret[%d]",ret); if(DB_REPEAT==ret) *pRetCode = E_DB_TRADESERIAL_E; else *pRetCode = E_DB_TRADESERIAL_I; goto L_RETU; } return 0; L_RETU: return -1; }
int F820124(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { T_t_phydevice aphydev; //int scode=0; int v_phytype=0; int nrows=0; int r=0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); SetCol(handle,F_LVOL6,F_SPHONE,F_SPAGER,F_SCERT_NO,F_USSET1,0); memset(&aphydev,0,sizeof(aphydev)); v_phytype = in_pack->lvol6; if(0==v_phytype) { DB_t_phydevice_open_select_by_c1(); while(1){ memset(&aphydev,0,sizeof(aphydev)); r=DB_t_phydevice_fetch_select_by_c1(&aphydev); if(0 != r) { if(SC_NOTFOUND == r) { if(0 == nrows) { *pRetCode=E_DB_PHYDEVICE_N; sprintf(szMsg,"查询设备结构信息表无记录,SQLCODE=%d\n",SQLCODE); writelog(LOG_WARNING,szMsg); db_chk_err(__FILE__,__LINE__,&sqlca); goto L_Ret_if; } } else { *pRetCode=E_DB_PHYDEVICE_R; sprintf(szMsg,"读取设备结构信息表出错,SQLCODE=%d\n",SQLCODE); writelog(LOG_WARNING,szMsg); db_chk_err(__FILE__,__LINE__,&sqlca); goto L_Ret_if; } break; } out_pack->lvol6 = aphydev.phytype; Strncpy_t(out_pack->sphone,aphydev.dname,sizeof(out_pack->sphone)); Strncpy_t(out_pack->spager,aphydev.dtype,sizeof(out_pack->spager)); Strncpy_t(out_pack->scert_no,aphydev.factory,sizeof(out_pack->scert_no)); Strncpy_t((char*)out_pack->usset1,aphydev.comments,sizeof(out_pack->usset1)); PutRow(handle,out_pack,pRetCode,szMsg); nrows++; if (15==nrows) { // 这里调用AnswerDataPart是为了不让前端等待太长时间,在有15条记录的时候就给返回,至于后续数据就不用管了,BCC与前端自动会将后续数据采集回去 AnswerDataPart(handle,*pRetCode,szMsg); } }; DB_t_phydevice_close_select_by_c1(); return 0; L_Ret_if: DB_t_phydevice_close_select_by_c1(); return r; } else{ r=DB_t_phydevice_read_by_phytype(v_phytype,&aphydev); if(SC_NOTFOUND==r) { *pRetCode=E_DB_PHYDEVICE_N; sprintf(szMsg,"设备物理信息表不存在相应记录,SQLCODE=%d\n",SQLCODE); writelog(LOG_ERR,szMsg); db_chk_err(__FILE__,__LINE__,&sqlca); goto L_Ret_else; } else if(r!=0) { *pRetCode=E_DB_PHYDEVICE_R; sprintf(szMsg,"设备物理信息表读取错误,SQLCODE=%d\n",SQLCODE); writelog(LOG_ERR,szMsg); db_chk_err(__FILE__,__LINE__,&sqlca); goto L_Ret_else; } out_pack->lvol6 = aphydev.phytype; Strncpy_t(out_pack->sphone,aphydev.dname,sizeof(out_pack->sphone)); Strncpy_t(out_pack->spager,aphydev.dtype,sizeof(out_pack->spager)); Strncpy_t(out_pack->scert_no,aphydev.factory,sizeof(out_pack->scert_no)); Strncpy_t((char*)out_pack->usset1,aphydev.comments,sizeof(out_pack->usset1)); PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_Ret_else: return r; } }
int F240002(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; double unique=0; int temp_serial_no=0; char logicdate[11]=""; char buffer[16]=""; int i=0; double trans_amt=0.0; char sMsg[255]=""; char sDebugMsg[255]=""; char sMaxCardBalance[20]=""; double dMaxCardBalance=0; T_t_aif_account tAccount; //帐户表 T_t_cif_customer tCustomer; T_t_pif_spefee tSpeFee; T_t_tif_tradeserial tradeserial; //卡操作流水表 T_t_pif_card card; InAcc IA; memset(&tSpeFee,0,sizeof(tSpeFee)); memset(&tCustomer,0,sizeof(tCustomer)); memset(&tAccount,0,sizeof(tAccount)); memset(&IA,0,sizeof(IA)); memset(&tradeserial,0,sizeof(tradeserial)); memset(&card,0,sizeof(card)); ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_DAMT0,F_DAMT1,F_DAMT2,F_LVOL1,F_LVOL2,F_SBANK_CODE,F_SEMP_NO,0); //memset(&tradeserial_bak,0,sizeof(tradeserial_bak)); ret=GetLogicDate(logicdate); //业务日期 if(ret) { *pRetCode=E_TRANS_UNKNOW_ERROR; writelog(LOG_ERR,"GetLogicDate error,errcode=[%d]",ret); goto L_RETU; } //判断设备是否登陆 if(0!=device_login_yes_or_no(atoi(rPack->sorder2))) { *pRetCode=E_TRANS_TERM_NOLOGIN; writelog(LOG_ERR,"Device don't login"); goto L_RETU; } //判断是否处于日终结算状态 ret=GetParameter(GLOBE_FLAG_BALANCE,buffer); if(ret) { *pRetCode=E_TRANS_UNKNOW_ERROR; writelog(LOG_ERR,"GetParameter error,errcode=[%d]",ret); goto L_RETU; } else if(strncmp(buffer,"0",1)!=0) { *pRetCode=E_TRANS_BANK_SERVICE_NOEXIT; writelog(LOG_ERR,"System is balance now!"); goto L_RETU; } ret=DB_t_pif_card_read_by_card_id(atoi(rPack->sserial0),&card); if(ret) { *pRetCode=E_TRANS_SCHACC_NOEXIT; writelog(LOG_ERR,"Create serial_no error,error code=[%d]",ret); goto L_RETU; } if(strncmp(card.state_id,CARDSTAT_LOGOUT,4)==0) { *pRetCode=E_TRANS_SCHACC_DESTORY; writelog(LOG_ERR,"card.state_id=[%d]",card.card_id); goto L_RETU; } if(STATE_TRUE==card.state_id[CARDSTAT_TYPE_LOST]) { DB_t_pif_card_free_lock_by_cur(); *pRetCode=E_TRANS_SCHCARD_LOSTING; writelog(LOG_ERR,"card_state=[%s]",card.state_id); goto L_RETU; } if(STATE_TRUE==card.state_id[CARDSTAT_TYPE_FREEZE]) { DB_t_pif_card_free_lock_by_cur(); *pRetCode=E_TRANS_SCHCARD_FREEZE; writelog(LOG_ERR,"card_state=[%s]",card.state_id); goto L_RETU; } if(STATE_TRUE==card.state_id[CARDSTAT_TYPE_WFAIL]) { DB_t_pif_card_free_lock_by_cur(); *pRetCode=E_TRANS_SCHCARD_WFAIL; writelog(LOG_ERR,"card_state=[%s]",card.state_id); goto L_RETU; } //转账不允许转小数金额 if((rPack->lvol5)%100>0) { *pRetCode=E_TRANS_TRANSMONEY_OUTRANGE; writelog(LOG_ERR,"Trans money is not a integer!,transmoney=[%f]",rPack->lvol5/100.0); goto L_RETU; } //开始填充流水数据 //流水号 ret=getNewUniqNo(KEYTYPE_TRADESERIAL, &unique); if(ret) { *pRetCode=E_TRANS_UNKNOW_ERROR; writelog(LOG_ERR,"Create serial_no error,error code=[%d]",ret); goto L_RETU; } tradeserial.serial_no=D2I(unique); //记录流水号,作为冲正使用 temp_serial_no=tradeserial.serial_no; tradeserial.other_seri_no=rPack->lvol0; //上传端流水号 tradeserial.serial_type=TXCODE_BANK_SCHOOL; //交易代码 tradeserial.serial_state=SERISTAT_NODEBT; //流水状态 tradeserial.card_id=atoi(rPack->sserial0); tradeserial.purse_id=0; tradeserial.in_balance=double((rPack->lvol6)/100.00); //入卡金额 tradeserial.out_balance=tradeserial.in_balance; //出卡金额 tradeserial.trade_count=rPack->lvol1+1; //当前卡中交易次数 ret=get_datetime_from_db(tradeserial.operate_date,tradeserial.operate_time); if(ret) { writelog(LOG_ERR,"get_datetime_from_db error,error code=[%d]",ret); getsysdate(tradeserial.operate_date); getsystime(tradeserial.operate_time); } Strncpy_t(tradeserial.collect_date,tradeserial.operate_date,sizeof(tradeserial.collect_date)); //采集日期 Strncpy_t(tradeserial.collect_time,tradeserial.operate_time,sizeof(tradeserial.collect_time)); //采集时间 Strncpy_t(tradeserial.enteract_date,logicdate,sizeof(tradeserial.enteract_date)); //入帐日期 Strncpy_t(tradeserial.enteract_time,tradeserial.operate_time,sizeof(tradeserial.enteract_time)); //入帐时间 tradeserial.maindevice_id=GetTransferSystemId(); //子系统号码 tradeserial.device_id=atoi(rPack->sorder2); //终端ID tradeserial.trade_fee=(rPack->lvol5)/100.0; //转帐金额 Strncpy_t(tradeserial.b_act_id,rPack->scust_auth,sizeof(tradeserial.b_act_id)); tradeserial.sys_id=rPack->lvol2; //表示银行 tradeserial.condition_id=SELF_TRANS; //自动/自助转帐标识 tradeserial.customer_id=card.cosumer_id; Strncpy_t(tradeserial.oper_code,OPER_SYSTEM_KEY,sizeof(tradeserial.oper_code)); //操作员代码 //判断转帐金额是否超出钱包最大限额 ret=DB_t_aif_account_read_by_card_id_and_purse_id(card.card_id, PURSE_NO_ONE,&tAccount); if(ret) { writelog(LOG_ERR,"DB_t_aif_account_read_by_card_id_and_purse_id ret[%d]card_id[%d]",ret,card.card_id); if(DB_NOTFOUND==ret) { *pRetCode=E_TRANS_SCHACC_NOEXIT; goto L_RETU; } else { *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } } ret=GetParameter(GLOBE_MAXCARDBALANCE,sMaxCardBalance); if(ret) { writelog(LOG_ERR,"GetParameter GLOBE_MAXCARDBALANCE error,errcode=[%d]",ret); *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } dMaxCardBalance=atof(sMaxCardBalance); if(amtcmp(tAccount.cur_bala+tradeserial.trade_fee,dMaxCardBalance)>0) { *pRetCode=E_TRANS_TRANSMONEY_OUTRANGE; goto L_RETU; } //读取客户收费类别字段 ret=DB_t_cif_customer_read_lock_by_cur_and_cut_id(card.cosumer_id, &tCustomer); if(ret) { writelog(LOG_ERR,"cut_id[%d]",card.cosumer_id); if(DB_NOTFOUND==ret) { *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } else { *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } } if(0==tCustomer.fee_type) { ret=DB_t_pif_spefee_read_by_dept_code_and_cut_type(tCustomer.classdept_no, tCustomer.cut_type,&tSpeFee); if(ret) { if(DB_NOTFOUND==ret) { tCustomer.fee_type=tCustomer.cut_type; } else { DB_t_cif_customer_free_lock_cur(); writelog(LOG_ERR,"DB_t_pif_spefee_read_by_dept_code_and_cut_type error,errcode=[%d]",ret); *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } } else { tCustomer.fee_type=tSpeFee.fee_type; } } DB_t_cif_customer_free_lock_cur(); //记录流水数据,用于提供正确的流水号,以及银行业务不成功供查询 ret=DB_t_tif_tradeserial_add(&tradeserial); if(ret) { *pRetCode=E_TRANS_UNKNOW_ERROR; writelog(LOG_ERR,"Insert t_tif_tradeserial table error,error code=[%d]",ret); goto L_RETU; } ret=db_commit(); if(ret) { *pRetCode=E_DB_COMMIT; writelog(LOG_ERR,"db_commit error,error code=[%d]",ret); goto L_RETU; } //填写入账结构,问问闻剑 memset(&IA,0,sizeof(IA)); des2src(IA.sArrInActno[0],tAccount.account_id); //贷方帐户,持卡人账户 des2src(IA.sArrInActno[2],rPack->sstation0); //借方帐号,由前置机上传 switch (rPack->lvol3) { case 4: IA.iArrInFeeSwitch[1] = 1; break; case 5: IA.iArrInFeeSwitch[1] = 0; break; default: break; } IA.iCardNo=card.card_id; IA.iFeeType=tCustomer.fee_type; IA.dArrInAmt[0]=tradeserial.trade_fee; writelog(LOG_ERR,"借方帐号=[%d]",atoi(rPack->sstation0)); ret=process(&IA,&tradeserial); if(ret) { writelog(LOG_ERR,"process err,errcode[%d]",ret); *pRetCode=E_TRANS_UNKNOW_ERROR; goto L_RETU; } sprintf(sDebugMsg,"流水号:%d ",IA.iSerialNo); for(i=1;i<=IA.iOutTxTypeCnt;i++) { switch(IA.iArrOutTxType[i]) { case TXTYPE_TOLL_DEPOSIT: case TXTYPE_DEDUCT_DEPOSIT: case TXTYPE_RETURN_DEPOSIT: tradeserial.deposit_fee=IA.dArrOutAmt[i]; break; case TXTYPE_PRE_TOLL_BOARD: case TXTYPE_TOLL_BOARD: case TXTYPE_DEDUCT_BOARD: case TXTYPE_RETURN_BOARD: case TXTYPE_BANK_PRE_TOLL_BOARD: tradeserial.boardfee=IA.dArrOutAmt[i]; break; case TXTYPE_TOLL_CHARGE: tradeserial.in_fee=IA.dArrOutAmt[i]; break; case TXTYPE_BANK_TRANSFER: trans_amt=IA.dArrOutAmt[i]; break; default: break; } if(amtcmp(IA.dArrOutAmt[i],0)!=0) { sprintf(sMsg,"%s:%.2lf元 ",IA.sArrOutTxName[i],IA.dArrOutAmt[i]); strcat(sDebugMsg,sMsg); } } sprintf(sMsg,"充值前卡余额:%.2lf 转帐后卡余额:%.2lf ",IA.dInCardBala,IA.dOutCardBala); strcat(sDebugMsg,sMsg); writelog(LOG_DEBUG,sDebugMsg); out_pack->damt0=tradeserial.out_balance; out_pack->damt1=tradeserial.trade_fee; out_pack->damt2=tradeserial.boardfee; out_pack->lvol1=tradeserial.serial_no; out_pack->lvol2=D2I(tradeserial.out_balance*100.0); des2src(out_pack->semp_no, tradeserial.operate_date); des2src(out_pack->sbank_code, tradeserial.operate_time); PutRow(handle,out_pack,pRetCode,szMsg); //业务结束后,回滚事务 ret=db_rollback(); if(ret) { *pRetCode=E_DB_ROLLBACK; writelog(LOG_ERR,"db_rollback error,error code=[%d]",ret); goto L_RETU; } return 0; L_RETU: return -1; }
//查询校园卡转帐流水 int Pos_QuerySerial(INNER_TRANS_REQUEST * pNode,TRUSERID *handle,int *pRetCode,char *szMsg) { char key[32+1]=""; char pwd[32+1]=""; //char account_id[16+1]=""; char account_pwd[6+1]=""; int ret=0; int cnt=0; //double unique=0.0; INNER_TRANS_REQUEST from_pos; T_t_tif_tradeserial tradeserial; //卡操作流水表 T_t_aif_account account; T_t_pif_card card; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); memset(&from_pos,0,sizeof(from_pos)); memset(&account,0,sizeof(account)); memset(&card,0,sizeof(card)); memcpy(&from_pos,pNode,sizeof(from_pos)); //判断设备是否登陆 if(0!=device_login_yes_or_no(atoi(from_pos.TerminalId))) { writelog(LOG_ERR,"Device don't login"); return E_TRANS_TERM_NOLOGIN; } ret=DB_t_pif_card_read_by_card_id(atoi(from_pos.CardNo),&card); if(ret) { writelog(LOG_ERR,"DB_t_pif_card_read_lock_by_cur_and_card_id error,errcode=[%d]",ret); //sprintf(pNode->RetCode,"%d",E_TRANS_UNKNOW_ERROR); return E_TRANS_SCHACC_NOEXIT; } strcpy(key,STATIC_SEED_KEY); Strncpy_t(account_pwd, from_pos.AccountPwd,sizeof(account_pwd)); EncodePwd(key,account_pwd,pwd, 0); //判断卡密码是否正确 if(0!=memcmp(pwd,card.password,sizeof(pwd))) { writelog(LOG_ERR,"Card password error,clear_pwd[%s],input_pwd=[%s],db_pwd=[%s]",account_pwd,pwd,card.password); //sprintf(pNode->RetCode,"%d",E_TRANS_SCHCARD_PWDERR); return E_TRANS_SCHCARD_PWDERR; } if(strncmp(card.state_id,TYPE_YES,1)!=0) { DB_t_pif_card_free_lock_by_cur(); writelog(LOG_ERR,"card_state=[%s]",card.state_id); return E_TRANS_SCHACC_DESTORY; } if(STATE_TRUE==card.state_id[CARDSTAT_TYPE_LOST]) { DB_t_pif_card_free_lock_by_cur(); writelog(LOG_ERR,"card_state=[%s]",card.state_id); return E_TRANS_SCHCARD_LOSTING; } if(STATE_TRUE==card.state_id[CARDSTAT_TYPE_FREEZE]) { DB_t_pif_card_free_lock_by_cur(); writelog(LOG_ERR,"card_state=[%s]",card.state_id); return E_TRANS_SCHCARD_FREEZE; } ret=DB_t_tif_tradeserial_open_select_by_cur3_and_serial_type_and_card_id(TRADE_INNER_TRANS,card.card_id); if(ret) { db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ALERT,"declare cursor err sqlcode[%d]",ret); return E_TRANS_UNKNOW_ERROR; } SetCol(handle,0); SetCol(handle,F_SCLOSE_EMP,F_SORDER0,F_SORDER1,F_SSERIAL1,F_LVOL0,F_LVOL1,F_SDATE0,F_STIME0,F_SDATE1,F_STIME1,F_SCUST_NO,F_SCHANGE_EMP,F_SSERIAL0,F_LVOL2,F_SCUST_AUTH,F_SSTATUS1,F_SEMP_PWD,F_SEMP_PWD2,F_SSTATION0,F_SSTATION1,F_SORDER2,0); while(1) { ret=DB_t_tif_tradeserial_fetch_select_by_cur3(&tradeserial); if(ret) { DB_t_tif_tradeserial_close_select_by_cur3(); if(ret==DB_NOTFOUND) { if(cnt==0) { writelog(LOG_DEBUG,"There havn't record from t_tif_tradeserial table!"); break; } else break; } else return E_TRANS_UNKNOW_ERROR; } cnt++; memcpy(from_pos.TradeDate,tradeserial.operate_date,sizeof(from_pos.TradeDate)); memcpy(from_pos.TradeTime,tradeserial.operate_time,sizeof(from_pos.TradeTime)); sprintf(from_pos.CardNo,"%d",tradeserial.card_id); memcpy(from_pos.BankCardNo,tradeserial.b_act_id,sizeof(from_pos.BankCardNo)); sprintf(from_pos.TransMoney,"%d",int(tradeserial.trade_fee)*100); if(tradeserial.serial_state!=2) { sprintf(from_pos.RetCode,"%s","失败"); } else sprintf(from_pos.RetCode,"%s","成功"); //开始返回应答包 Strncpy_t(out_pack->sclose_emp,from_pos.TradeCode,sizeof(out_pack->sclose_emp)); Strncpy_t(out_pack->sorder0,from_pos.TransMoney,sizeof(out_pack->sorder0)); Strncpy_t(out_pack->sorder1,from_pos.ExtraMoney,sizeof(out_pack->sorder1)); Strncpy_t(out_pack->sserial1,from_pos.AccountMoney,sizeof(out_pack->sserial1)); out_pack->lvol0=from_pos.SendNo; out_pack->lvol1=from_pos.RecvNo; memcpy(out_pack->sdate0,from_pos.TradeDate,sizeof(from_pos.TradeDate)); memcpy(out_pack->stime0,from_pos.TradeTime,sizeof(from_pos.TradeTime)); memcpy(out_pack->sdate1,from_pos.BankDate,sizeof(from_pos.BankDate)); memcpy(out_pack->stime1,from_pos.BankTime,sizeof(from_pos.BankTime)); Strncpy_t(out_pack->scust_no,from_pos.Balance,sizeof(out_pack->scust_no)); Strncpy_t(out_pack->schange_emp,from_pos.RetCode,sizeof(out_pack->schange_emp)); Strncpy_t(out_pack->sserial0,from_pos.CardNo,sizeof(out_pack->sserial0)); out_pack->lvol2=from_pos.Notecase; Strncpy_t(out_pack->scust_auth,from_pos.BankCardNo,sizeof(out_pack->scust_auth)); sprintf(out_pack->sstatus1,"%c",from_pos.MngFeeFlag); Strncpy_t(out_pack->semp_pwd,from_pos.AccountPwd,sizeof(out_pack->semp_pwd)); Strncpy_t(out_pack->semp_pwd2,from_pos.AccountNewPwd,sizeof(out_pack->semp_pwd2)); Strncpy_t(out_pack->sstation0,from_pos.BankCardPwd,sizeof(out_pack->sstation0)); Strncpy_t(out_pack->sstation1,from_pos.BankCardNewPwd,sizeof(out_pack->sstation1)); Strncpy_t(out_pack->sorder2,from_pos.TerminalId,sizeof(out_pack->sorder2)); // printf("LINE:%d\n",__LINE__); PutRow(handle,out_pack,pRetCode,szMsg); if(cnt>=10) { DB_t_tif_tradeserial_close_select_by_cur3(); break; } } // printf("LINE:%d\n",__LINE__); T_t_tif_tradeserial_his tradeserial_his; memset(&tradeserial_his,0,sizeof(tradeserial_his)); if(cnt<10) { ret=DB_t_tif_tradeserial_his_open_select_by_cur1_and_serial_type_and_card_id(TRADE_INNER_TRANS,card.card_id); if(ret) { db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ALERT,"declare cursor err sqlcode[%d]",ret); return E_TRANS_UNKNOW_ERROR; } // printf("LINE:%d\n",__LINE__); while(1) { ret=DB_t_tif_tradeserial_his_fetch_select_by_cur1(&tradeserial_his); if(ret) { DB_t_tif_tradeserial_his_close_select_by_cur1(); if(ret==DB_NOTFOUND) { writelog(LOG_DEBUG,"There havn't record from t_tif_tradeserial_his table!"); break; } else return E_TRANS_UNKNOW_ERROR; } cnt++; memcpy(from_pos.TradeDate,tradeserial_his.operate_date,sizeof(from_pos.TradeDate)); memcpy(from_pos.TradeTime,tradeserial_his.operate_time,sizeof(from_pos.TradeTime)); sprintf(from_pos.CardNo,"%d",tradeserial_his.card_id); memcpy(from_pos.BankCardNo,tradeserial_his.b_act_id,sizeof(from_pos.BankCardNo)); sprintf(from_pos.TransMoney,"%d",int(tradeserial_his.trade_fee)*100); if(tradeserial_his.serial_state!=2) { sprintf(from_pos.RetCode,"%s","失败"); } else sprintf(from_pos.RetCode,"%s","成功"); //开始返回应答包 Strncpy_t(out_pack->sclose_emp,from_pos.TradeCode,sizeof(out_pack->sclose_emp)); Strncpy_t(out_pack->sorder0,from_pos.TransMoney,sizeof(out_pack->sorder0)); Strncpy_t(out_pack->sorder1,from_pos.ExtraMoney,sizeof(out_pack->sorder1)); Strncpy_t(out_pack->sserial1,from_pos.AccountMoney,sizeof(out_pack->sserial1)); out_pack->lvol0=from_pos.SendNo; out_pack->lvol1=from_pos.RecvNo; Strncpy_t(out_pack->sdate0,from_pos.TradeDate,sizeof(out_pack->sdate0)); Strncpy_t(out_pack->stime0,from_pos.TradeTime,sizeof(out_pack->stime0)); Strncpy_t(out_pack->sdate1,from_pos.BankDate,sizeof(out_pack->sdate1)); Strncpy_t(out_pack->stime1,from_pos.BankTime,sizeof(out_pack->stime1)); Strncpy_t(out_pack->scust_no,from_pos.Balance,sizeof(out_pack->scust_no)); Strncpy_t(out_pack->schange_emp,from_pos.RetCode,sizeof(out_pack->schange_emp)); Strncpy_t(out_pack->sserial0,from_pos.CardNo,sizeof(out_pack->sserial0)); out_pack->lvol2=from_pos.Notecase; Strncpy_t(out_pack->scust_auth,from_pos.BankCardNo,sizeof(out_pack->scust_auth)); sprintf(out_pack->sstatus1,"%c",from_pos.MngFeeFlag); Strncpy_t(out_pack->semp_pwd,from_pos.AccountPwd,sizeof(out_pack->semp_pwd)); Strncpy_t(out_pack->semp_pwd2,from_pos.AccountNewPwd,sizeof(out_pack->semp_pwd2)); Strncpy_t(out_pack->sstation0,from_pos.BankCardPwd,sizeof(out_pack->sstation0)); Strncpy_t(out_pack->sstation1,from_pos.BankCardNewPwd,sizeof(out_pack->sstation1)); Strncpy_t(out_pack->sorder2,from_pos.TerminalId,sizeof(out_pack->sorder2)); PutRow(handle,out_pack,pRetCode,szMsg); if(cnt>=10) { DB_t_tif_tradeserial_his_close_select_by_cur1(); break; } } } writelog(LOG_INFO,"query trans record succeed!"); return 0; }
int F900077(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { int ret=0; char tradecode[6+1]=""; // 此处检查银行登陆状态,可能过于严格,可转移到switch中需要银行登陆的功能中 if(!BANK_LOGIN) { *pRetCode=E_TRANS_BANK_NETERR; return *pRetCode; } INNER_TRANS_REQUEST from_pos,to_pos; //BANK_TRANS_REQUEST from_bank; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); // 用于根据请求包整理本CPACK包的头清空包头位图和包体中的数据 ResetNormalCPack(&aPack,0,1); //初始化交换结构 memset(&from_pos,0,sizeof(from_pos)); //从输入cpack中提取数据,填充到通用交换数据结构中 memcpy(from_pos.TradeCode,in_pack->sclose_emp,sizeof(from_pos.TradeCode)); //交易代码 memcpy(from_pos.TransMoney,in_pack->sorder0,sizeof(from_pos.TransMoney)); //交易金额 memcpy(from_pos.ExtraMoney,in_pack->sorder1,sizeof(from_pos.ExtraMoney)); //附加交易金额 Strncpy_t(from_pos.AccountMoney,in_pack->sserial1,sizeof(from_pos.AccountMoney)); //校园卡帐户金额 from_pos.SendNo=in_pack->lvol0; //发起方流水号 from_pos.RecvNo=in_pack->lvol1; //接受方流水号 memcpy(from_pos.TradeDate,in_pack->sdate0,sizeof(from_pos.TradeDate)); //交易日期 YYYYMMDD memcpy(from_pos.TradeTime,in_pack->stime0,sizeof(from_pos.TradeTime)); //交易时间 HHMMSS memcpy(from_pos.BankDate,in_pack->sdate1,sizeof(from_pos.BankDate)); //银行处理日期 memcpy(from_pos.BankTime,in_pack->stime1,sizeof(from_pos.BankTime)); //银行处理时间 memcpy(from_pos.Balance,in_pack->scust_no,sizeof(from_pos.Balance)); //银行卡余额 memcpy(from_pos.RetCode,in_pack->schange_emp,sizeof(from_pos.RetCode)); //交易结果 memcpy(from_pos.CardNo,in_pack->sserial0,sizeof(from_pos.CardNo)); //校园卡卡号 from_pos.Notecase=in_pack->lvol2; //校园卡对应钱包号 memcpy(from_pos.BankCardNo,in_pack->scust_auth,sizeof(from_pos.BankCardNo)); //银行卡号 from_pos.MngFeeFlag=atoi(in_pack->sstatus1); //手续费标志 memcpy(from_pos.AccountPwd,in_pack->semp_pwd,sizeof(from_pos.AccountPwd)); //校园账户密码 memcpy(from_pos.AccountNewPwd,in_pack->semp_pwd2,sizeof(from_pos.AccountNewPwd)); //校园账户新密码 memcpy(from_pos.BankCardPwd,in_pack->sstation0,sizeof(from_pos.BankCardPwd)); //银行账户密码 memcpy(from_pos.BankCardNewPwd,in_pack->sstation1,sizeof(from_pos.BankCardNewPwd)); //银行账户新密码 memcpy(from_pos.TerminalId,in_pack->sorder2,sizeof(from_pos.TerminalId)); //终端编号 //判断交易代码,进行相应处理 //switch(241031) //int temp=atoi(from_pos.TradeCode); //printf("this is test record:atoi(from_pos.TradeCode)=[%d]\n",temp); SetCol(handle,0); SetCol(handle,F_SCLOSE_EMP,F_SORDER0,F_SORDER1,F_SSERIAL1,F_LVOL0,F_LVOL1,F_SDATE0,F_STIME0,F_SDATE1,F_STIME1,F_SCUST_NO,F_SCHANGE_EMP,F_SSERIAL0,F_LVOL2,F_SCUST_AUTH,F_SSTATUS1,F_SEMP_PWD,F_SEMP_PWD2,F_SSTATION0,F_SSTATION1,F_SORDER2,0); memcpy(tradecode,from_pos.TradeCode,sizeof(from_pos.TradeCode)); tradecode[6]=0; writelog(LOG_INFO,"Trade start,trade code=[%6.6s],card_id=[%s],bankcardno=[%s],TerminalId=[%s]!",tradecode,from_pos.CardNo,from_pos.BankCardNo,from_pos.TerminalId); switch(atoi(tradecode)) { case TRADE_INNER_QUERYBANK: ret=Pos_QueryBank(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_TRANS: ret=Pos_Transfer(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_FEE: ret=Pos_Fee(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_ADDRELATION: ret=Pos_AddRelation(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_DELRELATION: ret=Pos_DelRelation(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_POSLOGIN: ret=Pos_Login(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_QUERYINNER: ret=Pos_QuerySchool(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_CHANGEPWD: ret=Pos_ChangePwd(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_LOST: ret=Pos_LostCard(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_UNLOST: ret=Pos_UnlostCard(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } memcpy(&to_pos,&from_pos,sizeof(to_pos)); break; case TRADE_INNER_QUERYSERIAL: ret=Pos_QuerySerial(&from_pos,handle,pRetCode,szMsg); if(ret) { *pRetCode=ret; goto L_RETU; } return 0; case TRADE_INNER_WRITEERRCARD: ret=Pos_WriteErrCard(&from_pos); if(ret) { *pRetCode=ret; goto L_RETU; } break; //前台发起部分,包括签到、签退、对帐等 case TRADE_INNER_LOGIN: writelog(LOG_ERR,"start inner login!"); break; //查询补助信息 case TRADE_INNER_QUERYSUBSIDY: ret=query_subsidy(in_pack,handle,pRetCode,szMsg); if(ret) { *pRetCode=ret; goto L_RETU; } return 0; //领取补助 case TRADE_INNER_GETSUBSIDY: ret=get_subsidy(in_pack,handle,pRetCode,szMsg); if(ret) { *pRetCode=ret; goto L_RETU; } return 0; default: writelog(LOG_INFO,"This trade can't supplied,tradecode=[%d]!",atoi(tradecode)); *pRetCode=E_TRANS_FUNC_NONSUPPORT; goto L_RETU; } Strncpy_t(out_pack->sclose_emp,to_pos.TradeCode,sizeof(out_pack->sclose_emp)); Strncpy_t(out_pack->sorder0,to_pos.TransMoney,sizeof(out_pack->sorder0)); Strncpy_t(out_pack->sorder1,to_pos.ExtraMoney,sizeof(out_pack->sorder1)); Strncpy_t(out_pack->sserial1,to_pos.AccountMoney,sizeof(out_pack->sserial1)); out_pack->lvol0=to_pos.SendNo; out_pack->lvol1=to_pos.RecvNo; Strncpy_t(out_pack->sdate0,to_pos.TradeDate,sizeof(out_pack->sdate0)); Strncpy_t(out_pack->stime0,to_pos.TradeTime,sizeof(out_pack->stime0)); Strncpy_t(out_pack->sdate1,to_pos.BankDate,sizeof(out_pack->sdate1)); Strncpy_t(out_pack->stime1,to_pos.BankTime,sizeof(out_pack->stime1)); Strncpy_t(out_pack->scust_no,to_pos.Balance,sizeof(out_pack->scust_no)); Strncpy_t(out_pack->schange_emp,to_pos.RetCode,sizeof(out_pack->schange_emp)); Strncpy_t(out_pack->sserial0,to_pos.CardNo,sizeof(out_pack->sserial0)); out_pack->lvol2=to_pos.Notecase; Strncpy_t(out_pack->scust_auth,to_pos.BankCardNo,sizeof(out_pack->scust_auth)); sprintf(out_pack->sstatus1,"%c",to_pos.MngFeeFlag); Strncpy_t(out_pack->semp_pwd,to_pos.AccountPwd,sizeof(out_pack->semp_pwd)); Strncpy_t(out_pack->semp_pwd2,to_pos.AccountNewPwd,sizeof(out_pack->semp_pwd2)); Strncpy_t(out_pack->sstation0,to_pos.BankCardPwd,sizeof(out_pack->sstation0)); Strncpy_t(out_pack->sstation1,to_pos.BankCardNewPwd,sizeof(out_pack->sstation1)); Strncpy_t(out_pack->sorder2,to_pos.TerminalId,sizeof(out_pack->sorder2)); PutRow(handle,out_pack,pRetCode,szMsg); writelog(LOG_INFO,"Trade succeed,trade code=[%6.6s]!",to_pos.TradeCode); return 0; L_RETU: //writelog(LOG_ERR,"Trade faild,trade code=[%s],return code=[%d]!",to_pos.TradeCode,*pRetCode); return *pRetCode; L_RET_BANK_NOT_LOGIN: writelog(LOG_ERR,"Trade faild,trade code=[%s],return code=[%d]!",to_pos.TradeCode,*pRetCode); *pRetCode=E_TRANS_BANK_NETERR; return *pRetCode; }
int F900088(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { char hi_operator[10+1]; char szNull[] =""; int ret=0; // 解析操作员代码 Strncpy_t(hi_operator, in_pack->scust_no, sizeof(hi_operator)); // 输入参数检查 trim(hi_operator); if (strcmp (szNull,hi_operator) == 0) { *pRetCode=E_INPUT_NOOPERATOR; writelog(LOG_ERR,"hi_operator,hi_operator[%s]errcode[%d]!",hi_operator,E_INPUT_NOOPERATOR); goto L_RETU; } //停止入帐,改数据库全局参数表中的入帐标志 ret=StopInBalance(); if(ret) { writelog(LOG_ERR,"修改日结标志出错!"); return ret; } //生成运行情况报表 ret=CreateActiveReport(); if(ret) { writelog(LOG_ERR,"生成运行情况报表出错!"); return ret; } //生成操作情况报表 ret=CreateOperReport(); if(ret) { writelog(LOG_ERR,"生成操作情况表失败!"); return ret; } //生成普通商户结算报表 ret=CreateShopReport(); if(ret) { writelog(LOG_ERR,"生成商户结算报表失败!"); return ret; } //生成资产负债报表 ret=CreateRichDebtReport(); if(ret) { writelog(LOG_ERR,"生成资产负债表失败!"); return ret; } //手动结帐结束,启动服务,接收新的入帐流水 ret=Startup(); if(ret) { writelog(LOG_ERR,"系统启动服务失败!"); return ret; } writelog(LOG_ERR,"Manual balance is succeed![%d]",ret); //ERR_DEAL("结帐成功完成!",ret); return 0; L_RETU: return *pRetCode; }