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

📄 cmppqueryresponse.java

📁 短信网关发送接受平台。
💻 JAVA
字号:
import java.lang.*;
import java.net.*;
import java.io.*;

import CMPPCommandID;
import CMPPPacket;

public class CMPPQueryResponse extends CMPPPacket
{
	public String time = null;//时间(精确到日)
	public byte query_type = 0;//查询类别
	public String query_code = null;//查询码(业务类型)
	public int MT_TLMsg = 0;;//从SP接收信息总数
	public int MT_TLUsr = 0;//从SP接收用户总数
	public int MT_Scs = 0;//成功转发数量
	public int MT_WT = 0;//待转发的数量
	public int MT_FL = 0;//转发失败的数量
	public int MO_Scs = 0;//向SP成功发送的数量
	public int MO_WT = 0;//向SP待转发的数量
	public int MO_FL = 0;//向SP送打失败的数量
	
	public CMPPQueryResponse(int sequence_id)
	{
		super(CMPPCommandID.CMPP_QUERY_RESPONSE,sequence_id);
	}
	
	public CMPPQueryResponse(CMPPPacket packet)
	{
		super(packet);
	}
	
	public boolean isValid()
	{
		if(command_id != CMPPCommandID.CMPP_QUERY_RESPONSE)
		{
			CMPPLog.log("CMPPQueryResponse.isValid : not a CMPP_QUERY_RESPONSE command !",
				CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_ISVALID_METHOD);
			return false;
		}
		
		if(time == null || time.length() != 8)
		{
			CMPPLog.log("CMPPQueryResponse.isValid : invalid time !",
				CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_ISVALID_METHOD);
			return false;
		}
		
		if(query_type != 0 && query_type != 1)
		{
			CMPPLog.log("CMPPQueryResponse.isValid : invalid query_type !",
				CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_ISVALID_METHOD);
			return false;
		}
		

		if(query_code == null || query_code.length() != 10)
		{
			CMPPLog.log("CMPPQueryResponse.isValid : invalid query_code !",
				CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_ISVALID_METHOD);
			return false;
		}
		
		return true;
	}

	public void dump(long lMethod)
	{
		CMPPLog.log("\ttime = \"" + time + "\"",
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tquery_type = " + query_type 
			+ " [" + (query_type == 0 ? "总数查询" : "按业务代码查询") + "]",
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tquery_code = \"" + query_code + "\"",
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMT_TLMsg = " + MT_TLMsg,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMT_TLUsr = " + MT_TLUsr,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMT_Scs = " + MT_Scs,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);
			
		CMPPLog.log("\tMT_WT = " + MT_WT,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMT_FL = " + MT_FL,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMO_Scs = " + MO_Scs,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);
			
		CMPPLog.log("\tMO_WT = " + MO_WT,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);

		CMPPLog.log("\tMO_FL = " + MO_FL,
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | lMethod);
	}
	
	public void wrap()
		throws CMPPException
	{
		CMPPLog.log("CMPPQueryResponse.wrap : wrap elements !",
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_WRAP_METHOD);

		dump(CMPPLog.LOG_WRAP_METHOD);

		insertInteger(MO_FL);
		insertInteger(MO_WT);
		insertInteger(MO_Scs);
		insertInteger(MT_FL);
		insertInteger(MT_WT);
		insertInteger(MT_Scs);
		insertInteger(MT_TLUsr);
		insertInteger(MT_TLMsg);
		insertString(query_code);
		insertByte(query_type);
		insertString(time);	
	}
	
	public void unwrap()
		throws CMPPException
	{
		CMPPLog.log("CMPPQueryResponse.unwrap : unwrap elements !",
			CMPPLog.LOG_CMPP_QUERY_RESPONSE | CMPPLog.LOG_UNWRAP_METHOD);

		time = getString(8);
		query_type = getByte();
		query_code = getString(10);
		
		MT_TLMsg = getInteger();
		MT_TLUsr = getInteger();
		MT_Scs = getInteger();
		MT_WT = getInteger();
		MT_FL = getInteger();
		MO_Scs = getInteger();
		MO_WT = getInteger();
		MO_FL = getInteger();
			
		dump(CMPPLog.LOG_UNWRAP_METHOD);
	}
}

⌨️ 快捷键说明

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