Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -118,4 +124,46 @@ public static class ApplyData 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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,99 @@ public void testToJson() {

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());
}
}