🎨 精简代码,移除无用过期接口代码

This commit is contained in:
Binary Wang
2020-08-23 17:22:35 +08:00
parent 6d996f20b9
commit b5956fb298
28 changed files with 113 additions and 827 deletions

View File

@ -12,10 +12,6 @@ import java.util.List;
* @author gaigeshen
*/
public interface WxCpChatService {
@Deprecated
String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException;
/**
* 创建群聊会话,注意:刚创建的群,如果没有下发消息,在企业微信不会出现该群.
*
@ -28,9 +24,6 @@ public interface WxCpChatService {
*/
String create(String name, String owner, List<String> users, String chatId) throws WxErrorException;
@Deprecated
void chatUpdate(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete) throws WxErrorException;
/**
* 修改群聊会话.
*
@ -43,9 +36,6 @@ public interface WxCpChatService {
*/
void update(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete) throws WxErrorException;
@Deprecated
WxCpChat chatGet(String chatId) throws WxErrorException;
/**
* 获取群聊会话.
*

View File

@ -110,23 +110,6 @@ public interface WxCpOaService {
*/
WxCpApprovalDetailResult getApprovalDetail(@NonNull String spNo) throws WxErrorException;
/**
* <pre>
* 获取审批数据 (已过期, 请使用"批量获取审批单号" && "获取审批申请详情")
* 通过本接口来获取公司一段时间内的审批记录。一次拉取调用最多拉取10000个审批记录可以通过多次拉取的方式来满足需求但调用频率不可超过600次/分。
* API doc : https://work.weixin.qq.com/api/doc#90000/90135/91530
* </pre>
*
* @param startTime 获取审批记录的开始时间
* @param endTime 获取审批记录的结束时间
* @param nextSpnum 第一个拉取的审批单号,不填从该时间段的第一个审批单拉取
* @throws WxErrorException .
* @see me.chanjar.weixin.cp.api.WxCpOaService#getApprovalInfo
* @see me.chanjar.weixin.cp.api.WxCpOaService#getApprovalDetail
*/
@Deprecated
WxCpApprovalDataResult getApprovalData(Date startTime, Date endTime, Long nextSpnum) throws WxErrorException;
/**
* 获取公费电话拨打记录
*

View File

@ -17,7 +17,6 @@ import java.util.List;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxCpTagService {
/**
* 创建标签.
* <pre>
@ -32,17 +31,6 @@ public interface WxCpTagService {
*/
String create(String name, Integer id) throws WxErrorException;
/**
* 创建标签.
*
* @param tagName 标签名
* @return 标签id
* @throws WxErrorException .
* @deprecated 建议使用 {@link #create(String, Integer)},其中后面的参数可以为空
*/
@Deprecated
String create(String tagName) throws WxErrorException;
/**
* 更新标签.
*

View File

@ -24,11 +24,10 @@ import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Chat.*;
*/
@RequiredArgsConstructor
public class WxCpChatServiceImpl implements WxCpChatService {
private final WxCpService cpService;
@Override
public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException {
public String create(String name, String owner, List<String> users, String chatId) throws WxErrorException {
Map<String, Object> data = new HashMap<>(4);
if (StringUtils.isNotBlank(name)) {
data.put("name", name);
@ -48,12 +47,7 @@ public class WxCpChatServiceImpl implements WxCpChatService {
}
@Override
public String create(String name, String owner, List<String> users, String chatId) throws WxErrorException {
return this.chatCreate(name, owner, users, chatId);
}
@Override
public void chatUpdate(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete)
public void update(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete)
throws WxErrorException {
Map<String, Object> data = new HashMap<>(5);
if (StringUtils.isNotBlank(chatId)) {
@ -77,24 +71,13 @@ public class WxCpChatServiceImpl implements WxCpChatService {
}
@Override
public void update(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete)
throws WxErrorException {
chatUpdate(chatId, name, owner, usersToAdd, usersToDelete);
}
@Override
public WxCpChat chatGet(String chatId) throws WxErrorException {
public WxCpChat get(String chatId) throws WxErrorException {
final String url = this.cpService.getWxCpConfigStorage().getApiUrl(APPCHAT_GET_CHATID + chatId);
String result = this.cpService.get(url, null);
final String chatInfo = GsonParser.parse(result).getAsJsonObject("chat_info").toString();
return WxCpGsonBuilder.create().fromJson(chatInfo, WxCpChat.class);
}
@Override
public WxCpChat get(String chatId) throws WxErrorException {
return this.chatGet(chatId);
}
@Override
public void sendMsg(WxCpAppChatMessage message) throws WxErrorException {
this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(APPCHAT_SEND), message.toJson());

View File

@ -164,20 +164,6 @@ public class WxCpOaServiceImpl implements WxCpOaService {
return WxCpGsonBuilder.create().fromJson(responseContent, WxCpApprovalDetailResult.class);
}
@Override
public WxCpApprovalDataResult getApprovalData(Date startTime, Date endTime, Long nextSpnum) throws WxErrorException {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("starttime", startTime.getTime() / 1000L);
jsonObject.addProperty("endtime", endTime.getTime() / 1000L);
if (nextSpnum != null) {
jsonObject.addProperty("next_spnum", nextSpnum);
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_APPROVAL_DATA);
String responseContent = this.mainService.post(url, jsonObject.toString());
return WxCpGsonBuilder.create().fromJson(responseContent, WxCpApprovalDataResult.class);
}
@Override
public List<WxCpDialRecord> getDialRecord(Date startTime, Date endTime, Integer offset, Integer limit)
throws WxErrorException {

View File

@ -40,13 +40,6 @@ public class WxCpTagServiceImpl implements WxCpTagService {
return this.create(o);
}
@Override
public String create(String tagName) throws WxErrorException {
JsonObject o = new JsonObject();
o.addProperty("tagname", tagName);
return this.create(o);
}
private String create(JsonObject param) throws WxErrorException {
String url = this.mainService.getWxCpConfigStorage().getApiUrl(TAG_CREATE);
String responseContent = this.mainService.post(url, param.toString());

View File

@ -1,69 +0,0 @@
package me.chanjar.weixin.cp.bean.oa;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
/**
* 企业微信 OA 审批数据.
*
* @author Element
* @date 2019-04-06 14:36
*/
@Deprecated
@Data
public class WxCpApprovalDataResult implements Serializable {
private static final long serialVersionUID = -1046940445840716590L;
@SerializedName("errcode")
private Integer errCode;
@SerializedName("errmsg")
private String errMsg;
private Integer count;
private Integer total;
@SerializedName("next_spnum")
private Long nextSpNum;
private WxCpApprovalData[] data;
@Data
public static class WxCpApprovalData implements Serializable {
private static final long serialVersionUID = -3051785319608491640L;
@SerializedName("spname")
private String spName;
@SerializedName("apply_name")
private String applyName;
@SerializedName("apply_org")
private String applyOrg;
@SerializedName("approval_name")
private String[] approvalName;
@SerializedName("notify_name")
private String[] notifyName;
@SerializedName("sp_status")
private Integer spStatus;
@SerializedName("sp_num")
private Long spNum;
@SerializedName("apply_time")
private Long applyTime;
@SerializedName("apply_user_id")
private String applyUserId;
@SerializedName("comm")
private Map<String, String> comm;
}
}

View File

@ -12,7 +12,6 @@ import java.io.Serializable;
*/
@Data
public class WxCpApprovalDetailResult implements Serializable {
private static final long serialVersionUID = 3909779949756252918L;
@SerializedName("errcode")

View File

@ -11,7 +11,6 @@ import lombok.Data;
*/
@Data
public class WxCpApprovalInfo implements Serializable {
private static final long serialVersionUID = 7387181805254287167L;
@SerializedName("errcode")

View File

@ -68,8 +68,6 @@ public final class WxCpApiPathConsts {
public static final String GET_APPROVAL_INFO = "/cgi-bin/oa/getapprovalinfo";
public static final String GET_APPROVAL_DETAIL = "/cgi-bin/oa/getapprovaldetail";
public static final String GET_DIAL_RECORD = "/cgi-bin/dial/get_dial_record";
@Deprecated
public static final String GET_APPROVAL_DATA = "/cgi-bin/corp/getapprovaldata";
public static final String GET_TEMPLATE_DETAIL = "/cgi-bin/oa/gettemplatedetail";
public static final String APPLY_EVENT = "/cgi-bin/oa/applyevent";
}