1
0
mirror of synced 2025-12-24 19:28:33 +08:00

🆕 #2656【企业微信】增加微盘文件管理部分接口

This commit is contained in:
0katekate0
2022-05-22 21:16:10 +08:00
committed by GitHub
parent 9517292a0e
commit 1fdfd5c5a2
6 changed files with 208 additions and 0 deletions

View File

@@ -223,6 +223,32 @@ public interface WxCpOaWeDriveService {
*/
WxCpBaseResp fileDelete(@NonNull String userId, @NonNull List<String> fileId) throws WxErrorException;
/**
* 新增指定人
* 该接口用于对指定文件添加指定人/部门。
* <p>
* 请求方式POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_acl_add?access_token=ACCESS_TOKEN
*
* @param request 新增指定人请求参数
* @return
* @throws WxErrorException
*/
WxCpBaseResp fileAclAdd(@NonNull WxCpFileAclAddRequest request) throws WxErrorException;
/**
* 删除指定人
* 该接口用于删除指定文件的指定人/部门。
* <p>
* 请求方式POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_acl_del?access_token=ACCESS_TOKEN
*
* @param request 请求参数
* @return
* @throws WxErrorException
*/
WxCpBaseResp fileAclDel(@NonNull WxCpFileAclDelRequest request) throws WxErrorException;
/**
* 文件信息
* 该接口用于获取指定文件的信息。

View File

@@ -153,6 +153,20 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
return WxCpBaseResp.fromJson(responseContent);
}
@Override
public WxCpBaseResp fileAclAdd(@NonNull WxCpFileAclAddRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_ACL_ADD);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}
@Override
public WxCpBaseResp fileAclDel(@NonNull WxCpFileAclDelRequest request) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_ACL_DEL);
String responseContent = this.cpService.post(apiUrl, request.toJson());
return WxCpBaseResp.fromJson(responseContent);
}
@Override
public WxCpFileInfo fileInfo(@NonNull String userId, @NonNull String fileId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_INFO);

View File

@@ -0,0 +1,66 @@
package me.chanjar.weixin.cp.bean.oa.wedrive;
import com.google.gson.annotations.SerializedName;
import lombok.*;
import lombok.experimental.Accessors;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* 新增指定人请求参数.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxCpFileAclAddRequest implements Serializable {
private static final long serialVersionUID = -4960239393895754138L;
@SerializedName("userid")
private String userId;
@SerializedName("fileid")
private String fileId;
@SerializedName("auth_info")
private List<AuthInfo> authInfo;
@Getter
@Setter
public static class AuthInfo implements Serializable {
private static final long serialVersionUID = -4960239393895754598L;
@SerializedName("type")
private Integer type;
@SerializedName("departmentid")
private Integer departmentId;
@SerializedName("auth")
private Integer auth;
@SerializedName("userid")
private String userId;
public static AuthInfo fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, AuthInfo.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}
public static WxCpFileAclAddRequest fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpFileAclAddRequest.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,63 @@
package me.chanjar.weixin.cp.bean.oa.wedrive;
import com.google.gson.annotations.SerializedName;
import lombok.*;
import lombok.experimental.Accessors;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* 删除指定人请求参数.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxCpFileAclDelRequest implements Serializable {
private static final long serialVersionUID = -4960239393895754138L;
@SerializedName("userid")
private String userId;
@SerializedName("fileid")
private String fileId;
@SerializedName("auth_info")
private List<AuthInfo> authInfo;
@Getter
@Setter
public static class AuthInfo implements Serializable {
private static final long serialVersionUID = -4960239393895754598L;
@SerializedName("type")
private Integer type;
@SerializedName("departmentid")
private Integer departmentId;
@SerializedName("userid")
private String userId;
public static AuthInfo fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, AuthInfo.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}
public static WxCpFileAclDelRequest fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpFileAclDelRequest.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}

View File

@@ -161,6 +161,8 @@ public interface WxCpApiPathConsts {
String FILE_MOVE = "/cgi-bin/wedrive/file_move";
String FILE_DELETE = "/cgi-bin/wedrive/file_delete";
String FILE_INFO = "/cgi-bin/wedrive/file_info";
String FILE_ACL_ADD = "/cgi-bin/wedrive/file_acl_add";
String FILE_ACL_DEL = "/cgi-bin/wedrive/file_acl_del";
/**
* 审批流程引擎