MarketingSystemDataExportTool/grpc/dingtalk/dingtalkv1/approval.proto

267 lines
8.8 KiB
Protocol Buffer
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package dingtalkservice.dingtalkv1;
import "validate/validate.proto";
option go_package = "./dingtalk/dingtalkv1;dingtalkv1";
// 审批
service Approval {
// 创建审批单
rpc Create (ReqApprovalCreate) returns (RespApprovalDetail) {}
// 获取详情
rpc GetDetail(ReqApprovalGetDetail) returns(RespApprovalGetDetail) {}
// 获取附件下载链接
rpc GetDownload(ReqApprovalGetDownload) returns(RespApprovalReqApprovalGetDownload) {}
// 通过手机号获取用户id
rpc GetUserIdByMobile(ReqGetUserIdByMobile) returns(RespGetUserIdByMobile) {}
// 创建审批单
rpc CreateByBusinessCode (ReqApprovalCreateByBusinessCode) returns (RespApprovalDetail) {}
}
message ReqApprovalCreateByBusinessCode {
// 用户id
int32 userId = 1;
// 外部关联id审批回调时会携带此参数
int64 outId = 2;
// 审批模板内容
Body body = 3 [(validate.rules).message.required = true];
// 公司主体id
int32 companyId = 4;
// 业务编码
string business_code = 5;
// 是否需要审批单号
bool is_need_business_id = 6;
// 请求的 body 参数,对应钉钉文档中的 body 参数 json_encode后 https://open.dingtalk.com/document/orgapp/initiate-approval
message Body {
// string process_code = 1 [(validate.rules).string.min_len = 1]; //这里不传此参数要由业务编码动态决策用哪一个模板ID
// 发起人的钉钉ID
string originator_user_id = 2 [(validate.rules).string.min_len = 1];
// 部门ID
int32 dept_id = 3 [(validate.rules).int32.gte = -1];
// 表单参数
repeated FormComponentValue form_component_values = 4 [(validate.rules).repeated.min_items = 1];
// 指定审批单的执行流程最大列表长度20会覆盖审批单在OA后台设置的默认流程。
repeated ProcessInstanceApproverVo approvers_v2 = 5 [(validate.rules).repeated.max_items = 20];
// 自定义节点操作人列表流程预测结果中节点规则上必填的自选操作人列表最大列表长度20使用此参数时将使用钉钉新版本接口https://open.dingtalk.com/document/orgapp/create-an-approval-instance
repeated TargetSelectActionersVo target_select_actioners = 6[(validate.rules).repeated.max_items = 20];
}
message FormComponentValue {
string name = 1 [(validate.rules).string.min_len = 1];
string value = 2;
string ext_value = 3;
}
// 审批人列表最大列表长度20。
message ProcessInstanceApproverVo {
string task_action_type = 1; // 会签AND 或签OR 单人NONE
repeated string user_ids = 2; // 审批人id 会签/或签 要生效至少两个
}
// 使用审批流模板时,流程预测结果中节点规则上必填的自选操作人列表
message TargetSelectActionersVo {
string actioner_key = 1;
repeated string actioner_user_ids = 2;
}
}
message ReqGetUserIdByMobile {
// 手机号
string mobile = 1 [(validate.rules).string.min_len = 1];
// 公司主体id
int32 company_id = 2;
}
message RespGetUserIdByMobile {
string userid = 1;
}
message ReqApprovalGetDownload {
string process_instance_id = 1 [(validate.rules).string.min_len = 1];
string file_id = 2 [(validate.rules).string.min_len = 1];
// 公司主体id
int32 company_id = 3;
}
message RespApprovalReqApprovalGetDownload {
string download_uri = 1; // 文件下载地址有效期15分钟
}
message ReqApprovalGetDetail {
// 审批单id
string process_instance_id = 1 [(validate.rules).string.min_len = 1];
// 公司主体id
int32 company_id = 2;
}
// 返回的结果详情见https://open.dingtalk.com/document/orgapp/obtains-the-details-of-a-single-approval-instance#h2-n2q-pvq-r2s
message RespApprovalGetDetail {
string title = 1;
string process_instance_id = 2;
// 完成时间示例2020-12-21 15:30:27
string finish_time = 3;
string originator_userid = 4;
string originator_dept_id = 5;
string status = 6;
string result = 7;
repeated FormComponentValue form_component_values = 8;
string business_id = 9;
repeated Task Tasks = 10;
repeated operationRecord operationRecords = 11;
// 完成时间unix时间戳
int32 finish_time_unix = 12;
// "":正在处理 "agree":同意 "refuse":拒绝 "terminate":终止 "delete":删除
string final_result = 13;
message operationRecord {
string date = 1;
string userid = 2;
string remark = 3;
repeated Attachment attachments = 4;
// operation_result 操作结果
// AGREE同意
// REFUSE拒绝
// NONE
string operation_result = 5;
// operation_type 操作类型。
//EXECUTE_TASK_NORMAL正常执行任务
//EXECUTE_TASK_AGENT代理人执行任务
//APPEND_TASK_BEFORE前加签任务
//APPEND_TASK_AFTER后加签任务
//REDIRECT_TASK转交任务
//START_PROCESS_INSTANCE发起流程实例
//TERMINATE_PROCESS_INSTANCE终止(撤销)流程实例
//FINISH_PROCESS_INSTANCE结束流程实例
//ADD_REMARK添加评论
//REDIRECT_PROCESS审批退回
//PROCESS_CC抄送
string operation_type = 6;
message Attachment {
string file_name = 1;
string file_size = 2;
string file_id = 3; // 附件ID
string file_type = 4;
string space_id = 5;
}
}
message FormComponentValue {
string name = 1;
string value = 2;
string ext_value = 3;
string component_type = 4;
string id = 5;
}
message Task {
string userid = 1;
// TaskStatus 处理状态
// NEW未启动
// RUNNING处理中
// PAUSED暂停
// CANCELED取消
// COMPLETED完成
// TERMINATED终止
string task_status = 2;
// TaskResult 处理结果
//AGREE同意
//REFUSE拒绝
//REDIRECTED转交
string task_result = 3;
string create_time = 4;
string finish_time = 5;
string task_id = 6;
// 活动节点id
string activity_id = 8;
// string mobile_url = 9;
// string pc_url = 10;
}
}
message ReqApprovalCreate {
// 我们系统的用户id不是钉钉的用户ID,
int32 user_id = 1;
// 外部关联id审批回调时会携带此参数
int64 out_id = 2;
// 请求的 body 参数,对应钉钉文档中的 body 参数 json_encode后 https://open.dingtalk.com/document/orgapp/initiate-approval
Body body = 3 [(validate.rules).message.required = true];
// 公司主体id
int32 company_id = 4;
// 是否需要审批单号
bool is_need_business_id = 5;
message Body {
// 模板ID
string process_code = 1 [(validate.rules).string.min_len = 1];
// 发起人的钉钉ID
string originator_user_id = 2 [(validate.rules).string.min_len = 1];
// 部门ID
int32 dept_id = 3 [(validate.rules).int32.gte = -1];
// 表单参数
repeated FormComponentValue form_component_values = 4 [(validate.rules).repeated.min_items = 1];
// 指定审批单的执行流程最大列表长度20会覆盖审批单在OA后台设置的默认流程。
repeated ProcessInstanceApproverVo approvers_v2 = 5 [(validate.rules).repeated.max_items = 20];
// 自定义节点操作人列表流程预测结果中节点规则上必填的自选操作人列表最大列表长度20使用此参数时将使用钉钉新版本接口https://open.dingtalk.com/document/orgapp/create-an-approval-instance
repeated TargetSelectActionersVo target_select_actioners = 6[(validate.rules).repeated.max_items = 20];
}
message FormComponentValue {
string name = 1 [(validate.rules).string.min_len = 1];
string value = 2;
string ext_value = 3;
}
// 审批人列表最大列表长度20。
message ProcessInstanceApproverVo {
string task_action_type = 1; // 会签AND 或签OR 单人NONE
repeated string user_ids = 2; // 审批人id 会签/或签 要生效至少两个
}
// 使用审批流模板时,流程预测结果中节点规则上必填的自选操作人列表
message TargetSelectActionersVo {
string actioner_key = 1;
repeated string actioner_user_ids = 2;
}
}
message RespApprovalDetail{
// dingtalkService记录单据中的主键ID
int32 id = 1;
// 咱们系统的用户ID
int32 user_id = 2;
// 钉钉模板ID
string template_id = 3;
// 钉钉流程实例ID
string process_instance_id = 4;
// 外部关联ID
int32 out_id = 5;
// 表单数据
string form_data = 6;
// 通知数据
string notify_data = 7;
// 审批结果:terminate-终止(可能是撤销或删除)agree-同意refuse-拒绝,空字符串-没有最终结果
string final_result = 8;
// 推送地址事件地址
int32 pushed_url = 9;
// 创建时间
int32 create_time = 10;
// 完成时间戳
int32 finish_time = 11;
// 更新时间
int32 update_time = 12;
// 状态: 1-审批中,2-已审批,3-已推送
int32 status = 13;
// 主体的企业 id
string corp_id = 14;
// 审批单号
string business_id = 15;
}