: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
README.md
weixin-java-cp/src
main/java/me/chanjar/weixin/cp/tp/service
test/java/me/chanjar/weixin/cp/api

View File

@ -1,10 +1,10 @@
## WxJava - 微信开发 Java SDK
[![码云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 release](https://img.shields.io/github/release/Wechat-Group/WxJava.svg)](https://github.com/binarywang/WxJava/releases)
[![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/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)
[![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)
[![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>
* 部门管理接口 - 创建部门.
* 最多支持创建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>
*
* @param depart 部门
@ -29,7 +29,7 @@ public interface WxCpTpDepartmentService {
/**
* <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>
*
* @param id 部门id获取指定部门及其下的子部门非必需可为null
@ -42,7 +42,7 @@ public interface WxCpTpDepartmentService {
/**
* <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微信会返回系统繁忙的错误
* </pre>
*
@ -54,7 +54,7 @@ public interface WxCpTpDepartmentService {
/**
* <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>
*
@ -66,7 +66,7 @@ public interface WxCpTpDepartmentService {
/**
* <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>
*
* @param corpId the corp id

View File

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