123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907 |
- using Google.Protobuf.WellKnownTypes;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection.Metadata.Ecma335;
- using System.Text;
- using System.Text.Json.Serialization;
- using System.Threading.Tasks;
- namespace OASystem.Domain.ViewModels.QiYeWeChat
- {
- /// <summary>
- /// 企业微信 审批 View
- /// </summary>
- public class ApprovalDataView : ResponseBase
- {
- /// <summary>
- /// 拉取的审批单个数,最大值为100,当total参数大于100时,可运用next_spnum参数进行多次拉取
- /// </summary>
- public int Count { get; set; }
- /// <summary>
- /// 时间段内的总审批单个数
- /// </summary>
- public int total { get; set; }
- /// <summary>
- /// 拉取列表的最后一个审批单号
- /// </summary>
- public long next_spnum { get; set; }
- /// <summary>
- /// 审批Data
- /// </summary>
- public List<Sp_Info>? data { get; set; }
- }
- /// <summary>
- /// 批量获取审批单号 View
- /// </summary>
- public class ApprovalInfoView : ResponseBase
- {
- /// <summary>
- /// 审批单号列表,包含满足条件的审批申请
- /// </summary>
- public List<string>? sp_no_list { get; set; }
- /// <summary>
- /// 后续请求查询的游标,当返回结果没有该字段时表示审批单已经拉取完
- /// </summary>
- public string? new_next_cursor { get; set; }
- }
- /// <summary>
- /// 审批申请详情 View
- /// </summary>
- public class ApprovalDetailView : ResponseBase
- {
- /// <summary>
- /// 审批申请详情
- /// </summary>
- public Sp_Detail? info { get; set; }
- }
- /// <summary>
- /// 申请人信息
- /// </summary>
- public class Applyer
- {
- /// <summary>
- /// 申请人userid
- /// </summary>
- public string userid { get; set; }
- /// <summary>
- /// 申请人所在部门id
- /// </summary>
- public string partyid { get; set; }
- }
- /// <summary>
- /// 分支审批人
- /// </summary>
- public class Approver
- {
- /// <summary>
- /// 分支审批人userid
- /// </summary>
- public string userid { get; set; }
- }
- /// <summary>
- /// 审批节点详情,一个审批节点有多个审批人
- /// </summary>
- public class DetailsItem
- {
- /// <summary>
- /// 分支审批人
- /// </summary>
- public Approver approver { get; set; }
- /// <summary>
- /// 审批意见
- /// </summary>
- public string speech { get; set; }
- /// <summary>
- /// 分支审批人审批状态:1-审批中;2-已同意;3-已驳回;4-已转审;11-已退回;12-已加签;13-已同意并加签
- /// </summary>
- public int sp_status { get; set; }
- /// <summary>
- /// 节点分支审批人审批操作时间戳,0表示未操作
- /// </summary>
- public int sptime { get; set; }
- /// <summary>
- /// 节点分支审批人审批意见附件,media_id具体使用请参考:文档-获取临时素材
- /// </summary>
- public List<string> media_id { get; set; }
- }
- /// <summary>
- /// 审批流程信息,可能有多个审批节点。
- /// </summary>
- public class Sp_recordItem
- {
- /// <summary>
- /// 审批节点状态:1-审批中;2-已同意;3-已驳回;4-已转审;11-已退回;12-已加签;13-已同意并加签
- /// </summary>
- public int sp_status { get; set; }
- /// <summary>
- /// 节点审批方式:1-或签;2-会签
- /// </summary>
- public int approverattr { get; set; }
- /// <summary>
- /// 审批节点详情,一个审批节点有多个审批人
- /// </summary>
- public List<DetailsItem> details { get; set; }
- }
- /// <summary>
- /// 抄送信息,可能有多个抄送节点
- /// </summary>
- public class NotifyerItem
- {
- /// <summary>
- /// 节点抄送人userid
- /// </summary>
- public string userid { get; set; }
- }
- /// <summary>
- /// 控件标题
- /// </summary>
- public class TitleItem
- {
- /// <summary>
- /// 文本值 中文
- /// </summary>
- public string text { get; set; }
- /// <summary>
- /// 文本值 英文值
- /// </summary>
- public string lang { get; set; }
- }
- /// <summary>
- /// 用户所选选项
- /// </summary>
- public class OptionsItem
- {
- /// <summary>
- /// 选项key,选项的唯一id,可通过“获取审批模板详情”接口获得
- /// </summary>
- public string key { get; set; }
- /// <summary>
- /// 选项值,若配置了多语言则会包含中英文的选项值
- /// </summary>
- public List<TitleItem> value { get; set; }
- }
- /// <summary>
- /// 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
- /// </summary>
- public class Selector
- {
- /// <summary>
- /// 选择类型:single-单选;multi-多选,在假勤控件中固定为单选
- /// </summary>
- public string type { get; set; }
- /// <summary>
- /// 用户所选选项
- /// </summary>
- public List<OptionsItem> options { get; set; }
- }
- /// <summary>
- /// 假勤组件时间选择范围
- /// </summary>
- public class Date_range
- {
- /// <summary>
- /// 时间展示类型:halfday-日期;hour-日期+时间
- /// </summary>
- public string type { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public long new_begin { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public DateTime new_begin_dt
- {
- get
- {
- return new DateTime(new_begin * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 结束时间
- /// </summary>
- public long new_end { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public DateTime new_end_dt
- {
- get
- {
- return new DateTime(new_end * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 请假时长
- /// </summary>
- public int new_duration { get; set; }
- }
- /// <summary>
- /// 每一天的分片时长信息
- /// </summary>
- public class Day_itemsItem
- {
- /// <summary>
- /// 日期的00:00:00时间戳,Unix时间
- /// </summary>
- public long daytime { get; set; }
- public DateTime daytimeDt
- {
- get
- {
- return new DateTime(daytime * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> time_sections { get; set; }
- /// <summary>
- /// 分隔当前日期的时长秒数
- /// </summary>
- public long duration { get; set; }
- }
- /// <summary>
- /// 时长支持按天分片信息, 2020/10/01之前的历史表单不支持时长分片
- /// </summary>
- public class Slice_info
- {
- /// <summary>
- /// 每一天的分片时长信息
- /// </summary>
- public List<Day_itemsItem> day_items { get; set; }
- /// <summary>
- /// 时长计算来源类型: 1--系统自动计算;2--用户修改
- /// </summary>
- public int state { get; set; }
- /// <summary>
- /// 总时长,单位是秒
- /// </summary>
- public long duration { get; set; }
- }
- /// <summary>
- /// 假勤组件
- /// </summary>
- public class Attendance
- {
- /// <summary>
- /// 假勤组件时间选择范围
- /// </summary>
- public Date_range date_range { get; set; }
- /// <summary>
- /// 假勤组件类型:1-请假;2-补卡;3-出差;4-外出;5-加班
- /// </summary>
- public int type { get; set; }
- /// <summary>
- /// 时长支持按天分片信息, 2020/10/01之前的历史表单不支持时长分片
- /// </summary>
- public Slice_info slice_info { get; set; }
- }
- /// <summary>
- /// 假内容,即申请人在此组件内选择的请假信息
- /// </summary>
- public class Vacation
- {
- /// <summary>
- /// 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
- /// </summary>
- public Selector selector { get; set; }
- /// <summary>
- /// 假勤组件
- /// </summary>
- public Attendance attendance { get; set; }
- }
- /// <summary>
- /// 控件值 ,包含了申请人在各种类型控件中输入的值,不同控件有不同的值,具体说明详见附录
- /// </summary>
- public class Value
- {
- public string? text { get; set; }
- /// <summary>
- /// 此控件不显示在审批详情中,故value为空
- /// </summary>
- public object? tips { get; set; }
- /// <summary>
- /// 成员内容,即申请人在此控件选择的成员,多选模式下可能有多个
- /// </summary>
- public List<Member> members { get; set; }
- /// <summary>
- /// 部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
- /// </summary>
- public List<Department> departments { get; set; }
- /// <summary>
- /// 文件内容,即申请人在此控件上传的文件内容,可能有多个
- /// </summary>
- public List<File_Info> files { get; set; }
- /// <summary>
- /// 明细内容,一个明细控件可能包含多个子明细
- /// </summary>
- public List<Children> children { get; set; }
- /// <summary>
- ///
- /// </summary>
- public List<string> stat_field { get; set; }
- /// <summary>
- /// 请假内容,即申请人在此组件内选择的请假信息
- /// </summary>
- public Vacation vacation { get; set; }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> sum_field { get; set; }
- /// <summary>
- /// 补卡类型模板值
- /// </summary>
- public Punch_Correction punch_correction { get; set; }
- /// <summary>
- /// 关联审批单的模板
- /// </summary>
- public List<Related_Approval> related_approval { get; set; }
- public Attendance attendance { get; set; }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> students { get; set; }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> classes { get; set; }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> docs { get; set; }
- ///// <summary>
- /////
- ///// </summary>
- //public List<string> wedrive_files { get; set; }
- }
- /// <summary>
- /// 补卡模板 值
- /// </summary>
- public class Punch_Correction
- {
- /// <summary>
- /// 异常状态说明 状态 未打卡
- /// </summary>
- public string state { get; set; }
- /// <summary>
- /// 补卡时间
- /// </summary>
- public long time { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public DateTime time_dt
- {
- get
- {
- return new DateTime(time * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// ?
- /// </summary>
- public long date { get; set; }
- }
- /// <summary>
- /// 部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
- /// </summary>
- public class Department
- {
- /// <summary>
- /// 部门id
- /// </summary>
- public string openapi_id { get; set; }
- /// <summary>
- /// 部门名
- /// </summary>
- public string name { get; set; }
- }
- /// <summary>
- /// 成员内容,即申请人在此控件选择的成员,多选模式下可能有多个
- /// </summary>
- public class Member
- {
- /// <summary>
- /// 成员的userid
- /// </summary>
- public string userid { get; set; }
- /// <summary>
- /// 成员名
- /// </summary>
- public string name { get; set; }
- }
- /// <summary>
- /// 文件内容,即申请人在此控件上传的文件内容,可能有多个
- /// </summary>
- public class File_Info
- {
- /// <summary>
- /// 文件的media_id
- /// </summary>
- public string file_id { get; set; }
- }
- /// <summary>
- /// 明细内容,一个明细控件可能包含多个子明细
- /// </summary>
- public class Children
- {
- public List<ListInfo> list { get; set; }
- }
- public class ListInfo
- {
- public string control { get; set; }
- public string id { get; set; }
- public List<TitleItem> title { get; set; }
- public ValueText value { get; set; }
- }
- public class ValueText
- {
- public string text { get; set; }
- }
- /// <summary>
- /// 关联审批单的模板
- /// </summary>
- public class Related_Approval
- {
- /// <summary>
- /// 关联审批单的模板名
- /// </summary>
- public List<TitleItem> template_names { get; set; }
- /// <summary>
- /// 关联审批单的审批单号
- /// </summary>
- public string sp_no { get; set; }
- /// <summary>
- /// 关联审批单的状态
- /// </summary>
- public int sp_status { get; set; }
- /// <summary>
- /// 关联审批单的提单时间
- /// </summary>
- public long create_time { get; set; }
- /// <summary>
- /// 关联审批单的提单者
- /// </summary>
- public string name { get; set; }
- }
- /// <summary>
- /// 审批申请详情,由多个表单控件及其内容组成
- /// </summary>
- public class ContentsItem
- {
- /// <summary>
- /// 控件类型:
- /// Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;
- /// Selector-单选/多选;;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;
- /// Attendance-假勤;Vacation-请假;PunchCorrection-补卡;DateRange-时长
- /// </summary>
- public string control { get; set; }
- /// <summary>
- /// 控件id
- /// </summary>
- public string id { get; set; }
- /// <summary>
- /// 控件名称 ,若配置了多语言则会包含中英文的控件名称
- /// </summary>
- public List<TitleItem> title { get; set; }
- /// <summary>
- /// 控件值 ,包含了申请人在各种类型控件中输入的值,不同控件有不同的值,具体说明详见附录
- /// </summary>
- public Value value { get; set; }
- /// <summary>
- ///
- /// </summary>
- public int display { get; set; }
- /// <summary>
- ///
- /// </summary>
- public int require { get; set; }
- }
- /// <summary>
- /// 审批申请数据
- /// </summary>
- public class Apply_data
- {
- /// <summary>
- /// 审批申请详情,由多个表单控件及其内容组成
- /// </summary>
- public List<ContentsItem> contents { get; set; }
- }
- /// <summary>
- /// 审批详情
- /// </summary>
- public class Sp_Detail
- {
- /// <summary>
- /// 审批编号
- /// </summary>
- public string sp_no { get; set; }
- /// <summary>
- /// 审批申请类型名称(审批模板名称)
- /// </summary>
- public string sp_name { get; set; }
- /// <summary>
- /// 申请单状态:1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
- /// </summary>
- public int sp_status { get; set; }
- /// <summary>
- /// 审批模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。
- /// </summary>
- public string template_id { get; set; }
- /// <summary>
- /// 审批申请提交时间,Unix时间戳
- /// </summary>
- public long apply_time { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public DateTime apply_time_dt
- {
- get
- {
- return new DateTime(apply_time * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 申请人信息
- /// </summary>
- public Applyer applyer { get; set; }
- /// <summary>
- /// 审批流程信息,可能有多个审批节点。
- /// </summary>
- public List<Sp_recordItem> sp_record { get; set; }
- /// <summary>
- /// 抄送信息,可能有多个抄送节点
- /// </summary>
- public List<NotifyerItem> notifyer { get; set; }
- /// <summary>
- /// 审批申请数据
- /// </summary>
- public Apply_data apply_data { get; set; }
- /// <summary>
- /// 审批申请备注信息,可能有多个备注节点
- /// </summary>
- public List<Comment> comments { get; set; }
- }
- /// <summary>
- /// 审批申请备注信息
- /// </summary>
- public class Comment
- {
- /// <summary>
- /// userid
- /// </summary>
- public Approver commentUserInfo { get; set; }
- /// <summary>
- /// unix时间戳
- /// </summary>
- public long commenttime { get; set; }
- /// <summary>
- /// 备注信息
- /// </summary>
- public string commentcontent { get; set; }
- /// <summary>
- /// 备注id
- /// </summary>
- public string commentid { get; set; }
- /// <summary>
- /// 备注附件id,可能有多个,media_id具体使用请参考:文档-获取临时素材
- /// </summary>
- public List<string> media_id { get; set; }
- }
- #region 审批详情 (旧版)
- /// <summary>
- /// 审批基本信息
- /// </summary>
- public class Sp_Info
- {
- /// <summary>
- /// 审批名称(请假,报销,自定义审批名称)
- /// </summary>
- public string? spname { get; set; }
- /// <summary>
- /// 申请人姓名
- /// </summary>
- public string? apply_name { get; set; }
- /// <summary>
- /// 申请人部门
- /// </summary>
- public string? apply_org { get; set; }
- /// <summary>
- /// 审批人姓名
- /// </summary>
- public List<string>? approval_name { get; set; }
- /// <summary>
- /// 抄送人姓名
- /// </summary>
- public List<string>? notify_name { get; set; }
- /// <summary>
- /// 审批状态:1审批中;2 已通过;3已驳回;4已取消;6通过后撤销;10已支付
- /// </summary>
- public int sp_status { get; set; }
- /// <summary>
- /// 审批单号
- /// </summary>
- public long sp_num { get; set; }
- /// <summary>
- /// 请假类型(只有请假模板审批记录有此数据项)
- /// </summary>
- public Leave? leave { get; set; }
- /// <summary>
- /// 审批模板信息
- /// </summary>
- public Comm? comm { get; set; }
- ///// <summary>
- ///// 补卡时间
- ///// 打卡补卡 筛选使用
- ///// </summary>
- //public DateTime? comm_applydata_dt
- //{
- // get
- // {
- // DateTime? dt = null;
- // if (comm == null) return dt;
- // if (comm.FillingDt != null)
- // {
- // dt = comm.FillingDt;
- // }
- // return dt;
- // }
- //}
- /// <summary>
- /// 审批的附件media_id,可使用media/get获取附件
- /// </summary>
- public List<string>? mediaids { get; set; }
- /// <summary>
- /// 审批单提交时间
- /// Unix时间戳
- /// </summary>
- public uint apply_time { get; set; }
- /// <summary>
- /// 审批单提交时间
- /// datetime
- /// </summary>
- public DateTime apply_time_dt
- {
- get
- {
- return new DateTime(long.Parse(apply_time.ToString()) * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 审批单提交者的userid
- /// </summary>
- public string? apply_user_id { get; set; }
- }
- /// <summary>
- /// 审批类型
- /// </summary>
- public class Leave
- {
- /// <summary>
- /// 请假时间单位:0半天;1小时
- /// </summary>
- public int timeunit { get; set; }
- /// <summary>
- /// 请假类型
- /// 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他
- /// </summary>
- public int leave_type { get; set; }
- /// <summary>
- /// 请假开始时间,unix时间
- /// </summary>
- public uint start_time { get; set; }
- /// <summary>
- /// 请假开始时间,datetime时间
- /// </summary>
- public DateTime start_time_dt
- {
- get
- {
- return new DateTime(long.Parse(start_time.ToString()) * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 请假结束时间,unix时间
- /// </summary>
- public uint end_time { get; set; }
- /// <summary>
- /// 请假开始时间,datetime时间
- /// </summary>
- public DateTime end_time_dt
- {
- get
- {
- return new DateTime(long.Parse(end_time.ToString()) * 10000000 + 621355968000000000L).ToLocalTime();
- }
- }
- /// <summary>
- /// 请假时长,单位小时
- /// </summary>
- public int duration { get; set; }
- /// <summary>
- /// 请假事由
- /// </summary>
- public string? reason { get; set; }
- }
- /// <summary>
- /// 审批模板信息
- /// </summary>
- public class Comm
- {
- /// <summary>
- /// 模板数据
- /// </summary>
- public string? apply_data { get; set; }
- public List<ApplyInfo>? applydata
- {
- get
- {
- List<ApplyInfo> applyInfos = new List<ApplyInfo>();
- if (!string.IsNullOrEmpty(apply_data))
- {
- applyInfos = JsonConvert.DeserializeObject<List<ApplyInfo>>(apply_data);
- }
- return applyInfos;
- }
- }
- /// <summary>
- /// 补卡时间
- /// 筛选使用
- /// </summary>
- public DateTime? FillingDt {
- get
- {
- DateTime? dt = null;
- if (applydata != null && applydata.Count > 0)
- {
- ApplyInfo applyInfo = applydata.Where(it => it.id == "checkin-time").FirstOrDefault();
- if (applyInfo != null)
- {
- dt = applyInfo.valueDt;
- }
- }
- return dt;
- }
- }
- }
- /// <summary>
- ///
- /// </summary>
- public class ApplyInfo
- {
- public string? id { get; set; }
- public string? title { get; set; }
- public string? type { get; set; }
- public object? value { get; set; }
- public DateTime? valueDt
- {
- get
- {
- if (id == "checkin-time" && value != null)
- {
- long timeSpan = long.Parse(value.ToString()) / 1000;
- return new DateTime(timeSpan * 10000000 + 621355968000000000L).ToLocalTime();
- }
- return null;
- }
- }
- }
- #endregion
- }
|