Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weixin-java-cp: Fix and enhance serializable ability of CP's bean. #2117

Merged
merged 1 commit into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.chanjar.weixin.cp.bean;

import java.io.Serializable;
import java.util.List;

import lombok.Data;
Expand All @@ -10,7 +11,8 @@
* @author gaigeshen
*/
@Data
public class WxCpChat {
public class WxCpChat implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

private String id;
private String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.chanjar.weixin.cp.bean;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -19,7 +21,9 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class WxCpOauth2UserInfo {
public class WxCpOauth2UserInfo implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

private String openId;
private String deviceId;
private String userId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.chanjar.weixin.cp.bean;

import java.io.Serializable;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
Expand All @@ -11,7 +13,8 @@
* @date 2019-11-02
*/
@Data
public class WxCpProviderToken {
public class WxCpProviderToken implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;
/**
* 服务商的access_token,最长为512字节。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class WxCpTpAdmin extends WxCpBaseResp {

@Getter
@Setter
public static class Admin {
public static class Admin extends WxCpBaseResp {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("userid")
private String userId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Setter;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
Expand Down Expand Up @@ -37,7 +38,9 @@ public class WxCpTpAuthInfo extends WxCpBaseResp {

@Getter
@Setter
public static class DealerCorpInfo {
public static class DealerCorpInfo extends WxCpBaseResp {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("corpid")
private String corpId;

Expand All @@ -47,7 +50,9 @@ public static class DealerCorpInfo {

@Getter
@Setter
public static class AuthCorpInfo {
public static class AuthCorpInfo implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("corpid")
private String corpId;

Expand Down Expand Up @@ -112,7 +117,8 @@ public static class AuthCorpInfo {
*/
@Getter
@Setter
public static class AuthInfo {
public static class AuthInfo implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

/**
* 授权的应用信息,注意是一个数组,但仅旧的多应用套件授权时会返回多个agent,对新的单应用授权,永远只返回一个agent
Expand All @@ -124,7 +130,9 @@ public static class AuthInfo {

@Getter
@Setter
public static class Agent {
public static class Agent implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("agentid")
private Integer agentId;

Expand Down Expand Up @@ -157,7 +165,8 @@ public static class Agent {
*/
@Getter
@Setter
public static class Privilege {
public static class Privilege implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

/**
* 权限等级。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.chanjar.weixin.cp.bean;

import java.io.Serializable;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.experimental.Accessors;
Expand All @@ -12,7 +14,8 @@
*/
@Data
@Accessors(chain = true)
public class WxCpTpContactSearch {
public class WxCpTpContactSearch implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

/**
* 查询的企业corpid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -23,23 +24,27 @@ public class WxCpTpContactSearchResp extends WxCpBaseResp {
private QueryResult queryResult;

@Data
public static class QueryResult {
public static class QueryResult implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

@SerializedName("user")
private User user;
@SerializedName("party")
private Party party;

@Data
public static class User {
public static class User implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;
@SerializedName("userid")
private List<String> userid;
@SerializedName("open_userid")
private List<String> openUserId;
}

@Data
public static class Party {
public static class Party implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

@SerializedName("department_id")
private List<Integer> departmentId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Setter;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
Expand Down Expand Up @@ -48,7 +49,9 @@ public class WxCpTpPermanentCodeInfo extends WxCpBaseResp {

@Getter
@Setter
public static class AuthCorpInfo {
public static class AuthCorpInfo implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("corpid")
private String corpId;

Expand Down Expand Up @@ -113,7 +116,8 @@ public static class AuthCorpInfo {
*/
@Getter
@Setter
public static class AuthInfo {
public static class AuthInfo implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

/**
* 授权的应用信息,注意是一个数组,但仅旧的多应用套件授权时会返回多个agent,对新的单应用授权,永远只返回一个agent
Expand All @@ -125,7 +129,9 @@ public static class AuthInfo {

@Getter
@Setter
public static class Agent {
public static class Agent implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("agentid")
private Integer agentId;

Expand Down Expand Up @@ -158,7 +164,9 @@ public static class Agent {
*/
@Getter
@Setter
public static class AuthUserInfo {
public static class AuthUserInfo implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

@SerializedName("userid")
private String userId;

Expand All @@ -174,7 +182,8 @@ public static class AuthUserInfo {
*/
@Getter
@Setter
public static class Privilege {
public static class Privilege implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

/**
* 权限等级。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public String toJson() {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class Attr {
public static class Attr implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

/**
* 属性类型: 0-文本 1-网页
*/
Expand All @@ -109,7 +111,9 @@ public static class Attr {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ExternalAttribute {
public static class ExternalAttribute implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

/**
* 属性类型: 0-本文 1-网页 2-小程序.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.chanjar.weixin.cp.bean;

import java.io.Serializable;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

Expand All @@ -12,7 +14,8 @@
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Data
public class WxCpUserDetail {
public class WxCpUserDetail implements Serializable {
private static final long serialVersionUID = -4301684507150486556L;

/**
* 成员UserID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.*;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -17,7 +18,9 @@
*/
@Getter
@Setter
public class WxCpUserExternalContactInfo {
public class WxCpUserExternalContactInfo implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("external_contact")
private ExternalContact externalContact;

Expand All @@ -26,7 +29,9 @@ public class WxCpUserExternalContactInfo {

@Getter
@Setter
public static class ExternalContact {
public static class ExternalContact implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("external_userid")
private String externalUserId;

Expand Down Expand Up @@ -60,7 +65,9 @@ public static class ExternalContact {

@Setter
@Getter
public static class ExternalProfile {
public static class ExternalProfile implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("external_attr")
private List<ExternalAttribute> externalAttrs;
}
Expand All @@ -69,23 +76,30 @@ public static class ExternalProfile {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ExternalAttribute {
public static class ExternalAttribute implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;
@Setter
@Getter
public static class Text {
public static class Text implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

private String value;
}

@Setter
@Getter
public static class Web {
public static class Web implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

private String title;
private String url;
}

@Setter
@Getter
public static class MiniProgram {
public static class MiniProgram implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("pagepath")
private String pagePath;
private String appid;
Expand All @@ -106,7 +120,9 @@ public static class MiniProgram {

@Setter
@Getter
public static class FollowedUser {
public static class FollowedUser implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("userid")
private String userId;
private String remark;
Expand All @@ -132,7 +148,9 @@ public static WxCpUserExternalContactInfo fromJson(String json) {

@Setter
@Getter
public static class Tag {
public static class Tag implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

@SerializedName("group_name")
private String groupName;
@SerializedName("tag_name")
Expand Down
Loading