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