mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2579【企业微信】增加企业微信OA自建应用-审批流程引擎相关接口
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import lombok.NonNull;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.oa.selfagent.WxCpOpenApprovalData;
|
||||
|
||||
/**
|
||||
* 企业微信自建应用接口.
|
||||
* https://developer.work.weixin.qq.com/document/path/90269
|
||||
*
|
||||
* @author <a href="https://gitee.com/Wang_Wong/">Wang_Wong</a>
|
||||
* @date 2022-04-06
|
||||
*/
|
||||
public interface WxCpOaAgentService {
|
||||
|
||||
/**
|
||||
* 查询第三方应用审批申请当前状态
|
||||
* 开发者也可主动查询审批单的当前审批状态。
|
||||
*
|
||||
* 请求方式: POST(HTTPS)
|
||||
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/corp/getopenapprovaldata?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param thirdNo
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpOpenApprovalData getOpenApprovalData(@NonNull String thirdNo) throws WxErrorException;
|
||||
|
||||
}
|
||||
@@ -399,6 +399,13 @@ public interface WxCpService extends WxService {
|
||||
*/
|
||||
WxCpLivingService getLivingService();
|
||||
|
||||
/**
|
||||
* 获取OA 自建应用相关接口的服务类对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxCpOaAgentService getOaAgentService();
|
||||
|
||||
/**
|
||||
* 获取会话存档相关接口的服务类对象
|
||||
*
|
||||
|
||||
@@ -50,6 +50,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
|
||||
private WxCpAgentService agentService = new WxCpAgentServiceImpl(this);
|
||||
private WxCpOaService oaService = new WxCpOaServiceImpl(this);
|
||||
private WxCpLivingService livingService = new WxCpLivingServiceImpl(this);
|
||||
private WxCpOaAgentService oaAgentService = new WxCpOaAgentServiceImpl(this);
|
||||
private WxCpMsgAuditService msgAuditService = new WxCpMsgAuditServiceImpl(this);
|
||||
private WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl(this);
|
||||
private WxCpExternalContactService externalContactService = new WxCpExternalContactServiceImpl(this);
|
||||
@@ -485,6 +486,11 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
|
||||
return livingService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpOaAgentService getOaAgentService() {
|
||||
return oaAgentService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpMsgAuditService getMsgAuditService() {
|
||||
return msgAuditService;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
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.WxCpOaAgentService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.living.WxCpLivingInfo;
|
||||
import me.chanjar.weixin.cp.bean.oa.selfagent.WxCpOpenApprovalData;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Living.GET_USER_ALL_LIVINGID;
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.GET_OPEN_APPROVAL_DATA;
|
||||
|
||||
/**
|
||||
* 企业微信自建应用接口实现类.
|
||||
*
|
||||
* @author <a href="https://gitee.com/Wang_Wong/">Wang_Wong</a>
|
||||
* @date 2022-04-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class WxCpOaAgentServiceImpl implements WxCpOaAgentService {
|
||||
private final WxCpService cpService;
|
||||
|
||||
@Override
|
||||
public WxCpOpenApprovalData getOpenApprovalData(@NonNull String thirdNo) throws WxErrorException {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("thirdNo", thirdNo);
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_OPEN_APPROVAL_DATA);
|
||||
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
|
||||
return WxCpGsonBuilder.create()
|
||||
.fromJson(GsonParser.parse(responseContent).get("data"),
|
||||
new TypeToken<WxCpOpenApprovalData>() {
|
||||
}.getType()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user