Skip to content

Commit 3bf3595

Browse files
authored
🎨 修复 WxCpApprovalWorkflowDemo.java 的兼容性和编译错误
1 parent 4d0617f commit 3bf3595

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/demo/WxCpApprovalWorkflowDemo.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import me.chanjar.weixin.cp.bean.oa.WxCpApprovalDetailResult;
55
import me.chanjar.weixin.cp.bean.oa.WxCpApprovalInfo;
66
import me.chanjar.weixin.cp.bean.oa.WxCpOaApplyEventRequest;
7+
import me.chanjar.weixin.cp.bean.oa.WxCpOaApprovalTemplateResult;
78
import me.chanjar.weixin.cp.bean.oa.applydata.ApplyDataContent;
89
import me.chanjar.weixin.cp.bean.oa.applydata.ContentValue;
910

@@ -86,14 +87,14 @@ public void getApprovalDetails(String spNo) throws Exception {
8687

8788
System.out.println("审批单号: " + detail.getSpNo());
8889
System.out.println("审批名称: " + detail.getSpName());
89-
System.out.println("审批状态: " + detail.getSpStatus().getCode());
90-
System.out.println("申请人: " + detail.getApplyer().getUserId());
90+
System.out.println("审批状态: " + detail.getSpStatus());
91+
System.out.println("申请人: " + detail.getApplier().getUserId());
9192
System.out.println("申请时间: " + detail.getApplyTime());
9293

9394
// 打印审批记录
94-
if (detail.getSpRecord() != null) {
95-
detail.getSpRecord().forEach(record -> {
96-
System.out.println("审批节点状态: " + record.getSpStatus());
95+
if (detail.getSpRecords() != null) {
96+
Arrays.stream(detail.getSpRecords()).forEach(record -> {
97+
System.out.println("审批节点状态: " + record.getStatus());
9798
System.out.println("审批人: " + record.getDetails());
9899
});
99100
}
@@ -112,7 +113,7 @@ public void batchGetApprovalInfo() throws Exception {
112113
WxCpApprovalInfo approvalInfo = wxCpService.getOaService()
113114
.getApprovalInfo(startTime, endTime, "0", 100, null);
114115

115-
System.out.println("获取到的审批单数量: " + approvalInfo.getCount());
116+
System.out.println("获取到的审批单数量: " + (approvalInfo.getSpNoList() != null ? approvalInfo.getSpNoList().size() : 0));
116117

117118
// 遍历审批单号
118119
if (approvalInfo.getSpNoList() != null) {
@@ -130,7 +131,7 @@ public void batchGetApprovalInfo() throws Exception {
130131
public void templateManagement() throws Exception {
131132
// 获取模板详情
132133
String templateId = "3Tka1eD6v6JfzhDMqPd3aMkFdxqtJMc2ZRioUBGCNS";
133-
var templateResult = wxCpService.getOaService().getTemplateDetail(templateId);
134+
WxCpOaApprovalTemplateResult templateResult = wxCpService.getOaService().getTemplateDetail(templateId);
134135

135136
System.out.println("模板名称: " + templateResult.getTemplateNames());
136137
System.out.println("模板内容: " + templateResult.getTemplateContent());

0 commit comments

Comments
 (0)