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

Feature cptp #1947

Merged
merged 2 commits into from
Dec 29, 2020
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
@@ -0,0 +1,62 @@
package me.chanjar.weixin.cp.bean;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.experimental.Accessors;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

/**
* @author uianz
* @description
* @since 2020/12/23 下午 02:43
*/
@Data
@Accessors(chain = true)
public class WxCpTpContactSearch {

/**
* 查询的企业corpid
*/
@SerializedName("auth_corpid")
private String authCorpId;

/**
* 搜索关键词。当查询用户时应为用户名称、名称拼音或者英文名;当查询部门时应为部门名称或者部门名称拼音
*/
@SerializedName("query_word")
private String queryWord;

/**
* 查询类型 1:查询用户,返回用户userid列表 2:查询部门,返回部门id列表。 不填该字段或者填0代表同时查询部门跟用户
*/
@SerializedName("query_type")
private Integer type;

/**
* 应用id,若非0则只返回应用可见范围内的用户或者部门信息
*/
@SerializedName("agentid")
private Integer agentId;

/**
* 查询的偏移量,每次调用的offset在上一次offset基础上加上limit
*/
@SerializedName("offset")
private Integer offset;

/**
* 查询返回的最大数量,默认为50,最多为200,查询返回的数量可能小于limit指定的值
*/
@SerializedName("limit")
private Integer limit;

/**
* 如果需要精确匹配用户名称或者部门名称或者英文名,不填则默认为模糊匹配;1:匹配用户名称或者部门名称 2:匹配用户英文名
*/
@SerializedName("full_match_field")
private Integer fullMatchField;

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package me.chanjar.weixin.cp.bean;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.util.List;

/**
* @author uianz
* @description
* @since 2020/12/23 下午 02:55
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class WxCpTpContactSearchResp extends WxCpBaseResp {

@SerializedName("is_last")
private Boolean isLast;

@SerializedName("query_result")
private QueryResult queryResult;

@Data
public static class QueryResult {

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

@Data
public static class User {
@SerializedName("userid")
private List<String> userid;
@SerializedName("open_userid")
private List<String> openUserId;
}

@Data
public static class Party {
@SerializedName("department_id")
private List<Integer> departmentId;
}

}

public static WxCpTpContactSearchResp fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpTpContactSearchResp.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.chanjar.weixin.cp.bean;

import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;

/**
* 企业微信的部门.
*
* @author Daniel Qian
*/
@Data
public class WxCpTpDepart implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;

private Integer id;
private String name;
private String enName;
private Integer parentid;
private Integer order;

public static WxCpTpDepart fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpTpDepart.class);
}

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package me.chanjar.weixin.cp.bean;

import com.google.gson.annotations.SerializedName;
import lombok.*;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.util.List;

/**
* <pre>
* 外部联系人详情
* Created by Binary Wang on 2018/9/16.
* 参考文档:https://work.weixin.qq.com/api/doc#13878
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Getter
@Setter
public class WxCpUserExternalContactInfo {
@SerializedName("external_contact")
private ExternalContact externalContact;

@SerializedName("follow_user")
private List<FollowedUser> followedUsers;

@Getter
@Setter
public static class ExternalContact {
@SerializedName("external_userid")
private String externalUserId;

@SerializedName("position")
private String position;

@SerializedName("name")
private String name;

@SerializedName("avatar")
private String avatar;

@SerializedName("corp_name")
private String corpName;

@SerializedName("corp_full_name")
private String corpFullName;

@SerializedName("type")
private Integer type;

@SerializedName("gender")
private Integer gender;

@SerializedName("unionid")
private String unionId;

@SerializedName("external_profile")
private ExternalProfile externalProfile;
}

@Setter
@Getter
public static class ExternalProfile {
@SerializedName("external_attr")
private List<ExternalAttribute> externalAttrs;
}

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ExternalAttribute {
@Setter
@Getter
public static class Text {
private String value;
}

@Setter
@Getter
public static class Web {
private String title;
private String url;
}

@Setter
@Getter
public static class MiniProgram {
@SerializedName("pagepath")
private String pagePath;
private String appid;
private String title;
}

private int type;

private String name;

private Text text;

private Web web;

@SerializedName("miniprogram")
private MiniProgram miniProgram;
}

@Setter
@Getter
public static class FollowedUser {
@SerializedName("userid")
private String userId;
private String remark;
private String description;
@SerializedName("createtime")
private Long createTime;
private String state;
@SerializedName("remark_company")
private String remarkCompany;
@SerializedName("remark_mobiles")
private String[] remarkMobiles;
private Tag[] tags;
@SerializedName("add_way")
private Integer addWay;
@SerializedName("oper_userid")
private String operUserid;

}

public static WxCpUserExternalContactInfo fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalContactInfo.class);
}

@Setter
@Getter
public static class Tag {
@SerializedName("group_name")
private String groupName;
@SerializedName("tag_name")
private String tagName;
private int type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package me.chanjar.weixin.cp.bean;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.util.List;

/**
* @description: 登录信息
* @author: Jamie.shi
* @create: 2020-08-03 17:18
**/
@Data
public class WxTpLoginInfo extends WxCpBaseResp {
@SerializedName("usertype")
private Integer userType;
@SerializedName("user_info")
private UserInfo userInfo;
@SerializedName("corp_info")
private CorpInfoBean corpInfo;
@SerializedName("auth_info")
private AuthInfo authInfo;
private List<Agent> agent;

@Data
public static class UserInfo {
@SerializedName("userid")
private String userId;
@SerializedName("open_userid")
private String openUserId;
private String name;
private String avatar;
}

@Data
public static class CorpInfoBean {
@SerializedName("corpid")
private String corpId;
}

@Data
public static class AuthInfo {
private List<Department> department;

@Data
public static class Department {

private int id;
private boolean writable;
}
}

@Data
public static class Agent {
@SerializedName("agentid")
private int agentId;
@SerializedName("auth_type")
private int authType;
}

public static WxTpLoginInfo fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxTpLoginInfo.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public interface WxCpTpConfigStorage {
String getCorpId();
String getCorpSecret();

/**
* 服务商secret
*/
String getProviderSecret();

/**
* 授权企业的access token相关
*/
Expand All @@ -83,6 +88,11 @@ public interface WxCpTpConfigStorage {
boolean isAuthSuiteJsApiTicketExpired(String authCorpId);
void updateAuthSuiteJsApiTicket(String authCorpId, String jsApiTicket, int expiredInSeconds);;

boolean isProviderTokenExpired();
void updateProviderToken(String providerToken, int expiredInSeconds);

String getProviderToken();

/**
* 网络代理相关
*/
Expand Down
Loading