mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2725【企业微信】增加家校沟通-发送「学校通知」的接口
This commit is contained in:
@@ -50,4 +50,20 @@ public interface WxCpMessageService {
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 发送「学校通知」
|
||||
* https://developer.work.weixin.qq.com/document/path/92321
|
||||
* <p>
|
||||
* 学校可以通过此接口来给家长发送不同类型的学校通知,来满足多种场景下的学校通知需求。目前支持的消息类型为文本、图片、语音、视频、文件、图文。
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/externalcontact/message/send?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param message 要发送的消息对象
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpSchoolContactMessageSendResult sendSchoolContactMessage(WxCpSchoolContactMessage message) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,39 @@ public interface WxCpSchoolUserService {
|
||||
*/
|
||||
WxCpBaseResp createStudent(@NonNull String studentUserId, @NonNull String name, @NonNull List<Integer> departments) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量创建学生
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_create_student?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBatchResultList batchCreateStudent(@NonNull WxCpBatchCreateStudentRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量删除学生
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_delete_student?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBatchResultList batchDeleteStudent(@NonNull WxCpBatchDeleteStudentRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量更新学生
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_update_student?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBatchResultList batchUpdateStudent(@NonNull WxCpBatchUpdateStudentRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
* 请求方式:GET(HTTPS)
|
||||
|
||||
@@ -46,4 +46,15 @@ public class WxCpMessageServiceImpl implements WxCpMessageService {
|
||||
return WxCpLinkedCorpMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
|
||||
.getApiUrl(Message.LINKEDCORP_MESSAGE_SEND), message.toJson()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpSchoolContactMessageSendResult sendSchoolContactMessage(WxCpSchoolContactMessage message) throws WxErrorException {
|
||||
if (null == message.getAgentId()) {
|
||||
message.setAgentId(this.cpService.getWxCpConfigStorage().getAgentId());
|
||||
}
|
||||
|
||||
return WxCpSchoolContactMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
|
||||
.getApiUrl(Message.EXTERNAL_CONTACT_MESSAGE_SEND), message.toJson()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,27 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
return WxCpBaseResp.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBatchResultList batchCreateStudent(@NonNull WxCpBatchCreateStudentRequest request) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(BATCH_CREATE_STUDENT);
|
||||
String responseContent = this.cpService.post(apiUrl, request.toJson());
|
||||
return WxCpBatchResultList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBatchResultList batchDeleteStudent(@NonNull WxCpBatchDeleteStudentRequest request) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(BATCH_DELETE_STUDENT);
|
||||
String responseContent = this.cpService.post(apiUrl, request.toJson());
|
||||
return WxCpBatchResultList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBatchResultList batchUpdateStudent(@NonNull WxCpBatchUpdateStudentRequest request) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(BATCH_UPDATE_STUDENT);
|
||||
String responseContent = this.cpService.post(apiUrl, request.toJson());
|
||||
return WxCpBatchResultList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp deleteStudent(@NonNull String studentUserId) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(DELETE_STUDENT) + studentUserId;
|
||||
|
||||
Reference in New Issue
Block a user