📄 msgqueryusergrouprsp.java
字号:
/**
*
*/
package com.aceway.vas.sjcraw.cbgp201.crm.ugm;
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 MsgQueryUserGroupRsp extends Msg {
private final int LEN_RPE_USER_GROUP=63;
private class UserGroup{
/*
UserGroupID(1) 2 Integer 用户组ID
如果用户组ID为0,则表示为单个来电号码(不属于任何组),此时,Phone、PhoneLabel字段有效;如果用户组ID不为0,则表示为用户组,此时,Phone,PhoneLabel字段无效。
GroupLabel(1) 20 String 用户组标签
Phone(1) 21 String 来电号码
PhoneLabel(1) 20 String 来电号码对应的姓名
*/
public int userGroupId;
public String groupLabel;
public String phone;
public String phoneLabel;
}
/*
Startnum 4 Integer 起始记录数
Curnum 4 Integer 本次返回记录数
Allnum 4 Integer 记录总数
*/
private int startNum;
private int curNum;
private int allNum;
private Map<Integer,UserGroup> map = new HashMap<Integer,UserGroup>();
public MsgQueryUserGroupRsp(byte[] bytes) {
super(bytes);
ByteBuffer buff = super.getBodyBuffer();
this.startNum = buff.getInt();
this.curNum = buff.getInt();
this.allNum = buff.getInt();
buff = buff.slice();
byte[] msgUserGroup = new byte[buff.capacity()];
if (msgUserGroup.length%LEN_RPE_USER_GROUP==0 && msgUserGroup.length%LEN_RPE_USER_GROUP==curNum )
{
buff.get(msgUserGroup);
buff.flip();
for (int i=0; i<curNum; i++){
byte[] temp = new byte[LEN_RPE_USER_GROUP];
System.arraycopy(msgUserGroup, i*LEN_RPE_USER_GROUP, temp, 0, temp.length);
UserGroup userGroup = new UserGroup();
userGroup.userGroupId = DataFormat.bytes2int(new byte[]{0,0,temp[0], temp[1]});
try {
userGroup.groupLabel = new String(temp, 2, 20, "gbk");
userGroup.phone = new String(temp, 22, 21, "gbk");
userGroup.phoneLabel = new String(temp, 43, 20, "gbk");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.map.put(i, userGroup);
}
}
else{
System.err.print("消息体不正确");
return;
}
}
public int getAllNum() {
return this.allNum;
}
public int getCurNum() {
return this.curNum;
}
public int getStartNum() {
return this.startNum;
}
public String getGroupLabel(int position) {
UserGroup userGroup = this.map.get(Integer.valueOf(position));
return userGroup.groupLabel;
}
public String getPhone(int position) {
UserGroup userGroup = this.map.get(Integer.valueOf(position));
return userGroup.phone;
}
public String getPhoneLabel(int position) {
UserGroup userGroup = this.map.get(Integer.valueOf(position));
return userGroup.phoneLabel;
}
public int getUserGroupId(int position) {
UserGroup userGroup = this.map.get(Integer.valueOf(position));
return userGroup.userGroupId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -