:art: 优化部分javadoc文档和单元测试代码

This commit is contained in:
Binary Wang 2024-12-14 00:45:24 +08:00
parent 7494de9d4f
commit d3f6023d2c
3 changed files with 37 additions and 40 deletions

View File

@ -1,10 +1,10 @@
## WxJava - 微信开发 Java SDK ## WxJava - 微信开发 Java SDK
[![码云Gitee](https://gitee.com/binary/weixin-java-tools/badge/star.svg?theme=blue)](https://gitee.com/binary/weixin-java-tools) [![码云Gitee](https://gitee.com/binary/weixin-java-tools/badge/star.svg?theme=blue)](https://gitee.com/binary/weixin-java-tools)
[![Github](https://img.shields.io/github/stars/Wechat-Group/WxJava?logo=github&style=flat)](https://github.com/binarywang/WxJava) [![Github](https://img.shields.io/github/stars/binarywang/WxJava?logo=github&style=flat)](https://github.com/binarywang/WxJava)
[![GitHub release](https://img.shields.io/github/release/Wechat-Group/WxJava.svg)](https://github.com/binarywang/WxJava/releases) [![GitHub release](https://img.shields.io/github/release/binarywang/WxJava.svg)](https://github.com/binarywang/WxJava/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java) [![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/wx-java.svg)](http://mvnrepository.com/artifact/com.github.binarywang/wx-java)
[![Build Status](https://img.shields.io/circleci/project/github/Wechat-Group/WxJava/develop.svg?sanitize=true)](https://circleci.com/gh/Wechat-Group/WxJava/tree/develop) [![Build Status](https://img.shields.io/circleci/project/github/binarywang/WxJava/develop.svg?sanitize=true)](https://circleci.com/gh/binarywang/WxJava/tree/develop)
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-支持-blue.svg)](https://www.jetbrains.com/?from=WxJava-weixin-java-tools) [![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-支持-blue.svg)](https://www.jetbrains.com/?from=WxJava-weixin-java-tools)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

View File

@ -17,7 +17,7 @@ public interface WxCpTpDepartmentService {
* <pre> * <pre>
* 部门管理接口 - 创建部门. * 部门管理接口 - 创建部门.
* 最多支持创建500个部门 * 最多支持创建500个部门
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90205 * 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90205">...</a>
* </pre> * </pre>
* *
* @param depart 部门 * @param depart 部门
@ -29,7 +29,7 @@ public interface WxCpTpDepartmentService {
/** /**
* <pre> * <pre>
* 部门管理接口 - 获取部门列表. * 部门管理接口 - 获取部门列表.
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90208 * 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90208">...</a>
* </pre> * </pre>
* *
* @param id 部门id获取指定部门及其下的子部门非必需可为null * @param id 部门id获取指定部门及其下的子部门非必需可为null
@ -42,7 +42,7 @@ public interface WxCpTpDepartmentService {
/** /**
* <pre> * <pre>
* 部门管理接口 - 更新部门. * 部门管理接口 - 更新部门.
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90206 * 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90206">...</a>
* 如果id为0(未部门),1(黑名单),2(星标组)或者不存在的id微信会返回系统繁忙的错误 * 如果id为0(未部门),1(黑名单),2(星标组)或者不存在的id微信会返回系统繁忙的错误
* </pre> * </pre>
* *
@ -54,7 +54,7 @@ public interface WxCpTpDepartmentService {
/** /**
* <pre> * <pre>
* 部门管理接口 - 删除部门. * 部门管理接口 - 删除部门.
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90207 * 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90207">...</a>
* 应用须拥有指定部门的管理权限 * 应用须拥有指定部门的管理权限
* </pre> * </pre>
* *
@ -66,7 +66,7 @@ public interface WxCpTpDepartmentService {
/** /**
* <pre> * <pre>
* 部门管理接口 - 获取部门列表. * 部门管理接口 - 获取部门列表.
* 详情请见: https://work.weixin.qq.com/api/doc#90000/90135/90208 * 详情请见: <a href="https://work.weixin.qq.com/api/doc#90000/90135/90208">...</a>
* </pre> * </pre>
* *
* @param corpId the corp id * @param corpId the corp id

View File

@ -56,19 +56,19 @@ public class WxCpOaWeDriveServiceTest {
String fileId2 = "s.ww45d3e188865aca30.652091685u4h_f.652696024TU4P"; String fileId2 = "s.ww45d3e188865aca30.652091685u4h_f.652696024TU4P";
/** /*
* 获取分享链接 * 获取分享链接
*/ */
WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(uId, fileId2); WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(uId, fileId2);
log.info("获取分享链接返回结果为:{}", fileShare.toJson()); log.info("获取分享链接返回结果为:{}", fileShare.toJson());
/** /*
* 分享设置 * 分享设置
*/ */
WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(uId, fileId2, 2, 1); WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(uId, fileId2, 2, 1);
log.info("分享设置返回结果为:{}", fileSetting.toJson()); log.info("分享设置返回结果为:{}", fileSetting.toJson());
/** /*
* 删除指定人 * 删除指定人
*/ */
WxCpFileAclDelRequest aclDelRequest = new WxCpFileAclDelRequest(); WxCpFileAclDelRequest aclDelRequest = new WxCpFileAclDelRequest();
@ -87,7 +87,7 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp aclDel = cpService.getOaWeDriveService().fileAclDel(aclDelRequest); WxCpBaseResp aclDel = cpService.getOaWeDriveService().fileAclDel(aclDelRequest);
log.info("删除指定人返回结果为:{}", aclDel.toJson()); log.info("删除指定人返回结果为:{}", aclDel.toJson());
/** /*
* 新增指定人 * 新增指定人
*/ */
WxCpFileAclAddRequest fileAclAdd = new WxCpFileAclAddRequest(); WxCpFileAclAddRequest fileAclAdd = new WxCpFileAclAddRequest();
@ -105,7 +105,7 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp result = cpService.getOaWeDriveService().fileAclAdd(fileAclAdd); WxCpBaseResp result = cpService.getOaWeDriveService().fileAclAdd(fileAclAdd);
log.info("返回结果为:{}", result.toJson()); log.info("返回结果为:{}", result.toJson());
/** /*
* 删除文件 * 删除文件
*/ */
ArrayList<String> fileIds = Lists.newArrayList(); ArrayList<String> fileIds = Lists.newArrayList();
@ -113,17 +113,16 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp fileDelete = cpService.getOaWeDriveService().fileDelete(fileIds); WxCpBaseResp fileDelete = cpService.getOaWeDriveService().fileDelete(fileIds);
log.info("删除文件数据为:{}", fileDelete.toJson()); log.info("删除文件数据为:{}", fileDelete.toJson());
/** /*
* 文件信息 文件信息
*/ */
WxCpFileInfo fileInfo = cpService.getOaWeDriveService().fileInfo(fileId); WxCpFileInfo fileInfo = cpService.getOaWeDriveService().fileInfo(fileId);
log.info("fileInfo数据为{}", fileInfo.toJson()); log.info("fileInfo数据为{}", fileInfo.toJson());
/** /*
* 移动文件 移动文件
*/ */
WxCpFileMoveRequest fileMoveRequest = new WxCpFileMoveRequest(); WxCpFileMoveRequest fileMoveRequest = new WxCpFileMoveRequest();
fileMoveRequest.setUserId(uId);
fileMoveRequest.setFatherId(spId); fileMoveRequest.setFatherId(spId);
fileMoveRequest.setReplace(true); fileMoveRequest.setReplace(true);
fileMoveRequest.setFileId(new String[]{fileId}); fileMoveRequest.setFileId(new String[]{fileId});
@ -131,23 +130,22 @@ public class WxCpOaWeDriveServiceTest {
WxCpFileMove fileMove = cpService.getOaWeDriveService().fileMove(fileMoveRequest); WxCpFileMove fileMove = cpService.getOaWeDriveService().fileMove(fileMoveRequest);
log.info("fileMove数据为{}", fileMove.toJson()); log.info("fileMove数据为{}", fileMove.toJson());
/** /*
* 新建文件/微文档 新建文件/微文档
*/ */
WxCpFileCreate fileCreate = cpService.getOaWeDriveService().fileCreate(spId, spId, 3, "新建微文档1"); WxCpFileCreate fileCreate = cpService.getOaWeDriveService().fileCreate(spId, spId, 3, "新建微文档1");
log.info("新建文件/微文档:{}", fileCreate.toJson()); log.info("新建文件/微文档:{}", fileCreate.toJson());
/** /*
* 下载文件 下载文件
*/ */
WxCpFileDownload fileDownload = cpService.getOaWeDriveService().fileDownload(uId, fileId); WxCpFileDownload fileDownload = cpService.getOaWeDriveService().fileDownload(uId, fileId);
log.info("下载文件为:{}", fileDownload.toJson()); log.info("下载文件为:{}", fileDownload.toJson());
/** /*
* 上传文件 上传文件
*/ */
WxCpFileUploadRequest fileUploadRequest = new WxCpFileUploadRequest(); WxCpFileUploadRequest fileUploadRequest = new WxCpFileUploadRequest();
fileUploadRequest.setUserId(uId);
fileUploadRequest.setSpaceId(spId); fileUploadRequest.setSpaceId(spId);
fileUploadRequest.setFatherId(spId); fileUploadRequest.setFatherId(spId);
fileUploadRequest.setFileName("第一个文件"); fileUploadRequest.setFileName("第一个文件");
@ -165,17 +163,16 @@ public class WxCpOaWeDriveServiceTest {
WxCpFileUpload fileUpload = cpService.getOaWeDriveService().fileUpload(fileUploadRequest); WxCpFileUpload fileUpload = cpService.getOaWeDriveService().fileUpload(fileUploadRequest);
log.info("上传文件为:{}", fileUpload.toJson()); log.info("上传文件为:{}", fileUpload.toJson());
/** /*
* 重命名文件 重命名文件
*/ */
WxCpFileRename fileRename = cpService.getOaWeDriveService().fileRename(uId, fileUpload.getFileId(), "新的名字呢"); WxCpFileRename fileRename = cpService.getOaWeDriveService().fileRename(fileUpload.getFileId(), "新的名字呢");
log.info("重命名文件:{}", fileRename.toJson()); log.info("重命名文件:{}", fileRename.toJson());
/** /*
* 获取文件列表 获取文件列表
*/ */
WxCpFileListRequest fileListRequest = new WxCpFileListRequest(); WxCpFileListRequest fileListRequest = new WxCpFileListRequest();
fileListRequest.setUserId(uId);
fileListRequest.setSpaceId(spId); fileListRequest.setSpaceId(spId);
fileListRequest.setFatherId(spId); fileListRequest.setFatherId(spId);
fileListRequest.setSortType(1); fileListRequest.setSortType(1);
@ -185,7 +182,7 @@ public class WxCpOaWeDriveServiceTest {
WxCpFileList fileList = cpService.getOaWeDriveService().fileList(fileListRequest); WxCpFileList fileList = cpService.getOaWeDriveService().fileList(fileListRequest);
log.info("获取文件列表为:{}", fileList.toJson()); log.info("获取文件列表为:{}", fileList.toJson());
/** /*
* 权限管理 * 权限管理
*/ */
WxCpSpaceSettingRequest spaceSettingRequest = new WxCpSpaceSettingRequest(); WxCpSpaceSettingRequest spaceSettingRequest = new WxCpSpaceSettingRequest();
@ -200,19 +197,19 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp spaceSetting = cpService.getOaWeDriveService().spaceSetting(spaceSettingRequest); WxCpBaseResp spaceSetting = cpService.getOaWeDriveService().spaceSetting(spaceSettingRequest);
log.info("权限管理信息为:{}", spaceSetting.toJson()); log.info("权限管理信息为:{}", spaceSetting.toJson());
/** /*
* 获取邀请链接 * 获取邀请链接
*/ */
WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(uId, spId); WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(uId, spId);
log.info("获取邀请链接信息为:{}", spaceShare.toJson()); log.info("获取邀请链接信息为:{}", spaceShare.toJson());
/** /*
* 获取空间信息 * 获取空间信息
*/ */
WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(uId, spId); WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(uId, spId);
log.info("获取空间信息为:{}", data.toJson()); log.info("获取空间信息为:{}", data.toJson());
/** /*
* 移除成员/部门 * 移除成员/部门
*/ */
WxCpSpaceAclDelRequest spaceAclDelRequest = new WxCpSpaceAclDelRequest(); WxCpSpaceAclDelRequest spaceAclDelRequest = new WxCpSpaceAclDelRequest();
@ -231,7 +228,7 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp spaceAclDel = cpService.getOaWeDriveService().spaceAclDel(spaceAclDelRequest); WxCpBaseResp spaceAclDel = cpService.getOaWeDriveService().spaceAclDel(spaceAclDelRequest);
log.info("移除成员/部门,返回数据为:{}", spaceAclDel.toJson()); log.info("移除成员/部门,返回数据为:{}", spaceAclDel.toJson());
/** /*
* 添加成员/部门 * 添加成员/部门
* https://developer.work.weixin.qq.com/document/path/93656 * https://developer.work.weixin.qq.com/document/path/93656
*/ */
@ -252,13 +249,13 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp wxCpBaseResp = cpService.getOaWeDriveService().spaceAclAdd(spaceAclAddRequest); WxCpBaseResp wxCpBaseResp = cpService.getOaWeDriveService().spaceAclAdd(spaceAclAddRequest);
log.info("添加成员/部门,返回数据为:{}", wxCpBaseResp.toJson()); log.info("添加成员/部门,返回数据为:{}", wxCpBaseResp.toJson());
/** /*
* 获取空间信息 * 获取空间信息
*/ */
WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("WangKai", "s.ww45d3e188865aca30.652091685u4h"); WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("WangKai", "s.ww45d3e188865aca30.652091685u4h");
log.info("获取空间信息spaceInfo信息为{}", spaceInfo.toJson()); log.info("获取空间信息spaceInfo信息为{}", spaceInfo.toJson());
/** /*
* 新建空间 * 新建空间
*/ */
WxCpSpaceCreateRequest request = new WxCpSpaceCreateRequest(); WxCpSpaceCreateRequest request = new WxCpSpaceCreateRequest();
@ -269,7 +266,7 @@ public class WxCpOaWeDriveServiceTest {
log.info("空间id为{}", spaceCreateData.getSpaceId()); // log.info("空间id为{}", spaceCreateData.getSpaceId()); //
log.info(spaceCreateData.toJson()); log.info(spaceCreateData.toJson());
/** /*
* 重命名空间 * 重命名空间
*/ */
WxCpSpaceRenameRequest wxCpSpaceRenameRequest = new WxCpSpaceRenameRequest(); WxCpSpaceRenameRequest wxCpSpaceRenameRequest = new WxCpSpaceRenameRequest();
@ -279,7 +276,7 @@ public class WxCpOaWeDriveServiceTest {
WxCpBaseResp baseResp = cpService.getOaWeDriveService().spaceRename(wxCpSpaceRenameRequest); WxCpBaseResp baseResp = cpService.getOaWeDriveService().spaceRename(wxCpSpaceRenameRequest);
log.info("重命名成功:{}", baseResp.toJson()); log.info("重命名成功:{}", baseResp.toJson());
/** /*
* 解散空间 * 解散空间
*/ */
WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss("WangKai", spaceCreateData.getSpaceId()); WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss("WangKai", spaceCreateData.getSpaceId());