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; }
}
///
/// 审批基本信息
///
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;
}
}
}
}