mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	添加批量查询用户基本信息功能,没有测试,没有添加超过100验证
This commit is contained in:
		| @ -1,6 +1,9 @@ | ||||
| package me.chanjar.weixin.mp.api; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.mp.bean.WxMpUserQuery; | ||||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | ||||
| import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
|  | ||||
| @ -11,35 +14,55 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
|  */ | ||||
| public interface WxMpUserService { | ||||
|  | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 设置用户备注名接口 | ||||
|    * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=设置用户备注名接口 | ||||
|    * </pre> | ||||
|    * | ||||
|    * @param openid 用户openid | ||||
|    * @param remark 备注名 | ||||
|    */ | ||||
|   void userUpdateRemark(String openid, String remark) throws WxErrorException; | ||||
| 	/** | ||||
| 	 * <pre> | ||||
| 	 * 设置用户备注名接口 | ||||
| 	 * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=设置用户备注名接口 | ||||
| 	 * </pre> | ||||
| 	 * | ||||
| 	 * @param openid 用户openid | ||||
| 	 * @param remark 备注名 | ||||
| 	 */ | ||||
| 	void userUpdateRemark(String openid, String remark) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 获取用户基本信息 | ||||
|    * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息 | ||||
|    * </pre> | ||||
|    * | ||||
|    * @param openid 用户openid | ||||
|    * @param lang   语言,zh_CN 简体(默认),zh_TW 繁体,en 英语 | ||||
|    */ | ||||
|   WxMpUser userInfo(String openid, String lang) throws WxErrorException; | ||||
| 	/** | ||||
| 	 * <pre> | ||||
| 	 * 获取用户基本信息 | ||||
| 	 * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息 | ||||
| 	 * </pre> | ||||
| 	 * | ||||
| 	 * @param openid 用户openid | ||||
| 	 * @param lang 语言,zh_CN 简体(默认),zh_TW 繁体,en 英语 | ||||
| 	 */ | ||||
| 	WxMpUser userInfo(String openid, String lang) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 获取关注者列表 | ||||
|    * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表 | ||||
|    * </pre> | ||||
|    * | ||||
|    * @param next_openid 可选,第一个拉取的OPENID,null为从头开始拉取 | ||||
|    */ | ||||
|   WxMpUserList userList(String next_openid) throws WxErrorException; | ||||
| 	/** | ||||
| 	 * <pre> | ||||
| 	 * 获取用户基本信息列表 | ||||
| 	 * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息 | ||||
| 	 * </pre> | ||||
| 	 * | ||||
| 	 * @param openid 用户openid, lang 使用默认(zh_CN 简体) | ||||
| 	 */ | ||||
| 	List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException; | ||||
|  | ||||
| 	/** | ||||
| 	 * <pre> | ||||
| 	 * 获取用户基本信息列表 | ||||
| 	 * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息 | ||||
| 	 * </pre> | ||||
| 	 * | ||||
| 	 * @param userQuery 详细查询参数 | ||||
| 	 */ | ||||
| 	List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException; | ||||
|  | ||||
| 	/** | ||||
| 	 * <pre> | ||||
| 	 * 获取关注者列表 | ||||
| 	 * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表 | ||||
| 	 * </pre> | ||||
| 	 * | ||||
| 	 * @param nextOpenid 可选,第一个拉取的OPENID,null为从头开始拉取 | ||||
| 	 */ | ||||
| 	WxMpUserList userList(String nextOpenid) throws WxErrorException; | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,7 @@ | ||||
| package me.chanjar.weixin.mp.api.impl; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.google.gson.JsonObject; | ||||
|  | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| @ -7,6 +9,7 @@ import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; | ||||
| import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor; | ||||
| import me.chanjar.weixin.mp.api.WxMpService; | ||||
| import me.chanjar.weixin.mp.api.WxMpUserService; | ||||
| import me.chanjar.weixin.mp.bean.WxMpUserQuery; | ||||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | ||||
| import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
|  | ||||
| @ -14,35 +17,47 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
|  * Created by Binary Wang on 2016/7/21. | ||||
|  */ | ||||
| public class WxMpUserServiceImpl implements WxMpUserService { | ||||
|   private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/user"; | ||||
|   private WxMpService wxMpService; | ||||
| 	private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/user"; | ||||
| 	private WxMpService wxMpService; | ||||
|  | ||||
|   public WxMpUserServiceImpl(WxMpService wxMpService) { | ||||
|     this.wxMpService = wxMpService; | ||||
|   } | ||||
| 	public WxMpUserServiceImpl(WxMpService wxMpService) { | ||||
| 		this.wxMpService = wxMpService; | ||||
| 	} | ||||
|  | ||||
|   @Override | ||||
|   public void userUpdateRemark(String openid, String remark) throws WxErrorException { | ||||
|     String url = API_URL_PREFIX + "/info/updateremark"; | ||||
|     JsonObject json = new JsonObject(); | ||||
|     json.addProperty("openid", openid); | ||||
|     json.addProperty("remark", remark); | ||||
|     this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString()); | ||||
|   } | ||||
| 	@Override | ||||
| 	public void userUpdateRemark(String openid, String remark) throws WxErrorException { | ||||
| 		String url = API_URL_PREFIX + "/info/updateremark"; | ||||
| 		JsonObject json = new JsonObject(); | ||||
| 		json.addProperty("openid", openid); | ||||
| 		json.addProperty("remark", remark); | ||||
| 		this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString()); | ||||
| 	} | ||||
|  | ||||
|   @Override | ||||
|   public WxMpUser userInfo(String openid, String lang) throws WxErrorException { | ||||
|     String url = API_URL_PREFIX + "/info"; | ||||
|     lang = lang == null ? "zh_CN" : lang; | ||||
|     String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang); | ||||
|     return WxMpUser.fromJson(responseContent); | ||||
|   } | ||||
| 	@Override | ||||
| 	public WxMpUser userInfo(String openid, String lang) throws WxErrorException { | ||||
| 		String url = API_URL_PREFIX + "/info"; | ||||
| 		lang = lang == null ? "zh_CN" : lang; | ||||
| 		String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang); | ||||
| 		return WxMpUser.fromJson(responseContent); | ||||
| 	} | ||||
|  | ||||
|   @Override | ||||
|   public WxMpUserList userList(String next_openid) throws WxErrorException { | ||||
|     String url = API_URL_PREFIX + "/get"; | ||||
|     String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid); | ||||
|     return WxMpUserList.fromJson(responseContent); | ||||
|   } | ||||
| 	@Override | ||||
| 	public WxMpUserList userList(String next_openid) throws WxErrorException { | ||||
| 		String url = API_URL_PREFIX + "/get"; | ||||
| 		String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid); | ||||
| 		return WxMpUserList.fromJson(responseContent); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException { | ||||
| 		return userInfoList(new WxMpUserQuery(openidList)); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException { | ||||
| 		String url = API_URL_PREFIX + "/info/batchget"; | ||||
| 		String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, userQuery.toJsonString()); | ||||
| 		return WxMpUser.fromJsonList(responseContent); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,194 @@ | ||||
| package me.chanjar.weixin.mp.bean; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.google.gson.Gson; | ||||
|  | ||||
| /** | ||||
|  * 批量查询用户信息查询参数 <br> | ||||
|  * Created by LiuJunGuang on 2016/8/31. | ||||
|  *  | ||||
|  * @author LiuJunGuang | ||||
|  */ | ||||
| public class WxMpUserQuery { | ||||
| 	private List<WxMpUserQueryParam> queryParamList = new ArrayList<>(); | ||||
|  | ||||
| 	public WxMpUserQuery() { | ||||
| 		super(); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 语言使用默认(zh_CN) | ||||
| 	 *  | ||||
| 	 * @description | ||||
| 	 * @param openIdList | ||||
| 	 */ | ||||
| 	public WxMpUserQuery(List<String> openIdList) { | ||||
| 		super(); | ||||
| 		add(openIdList); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 添加OpenId列表,语言使用默认(zh_CN) | ||||
| 	 *  | ||||
| 	 * @param openIdList | ||||
| 	 * @return {@link WxMpUserQuery} | ||||
| 	 */ | ||||
| 	public WxMpUserQuery add(List<String> openIdList) { | ||||
| 		for (String openId : openIdList) { | ||||
| 			this.add(openId); | ||||
| 		} | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 添加一个OpenId | ||||
| 	 *  | ||||
| 	 * @param openId | ||||
| 	 * @param lang 国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语 | ||||
| 	 * @return {@link WxMpUserQuery} | ||||
| 	 */ | ||||
| 	public WxMpUserQuery add(String openId, String lang) { | ||||
| 		queryParamList.add(new WxMpUserQueryParam(openId, lang)); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 添加一个OpenId到列表中,并返回本对象 | ||||
| 	 *  | ||||
| 	 * <pre> | ||||
| 	 * 该方法默认lang = zh_CN | ||||
| 	 * </pre> | ||||
| 	 *  | ||||
| 	 * @param openId | ||||
| 	 * @return {@link WxMpUserQuery} | ||||
| 	 */ | ||||
| 	public WxMpUserQuery add(String openId) { | ||||
| 		queryParamList.add(new WxMpUserQueryParam(openId)); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 删除指定的OpenId,语言使用默认(zh_CN) | ||||
| 	 *  | ||||
| 	 * @param openId | ||||
| 	 * @return {@link WxMpUserQuery} | ||||
| 	 */ | ||||
| 	public WxMpUserQuery remove(String openId) { | ||||
| 		queryParamList.remove(new WxMpUserQueryParam(openId)); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 删除指定的OpenId | ||||
| 	 *  | ||||
| 	 * @param openId | ||||
| 	 * @param lang 国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语 | ||||
| 	 * @return {@link WxMpUserQuery} | ||||
| 	 */ | ||||
| 	public WxMpUserQuery remove(String openId, String lang) { | ||||
| 		queryParamList.remove(new WxMpUserQueryParam(openId, lang)); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 获取查询参数列表 | ||||
| 	 *  | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public List<WxMpUserQueryParam> getQueryParamList() { | ||||
| 		return queryParamList; | ||||
| 	} | ||||
|  | ||||
| 	public String toJsonString() { | ||||
| 		Map<String, Object> map = new HashMap<>(); | ||||
| 		map.put("user_list", queryParamList); | ||||
| 		return new Gson().toJson(map); | ||||
| 	} | ||||
|  | ||||
| 	// 查询参数封装 | ||||
| 	public class WxMpUserQueryParam implements Serializable { | ||||
| 		/** | ||||
| 		 * @fields serialVersionUID | ||||
| 		 */ | ||||
| 		private static final long serialVersionUID = -6863571795702385319L; | ||||
| 		private String openid; | ||||
| 		private String lang; | ||||
|  | ||||
| 		public WxMpUserQueryParam(String openid, String lang) { | ||||
| 			super(); | ||||
| 			this.openid = openid; | ||||
| 			this.lang = lang; | ||||
| 		} | ||||
|  | ||||
| 		public WxMpUserQueryParam(String openid) { | ||||
| 			super(); | ||||
| 			this.openid = openid; | ||||
| 			this.lang = "zh_CN"; | ||||
| 		} | ||||
|  | ||||
| 		public WxMpUserQueryParam() { | ||||
| 			super(); | ||||
| 		} | ||||
|  | ||||
| 		public String getOpenid() { | ||||
| 			return openid; | ||||
| 		} | ||||
|  | ||||
| 		public void setOpenid(String openid) { | ||||
| 			this.openid = openid; | ||||
| 		} | ||||
|  | ||||
| 		public String getLang() { | ||||
| 			return lang; | ||||
| 		} | ||||
|  | ||||
| 		public void setLang(String lang) { | ||||
| 			this.lang = lang; | ||||
| 		} | ||||
|  | ||||
| 		@Override | ||||
| 		public int hashCode() { | ||||
| 			final int prime = 31; | ||||
| 			int result = 1; | ||||
| 			result = prime * result + getOuterType().hashCode(); | ||||
| 			result = prime * result + ((lang == null) ? 0 : lang.hashCode()); | ||||
| 			result = prime * result + ((openid == null) ? 0 : openid.hashCode()); | ||||
| 			return result; | ||||
| 		} | ||||
|  | ||||
| 		@Override | ||||
| 		public boolean equals(Object obj) { | ||||
| 			if (this == obj) | ||||
| 				return true; | ||||
| 			if (obj == null) | ||||
| 				return false; | ||||
| 			if (getClass() != obj.getClass()) | ||||
| 				return false; | ||||
| 			WxMpUserQueryParam other = (WxMpUserQueryParam) obj; | ||||
| 			if (!getOuterType().equals(other.getOuterType())) | ||||
| 				return false; | ||||
| 			if (lang == null) { | ||||
| 				if (other.lang != null) | ||||
| 					return false; | ||||
| 			} else if (!lang.equals(other.lang)) | ||||
| 				return false; | ||||
| 			if (openid == null) { | ||||
| 				if (other.openid != null) | ||||
| 					return false; | ||||
| 			} else if (!openid.equals(other.openid)) | ||||
| 				return false; | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		private WxMpUserQuery getOuterType() { | ||||
| 			return WxMpUserQuery.this; | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @ -1,143 +1,175 @@ | ||||
| package me.chanjar.weixin.mp.bean.result; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.lang.reflect.Type; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.google.gson.Gson; | ||||
| import com.google.gson.JsonObject; | ||||
| import com.google.gson.reflect.TypeToken; | ||||
|  | ||||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||
|  | ||||
| import java.io.Serializable; | ||||
|  | ||||
| /** | ||||
|  * 微信用户信息 | ||||
|  *  | ||||
|  * @author chanjarster | ||||
|  * | ||||
|  */ | ||||
| public class WxMpUser implements Serializable { | ||||
|  | ||||
|   protected Boolean subscribe; | ||||
|   protected String openId; | ||||
|   protected String nickname; | ||||
|   protected String sex; | ||||
|   protected String language; | ||||
|   protected String city; | ||||
|   protected String province; | ||||
|   protected String country; | ||||
|   protected String headImgUrl; | ||||
|   protected Long subscribeTime; | ||||
|   protected String unionId; | ||||
|   protected Integer sexId; | ||||
|   protected String remark; | ||||
|   protected Integer groupId; | ||||
| 	/** | ||||
| 	 * @fields serialVersionUID | ||||
| 	 */ | ||||
| 	private static final long serialVersionUID = 5788154322646488738L; | ||||
| 	protected Boolean subscribe; | ||||
| 	protected String openId; | ||||
| 	protected String nickname; | ||||
| 	protected String sex; | ||||
| 	protected String language; | ||||
| 	protected String city; | ||||
| 	protected String province; | ||||
| 	protected String country; | ||||
| 	protected String headImgUrl; | ||||
| 	protected Long subscribeTime; | ||||
| 	protected String unionId; | ||||
| 	protected Integer sexId; | ||||
| 	protected String remark; | ||||
| 	protected Integer groupId; | ||||
|  | ||||
|   public Boolean getSubscribe() { | ||||
|     return subscribe; | ||||
|   } | ||||
|   public Boolean isSubscribe() { | ||||
|     return subscribe; | ||||
|   } | ||||
|   public void setSubscribe(Boolean subscribe) { | ||||
|     this.subscribe = subscribe; | ||||
|   } | ||||
|   public String getOpenId() { | ||||
|     return openId; | ||||
|   } | ||||
|   public void setOpenId(String openId) { | ||||
|     this.openId = openId; | ||||
|   } | ||||
|   public String getNickname() { | ||||
|     return nickname; | ||||
|   } | ||||
|   public void setNickname(String nickname) { | ||||
|     this.nickname = nickname; | ||||
|   } | ||||
|   public String getSex() { | ||||
|     return sex; | ||||
|   } | ||||
|   public void setSex(String sex) { | ||||
|     this.sex = sex; | ||||
|   } | ||||
|   public String getLanguage() { | ||||
|     return language; | ||||
|   } | ||||
|   public void setLanguage(String language) { | ||||
|     this.language = language; | ||||
|   } | ||||
|   public String getCity() { | ||||
|     return city; | ||||
|   } | ||||
|   public void setCity(String city) { | ||||
|     this.city = city; | ||||
|   } | ||||
|   public String getProvince() { | ||||
|     return province; | ||||
|   } | ||||
|   public void setProvince(String province) { | ||||
|     this.province = province; | ||||
|   } | ||||
|   public String getCountry() { | ||||
|     return country; | ||||
|   } | ||||
|   public void setCountry(String country) { | ||||
|     this.country = country; | ||||
|   } | ||||
|   public String getHeadImgUrl() { | ||||
|     return headImgUrl; | ||||
|   } | ||||
|   public void setHeadImgUrl(String headImgUrl) { | ||||
|     this.headImgUrl = headImgUrl; | ||||
|   } | ||||
|   public Long getSubscribeTime() { | ||||
|     return subscribeTime; | ||||
|   } | ||||
|   public void setSubscribeTime(Long subscribeTime) { | ||||
|     this.subscribeTime = subscribeTime; | ||||
|   } | ||||
|   public String getUnionId() { | ||||
|     return unionId; | ||||
|   } | ||||
|   public void setUnionId(String unionId) { | ||||
|     this.unionId = unionId; | ||||
|   } | ||||
| 	public Boolean getSubscribe() { | ||||
| 		return subscribe; | ||||
| 	} | ||||
|  | ||||
|   public Integer getSexId() { | ||||
| 	public Boolean isSubscribe() { | ||||
| 		return subscribe; | ||||
| 	} | ||||
|  | ||||
|     return sexId; | ||||
|   } | ||||
| 	public void setSubscribe(Boolean subscribe) { | ||||
| 		this.subscribe = subscribe; | ||||
| 	} | ||||
|  | ||||
|   public void setSexId(Integer sexId) { | ||||
|     this.sexId = sexId; | ||||
|   } | ||||
| 	public String getOpenId() { | ||||
| 		return openId; | ||||
| 	} | ||||
|  | ||||
|   public String getRemark() { | ||||
|     return remark; | ||||
|   } | ||||
|   public void setRemark(String remark) { | ||||
|     this.remark = remark; | ||||
|   } | ||||
|   public Integer getGroupId() { | ||||
|     return groupId; | ||||
|   } | ||||
|   public void setGroupId(Integer groupId) { | ||||
|     this.groupId = groupId; | ||||
|   } | ||||
| 	public void setOpenId(String openId) { | ||||
| 		this.openId = openId; | ||||
| 	} | ||||
|  | ||||
|   public static WxMpUser fromJson(String json) { | ||||
|     return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class); | ||||
|   } | ||||
| 	public String getNickname() { | ||||
| 		return nickname; | ||||
| 	} | ||||
|  | ||||
|   @Override | ||||
|   public String toString() { | ||||
|     return "WxMpUser{" + | ||||
|         "subscribe=" + subscribe + | ||||
|         ", openId='" + openId + '\'' + | ||||
|         ", nickname='" + nickname + '\'' + | ||||
|         ", sex='" + sex + '\'' + | ||||
|         ", language='" + language + '\'' + | ||||
|         ", city='" + city + '\'' + | ||||
|         ", province='" + province + '\'' + | ||||
|         ", country='" + country + '\'' + | ||||
|         ", headImgUrl='" + headImgUrl + '\'' + | ||||
|         ", subscribeTime=" + subscribeTime + | ||||
|         ", unionId='" + unionId + '\'' + | ||||
|         ", remark='" + remark + '\'' + | ||||
|         ", groupId='" + groupId + '\'' + | ||||
|         '}'; | ||||
|   } | ||||
| 	public void setNickname(String nickname) { | ||||
| 		this.nickname = nickname; | ||||
| 	} | ||||
|  | ||||
| 	public String getSex() { | ||||
| 		return sex; | ||||
| 	} | ||||
|  | ||||
| 	public void setSex(String sex) { | ||||
| 		this.sex = sex; | ||||
| 	} | ||||
|  | ||||
| 	public String getLanguage() { | ||||
| 		return language; | ||||
| 	} | ||||
|  | ||||
| 	public void setLanguage(String language) { | ||||
| 		this.language = language; | ||||
| 	} | ||||
|  | ||||
| 	public String getCity() { | ||||
| 		return city; | ||||
| 	} | ||||
|  | ||||
| 	public void setCity(String city) { | ||||
| 		this.city = city; | ||||
| 	} | ||||
|  | ||||
| 	public String getProvince() { | ||||
| 		return province; | ||||
| 	} | ||||
|  | ||||
| 	public void setProvince(String province) { | ||||
| 		this.province = province; | ||||
| 	} | ||||
|  | ||||
| 	public String getCountry() { | ||||
| 		return country; | ||||
| 	} | ||||
|  | ||||
| 	public void setCountry(String country) { | ||||
| 		this.country = country; | ||||
| 	} | ||||
|  | ||||
| 	public String getHeadImgUrl() { | ||||
| 		return headImgUrl; | ||||
| 	} | ||||
|  | ||||
| 	public void setHeadImgUrl(String headImgUrl) { | ||||
| 		this.headImgUrl = headImgUrl; | ||||
| 	} | ||||
|  | ||||
| 	public Long getSubscribeTime() { | ||||
| 		return subscribeTime; | ||||
| 	} | ||||
|  | ||||
| 	public void setSubscribeTime(Long subscribeTime) { | ||||
| 		this.subscribeTime = subscribeTime; | ||||
| 	} | ||||
|  | ||||
| 	public String getUnionId() { | ||||
| 		return unionId; | ||||
| 	} | ||||
|  | ||||
| 	public void setUnionId(String unionId) { | ||||
| 		this.unionId = unionId; | ||||
| 	} | ||||
|  | ||||
| 	public Integer getSexId() { | ||||
|  | ||||
| 		return sexId; | ||||
| 	} | ||||
|  | ||||
| 	public void setSexId(Integer sexId) { | ||||
| 		this.sexId = sexId; | ||||
| 	} | ||||
|  | ||||
| 	public String getRemark() { | ||||
| 		return remark; | ||||
| 	} | ||||
|  | ||||
| 	public void setRemark(String remark) { | ||||
| 		this.remark = remark; | ||||
| 	} | ||||
|  | ||||
| 	public Integer getGroupId() { | ||||
| 		return groupId; | ||||
| 	} | ||||
|  | ||||
| 	public void setGroupId(Integer groupId) { | ||||
| 		this.groupId = groupId; | ||||
| 	} | ||||
|  | ||||
| 	public static WxMpUser fromJson(String json) { | ||||
| 		return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class); | ||||
| 	} | ||||
|  | ||||
| 	public static List<WxMpUser> fromJsonList(String json) { | ||||
| 		Type collectionType = new TypeToken<List<WxMpUser>>() { | ||||
| 		}.getType(); | ||||
| 		Gson gson = WxMpGsonBuilder.INSTANCE.create(); | ||||
| 		JsonObject jsonObject = gson.fromJson(json, JsonObject.class); | ||||
| 		return gson.fromJson(jsonObject.get("user_info_list"), collectionType); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public String toString() { | ||||
| 		return "WxMpUser{" + "subscribe=" + subscribe + ", openId='" + openId + '\'' + ", nickname='" + nickname + '\'' + ", sex='" + sex + '\'' + ", language='" + language + '\'' | ||||
| 				+ ", city='" + city + '\'' + ", province='" + province + '\'' + ", country='" + country + '\'' + ", headImgUrl='" + headImgUrl + '\'' + ", subscribeTime=" + subscribeTime | ||||
| 				+ ", unionId='" + unionId + '\'' + ", remark='" + remark + '\'' + ", groupId='" + groupId + '\'' + '}'; | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 aimil
					aimil