mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🆕 #2719 【企业微信】增加家校沟通-基础接口
This commit is contained in:
parent
a12fa55601
commit
4b3d59645e
@ -135,6 +135,70 @@ public interface WxCpSchoolUserService {
|
||||
*/
|
||||
WxCpBaseResp deleteDepartment(Integer id) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 设置关注「学校通知」的模式
|
||||
* 可通过此接口修改家长关注「学校通知」的模式:“可扫码填写资料加入”或“禁止扫码填写资料加入”
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/set_subscribe_mode?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param subscribeMode 关注模式, 1:可扫码填写资料加入, 2:禁止扫码填写资料加入
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp setSubscribeMode(@NonNull Integer subscribeMode) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取关注「学校通知」的模式
|
||||
* 可通过此接口获取家长关注「学校通知」的模式:“可扫码填写资料加入”或“禁止扫码填写资料加入”
|
||||
* <p>
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_subscribe_mode?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
Integer getSubscribeMode() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取外部联系人详情
|
||||
* 学校可通过此接口,根据外部联系人的userid(如何获取?),拉取外部联系人详情。
|
||||
* <p>
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=ACCESS_TOKEN&external_userid=EXTERNAL_USERID
|
||||
*
|
||||
* @param externalUserId 外部联系人的userid,注意不是学校成员的帐号
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpExternalContact getExternalContact(@NonNull String externalUserId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取可使用的家长范围
|
||||
* 获取可在微信「学校通知-学校应用」使用该应用的家长范围,以学生或部门列表的形式返回。应用只能给该列表下的家长发送「学校通知」。注意该范围只能由学校的系统管理员在「管理端-家校沟通-配置」配置。
|
||||
* <p>
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/agent/get_allow_scope?access_token=ACCESS_TOKEN&agentid=AGENTID
|
||||
*
|
||||
* @param agentId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpAllowScope getAllowScope(@NonNull Integer agentId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 外部联系人openid转换
|
||||
* 企业和服务商可通过此接口,将微信外部联系人的userid(如何获取?)转为微信openid,用于调用支付相关接口。暂不支持企业微信外部联系人(ExternalUserid为wo开头)的userid转openid。
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/convert_to_openid?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param externalUserId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
String convertToOpenId(@NonNull String externalUserId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
* 请求方式:GET(HTTPS)
|
||||
@ -146,6 +210,17 @@ public interface WxCpSchoolUserService {
|
||||
*/
|
||||
WxCpDepartmentList listDepartment(Integer id) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取「学校通知」二维码
|
||||
* 学校可通过此接口获取「学校通知」二维码,家长可通过扫描此二维码关注「学校通知」并接收学校推送的消息。
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_subscribe_qr_code?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpSubscribeQrCode getSubscribeQrCode() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 修改自动升年级的配置
|
||||
* 请求方式: POST(HTTPS)
|
||||
|
@ -7,6 +7,7 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import me.chanjar.weixin.cp.api.WxCpSchoolUserService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.School.*;
|
||||
|
||||
/**
|
||||
@ -125,6 +127,41 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
return WxCpBaseResp.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp setSubscribeMode(@NonNull Integer subscribeMode) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SET_SUBSCRIBE_MODE);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("subscribe_mode", subscribeMode);
|
||||
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
|
||||
return WxCpBaseResp.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSubscribeMode() throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_SUBSCRIBE_MODE);
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return GsonParser.parse(responseContent).get("subscribe_mode").getAsInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpExternalContact getExternalContact(@NonNull String externalUserId) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(EXTERNAL_CONTACT_GET) + externalUserId;
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpExternalContact.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpAllowScope getAllowScope(@NonNull Integer agentId) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_ALLOW_SCOPE) + agentId;
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpAllowScope.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToOpenId(@NonNull String externalUserId) throws WxErrorException {
|
||||
return cpService.getExternalContactService().convertToOpenid(externalUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpDepartmentList listDepartment(Integer id) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(DEPARTMENT_LIST) + id;
|
||||
@ -132,6 +169,13 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
return WxCpDepartmentList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpSubscribeQrCode getSubscribeQrCode() throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_SUBSCRIBE_QR_CODE);
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpSubscribeQrCode.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpSetUpgradeInfo setUpgradeInfo(Long upgradeTime, Integer upgradeSwitch) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SET_UPGRADE_INFO);
|
||||
|
@ -0,0 +1,62 @@
|
||||
package me.chanjar.weixin.cp.bean.school.user;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取可使用的家长范围 返回结果.
|
||||
*
|
||||
* @author Wang_Wong
|
||||
*/
|
||||
@Data
|
||||
public class WxCpAllowScope extends WxCpBaseResp implements Serializable {
|
||||
private static final long serialVersionUID = -5028321625140879571L;
|
||||
|
||||
@SerializedName("allow_scope")
|
||||
private AllowScope allowScope;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public static class AllowScope implements Serializable {
|
||||
|
||||
@SerializedName("students")
|
||||
private List<Student> students;
|
||||
|
||||
@SerializedName("departments")
|
||||
private List<Integer> departments;
|
||||
|
||||
public static AllowScope fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, AllowScope.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public static class Student implements Serializable {
|
||||
|
||||
@SerializedName("userid")
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
||||
public static WxCpAllowScope fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpAllowScope.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package me.chanjar.weixin.cp.bean.school.user;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取外部联系人详情
|
||||
* https://developer.work.weixin.qq.com/document/path/91670
|
||||
*
|
||||
* @author <a href="https://github.com/0katekate0">Wang_Wong</a>
|
||||
* @date: 2022/6/27 9:10
|
||||
*/
|
||||
@Data
|
||||
public class WxCpExternalContact extends WxCpBaseResp implements Serializable {
|
||||
private static final long serialVersionUID = 4311777322534499260L;
|
||||
|
||||
@SerializedName("external_contact")
|
||||
private ExternalContact externalContact;
|
||||
|
||||
@SerializedName("follow_user")
|
||||
private List<WxCpFollowUser> followedUsers;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class WxCpFollowUser implements Serializable {
|
||||
private static final long serialVersionUID = -4301684507150486556L;
|
||||
|
||||
@SerializedName("userid")
|
||||
private String userId;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String description;
|
||||
|
||||
@SerializedName("createtime")
|
||||
private Long createTime;
|
||||
|
||||
private String state;
|
||||
|
||||
@SerializedName("remark_mobiles")
|
||||
private String[] remarkMobiles;
|
||||
|
||||
@SerializedName("remark_corp_name")
|
||||
private String remarkCorpName;
|
||||
|
||||
private Tag[] tags;
|
||||
|
||||
public static WxCpFollowUser fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpFollowUser.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Tag implements Serializable {
|
||||
private static final long serialVersionUID = -7556237053703295482L;
|
||||
|
||||
/**
|
||||
* 该成员添加此外部联系人所打标签的分组名称(标签功能需要企业微信升级到2.7.5及以上版本)
|
||||
*/
|
||||
@SerializedName("group_name")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 该成员添加此外部联系人所打标签名称
|
||||
*/
|
||||
@SerializedName("tag_name")
|
||||
private String tagName;
|
||||
|
||||
/**
|
||||
* 该成员添加此外部联系人所打标签类型, 1-企业设置, 2-用户自定义
|
||||
*/
|
||||
private int type;
|
||||
|
||||
public static Tag fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, Tag.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ExternalContact implements Serializable {
|
||||
private static final long serialVersionUID = -1049085217436072418L;
|
||||
|
||||
@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("is_subscribe")
|
||||
private Integer isSubscribe;
|
||||
|
||||
@SerializedName("subscriber_info")
|
||||
private SubscriberInfo subscriberInfo;
|
||||
|
||||
@SerializedName("external_profile")
|
||||
private ExternalProfile externalProfile;
|
||||
|
||||
public static ExternalContact fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, ExternalContact.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class SubscriberInfo implements Serializable {
|
||||
private static final long serialVersionUID = -2899906589789022765L;
|
||||
|
||||
@SerializedName("tag_id")
|
||||
private List<String> tagId;
|
||||
|
||||
@SerializedName("remark_mobiles")
|
||||
private List<String> remarkMobiles;
|
||||
|
||||
@SerializedName("remark")
|
||||
private String remark;
|
||||
|
||||
public static SubscriberInfo fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, SubscriberInfo.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ExternalProfile implements Serializable {
|
||||
private static final long serialVersionUID = -2899906589789022765L;
|
||||
|
||||
@SerializedName("external_attr")
|
||||
private List<ExternalAttribute> externalAttrs;
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ExternalAttribute implements Serializable {
|
||||
private static final long serialVersionUID = -1262278808286421085L;
|
||||
|
||||
private int type;
|
||||
|
||||
private String name;
|
||||
|
||||
private Text text;
|
||||
|
||||
private Web web;
|
||||
|
||||
@SerializedName("miniprogram")
|
||||
private MiniProgram miniProgram;
|
||||
|
||||
public static ExternalAttribute fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, ExternalAttribute.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Text implements Serializable {
|
||||
private static final long serialVersionUID = -8161579335600269094L;
|
||||
|
||||
private String value;
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Web implements Serializable {
|
||||
private static final long serialVersionUID = 3664557135411521862L;
|
||||
|
||||
private String title;
|
||||
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class MiniProgram implements Serializable {
|
||||
private static final long serialVersionUID = -5329210594501835796L;
|
||||
|
||||
@SerializedName("pagepath")
|
||||
private String pagePath;
|
||||
|
||||
private String appid;
|
||||
|
||||
private String title;
|
||||
|
||||
}
|
||||
|
||||
public static WxCpExternalContact fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpExternalContact.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package me.chanjar.weixin.cp.bean.school.user;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取「学校通知」二维码 返回结果.
|
||||
*
|
||||
* @author Wang_Wong
|
||||
*/
|
||||
@Data
|
||||
public class WxCpSubscribeQrCode extends WxCpBaseResp implements Serializable {
|
||||
private static final long serialVersionUID = -5028321625140879571L;
|
||||
|
||||
@SerializedName("qrcode_big")
|
||||
private String qrCodeBig;
|
||||
|
||||
@SerializedName("qrcode_middle")
|
||||
private String qrCodeMiddle;
|
||||
|
||||
@SerializedName("qrcode_thumb")
|
||||
private String qrCodeThumb;
|
||||
|
||||
public static WxCpSubscribeQrCode fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpSubscribeQrCode.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -199,6 +199,7 @@ public interface WxCpApiPathConsts {
|
||||
|
||||
String GET_PAYMENT_RESULT = "/cgi-bin/school/get_payment_result";
|
||||
String GET_TRADE = "/cgi-bin/school/get_trade";
|
||||
String GET_ALLOW_SCOPE = "/cgi-bin/school/agent/get_allow_scope?agentid=";
|
||||
|
||||
/**
|
||||
* 上课直播
|
||||
@ -379,6 +380,10 @@ public interface WxCpApiPathConsts {
|
||||
|
||||
String UPLOAD_ATTACHMENT = "/cgi-bin/media/upload_attachment";
|
||||
|
||||
String GET_SUBSCRIBE_QR_CODE = "/cgi-bin/externalcontact/get_subscribe_qr_code";
|
||||
String SET_SUBSCRIBE_MODE = "/cgi-bin/externalcontact/set_subscribe_mode";
|
||||
String GET_SUBSCRIBE_MODE = "/cgi-bin/externalcontact/get_subscribe_mode";
|
||||
String EXTERNAL_CONTACT_GET = "/cgi-bin/externalcontact/get?external_userid=";
|
||||
|
||||
String ADD_INTERCEPT_RULE = "/cgi-bin/externalcontact/add_intercept_rule";
|
||||
String UPDATE_INTERCEPT_RULE = "/cgi-bin/externalcontact/update_intercept_rule";
|
||||
|
@ -44,8 +44,83 @@ public class WxCpSchoolUserTest {
|
||||
log.info("list:{}", list.toString());
|
||||
|
||||
final String userId = "WangKai";
|
||||
final String exUserId = "wmOQpTDwAAJFHrryZ8I8ALLEZuLHIUKA";
|
||||
|
||||
|
||||
/**
|
||||
* 获取可使用的家长范围
|
||||
* https://developer.work.weixin.qq.com/document/path/94895
|
||||
*/
|
||||
String str8 = "{\n" +
|
||||
" \"errcode\": 0,\n" +
|
||||
" \"errmsg\": \"ok\",\n" +
|
||||
" \"allow_scope\": {\n" +
|
||||
" \"students\": [\n" +
|
||||
" {\"userid\": \"student1\"},\n" +
|
||||
" {\"userid\": \"student2\"}\n" +
|
||||
" ],\n" +
|
||||
"\t \"departments\": [1, 2]\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
WxCpAllowScope cpAllowScope = WxCpAllowScope.fromJson(str8);
|
||||
log.info("cpAllowScope:{}", cpAllowScope.toJson());
|
||||
|
||||
WxCpAllowScope allowScope = cpService.getSchoolUserService().getAllowScope(100000);
|
||||
log.info("allowScope:{}", allowScope);
|
||||
|
||||
/**
|
||||
* 外部联系人openid转换
|
||||
* https://developer.work.weixin.qq.com/document/path/92323
|
||||
*/
|
||||
String openId = cpService.getSchoolUserService().convertToOpenId("wmOQpTDwAAh_sKvmJBJ4FQ0iYAcbppFA");
|
||||
log.info("openId:{}", openId);
|
||||
|
||||
/**
|
||||
* 家校沟通 获取外部联系人详情
|
||||
* https://developer.work.weixin.qq.com/document/path/92322
|
||||
*/
|
||||
String str7 = "{\"errcode\":0,\"errmsg\":\"ok\",\"external_contact\":{\"external_userid\":\"woAAAA\",\"name\":\"李四\",\"position\":\"Mangaer\",\"avatar\":\"http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0\",\"corp_name\":\"腾讯\",\"corp_full_name\":\"腾讯科技有限公司\",\"type\":2,\"gender\":1,\"unionid\":\"unAAAAA\",\"is_subscribe\":1,\"subscriber_info\":{\"tag_id\":[\"TAG_ID1\",\"TAG_ID2\"],\"remark_mobiles\":[\"10000000000\",\"10000000001\"],\"remark\":\"李小明-爸爸\"},\"external_profile\":{\"external_attr\":[{\"type\":0,\"name\":\"文本名称\",\"text\":{\"value\":\"文本\"}},{\"type\":1,\"name\":\"网页名称\",\"web\":{\"url\":\"http://www.test.com\",\"title\":\"标题\"}},{\"type\":2,\"name\":\"测试app\",\"miniprogram\":{\"appid\":\"wxAAAAA\",\"pagepath\":\"/index\",\"title\":\"my miniprogram\"}}]}},\"follow_user\":[{\"userid\":\"rocky\",\"remark\":\"李部长\",\"description\":\"对接采购事物\",\"createtime\":1525779812,\"tags\":[{\"group_name\":\"标签分组名称\",\"tag_name\":\"标签名称\",\"type\":1}],\"remark_corp_name\":\"腾讯科技\",\"remark_mobiles\":[10000000003,10000000004]},{\"userid\":\"tommy\",\"remark\":\"李总\",\"description\":\"采购问题咨询\",\"createtime\":1525881637,\"state\":\"外联二维码1\"}]}";
|
||||
WxCpExternalContact wxCpExternalContact = WxCpExternalContact.fromJson(str7);
|
||||
log.info("wxCpExternalContact:{}", wxCpExternalContact.toJson());
|
||||
|
||||
// cpService.getExternalContactService().getExternalContact();
|
||||
WxCpExternalContact externalContact = cpService.getSchoolUserService().getExternalContact(exUserId);
|
||||
log.info("externalContact:{}", externalContact.toJson());
|
||||
|
||||
/**
|
||||
* 获取关注「学校通知」的模式
|
||||
* 可通过此接口获取家长关注「学校通知」的模式:“可扫码填写资料加入”或“禁止扫码填写资料加入”
|
||||
* https://developer.work.weixin.qq.com/document/path/92290
|
||||
*/
|
||||
Integer subscribeMode = cpService.getSchoolUserService().getSubscribeMode();
|
||||
log.info("subscribeMode:{}", subscribeMode);
|
||||
|
||||
/**
|
||||
* 管理「学校通知」的关注模式
|
||||
* 设置关注「学校通知」的模式
|
||||
* https://developer.work.weixin.qq.com/document/path/92290
|
||||
*/
|
||||
WxCpBaseResp setSubscribeMode = cpService.getSchoolUserService().setSubscribeMode(1);
|
||||
log.info("setSubscribeMode:{}", setSubscribeMode.toJson());
|
||||
|
||||
/**
|
||||
* 获取「学校通知」二维码
|
||||
* https://developer.work.weixin.qq.com/document/path/92320
|
||||
*/
|
||||
String str6 = "{\n" +
|
||||
" \"errcode\": 0,\n" +
|
||||
" \"errmsg\": \"ok\",\n" +
|
||||
" \"qrcode_big\":\"http://p.qpic.cn/wwhead/XXXX\",\n" +
|
||||
" \"qrcode_middle\":\"http://p.qpic.cn/wwhead/XXXX\",\n" +
|
||||
" \"qrcode_thumb\":\"http://p.qpic.cn/wwhead/XXXX\"\n" +
|
||||
"}";
|
||||
|
||||
WxCpSubscribeQrCode cpSubscribeQrCode = WxCpSubscribeQrCode.fromJson(str6);
|
||||
log.info("cpSubscribeQrCode:{}", cpSubscribeQrCode.toJson());
|
||||
|
||||
WxCpSubscribeQrCode subscribeQrCode = cpService.getSchoolUserService().getSubscribeQrCode();
|
||||
log.info("subscribeQrCode:{}", subscribeQrCode.toJson());
|
||||
|
||||
/**
|
||||
* 修改自动升年级的配置
|
||||
* https://developer.work.weixin.qq.com/document/path/92949
|
||||
|
Loading…
Reference in New Issue
Block a user