mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
🐛 #2148 【企业微信】修复互联企业消息推送接口返回字段问题
This commit is contained in:
parent
1e64a7f7b3
commit
71289e4dea
@ -1,10 +1,7 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpLinkedCorpMessage;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessage;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessageSendStatistics;
|
||||
import me.chanjar.weixin.cp.bean.message.*;
|
||||
|
||||
/**
|
||||
* 消息推送接口.
|
||||
@ -52,5 +49,5 @@ public interface WxCpMessageService {
|
||||
* @return the wx cp message send result
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException;
|
||||
WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException;
|
||||
}
|
||||
|
@ -5,10 +5,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.WxCpMessageService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpLinkedCorpMessage;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessage;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpMessageSendStatistics;
|
||||
import me.chanjar.weixin.cp.bean.message.*;
|
||||
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Message;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
@ -40,13 +37,13 @@ public class WxCpMessageServiceImpl implements WxCpMessageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException {
|
||||
public WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException {
|
||||
Integer agentId = message.getAgentId();
|
||||
if (null == agentId) {
|
||||
message.setAgentId(this.cpService.getWxCpConfigStorage().getAgentId());
|
||||
}
|
||||
|
||||
return WxCpMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
|
||||
return WxCpLinkedCorpMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
|
||||
.getApiUrl(Message.LINKEDCORP_MESSAGE_SEND), message.toJson()));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package me.chanjar.weixin.cp.bean.message;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
/**
|
||||
* 互联企业的消息推送接口返回实体
|
||||
*
|
||||
* @author pg
|
||||
* @date 2021年6月22日
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class WxCpLinkedCorpMessageSendResult extends WxCpBaseResp {
|
||||
private static final long serialVersionUID = 3990693822996824333L;
|
||||
|
||||
@SerializedName("invaliduser")
|
||||
private String[] invalidUser;
|
||||
|
||||
@SerializedName("invalidparty")
|
||||
private String[] invalidParty;
|
||||
|
||||
@SerializedName("invalidtag")
|
||||
private String[] invalidTag;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
public static WxCpLinkedCorpMessageSendResult fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpLinkedCorpMessageSendResult.class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user