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

📄 msgqueryringgrouprsp.java

📁 同步接收web services请求
💻 JAVA
字号:
/**
 * 
 */
package com.aceway.vas.sjcraw.cbgp201.crm.rgm;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;

import com.aceway.vas.sjcraw.cbgp201.Msg;
import com.aceway.vas.sjcraw.cbgp201.common.DataFormat;

/**
 * @标题: 华为彩铃平台接口规范
 * @说明: 
 * @版权: Copyright(c) 2007 
 * @公司: 北京汉铭信通科技有限公司 
 * @部门: 增值业务部 
 * @作者: 武达
 * @Jun 6, 2007
 */
public class MsgQueryRingGroupRsp extends Msg {
	
	private final int LEN_PRE_PHONE=22;
	/*
Startnum	4	Integer	起始记录数
Curnum	4	Integer	本次返回记录数
Allnum	4	Integer	记录总数
	 */
	private int startNum;
	private int curNum;
	private int allNum;
	private Map<Integer, RingGroup>map = new HashMap<Integer, RingGroup>();
	
	private class RingGroup{
		/*
RingGroupID(1)	2	Integer	铃音组ID 
RingGroupLabel(1)	20	String	铃音组标签(名称)

		 */
		public int ringGroupId;
		public String ringGroupLabel;

	}

	/**
	 * @param bytes
	 */
	public MsgQueryRingGroupRsp(byte[] bytes) {
		super(bytes);
		ByteBuffer buff = super.getBodyBuffer();
		this.startNum = buff.getInt();
		this.curNum = buff.getInt();
		this.allNum = buff.getInt();
		buff = buff.slice();
		byte[] msgPhone = new byte[buff.capacity()];
		if (buff.capacity()%this.LEN_PRE_PHONE==0 && buff.capacity()/this.LEN_PRE_PHONE==this.curNum){
			for (int i=0; i<this.curNum; i++){
				byte[] temp = new byte[LEN_PRE_PHONE];
				System.arraycopy(msgPhone, i*LEN_PRE_PHONE, temp, 0, temp.length);
				RingGroup phone = new RingGroup();
				try {
					
	                phone.ringGroupId = DataFormat.bytes2int(new byte[]{0, 0, temp[1], temp[2]});
	                phone.ringGroupLabel = new String(temp, 2, 20, "gbk");
                } catch (UnsupportedEncodingException e) {
	                e.printStackTrace();
                }
                this.map.put(i, phone);
			}
		}else {
			System.err.print("消息体不正确");
			return;
		}
		
		
		
	}

	public int getAllNum() {
    	return this.allNum;
    }

	public int getCurNum() {
    	return this.curNum;
    }

	public int getStartNum() {
    	return this.startNum;
    }
	public int getRingGroupId(int position) {
		RingGroup phone = (RingGroup)map.get(position);
    	return phone.ringGroupId;
    }
	public String getRingGroupLabel(int position) {
		RingGroup phone = (RingGroup)map.get(position);
    	return phone.ringGroupLabel;
    }

}

⌨️ 快捷键说明

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