⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tuxedo.cpp

📁 本源码为移动公司话费查询中间件TUXEDO使用的实例
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	}

	
	//if(startindex==0)
	if(!m_bFlag1)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(13);    //主叫号
		m_pShppRequest->AddPrintField(12);    //叫呼转号码
		m_pShppRequest->AddPrintField(13);//4日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(5,2);   //5时长(秒)
		m_pShppRequest->AddPrintField(6,2);   //6话费
		m_pShppRequest->PrintLine("语音话单-呼转语音话单",LPLCENTER);
//		m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("主叫号码     呼转号码        日期     时长 话费 ");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_bFlag1=TRUE;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 11;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
				input2.num[i][j]='\0';
			}
			strcpy(input1.num[0],"15");strcpy(input1.num[1],"15");strcpy(input1.num[2],"15");
			strcpy(input1.num[3],"20");strcpy(input1.num[4],"5");strcpy(input1.num[5],"6");
			strcpy(input1.num[6],"4");strcpy(input1.num[7],"11");strcpy(input1.num[8],"10");
			strcpy(input1.num[9],"10");strcpy(input1.num[10],"6");
			
			input2.count = 7;//1参数 第1,2是否可能超长  2参数  那个是时间  3参数 费用在那几个字段内 
			strcpy(input2.num[0],"1");strcpy(input2.num[1],"3");strcpy(input2.num[2],"4");
			strcpy(input2.num[3],"6");strcpy(input2.num[4],"9");strcpy(input2.num[5],"10");			
			strcpy(input2.num[6],"11");strcpy(input2.num[7],"4");
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
	}
	else
	{	
		//rebuf=rebuf+114;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>2)
		{
			//	str=rebuf;
			countindex=0;
			//if((countindex=putongaddline(rebuf,input1,input2))>0)
			try
			{
				countindex=daishouaddline(rebuf,12,4);	
			}
			catch(...)
			{
				printf("呼转语音分解函数%s %d\n",phone,__LINE__);
				return -1;
			}
			if(countindex>0)
			{//加记录到内存
				try
					{				
					tempfee=0.0;
					tempfee=atof(Param[8]);//费用
					tempfee=tempfee+atof(Param[9]);//费用
					tempfee=tempfee+atof(Param[10]);//费用
					m_fFeeCount=m_fFeeCount+tempfee;

					char tempbuf1[6];
					memset(tempbuf1,'\0',6);
					sprintf(tempbuf1,"%.2f",tempfee);
					
					//for(int j=0;j<input2.count-4;j++)
					//	m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
					m_pShppRequest->AddFieldVal(Param[0],strlen(Param[0]));
					m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
					m_pShppRequest->AddFieldVal(Param[3],strlen(Param[3]));
					m_pShppRequest->AddFieldVal(Param[5],strlen(Param[5]));
					m_pShppRequest->AddFieldVal(tempbuf1,strlen(tempbuf1));
				}
				catch(...)
				{
					printf("呼转语音分解函数%s %d\n",phone,__LINE__);
					return -1;					
				}
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}
		}
		
	}
	
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"呼转语音话单 总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"呼转语音话单 总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}
	
	return 0;
}
//==========================================
int CTuxedo::vpmn(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0)&&(strstr(rebuf,"-------")==NULL))
		return 0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	if(strstr(rebuf,"VPMN基本话费")!=NULL)
		return 0;

	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(13);    //1对方号码
		m_pShppRequest->AddPrintField(4);     //2方式
		m_pShppRequest->AddPrintField(13);    //3日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(6,2);   //4时长(秒)
		m_pShppRequest->AddPrintField(6,2);   //5话费
		m_pShppRequest->AddPrintField(7,2);   //6本方所在地		
		m_pShppRequest->PrintLine("VPMN语音话单",LPLCENTER);
		m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 13;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
			    input2.num[i][j]='\0';
			}
		strcpy(input1.num[0],"15");strcpy(input1.num[1],"15");strcpy(input1.num[2],"20");
		strcpy(input1.num[3],"5");strcpy(input1.num[4],"5");strcpy(input1.num[5],"7");
		strcpy(input1.num[6],"7");strcpy(input1.num[7],"7");strcpy(input1.num[8],"5");
		strcpy(input1.num[9],"9");strcpy(input1.num[10],"7");strcpy(input1.num[11],"7");
		strcpy(input1.num[12],"6");

		input2.count = 6;//count 里面存放的几个是时间
			strcpy(input2.num[0],"1");strcpy(input2.num[1],"2");strcpy(input2.num[2],"3");
			strcpy(input2.num[3],"5");strcpy(input2.num[4],"14");strcpy(input2.num[5],"10");			
			strcpy(input2.num[6],"3");		
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
//		number=number-(str-rebuf);	
	}
	else
	{	
//		rebuf=rebuf+114;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>2)
		{
			try
			{
				countindex=daishouaddline(rebuf,14,3);	
			}
			catch(...)
			{
				printf("vpmn分解函数%s %d\n",phone,__LINE__);
				return -1;
			}
			if(countindex>0)
			{//加记录到内存
				m_fFeeCount=m_fFeeCount+atof(Param[13]);//费用
				
				try
				{
					if(strncmp(Param[0],phone,strlen(phone))==0)
					{
						m_pShppRequest->AddFieldVal(Param[1],strlen(rtrim(Param[1])));
						m_pShppRequest->AddFieldVal("主",2);
					}
					else
					{
						m_pShppRequest->AddFieldVal(Param[0],strlen(rtrim(Param[0])));
						m_pShppRequest->AddFieldVal("被",2);					
					}	
					/*for(int j=2;j<input2.count;j++)
					{
						if(strlen(rtrim(Param[atoi(input2.num[j])-1]))!=0)
							m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
						else
							m_pShppRequest->AddFieldVal("无",2);
					}*/
					m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
					m_pShppRequest->AddFieldVal(Param[4],strlen(Param[4]));
					m_pShppRequest->AddFieldVal(Param[13],strlen(Param[13]));
					m_pShppRequest->AddFieldVal(Param[9],strlen(Param[9]));
				}
				catch(...)
				{
					printf("vpmn分解函数%s %d\n",phone,__LINE__);
					return -1;					
				}
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}				
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}			
		}
	}
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"VPMN语音话单 总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"VPMN语音话单 总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}

	return 0;
}
//==========================================
int CTuxedo::yuyinzazhi(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0)&&(strstr(rebuf,"-------")==NULL))
		return 0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(11);    //1对方号码
		m_pShppRequest->AddPrintField(14);     //2方式
		m_pShppRequest->AddPrintField(7);    //3日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(11);   //4时长(秒)
		m_pShppRequest->AddPrintField(6,2);   //5话费
		m_pShppRequest->PrintLine("语音话单-语音杂志话单",LPLCENTER);
		//m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("被叫号码      时间      时长    计费类型  信息费");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 6;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
			    input2.num[i][j]='\0';
			}
		strcpy(input1.num[0],"15");strcpy(input1.num[1],"15");strcpy(input1.num[2],"22");
		strcpy(input1.num[3],"11");strcpy(input1.num[4],"11");strcpy(input1.num[5],"11");

		input2.count = 5;//count 里面存放的几个是时间
			strcpy(input2.num[0],"2");strcpy(input2.num[1],"3");strcpy(input2.num[2],"5");
			strcpy(input2.num[3],"6");strcpy(input2.num[4],"7");strcpy(input2.num[5],"3");			
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
	}
	else
	{	
//		rebuf=rebuf+114;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>2)
		{
			//	str=rebuf;
			countindex=0;
			if((countindex=daishouaddline(rebuf,7,3))>0)
			{//加记录到内存
				m_fFeeCount=m_fFeeCount+atof(Param[6]);//费用
			
	//			for(int j=0;j<input2.count;j++)
	//				m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
	            m_pShppRequest->AddFieldVal(Param[1],strlen(Param[1]));
				m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
				m_pShppRequest->AddFieldVal(Param[4],strlen(Param[4]));
				m_pShppRequest->AddFieldVal(Param[5],strlen(Param[5]));
				m_pShppRequest->AddFieldVal(Param[6],strlen(Param[6]));
				
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}
			
		}
	}
	
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"语音杂志话单 总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"语音杂志话单 总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}

	return 0;
}
//==========================================
int CTuxedo::putongduanxin(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	float tempfee = 0.0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	if(strstr(rebuf,"合计")!=NULL)
	{
		endindex=1;
		if((endindex==1)&&(m_nCountLine!=0))
		{
			//处理结尾
			char pList[256];
			m_pShppRequest->PutParameter(s_chSeparator);		
			sprintf(pList,"普通短信话单 总费用:%0.2f元;",m_fFeeCount);
			m_tempfee=m_tempfee+m_fFeeCount;
			m_pShppRequest->PutParameter(pList);
			sprintf(pList,"普通短信话单 总次数:%d次;", m_nCountLine);
			m_tempcount=m_tempcount+m_nCountLine;
			m_pShppRequest->PutParameter(pList);
			m_pShppRequest->PutParameter(s_chSeparator);
			
			//	*m_pfOutFeeCount += m_fFeeCount;
			//	*m_pnLineCount += m_nCountLine;
			//m_pShppRequest->Flush();
			
			m_fFeeCount  = 0.0;
			m_nCountLine = 0;
			startindex   = 0;
			endindex     = 0;
		}
		return 0;
	}

	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(15);    //主叫号
		m_pShppRequest->AddPrintField(5);    //叫呼转号码
		m_pShppRequest->AddPrintField(15);//4日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(7);   //5时长(秒)
		m_pShppRequest->AddPrintField(8);   //6话费
		m_pShppRequest->PrintLine("短信话单-普通短信话单",LPLCENTER);
//		m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("对方号码       方式      日期       费用   状态");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 8;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
				input2.num[i][j]='\0';
			}
			strcpy(input1.num[0],"24");strcpy(input1.num[1],"24");strcpy(input1.num[2],"22");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -