1
0
mirror of synced 2025-12-22 18:08:12 +08:00

🎨 #3751 【企业微信】提交审批申请接口增加process参数以支持新版的审批流程信息

This commit is contained in:
Copilot
2025-11-17 11:59:51 +08:00
committed by GitHub
parent 3c440eacb3
commit 1922aaaa94
2 changed files with 144 additions and 1 deletions

View File

@@ -44,7 +44,13 @@ public class WxCpOaApplyEventRequest implements Serializable {
private Integer chooseDepartment;
/**
* 审批流程信息用于指定审批申请的审批流程支持单人审批、多人会签、多人或签可能有多个审批节点仅use_template_approver为0时生效。
* 审批流程信息(新版流程列表)用于指定审批申请的审批流程支持单人审批、多人会签、多人或签可能有多个审批节点仅use_template_approver为0时生效。
*/
@SerializedName("process")
private Process process;
/**
* 审批流程信息旧版用于指定审批申请的审批流程支持单人审批、多人会签、多人或签可能有多个审批节点仅use_template_approver为0时生效。
*/
@SerializedName("approver")
private List<Approver> approvers;
@@ -118,4 +124,46 @@ public class WxCpOaApplyEventRequest implements Serializable {
private List<ApplyDataContent> contents;
}
/**
* 审批流程信息(新版).
*/
@Data
@Accessors(chain = true)
public static class Process implements Serializable {
private static final long serialVersionUID = 4758206091546930988L;
/**
* 审批流程节点列表当use_template_approver为0时必填
*/
@SerializedName("node_list")
private List<ProcessNode> nodeList;
}
/**
* 审批流程节点.
*/
@Data
@Accessors(chain = true)
public static class ProcessNode implements Serializable {
private static final long serialVersionUID = 1758206091546930988L;
/**
* 节点类型1-审批人2-抄送人3-抄送人
*/
@SerializedName("type")
private Integer type;
/**
* 多人审批方式1-全签2-或签3-依次审批
*/
@SerializedName("apv_rel")
private Integer apvRel;
/**
* 审批节点审批人userid列表若为多人会签、多人或签需填写每个人的userid
*/
@SerializedName("userid")
private String[] userIds;
}
}

View File

@@ -95,4 +95,99 @@ public class WxCpOaApplyEventRequestTest {
assertThat(request.toJson()).isEqualTo(GsonParser.parse(json).toString());
}
/**
* Test to json with process.
*/
@Test
public void testToJsonWithProcess() {
String json = "{\n" +
" \"creator_userid\": \"WangXiaoMing\",\n" +
" \"template_id\": \"3Tka1eD6v6JfzhDMqPd3aMkFdxqtJMc2ZRioeFXkaaa\",\n" +
" \"use_template_approver\":0,\n" +
" \"process\": {\n" +
" \"node_list\": [\n" +
" {\n" +
" \"type\": 1,\n" +
" \"apv_rel\": 2,\n" +
" \"userid\": [\"WuJunJie\",\"WangXiaoMing\"]\n" +
" },\n" +
" {\n" +
" \"type\": 1,\n" +
" \"apv_rel\": 1,\n" +
" \"userid\": [\"LiuXiaoGang\"]\n" +
" },\n" +
" {\n" +
" \"type\": 2,\n" +
" \"userid\": [\"ZhangSan\",\"LiSi\"]\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"apply_data\": {\n" +
" \"contents\": [\n" +
" {\n" +
" \"control\": \"Text\",\n" +
" \"id\": \"Text-15111111111\",\n" +
" \"value\": {\n" +
" \"text\": \"文本填写的内容\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"summary_list\": [\n" +
" {\n" +
" \"summary_info\": [{\n" +
" \"text\": \"摘要第1行\",\n" +
" \"lang\": \"zh_CN\"\n" +
" }]\n" +
" },\n" +
" {\n" +
" \"summary_info\": [{\n" +
" \"text\": \"摘要第2行\",\n" +
" \"lang\": \"zh_CN\"\n" +
" }]\n" +
" },\n" +
" {\n" +
" \"summary_info\": [{\n" +
" \"text\": \"摘要第3行\",\n" +
" \"lang\": \"zh_CN\"\n" +
" }]\n" +
" }\n" +
" ]\n" +
"}";
WxCpOaApplyEventRequest request = new WxCpOaApplyEventRequest();
request.setCreatorUserId("WangXiaoMing")
.setTemplateId("3Tka1eD6v6JfzhDMqPd3aMkFdxqtJMc2ZRioeFXkaaa")
.setUseTemplateApprover(0)
.setProcess(new WxCpOaApplyEventRequest.Process()
.setNodeList(Arrays.asList(
new WxCpOaApplyEventRequest.ProcessNode()
.setType(1)
.setApvRel(2)
.setUserIds(new String[]{"WuJunJie", "WangXiaoMing"}),
new WxCpOaApplyEventRequest.ProcessNode()
.setType(1)
.setApvRel(1)
.setUserIds(new String[]{"LiuXiaoGang"}),
new WxCpOaApplyEventRequest.ProcessNode()
.setType(2)
.setUserIds(new String[]{"ZhangSan", "LiSi"})
)))
.setApplyData(new WxCpOaApplyEventRequest.ApplyData()
.setContents(Collections.singletonList(new ApplyDataContent()
.setControl("Text").setId("Text-15111111111").setValue(new ContentValue().setText("文本填写的内容")))))
.setSummaryList(Arrays.asList(new SummaryInfo()
.setSummaryInfoData(Collections.singletonList(new SummaryInfo.SummaryInfoData().setLang("zh_CN").setText(
"摘要第1行"))),
new SummaryInfo()
.setSummaryInfoData(Collections.singletonList(new SummaryInfo.SummaryInfoData().setLang("zh_CN").setText(
"摘要第2行"))),
new SummaryInfo()
.setSummaryInfoData(Collections.singletonList(new SummaryInfo.SummaryInfoData().setLang("zh_CN").setText(
"摘要第3行")))))
;
assertThat(request.toJson()).isEqualTo(GsonParser.parse(json).toString());
}
}