Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,13 @@ public interface WxCpService extends WxService {
*/
WxCpOaWeDriveService getOaWeDriveService();

/**
* 获取OA效率工具 文档的服务类对象
*
* @return oa we doc service
*/
WxCpOaWeDocService getOaWeDocService();

/**
* 获取会话存档相关接口的服务类对象
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
private final WxCpLivingService livingService = new WxCpLivingServiceImpl(this);
private final WxCpOaAgentService oaAgentService = new WxCpOaAgentServiceImpl(this);
private final WxCpOaWeDriveService oaWeDriveService = new WxCpOaWeDriveServiceImpl(this);
private final WxCpOaWeDocService oaWeDocService = new WxCpOaWeDocServiceImpl(this);
private final WxCpMsgAuditService msgAuditService = new WxCpMsgAuditServiceImpl(this);
private final WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl(this);
private final WxCpExternalContactService externalContactService = new WxCpExternalContactServiceImpl(this);
Expand Down Expand Up @@ -595,6 +596,11 @@ public WxCpOaWeDriveService getOaWeDriveService() {
return oaWeDriveService;
}

@Override
public WxCpOaWeDocService getOaWeDocService() {
return oaWeDocService;
}

@Override
public WxCpMsgAuditService getMsgAuditService() {
return msgAuditService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.CommonUploadParam;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpOaWeDocService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.oa.doc.*;

import java.io.File;
import java.util.List;

import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.*;

/**
* 企业微信微盘接口实现类.
* 企业微信文档接口实现类.
*
* @author Wang_Wong created on 2022-04-22
* @author Wang_Wong created on 2022-04-22
*/
@Slf4j
@RequiredArgsConstructor
Expand Down Expand Up @@ -57,11 +61,44 @@ public WxCpDocInfo docInfo(@NonNull String docId) throws WxErrorException {

@Override
public WxCpDocShare docShare(@NonNull String docId) throws WxErrorException {
return docShare(WxCpDocShareRequest.builder().docId(docId).build());
}

@Override
public WxCpDocShare docShare(@NonNull WxCpDocShareRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_DOC_SHARE);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocShare.fromJson(responseContent);
}

@Override
public WxCpDocAuthInfo docGetAuth(@NonNull String docId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_DOC_GET_AUTH);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("docid", docId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpDocShare.fromJson(responseContent);
return WxCpDocAuthInfo.fromJson(responseContent);
}

@Override
public WxCpBaseResp docModifyJoinRule(@NonNull WxCpDocModifyJoinRuleRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_MOD_DOC_JOIN_RULE);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp docModifyMember(@NonNull WxCpDocModifyMemberRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_MOD_DOC_MEMBER);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp docModifySaftySetting(@NonNull WxCpDocModifySaftySettingRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_MOD_DOC_SAFTY_SETTING);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
Expand All @@ -86,4 +123,211 @@ public WxCpDocSheetData getSheetRangeData(@NonNull WxCpDocSheetGetDataRequest re
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSheetData.fromJson(responseContent);
}

@Override
public WxCpDocData docGetData(@NonNull WxCpDocGetDataRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_GET_DOC_DATA);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocData.fromJson(responseContent);
}

@Override
public WxCpBaseResp docModify(@NonNull WxCpDocModifyRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_MOD_DOC);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocImageUploadResult docUploadImage(@NonNull File file) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_UPLOAD_DOC_IMAGE);
String responseContent = this.cpService.upload(apiUrl, CommonUploadParam.fromFile("media", file));
return WxCpDocImageUploadResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp docAddAdmin(@NonNull WxCpDocAdminRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_ADD_ADMIN);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp docDeleteAdmin(@NonNull WxCpDocAdminRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_DEL_ADMIN);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocAdminListResult docGetAdminList(@NonNull String docId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_GET_ADMIN_LIST);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("docid", docId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpDocAdminListResult.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetAuth smartSheetGetAuth(@NonNull WxCpDocSmartSheetAuthRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_GET_SHEET_AUTH);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetAuth.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetModifyAuth(@NonNull WxCpDocSmartSheetModifyAuthRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_MOD_SHEET_AUTH);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetGetSheet(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_GET_SHEET);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetAddSheet(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_ADD_SHEET);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetDeleteSheet(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_DELETE_SHEET);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetUpdateSheet(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_UPDATE_SHEET);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetGetViews(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_GET_VIEWS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetAddView(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_ADD_VIEW);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetDeleteViews(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_DELETE_VIEWS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetUpdateView(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_UPDATE_VIEW);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetGetFields(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_GET_FIELDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetAddFields(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_ADD_FIELDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetDeleteFields(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_DELETE_FIELDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetUpdateFields(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_UPDATE_FIELDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetGetRecords(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_GET_RECORDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpDocSmartSheetResult smartSheetAddRecords(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_ADD_RECORDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpDocSmartSheetResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetDeleteRecords(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_DELETE_RECORDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpBaseResp smartSheetUpdateRecords(@NonNull WxCpDocSmartSheetRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_SMARTSHEET_UPDATE_RECORDS);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpFormCreateResult formCreate(@NonNull WxCpFormCreateRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_CREATE_FORM);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpFormCreateResult.fromJson(responseContent);
}

@Override
public WxCpBaseResp formModify(@NonNull WxCpFormModifyRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_MODIFY_FORM);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}

@Override
public WxCpFormInfoResult formInfo(@NonNull String formId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_GET_FORM_INFO);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("formid", formId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpFormInfoResult.fromJson(responseContent);
}

@Override
public List<WxCpFormStatistic> formStatistic(@NonNull List<WxCpFormStatisticRequest> requests) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_GET_FORM_STATISTIC);
String responseContent = this.cpService.post(apiUrl, WxCpFormStatisticRequest.toJson(requests));
return WxCpFormStatistic.listFromJson(responseContent);
}

@Override
public WxCpFormAnswer formAnswer(@NonNull WxCpFormAnswerRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(WEDOC_GET_FORM_ANSWER);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpFormAnswer.fromJson(responseContent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package me.chanjar.weixin.cp.bean.oa.doc;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
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;

/**
* 文档高级功能账号列表.
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxCpDocAdminListResult extends WxCpBaseResp implements Serializable {
private static final long serialVersionUID = 6293762486917512845L;

@SerializedName("docid")
private String docId;

@SerializedName("admin_list")
private List<Admin> adminList;

public static WxCpDocAdminListResult fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpDocAdminListResult.class);
}

@Override
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}

@Getter
@Setter
public static class Admin implements Serializable {
private static final long serialVersionUID = -4984807259145367427L;

@SerializedName("userid")
private String userId;

@SerializedName("open_userid")
private String openUserId;

@SerializedName("type")
private Integer type;
}
}
Loading