Skip to content

Commit 0dfedb1

Browse files
authored
🆕 #3853 【企业微信】新增服务商代开发相关接口实现
1 parent 6a9852f commit 0dfedb1

File tree

8 files changed

+621
-0
lines changed

8 files changed

+621
-0
lines changed
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
package me.chanjar.weixin.cp.bean;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
6+
7+
import java.io.Serializable;
8+
import java.util.List;
9+
10+
/**
11+
* 代开发应用详情.
12+
*
13+
* @author <a href="https://github.com/binarywang">Binary Wang</a>
14+
* created on 2026-01-14
15+
*/
16+
@Data
17+
public class WxCpTpCustomizedAppDetail extends WxCpBaseResp {
18+
19+
/**
20+
* 授权方企业id
21+
*/
22+
@SerializedName("auth_corpid")
23+
private String authCorpId;
24+
25+
/**
26+
* 授权方企业名称
27+
*/
28+
@SerializedName("auth_corp_name")
29+
private String authCorpName;
30+
31+
/**
32+
* 授权方企业方形头像
33+
*/
34+
@SerializedName("auth_corp_square_logo_url")
35+
private String authCorpSquareLogoUrl;
36+
37+
/**
38+
* 授权方企业圆形头像
39+
*/
40+
@SerializedName("auth_corp_round_logo_url")
41+
private String authCorpRoundLogoUrl;
42+
43+
/**
44+
* 授权方企业类型,1. 企业; 2. 政府以及事业单位; 3. 其他组织, 4.团队小型企业(原企业微信认证版用户)
45+
*/
46+
@SerializedName("auth_corp_type")
47+
private Integer authCorpType;
48+
49+
/**
50+
* 授权方企业在微工作台(原企业号)的二维码,可用于关注微工作台
51+
*/
52+
@SerializedName("auth_corp_qrcode_url")
53+
private String authCorpQrcodeUrl;
54+
55+
/**
56+
* 授权方企业用户规模
57+
*/
58+
@SerializedName("auth_corp_user_limit")
59+
private Integer authCorpUserLimit;
60+
61+
/**
62+
* 授权方企业的主体名称(仅认证或验证过的企业有),即企业全称
63+
*/
64+
@SerializedName("auth_corp_full_name")
65+
private String authCorpFullName;
66+
67+
/**
68+
* 企业类型,1. 已验证企业;2. 已认证企业
69+
*/
70+
@SerializedName("auth_corp_verified_type")
71+
private Integer authCorpVerifiedType;
72+
73+
/**
74+
* 授权方企业所属行业
75+
*/
76+
@SerializedName("auth_corp_industry")
77+
private String authCorpIndustry;
78+
79+
/**
80+
* 授权方企业所属子行业
81+
*/
82+
@SerializedName("auth_corp_sub_industry")
83+
private String authCorpSubIndustry;
84+
85+
/**
86+
* 授权方企业所在地址
87+
*/
88+
@SerializedName("auth_corp_location")
89+
private String authCorpLocation;
90+
91+
/**
92+
* 代开发自建应用详情
93+
*/
94+
@SerializedName("customized_app_list")
95+
private List<CustomizedApp> customizedAppList;
96+
97+
/**
98+
* From json wx cp tp customized app detail.
99+
*
100+
* @param json the json
101+
* @return the wx cp tp customized app detail
102+
*/
103+
public static WxCpTpCustomizedAppDetail fromJson(String json) {
104+
return WxCpGsonBuilder.create().fromJson(json, WxCpTpCustomizedAppDetail.class);
105+
}
106+
107+
@Override
108+
public String toJson() {
109+
return WxCpGsonBuilder.create().toJson(this);
110+
}
111+
112+
/**
113+
* 代开发自建应用信息
114+
*/
115+
@Data
116+
public static class CustomizedApp implements Serializable {
117+
private static final long serialVersionUID = 1L;
118+
119+
/**
120+
* 代开发自建应用的agentid
121+
*/
122+
@SerializedName("agentid")
123+
private Integer agentId;
124+
125+
/**
126+
* 代开发自建应用对应的模板id
127+
*/
128+
@SerializedName("template_id")
129+
private String templateId;
130+
131+
/**
132+
* 代开发自建应用的name
133+
*/
134+
@SerializedName("name")
135+
private String name;
136+
137+
/**
138+
* 代开发自建应用的description
139+
*/
140+
@SerializedName("description")
141+
private String description;
142+
143+
/**
144+
* 代开发自建应用的logo url
145+
*/
146+
@SerializedName("logo_url")
147+
private String logoUrl;
148+
149+
/**
150+
* 代开发自建应用的可见范围
151+
*/
152+
@SerializedName("allow_userinfos")
153+
private AllowUserInfos allowUserInfos;
154+
155+
/**
156+
* 代开发自建应用是否被禁用
157+
*/
158+
@SerializedName("close")
159+
private Integer close;
160+
161+
/**
162+
* 代开发自建应用主页url
163+
*/
164+
@SerializedName("home_url")
165+
private String homeUrl;
166+
167+
/**
168+
* 代开发自建应用的模式,0 = 代开发自建应用;1 = 第三方应用代开发
169+
*/
170+
@SerializedName("app_type")
171+
private Integer appType;
172+
}
173+
174+
/**
175+
* 应用可见范围
176+
*/
177+
@Data
178+
public static class AllowUserInfos implements Serializable {
179+
private static final long serialVersionUID = 1L;
180+
181+
/**
182+
* 应用可见范围(成员)
183+
*/
184+
@SerializedName("user")
185+
private List<User> users;
186+
187+
/**
188+
* 应用可见范围(部门)
189+
*/
190+
@SerializedName("department")
191+
private List<Department> departments;
192+
}
193+
194+
/**
195+
* 成员信息
196+
*/
197+
@Data
198+
public static class User implements Serializable {
199+
private static final long serialVersionUID = 1L;
200+
201+
/**
202+
* 成员userid
203+
*/
204+
@SerializedName("userid")
205+
private String userId;
206+
}
207+
208+
/**
209+
* 部门信息
210+
*/
211+
@Data
212+
public static class Department implements Serializable {
213+
private static final long serialVersionUID = 1L;
214+
215+
/**
216+
* 部门id
217+
*/
218+
@SerializedName("id")
219+
private Integer id;
220+
}
221+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package me.chanjar.weixin.cp.bean;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
6+
7+
import java.io.Serializable;
8+
import java.util.List;
9+
10+
/**
11+
* 应用模板列表.
12+
*
13+
* @author <a href="https://github.com/binarywang">Binary Wang</a>
14+
* created on 2026-01-14
15+
*/
16+
@Data
17+
public class WxCpTpTemplateList extends WxCpBaseResp {
18+
19+
/**
20+
* 应用模板列表
21+
*/
22+
@SerializedName("template_list")
23+
private List<Template> templateList;
24+
25+
/**
26+
* From json wx cp tp template list.
27+
*
28+
* @param json the json
29+
* @return the wx cp tp template list
30+
*/
31+
public static WxCpTpTemplateList fromJson(String json) {
32+
return WxCpGsonBuilder.create().fromJson(json, WxCpTpTemplateList.class);
33+
}
34+
35+
@Override
36+
public String toJson() {
37+
return WxCpGsonBuilder.create().toJson(this);
38+
}
39+
40+
/**
41+
* 应用模板信息
42+
*/
43+
@Data
44+
public static class Template implements Serializable {
45+
private static final long serialVersionUID = 1L;
46+
47+
/**
48+
* 模板id
49+
*/
50+
@SerializedName("template_id")
51+
private String templateId;
52+
53+
/**
54+
* 模板类型
55+
*/
56+
@SerializedName("template_type")
57+
private Integer templateType;
58+
59+
/**
60+
* 应用名称
61+
*/
62+
@SerializedName("app_name")
63+
private String appName;
64+
65+
/**
66+
* 应用logo url
67+
*/
68+
@SerializedName("logo_url")
69+
private String logoUrl;
70+
71+
/**
72+
* 应用简介
73+
*/
74+
@SerializedName("app_desc")
75+
private String appDesc;
76+
77+
/**
78+
* 应用状态
79+
*/
80+
@SerializedName("status")
81+
private Integer status;
82+
}
83+
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,15 @@ interface Tp {
920920
*/
921921
String GET_CUSTOMIZED_AUTH_URL = "/cgi-bin/service/get_customized_auth_url";
922922

923+
/**
924+
* The constant GET_TEMPLATE_LIST.
925+
*/
926+
String GET_TEMPLATE_LIST = "/cgi-bin/service/get_template_list";
927+
928+
/**
929+
* The constant GET_CUSTOMIZED_APP_DETAIL.
930+
*/
931+
String GET_CUSTOMIZED_APP_DETAIL = "/cgi-bin/service/get_customized_app_detail";
923932

924933
/**
925934
* The constant CONTACT_SEARCH.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package me.chanjar.weixin.cp.tp.service;
2+
3+
import me.chanjar.weixin.common.error.WxErrorException;
4+
import me.chanjar.weixin.cp.bean.WxCpTpCustomizedAppDetail;
5+
import me.chanjar.weixin.cp.bean.WxCpTpTemplateList;
6+
7+
/**
8+
* 企业微信第三方应用 - 代开发相关接口.
9+
*
10+
* @author <a href="https://github.com/binarywang">Binary Wang</a>
11+
* created on 2026-01-14
12+
*/
13+
public interface WxCpTpCustomizedService {
14+
15+
/**
16+
* 获取应用模板列表
17+
* <pre>
18+
* 服务商可通过本接口获取服务商所拥有的应用模板列表
19+
* 文档地址:https://developer.work.weixin.qq.com/document/path/97111
20+
* </pre>
21+
*
22+
* @return 应用模板列表
23+
* @throws WxErrorException 微信错误异常
24+
*/
25+
WxCpTpTemplateList getTemplateList() throws WxErrorException;
26+
27+
/**
28+
* 获取代开发应用详情
29+
* <pre>
30+
* 服务商可通过本接口获取某个授权企业中已经安装的代开发自建应用的详情
31+
* 文档地址:https://developer.work.weixin.qq.com/document/path/97111
32+
* </pre>
33+
*
34+
* @param authCorpId 授权企业的corpid
35+
* @param agentId 应用的agentid,为空时则返回该企业所有的代开发自建应用详情
36+
* @return 代开发应用详情
37+
* @throws WxErrorException 微信错误异常
38+
*/
39+
WxCpTpCustomizedAppDetail getCustomizedAppDetail(String authCorpId, Integer agentId) throws WxErrorException;
40+
41+
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,4 +662,18 @@ WxCpTpXmlMessage fromEncryptedXml(String encryptedXml,
662662

663663
void setWxCpTpOAuth2Service(WxCpTpOAuth2Service wxCpTpOAuth2Service);
664664

665+
/**
666+
* 获取代开发服务
667+
*
668+
* @return 代开发服务
669+
*/
670+
WxCpTpCustomizedService getWxCpTpCustomizedService();
671+
672+
/**
673+
* 设置代开发服务
674+
*
675+
* @param wxCpTpCustomizedService 代开发服务
676+
*/
677+
void setWxCpTpCustomizedService(WxCpTpCustomizedService wxCpTpCustomizedService);
678+
665679
}

0 commit comments

Comments
 (0)