diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventRequest.cs new file mode 100644 index 0000000000..56481bc39c --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventRequest.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// 请求参数 + /// + public class ApplyEventRequest + { + /// + /// 申请人userid,此审批申请将以此员工身份提交,申请人需在应用可见范围内 + /// + public string creator_userid { get; set; } + + /// + /// 模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。暂不支持通过接口提交[打卡补卡][调班]模板审批单。 + /// + public string template_id { get; set; } + + /// + /// 审批人模式:0-通过接口指定审批人、抄送人(此时approver、notifyer等参数可用); 1-使用此模板在管理后台设置的审批流程(需要保证审批流程中没有“申请人自选”节点),支持条件审批。默认为0 + /// + public int use_template_approver { get; set; } + + /// + /// 提单者提单部门id,不填默认为主部门 + /// 非必填 + /// + public int choose_department { get; set; } + + /// + /// 审批流程信息,用于指定审批申请的审批流程,支持单人审批、多人会签、多人或签,可能有多个审批节点,仅use_template_approver为0时生效。 + /// + public List approver { get; set; } + + /// + /// 抄送人节点userid列表,仅use_template_approver为0时生效。 + /// + public List notifyer { get; set; } + + /// + /// 抄送方式:1-提单时抄送(默认值); 2-单据通过后抄送;3-提单和单据通过后抄送。仅use_template_approver为0时生效。 + /// + public int notify_type { get; set; } + + /// + /// 审批申请数据,可定义审批申请中各个控件的值,其中必填项必须有值,选填项可为空,数据结构同“获取审批申请详情”接口返回值中同名参数“apply_data” + /// + public ApplyEventRequest_ApplyData apply_data { get; set; } + + /// + /// 摘要信息,用于显示在审批通知卡片、审批列表的摘要信息,最多3行 + /// + public List summary_list { get; set; } + } + + public class ApplyEventRequest_TextLang + { + /// + /// 摘要行显示文字,用于记录列表和消息通知的显示,不要超过20个字符 + /// + public string text { get; set; } + + /// + /// 摘要行显示语言,中文:zh_CN(注意不是zh-CN),英文:en。 + /// + public string lang { get; set; } + } + + public class ApplyEventRequest_Approver + { + /// + /// 节点审批方式:1-或签;2-会签,仅在节点为多人审批时有效 + /// + public int attr { get; set; } + + /// + /// 审批节点审批人userid列表,若为多人会签、多人或签,需填写每个人的userid + /// + public List userid { get; set; } + } + + public class ApplyEventRequest_ApplyData + { + /// + /// 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息 + /// + public List contents { get; set; } + } + + public class ApplyEventRequest_ApplyData_Contents + { + /// + /// 控件类型:Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;Selector-单选/多选;;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;Location-位置;RelatedApproval-关联审批单;Formula-公式;DateRange-时长; + /// + public string control { get; set; } + + /// + /// 控件id:控件的唯一id,可通过“获取审批模板详情”接口获取 + /// + public string id { get; set; } + + /// + /// 控件值 ,需在此为申请人在各个控件中填写内容不同控件有不同的赋值参数,具体说明详见附录。模板配置的控件属性为必填时,对应value值需要有值。 + /// + public ApplyEventRequest_ApplyData_Contents_Value value { get; set; } + } + + public class ApplyEventRequest_ApplyData_Contents_Value + { + /// + /// + /// + public string text { get; set; } + } + + public class ApplyEventRequest_SummaryList + { + /// + /// 摘要行信息,用于定义某一行摘要显示的内容 + /// + public List summary_info { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventResult.cs new file mode 100644 index 0000000000..4baef2bf35 --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApplyEventResult.cs @@ -0,0 +1,17 @@ + + +using Senparc.Weixin.Entities; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class ApplyEventResult : WorkJsonResult + { + /// + /// + /// + public string sp_no { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalCreateTemplateRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalCreateTemplateRequest.cs new file mode 100644 index 0000000000..e5fb196fbf --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalCreateTemplateRequest.cs @@ -0,0 +1,356 @@ +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class ApprovalCreateTemplateRequest + { + /// + /// + /// + public List template_names { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent template_content { get; set; } + } + /// + /// + /// + public class ApprovalCreateTemplateRequest_TextAndLang + { + /// + /// + /// + public string text { get; set; } + + /// + /// + /// + public string lang { get; set; } + } + + /// + /// + /// + public class ApprovalCreateTemplateRequest_TemplateContent + { + /// + /// + /// + public List controls { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls + { + /// + /// 模板控件属性,包含了模板内控件的各种属性信息 + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Property property { get; set; } + + /// + /// 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班) + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config config { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Property + { + /// + /// 控件类型:Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;Attendance-假勤控件;Vacation-请假控件;Location-位置;RelatedApproval-关联审批单;Formula-公式;DateRange-时长 + /// + public string control { get; set; } + + /// + /// 控件id + /// + public string id { get; set; } + + /// + /// 控件名称,若配置了多语言则会包含中英文的控件名称,默认为zh_CN中文 + /// + public List title { get; set; } + + /// + /// 控件说明,向申请者展示的控件填写说明,若配置了多语言则会包含中英文的控件说明,默认为zh_CN中文 + /// + public List placeholder { get; set; } + + /// + /// 是否必填:1-必填;0-非必填 + /// + public int require { get; set; } + + /// + /// 是否参与打印:1-不参与打印;0-参与打印 + /// + public int un_print { get; set; } + } + + /// + /// 附1 文本/多行文本控件(control参数为Text或Textarea) 文本/多行文本控件中config不需要填写 + /// 附2 数字控件(control参数为Number) 数字控件中config不需要填写 + /// 附3 金额控件(control参数为Money) 金额控件中config不需要填写 + /// 附4 日期/日期+时间控件(control参数为Date) + /// 附5 单选/多选控件(control参数为Selector) + /// 附6 成员控件(control参数为Contact) + /// 附7 说明文字控件(control参数为Tips) 说明文字控件中config不需要填写 + /// 附8 附件控件(control参数为File,且value参数为files) + /// 附9 明细控件(control参数为Table) + /// 附10 假勤组件-请假组件(control参数为Vacation) + /// 附11 假勤组件-出差/外出/加班组件(control参数为Attendance) + /// 附12 位置控件(control参数为Location) + /// 附13 关联审批单控件(control参数为RelatedApproval) + /// + /// + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config + { + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Date date { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Selector selector { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Contact contact { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_File file { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table table { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Attendance attendance { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Location location { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_RelatedApproval related_approval { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_DateRange date_range { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Date + { + /// + /// 时间展示类型:day-日期;hour-日期+时间 ,和对应模板控件属性一致 + /// + public string type { get; set; } + + public List options { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Selector + { + /// + /// 选择方式:single-单选;multi-多选 + /// + public string type { get; set; } + + /// + /// 多选选项,多选属性的选择控件允许输入多个 + /// + public List options { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Selector_Options + { + /// + /// 选项key + /// + public string key { get; set; } + + /// + /// 选项说明,text和lang规则同上 + /// + public List value { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Contact + { + /// + /// single-单选、multi-多选 + /// + public string type { get; set; } + + /// + /// user-成员、department-部门 + /// + public string mode { get; set; } + } + + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_File + { + /// + /// 是否只允许拍照,1--是, 0--否 + /// + public int is_only_photo { get; set; } + } + + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table + { + /// + /// 是否只允许拍照,1--是, 0--否 + /// + public int print_format { get; set; } + + /// + /// + /// + public List children { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children + { + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Property property { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Config config { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Property + { + /// + /// 是否只允许拍照,1--是, 0--否 + /// + public string control { get; set; } + + /// + /// + /// + public string id { get; set; } + + /// + /// + /// + public List title { get; set; } + + /// + /// + /// + public List placeholder { get; set; } + + /// + /// + /// + public int require { get; set; } + + /// + /// + /// + public int un_print { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Config + { + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Config_File file { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Table_Children_Config_File + { + /// + /// + /// + public int is_only_photo { get; set; } + } + + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Attendance + { + /// + /// + /// + public int type { get; set; } + + /// + /// + /// + public ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Attendance_DateRange date_range { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Attendance_DateRange + { + /// + /// 时间展示类型:halfday-日期;hour-日期+时间 + /// + public string type { get; set; } + + /// + /// 0-自然日;1-工作日 + /// + public int official_holiday { get; set; } + + /// + /// 一天的时长(单位为秒),必须大于0小于等于86400 + /// + public int perday_duration { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_Location + { + /// + /// 距离,目前支持100、200、300 + /// + public int distance { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_RelatedApproval + { + /// + /// 关联审批单的template_id ,不填时表示可以关联所有模版,该template_id可通过获取审批模版接口获取 + /// + public List template_id { get; set; } + } + + public class ApprovalCreateTemplateRequest_TemplateContent_Controls_Config_DateRange + { + /// + /// 时间展示类型:halfday-日期;hour-日期+时间 + /// + public string type { get; set; } + + /// + /// 0-自然日;1-工作日 + /// + public int official_holiday { get; set; } + + /// + /// 一天的时长(单位为秒),必须大于0小于等于86400 + /// + public int perday_duration { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalUpdateTemplateRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalUpdateTemplateRequest.cs new file mode 100644 index 0000000000..fc4d3c2d66 --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/ApprovalUpdateTemplateRequest.cs @@ -0,0 +1,13 @@ +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class ApprovalUpdateTemplateRequest:ApprovalCreateTemplateRequest + { + /// + /// + /// + public string template_id { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalDetailResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalDetailResult.cs new file mode 100644 index 0000000000..483d72aa99 --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalDetailResult.cs @@ -0,0 +1,234 @@ + + +using Senparc.Weixin.Entities; +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class GetApprovalDetailResult : WorkJsonResult + { + /// + /// + /// + public GetApprovalDetailResult_Info info { get; set; } + } + + public class GetApprovalDetailResult_Info + { + /// + /// + /// + public string sp_no { get; set; } + + /// + /// + /// + public string sp_name { get; set; } + + /// + /// + /// + public int sp_status { get; set; } + + /// + /// + /// + public string template_id { get; set; } + + /// + /// + /// + public long apply_time { get; set; } + + /// + /// + /// + public GetApprovalDetailResult_Info_Applyer applyer { get; set; } + + /// + /// + /// + public List sp_record { get; set; } + + + + /// + /// + /// + public List notifyer { get; set; } + + /// + /// + /// + public GetApprovalDetailResult_Info_ApplyData apply_data { get; set; } + + /// + /// + /// + public List comments { get; set; } + } + + public class GetApprovalDetailResult_TextLang + { + /// + /// 摘要行显示文字,用于记录列表和消息通知的显示,不要超过20个字符 + /// + public string text { get; set; } + + /// + /// 摘要行显示语言,中文:zh_CN(注意不是zh-CN),英文:en。 + /// + public string lang { get; set; } + } + + public class GetApprovalDetailResult_Info_Applyer + { + /// + /// + /// + public string userid { get; set; } + + /// + /// + /// + public string partyid { get; set; } + } + + public class GetApprovalDetailResult_Info_SpRecord + { + /// + /// + /// + public int sp_status { get; set; } + + /// + /// + /// + public int approverattr { get; set; } + + /// + /// + /// + public List details { get; set; } + } + + public class GetApprovalDetailResult_Info_SpRecord_Details + { + /// + /// + /// + public GetApprovalDetailResult_Info_SpRecord_Details_Approver approver { get; set; } + + public string speech { get; set; } + + public int sp_status { get; set; } + + public long sptime { get; set; } + + public List media_id { get; set; } + + } + + public class GetApprovalDetailResult_Info_SpRecord_Details_Approver + { + /// + /// + /// + public string userid { get; set; } + + } + + + public class GetApprovalDetailResult_Info_Notifyer + { + /// + /// + /// + public string userid { get; set; } + + } + + public class GetApprovalDetailResult_Info_ApplyData + { + /// + /// + /// + public List contents { get; set; } + + } + + public class GetApprovalDetailResult_Info_ApplyData_Contents + { + /// + /// + /// + public string control { get; set; } + + /// + /// + /// + public string id { get; set; } + + /// + /// + /// + public List title { get; set; } + + /// + /// + /// + public GetApprovalDetailResult_Info_ApplyData_Contents_Value value { get; set; } + } + + public class GetApprovalDetailResult_Info_ApplyData_Contents_Value + { + /// + /// + /// + public string text { get; set; } + + /// + /// + /// + public List tips { get; set; } + } + + public class GetApprovalDetailResult_Info_Comments + { + /// + /// + /// + public GetApprovalDetailResult_Info_Comments_CommentUserInfo commentUserInfo { get; set; } + + /// + /// + /// + public long commenttime { get; set; } + + /// + /// + /// + public string commentcontent { get; set; } + + /// + /// + /// + public string commentid { get; set; } + + /// + /// + /// + public List media_id { get; set; } + } + + public class GetApprovalDetailResult_Info_Comments_CommentUserInfo + { + /// + /// + /// + public string userid { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoRequest.cs new file mode 100644 index 0000000000..6685fa8572 --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoRequest.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// 请求参数 + /// + public class GetApprovalInfoRequest + { + /// + /// 审批单提交的时间范围,开始时间,UNix时间戳 + /// 1569546000 + /// + public string starttime { get; set; } + + /// + /// 审批单提交的时间范围,结束时间,Unix时间戳 + /// + public string endtime { get; set; } + + /// + /// 分页查询游标,默认为0,后续使用返回的next_cursor进行分页拉取 + /// + public int cursor { get; set; } + + /// + /// 一次请求拉取审批单数量,默认值为100,上限值为100。若accesstoken为自建应用,仅允许获取在应用可见范围内申请人提交的表单,返回的sp_no_list个数可能和size不一致,开发者需用next_cursor判断表单记录是否拉取完 + /// + public int size { get; set; } + + /// + /// 筛选条件,可对批量拉取的审批申请设置约束条件,支持设置多个条件 + /// + public List filters { get; set; } + } + + public class GetApprovalInfoRequest_Filter + { + /// + /// 筛选类型,包括: + /// template_id - 模板类型/模板id; + /// creator - 申请人; + /// department - 审批单提单者所在部门; + /// sp_status - 审批状态; + /// record_type - 审批单类型属性,1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批 + /// + /// 注意: + /// 1、仅“部门”支持同时配置多个筛选条件。 + /// 2、不同类型的筛选条件之间为“与”的关系,同类型筛选条件之间为“或”的关系 + /// 3、record_type筛选类型仅支持2021/05/31以后新提交的审批单,历史单不支持表单类型属性过滤 + /// + public string key { get; set; } + + /// + /// 筛选值,对应为:template_id-模板id;creator-申请人userid ;department-所在部门id;sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付) + /// + public string value { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoResult.cs new file mode 100644 index 0000000000..16a38ea6ad --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetApprovalInfoResult.cs @@ -0,0 +1,18 @@ + + +using Senparc.Weixin.Entities; +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class GetApprovalInfoResult : WorkJsonResult + { + /// + /// + /// + public List sp_no_list { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailRequest.cs new file mode 100644 index 0000000000..300fa4098d --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailRequest.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// 获取审批模板详情 请求参数 + /// + public class GetTemplateDetailRequest + { + /// + /// 模板的唯一标识id。可在“获取审批单据详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面浏览器Url链接中获得。 + /// + public string template_id { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailResult.cs new file mode 100644 index 0000000000..44ae362c2f --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/GetTemplateDetailResult.cs @@ -0,0 +1,131 @@ + + +using Senparc.Weixin.Entities; +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// 上传临时媒体文件返回结果 + /// + public class GetTemplateDetailResult : WorkJsonResult + { + /// + /// + /// + public List template_names { get; set; } + + /// + /// + /// + public GetTemplateDetailResult_TemplateContent template_content { get; set; } + } + + /// + /// + /// + public class GetTemplateDetailResult_TextAndLang + { + /// + /// + /// + public string text { get; set; } + + /// + /// + /// + public string lang { get; set; } + } + + /// + /// + /// + public class GetTemplateDetailResult_TemplateContent + { + /// + /// + /// + public List controls { get; set; } + } + + public class GetTemplateDetailResult_TemplateContent_Controls + { + /// + /// 模板控件属性,包含了模板内控件的各种属性信息 + /// + public GetTemplateDetailResult_TemplateContent_Controls_Property property { get; set; } + + /// + /// 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班) + /// + public GetTemplateDetailResult_TemplateContent_Controls_Config config { get; set; } + } + + public class GetTemplateDetailResult_TemplateContent_Controls_Property + { + /// + /// 控件类型:Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;Attendance-假勤控件;Vacation-请假控件;Location-位置;RelatedApproval-关联审批单;Formula-公式;DateRange-时长 + /// + public string control { get; set; } + + /// + /// 控件id + /// + public string id { get; set; } + + /// + /// 控件名称,若配置了多语言则会包含中英文的控件名称,默认为zh_CN中文 + /// + public List title { get; set; } + + /// + /// 控件说明,向申请者展示的控件填写说明,若配置了多语言则会包含中英文的控件说明,默认为zh_CN中文 + /// + public List placeholder { get; set; } + + /// + /// 是否必填:1-必填;0-非必填 + /// + public int require { get; set; } + + /// + /// 是否参与打印:1-不参与打印;0-参与打印 + /// + public int un_print { get; set; } + } + + + public class GetTemplateDetailResult_TemplateContent_Controls_Config + { + /// + /// + /// + public GetTemplateDetailResult_TemplateContent_Controls_Config_Selector selector { get; set; } + } + + public class GetTemplateDetailResult_TemplateContent_Controls_Config_Selector + { + /// + /// + /// + public string type { get; set; } + + public int exp_type { get; set; } + + public List options { get; set; } + } + + public class GetTemplateDetailResult_TemplateContent_Controls_Config_Selector_Options + { + /// + /// + /// + public string key { get; set; } + + /// + /// + /// + public List value { get; set; } + } + +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/SetOneUserQuotaRequest.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/SetOneUserQuotaRequest.cs new file mode 100644 index 0000000000..3076a9840c --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/SetOneUserQuotaRequest.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// 请求参数 + /// + public class SetOneUserQuotaRequest + { + /// + /// 需要修改假期余额的成员的userid + /// + public string userid { get; set; } + + /// + /// 假期id + /// + public string vacation_id { get; set; } + + /// + /// 设置的假期余额,单位为秒 + /// 不能大于1000天或24000小时,当假期时间刻度为按小时请假时,必须为360整倍数,即0.1小时整倍数,按天请假时,必须为8640整倍数,即0.1天整倍数 + /// + public int leftduration { get; set; } + + /// + /// 假期时间刻度:0-按天请假;1-按小时请假 + /// 主要用于校验,必须等于企业假期管理配置中设置的假期时间刻度类型 + /// + public int time_attr { get; set; } + + /// + /// 修改备注,用于显示在假期余额的修改记录当中,可对修改行为作说明,不超过200字符 + /// 非必填 + /// + public string remarks { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetCorpConfResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetCorpConfResult.cs new file mode 100644 index 0000000000..ead2cee26c --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetCorpConfResult.cs @@ -0,0 +1,177 @@ + + +using Senparc.Weixin.Entities; +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class VacationGetCorpConfResult : WorkJsonResult + { + /// + /// 假期列表 + /// + public List lists { get; set; } + } + + public class VacationGetCorpConfResult_Lists + { + /// + /// 假期id + /// + public int id { get; set; } + + /// + /// 假期名称 + /// + public string name { get; set; } + + /// + /// 假期时间刻度:0-按天请假;1-按小时请假 + /// + public int time_attr { get; set; } + + /// + /// 时长计算类型:0-自然日;1-工作日 + /// + public int duration_type { get; set; } + + /// + /// 假期发放相关配置 + /// + public VacationGetCorpConfResult_Lists_QuotaAttr quota_attr { get; set; } + + /// + /// 单位换算值,即1天对应的秒数,可将此值除以3600得到一天对应的小时。 + /// + public int perday_duration { get; set; } + + /// + /// 是否关联加班调休,0-不关联,1-关联,关联后改假期类型变为调休假 + /// + public int is_newovertime { get; set; } + + /// + /// 入职时间大于n个月可用该假期,单位为月 + /// + public int enter_comp_time_limit { get; set; } + + /// + /// 假期过期规则 + /// + public VacationGetCorpConfResult_Lists_ExpireRule expire_rule { get; set; } + } + + public class VacationGetCorpConfResult_Lists_QuotaAttr + { + /// + /// 假期发放类型:0-不限额;1-自动按年发放;2-手动发放;3-自动按月发放 + /// + public int type { get; set; } + + /// + /// 自动发放时间戳,若假期发放为自动发放,此参数代表自动发放日期。注:返回时间戳的年份是无意义的,请只使用返回时间的月和日;若at_entry_date为true,该字段则无效,假期发放时间为员工入职时间 + /// + public long autoreset_time { get; set; } + + /// + /// 自动发放时长,单位为秒。注:只有自动按年发放和自动按月发放时有效,若选择了按照工龄和司龄发放,该字段无效,发放时长请使用区间中的quota + /// + public long autoreset_duration { get; set; } + + /// + /// 额度计算类型,自动按年发放时有效,0-固定额度;1-按工龄计算;2-按司龄计算 + /// + public int quota_rule_type { get; set; } + + /// + /// 额度计算规则,自动按年发放时有效 + /// + public VacationGetCorpConfResult_Lists_QuotaAttr_QuotaRules quota_rules { get; set; } + + /// + /// 是否按照入职日期发放假期,只有在自动按年发放类型有效,选择后发放假期的时间会成为员工入职的日期 + /// + public bool at_entry_date { get; set; } + + /// + /// 自动按月发放的发放时间,只有自动按月发放类型有效 + /// + public int auto_reset_month_day { get; set; } + } + + public class VacationGetCorpConfResult_Lists_QuotaAttr_QuotaRules + { + /// + /// 额度计算规则区间,只有在选择了按照工龄计算或者按照司龄计算时有效 + /// + public List list { get; set; } + + /// + /// 是否根据实际入职时间计算假期,选择后会根据员工在今年的实际工作时间发放假期 + /// + public bool based_on_actual_work_time { get; set; } + } + + public class VacationGetCorpConfResult_Lists_QuotaAttr_QuotaRules_List + { + /// + /// 区间发放时长,单位为s + /// + public int quota { get; set; } + + /// + /// 区间开始点,单位为年 + /// + public int begin { get; set; } + + /// + /// 区间结束点,无穷大则为0,单位为年 + /// + public int end { get; set; } + } + + public class VacationGetCorpConfResult_Lists_ExpireRule + { + /// + /// 过期规则类型,1-按固定时间过期,2-从发放日按年过期,3-从发放日按月过期,4-不过期 + /// + public int type { get; set; } + + /// + /// 有效期,按年过期为年,按月过期为月,只有在以上两种情况时有效 + /// + public int duration { get; set; } + + /// + /// 失效日期,只有按固定时间过期时有效 + /// + public VacationGetCorpConfResult_Lists_ExpireRule_Date date { get; set; } + + /// + /// 是否允许延长有效期 + /// + public bool extern_duration_enable { get; set; } + + /// + /// 延长有效期的具体时间,只有在extern_duration_enable为true时有效 + /// + public VacationGetCorpConfResult_Lists_ExpireRule_Date extern_duration { get; set; } + } + + + public class VacationGetCorpConfResult_Lists_ExpireRule_Date + { + /// + /// + /// + public int month { get; set; } + + /// + /// + /// + public int day { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetUserVacationQuotaResult.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetUserVacationQuotaResult.cs new file mode 100644 index 0000000000..c515598d71 --- /dev/null +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OAJson/VacationGetUserVacationQuotaResult.cs @@ -0,0 +1,51 @@ + + +using Senparc.Weixin.Entities; +using System.Collections.Generic; + +namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson +{ + /// + /// + /// + public class VacationGetUserVacationQuotaResult : WorkJsonResult + { + /// + /// 假期列表 + /// + public List lists { get; set; } + } + + public class VacationGetUserVacationQuotaResult_Lists + { + /// + /// 假期id + /// + public int id { get; set; } + + /// + /// 发放时长,单位为秒 + /// + public int assignduration { get; set; } + + /// + /// 使用时长,单位为秒 + /// + public int usedduration { get; set; } + + /// + /// 剩余时长,单位为秒 + /// + public int leftduration { get; set; } + + /// + /// 假期名称 + /// + public string vacationname { get; set; } + + /// + /// 假期的实际发放时长,通常在设置了按照实际工作时间发放假期后进行计算 + /// + public int real_assignduration { get; set; } + } +} diff --git a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OaApi.cs b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OaApi.cs index 1995d9139a..df6f63cd24 100644 --- a/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OaApi.cs +++ b/src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/OA/OaApi.cs @@ -1,4 +1,9 @@ -using System; +using Senparc.NeuChar; +using Senparc.Weixin.CommonAPIs; +using Senparc.Weixin.Entities; +using Senparc.Weixin.Work.AdvancedAPIs.Mobile; +using Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,8 +11,276 @@ namespace Senparc.Weixin.Work.AdvancedAPIs.OA { + [NcApiBind(NeuChar.PlatformType.WeChat_Work, true)] public static class OaApi { - //TODO:审批:https://developer.work.weixin.qq.com/document/path/91853 + #region 同步方法 + /// + /// 获取审批模板详情 + /// https://developer.work.weixin.qq.com/document/path/91982 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static GetTemplateDetailResult GetTemplateDetail(string accessToken, GetTemplateDetailRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/gettemplatedetail?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 提交审批申请 + /// https://developer.work.weixin.qq.com/document/path/91853 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static ApplyEventResult ApplyEvent(string accessToken, ApplyEventRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/applyevent?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 批量获取审批单号 + /// https://developer.work.weixin.qq.com/document/path/91816 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static GetApprovalInfoResult GetApprovalInfo(string accessToken, GetApprovalInfoRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/getapprovalinfo?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 获取审批申请详情 + /// https://developer.work.weixin.qq.com/document/path/91983 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static GetApprovalDetailResult GetApprovalDetail(string accessToken, string sp_no, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/getapprovaldetail?access_token={0}"; + var data = new + { + sp_no + }; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 获取企业假期管理配置 + /// https://developer.work.weixin.qq.com/document/path/93375 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// + /// + public static VacationGetCorpConfResult VacationGetCorpConf(string accessToken, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/getcorpconf?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, null, CommonJsonSendType.GET, timeOut); + } + + /// + /// 获取企业假期管理配置 + /// https://developer.work.weixin.qq.com/document/path/93376 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// + /// + public static VacationGetUserVacationQuotaResult VacationGetUserVacationQuota(string accessToken, string userid, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/getuservacationquota?access_token={0}"; + var data = new + { + userid + }; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 修改成员假期余额 + /// https://developer.work.weixin.qq.com/document/path/93377 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static WxJsonResult SetOneUserQuota(string accessToken, SetOneUserQuotaRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/setoneuserquota?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 创建审批模板 + /// https://developer.work.weixin.qq.com/document/path/97437 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static WxJsonResult ApprovalCreateTemplate(string accessToken, ApprovalCreateTemplateRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/approval/create_template?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 更新审批模板 + /// https://developer.work.weixin.qq.com/document/path/97438 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static WxJsonResult ApprovalUpdateTemplate(string accessToken, ApprovalUpdateTemplateRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/approval/update_template?access_token={0}"; + return CommonJsonSend.Send(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + #endregion + + + #region 异步方法 + /// + /// 获取审批模板详情 + /// https://developer.work.weixin.qq.com/document/path/91982 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task GetTemplateDetailAsync(string accessToken, GetTemplateDetailRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/gettemplatedetail?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 提交审批申请 + /// https://developer.work.weixin.qq.com/document/path/91853 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task ApplyEventAsync(string accessToken, ApplyEventRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/applyevent?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 批量获取审批单号 + /// https://developer.work.weixin.qq.com/document/path/91816 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task GetApprovalInfoAsync(string accessToken, GetApprovalInfoRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/getapprovalinfo?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 获取审批申请详情 + /// https://developer.work.weixin.qq.com/document/path/91983 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task GetApprovalDetailAsync(string accessToken, string sp_no, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/getapprovaldetail?access_token={0}"; + var data = new + { + sp_no + }; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 获取企业假期管理配置 + /// https://developer.work.weixin.qq.com/document/path/93375 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// + /// + public static async Task VacationGetCorpConfAsync(string accessToken, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/getcorpconf?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, null, CommonJsonSendType.GET, timeOut); + } + + /// + /// 获取企业假期管理配置 + /// https://developer.work.weixin.qq.com/document/path/93376 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// + /// + public static async Task VacationGetUserVacationQuotaAsync(string accessToken, string userid, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/getuservacationquota?access_token={0}"; + var data = new + { + userid + }; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 修改成员假期余额 + /// https://developer.work.weixin.qq.com/document/path/93377 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task SetOneUserQuotaAsync(string accessToken, SetOneUserQuotaRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/vacation/setoneuserquota?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 创建审批模板 + /// https://developer.work.weixin.qq.com/document/path/97437 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task ApprovalCreateTemplateAsync(string accessToken, ApprovalCreateTemplateRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/approval/create_template?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + + /// + /// 更新审批模板 + /// https://developer.work.weixin.qq.com/document/path/97438 + /// + /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取 + /// 请求参数 + /// + /// + public static async Task ApprovalUpdateTemplateAsync(string accessToken, ApprovalUpdateTemplateRequest data, int timeOut = Config.TIME_OUT) + { + var urlFormat = Config.ApiWorkHost + "/cgi-bin/oa/approval/update_template?access_token={0}"; + return await CommonJsonSend.SendAsync(accessToken, urlFormat, data, CommonJsonSendType.POST, timeOut); + } + #endregion } }