using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace OASystem.Domain.ViewModels.QiYeWeChat
{
#region 企业微信 API 获取企业打卡规则
///
/// 企业微信 API 获取企业打卡规则
///
public class CorpCheckInRuleView : ResponseBase
{
/// 打卡规则列表
public List group { get; set; } = new();
/// 更新时间戳
public int uptime { get; set; }
}
///
/// 打卡规则组
///
public class CheckInGroup
{
/// 打卡规则ID
public uint groupid { get; set; }
/// 打卡规则名称
public string groupname { get; set; } = string.Empty;
///
/// 打卡规则类型
/// 1:固定时间上下班;2:按班次上下班;3:自由上下班
///
public uint grouptype { get; set; }
/// 打卡时间配置(支持多个时段,如早/晚班)
public List checkindate { get; set; } = new();
/// 特殊日期-必须打卡日期
public List spe_workdays { get; set; } = new();
/// 特殊日期-不用打卡日期
public List spe_offdays { get; set; } = new();
/// 是否同步法定节假日
public bool sync_holidays { get; set; }
/// 是否非工作日允许打卡
public bool allow_checkin_offworkday { get; set; }
/// 是否允许提交补卡申请
public bool allow_apply_offworkday { get; set; }
/// 每月最多补卡次数,-1表示不限制
public int allow_apply_bk_cnt { get; set; } = -1;
/// 允许补卡时限(天),-1表示不限制
public int allow_apply_bk_day_limit { get; set; } = -1;
/// 打卡人员范围
public CheckInRange range { get; set; } = new();
/// 白名单用户ID列表
public List white_users { get; set; } = new();
/// 创建时间戳
public int create_time { get; set; }
/// 打卡方式:0-手机;2-智慧考勤机;3-手机+智慧考勤机
public int type { get; set; }
/// 是否必须拍照打卡
public bool need_photo { get; set; }
/// 备注时是否允许上传本地图片
public bool note_can_use_local_pic { get; set; }
/// WiFi打卡信息列表
public List wifimac_infos { get; set; } = new();
/// 位置打卡信息列表
public List loc_infos { get; set; } = new();
/// 范围外打卡处理方式:0-不允许打卡;1-允许打卡但标记异常;2-允许打卡且不标记异常
public int option_out_range { get; set; }
/// 是否开启人脸识别打卡
public bool use_face_detect { get; set; }
/// 规则创建人userid
public string create_userid { get; set; } = string.Empty;
/// 规则最近编辑人userid
public string update_userid { get; set; } = string.Empty;
/// 排班信息(仅规则类型为按班次上下班时有效)
public List schedulelist { get; set; } = new();
/// 汇报对象信息
public ReporterInfo reporterinfo { get; set; } = new();
/// 加班规则V1(旧版)
public OtInfo ot_info { get; set; } = new();
///
/// 以下为补充字段(根据实际JSON)
///
/// 下班打卡时间间隔(秒)
public int offwork_interval_time { get; set; }
/// 是否开启人脸活体检测
public bool open_face_live_detect { get; set; }
/// 次月补卡限制次数,-1表示不限制
public int buka_limit_next_month { get; set; }
/// 加班规则V2(新版)
public OtInfoV2 ot_info_v2 { get; set; } = new();
/// 是否同步外出打卡记录
public bool sync_out_checkin { get; set; }
/// 补卡提醒配置
public BukaRemind buka_remind { get; set; } = new();
/// 补卡限制类型(0-不限制,1-仅限本人,2-禁止补卡等)
public int buka_restriction { get; set; }
/// 是否开启特殊日期打卡(如节假日配置)
public bool open_sp_checkin { get; set; }
/// 打卡方式类型扩展字段
public int checkin_method_type { get; set; }
}
///
/// 打卡日期配置(某一天或一组工作日的规则)
///
public class CheckInDate
{
/// 工作日:0-星期日,1-6-星期一到星期六
public List workdays { get; set; } = new();
/// 上下班时段列表(支持一天多个时段)
public List checkintime { get; set; } = new();
/// 弹性时间设置(单位:秒)
public int flex_time { get; set; }
/// 下班是否需要打卡(整体规则)
public bool noneed_offwork { get; set; }
/// 打卡时间限制(毫秒),如限制必须提前多久打卡
public int limit_aheadtime { get; set; }
/// 允许迟到时间(秒)
public int flex_on_duty_time { get; set; }
/// 允许早退时间(秒)
public int flex_off_duty_time { get; set; }
/// 是否允许弹性时间(如弹性上下班)
public bool allow_flex { get; set; }
/// 迟到规则(如晚走次日可晚到)
public LateRule late_rule { get; set; } = new();
/// 最多允许早到时间(秒)
public int max_allow_arrive_early { get; set; }
/// 最多允许迟到时间(秒)
public int max_allow_arrive_late { get; set; }
/// 大小周配置(可选)
public BiweeklyInfo biweekly { get; set; } = new();
}
///
/// 上下班打卡时段(具体的上班时间、下班时间)
///
public class CheckInTime
{
/// 时段ID(适用于一天多个时段)
public int time_id { get; set; }
/// 上班时间(距离当天0点的秒数)
public int work_sec { get; set; }
/// 下班时间(距离当天0点的秒数)
public int off_work_sec { get; set; }
/// 上班提醒时间(秒)
public int remind_work_sec { get; set; }
/// 下班提醒时间(秒)
public int remind_off_work_sec { get; set; }
/// 最早休息开始时间(秒)
public int rest_begin_time { get; set; }
/// 最早休息结束时间(秒)
public int rest_end_time { get; set; }
/// 是否允许休息
public bool allow_rest { get; set; }
/// 最早可打卡上班时间(秒)
public int earliest_work_sec { get; set; }
/// 最晚可打卡上班时间(秒)
public int latest_work_sec { get; set; }
/// 最早可打卡下班时间(秒)
public int earliest_off_work_sec { get; set; }
/// 最晚可打卡下班时间(秒)
public int latest_off_work_sec { get; set; }
/// 上班是否需要打卡
public bool no_need_checkon { get; set; }
/// 下班是否需要打卡(时段级)
public bool no_need_checkoff { get; set; }
/// 休息时段列表(一天内可能有多个休息)
public List rest_times { get; set; } = new();
/// 上班时间(TimeSpan格式,仅用于辅助)
public TimeSpan WorkTime => TimeSpan.FromSeconds(work_sec);
/// 下班时间(TimeSpan格式,仅用于辅助)
public TimeSpan OffWorkTime => TimeSpan.FromSeconds(off_work_sec);
}
///
/// 特殊工作日(必须打卡)
///
public class SpecialWorkDay
{
/// 日期时间戳
public int timestamp { get; set; }
/// 备注
public string notes { get; set; } = string.Empty;
/// 打卡时间配置(可覆盖默认时段)
public List checkintime { get; set; } = new();
/// 日期(本地时间)
public DateTime Date => DateTimeOffset.FromUnixTimeSeconds(timestamp).LocalDateTime;
}
///
/// 特殊休息日(不用打卡)
///
public class SpecialOffDay
{
/// 日期时间戳
public int timestamp { get; set; }
/// 备注
public string notes { get; set; } = string.Empty;
/// 日期(本地时间)
public DateTime Date => DateTimeOffset.FromUnixTimeSeconds(timestamp).LocalDateTime;
}
///
/// 打卡人员范围
///
public class CheckInRange
{
/// 成员ID列表
public List userid { get; set; } = new();
/// 部门ID列表
public List party_id { get; set; } = new();
/// 标签ID列表
public List tagid { get; set; } = new();
}
///
/// WiFi打卡信息
///
public class WifiInfo
{
/// WiFi名称
public string wifiname { get; set; } = string.Empty;
/// WiFi MAC地址 或 BSSID
public string wifimac { get; set; } = string.Empty;
/// BSSID(部分场景使用)
public string bssid { get; set; } = string.Empty;
}
///
/// 位置打卡信息
///
public class LocationInfo
{
/// 纬度(实际纬度 × 1,000,000)
public long lat { get; set; }
/// 经度(实际经度 × 1,000,000)
public long lng { get; set; }
/// 位置名称
public string loc_title { get; set; } = string.Empty;
/// 位置详细地址
public string loc_detail { get; set; } = string.Empty;
/// 允许打卡范围(米)
public int distance { get; set; }
}
///
/// 排班信息(按班次上下班时使用)
///
public class ScheduleInfo
{
/// 班次ID
public int schedule_id { get; set; }
/// 班次名称
public string schedule_name { get; set; } = string.Empty;
/// 班次上下班时段信息
public List time_section { get; set; } = new();
/// 允许提前打卡时间(秒)
public int limit_aheadtime { get; set; }
/// 下班后超过此秒数不允许打下班卡
public int limit_offtime { get; set; }
/// 下班不需要打卡
public bool noneed_offwork { get; set; }
/// 是否允许弹性时间
public bool allow_flex { get; set; }
/// 允许迟到时间(秒)
public int flex_on_duty_time { get; set; }
/// 允许早退时间(秒)
public int flex_off_duty_time { get; set; }
/// 迟到规则
public LateRule late_rule { get; set; } = new();
}
///
/// 时段信息(班次中的某个时段)
///
public class TimeSection
{
/// 时段ID
public int time_id { get; set; }
/// 上班时间(秒)
public int work_sec { get; set; }
/// 下班时间(秒)
public int off_work_sec { get; set; }
/// 上班提醒时间(秒)
public int remind_work_sec { get; set; }
/// 下班提醒时间(秒)
public int remind_off_work_sec { get; set; }
/// 休息时间列表
public List rest_times { get; set; } = new();
/// 最早休息开始时间(秒)
public int rest_begin_time { get; set; }
/// 最早休息结束时间(秒)
public int rest_end_time { get; set; }
/// 是否允许休息
public bool allow_rest { get; set; }
}
///
/// 休息时段
///
public class RestTime
{
/// 休息开始时间(秒)
public int rest_begin_time { get; set; }
/// 休息结束时间(秒)
public int rest_end_time { get; set; }
}
///
/// 迟到规则(晚走次日可晚到)
///
public class LateRule
{
/// 是否允许超时下班后次日弹性上班
public bool allow_offwork_after_time { get; set; }
/// 具体时间规则列表
public List timerules { get; set; } = new();
}
///
/// 时间规则(加班与次日弹性关系)
///
public class TimeRule
{
/// 晚走的时间(秒),即加班时长
public int offwork_after_time { get; set; }
/// 第二天允许迟到的弹性时间(秒)
public int onwork_flex_time { get; set; }
}
///
/// 汇报对象信息
///
public class ReporterInfo
{
/// 汇报对象列表
public List reporters { get; set; } = new();
/// 汇报对象更新时间戳
public int updatetime { get; set; }
}
///
/// 汇报人
///
public class Reporter
{
/// 汇报人userid
public string userid { get; set; } = string.Empty;
}
///
/// 加班时长计算规则(基于打卡时间)
///
public class OtCheckInfo
{
/// 工作日加班开始时间(下班后经过此秒数才算加班)
public int ot_workingday_time_start { get; set; }
/// 工作日最短加班时长(秒)
public int ot_workingday_time_min { get; set; }
/// 工作日最长加班时长(秒)
public int ot_workingday_time_max { get; set; }
/// 非工作日最短加班时长(秒)
public int ot_nonworkingday_time_min { get; set; }
/// 非工作日最长加班时长(秒)
public int ot_nonworkingday_time_max { get; set; }
/// 非工作日加班跨天时间(秒)
public int ot_nonworkingday_spanday_time { get; set; }
/// 工作日加班休息扣除配置
public RestConfig ot_workingday_restinfo { get; set; } = new();
/// 非工作日加班休息扣除配置
public RestConfig ot_nonworkingday_restinfo { get; set; } = new();
}
///
/// 休息时间扣除配置(加班时长中扣除休息时间)
///
public class RestConfig
{
/// 扣除类型:0-不扣除;1-按固定时间扣除;2-按加班时长阶梯扣除
public int type { get; set; }
/// 固定时间扣除规则(type=1时有效)
public FixTimeRule fix_time_rule { get; set; } = new();
/// 阶梯扣除规则(type=2时有效)
public CalOtTimeRule cal_ottime_rule { get; set; } = new();
}
///
/// 固定时间扣除规则
///
public class FixTimeRule
{
/// 固定休息开始时间(秒)
public int fix_time_begin_sec { get; set; }
/// 固定休息结束时间(秒)
public int fix_time_end_sec { get; set; }
}
///
/// 阶梯扣除规则(按加班时长扣除)
///
public class CalOtTimeRule
{
/// 扣除条件列表
public List items { get; set; } = new();
}
///
/// 加班时长扣除条件项
///
public class OtTimeItem
{
/// 加班满此秒数后触发扣除
public int ot_time { get; set; }
/// 对应扣除的休息秒数
public int rest_time { get; set; }
}
///
/// 加班规则V2(新版,结构更细化)
///
public class OtInfoV2
{
/// 工作日加班配置
public WorkdayConf workdayconf { get; set; } = new();
/// 休息日加班配置
public RestdayConf restdayconf { get; set; } = new();
/// 法定节假日加班配置
public HolidayConf holidayconf { get; set; } = new();
/// 配置更新时间戳
public int updatetime { get; set; }
/// 时间单位配置(如加班时长舍入规则)
public TimeUnitConfig time_unit_config { get; set; } = new();
}
///
/// 工作日加班配置
///
public class WorkdayConf
{
/// 是否允许加班
public bool allow_ot { get; set; }
/// 加班计算类型:2-以打卡时间为准(常见)
public int type { get; set; }
/// 申请/打卡相关配置
public ApplyInfo apply { get; set; } = new();
/// 是否启用加班转调休/加班费
public bool ot_trans_enable { get; set; }
/// 转换类型:1-转调休;2-转加班费
public int ot_trans_type { get; set; }
/// 假期转换配置(如转调休比例)
public Vacation vacation { get; set; } = new();
/// 加班时长范围限制(秒)
public int ot_time_range { get; set; }
}
///
/// 休息日加班配置(继承WorkdayConf)
///
public class RestdayConf : WorkdayConf { }
///
/// 法定节假日加班配置(继承WorkdayConf)
///
public class HolidayConf : WorkdayConf { }
///
/// 申请或打卡相关配置
///
//public class ApplyInfo
//{
// /// 休息扣除配置
// public RestInfo restinfo { get; set; } = new();
// /// 加班开始时间(秒,用于指定从几点开始算加班)
// public int ot_time_start { get; set; }
//}
///
/// 休息扣除信息(V2版本使用)
///
public class RestInfo
{
/// 休息扣除类型:0-不扣除;1-指定固定时段扣除
public int type { get; set; }
/// 固定扣除时段列表
public List fix_time_rule_list { get; set; } = new();
}
/////
///// 假期转换配置
/////
//public class Vacation
//{
// /// 转换比例(如100表示1小时加班转1小时调休)
// public int trans_ratio { get; set; }
// /// 是否同步到假期余额
// public bool sync_vacation { get; set; }
//}
///
/// 时间单位配置(加班时长舍入规则)
///
public class TimeUnitConfig
{
/// 加班时间单位:1-分钟;2-小时
public int ot_time_unit { get; set; }
/// 每日最大加班时长(秒)
public int perday_duration_secs { get; set; }
/// 舍入方式:1-向上舍入;2-向下舍入;3-四舍五入
public int rounding_method { get; set; }
/// 舍入精度:如以30分钟为单位
public int rounding_precision { get; set; }
/// 步长(秒),用于限制加班时长必须为此值的倍数
public int step_size { get; set; }
}
///
/// 补卡提醒配置
///
public class BukaRemind
{
/// 是否开启补卡提醒
public bool open_remind { get; set; }
/// 每月第几天提醒补卡(如1表示每月1日提醒)
public int buka_remind_day { get; set; }
/// 每月提醒补卡的月份偏移(0-当月,1-次月)
public int buka_remind_month { get; set; }
}
///
/// 大小周配置
///
public class BiweeklyInfo
{
/// 是否开启大小周
public bool enable_weekday_recurrence { get; set; }
/// 奇数周工作日(0-6,0周日)
public List odd_workdays { get; set; } = new();
/// 偶数周工作日(0-6,0周日)
public List even_workdays { get; set; } = new();
}
#endregion
#region 邮件相关
public class EmailRequestDto
{
///
/// 收件人邮箱地址列表
///
public List ToEmails { get; set; }
///
/// 抄送人邮箱地址列表
///
public List CcEmails { get; set; }
///
/// 密送人邮箱地址列表
///
public List BccEmails { get; set; }
///
/// 邮件主题
///
public string Subject { get; set; }
///
/// 邮件正文内容
///
public string Body { get; set; }
///
/// 附件列表
///
public IFormFile[] Files { get; set; }
}
public class Attachment
{
///
/// 文件名
///
public string file_name { get; set; }
///
/// 文件内容(base64编码),所有附件加正文的大小不允许超过50M, 且附件个数不能超过200个
///
public string content { get; set; }
}
#endregion
///
/// 企业微信 API
/// 打卡月数据
///
public class CheckInView:ResponseBase
{
///
/// 基础信息
///
public List? datas { get; set; }
}
///
/// 基础信息 Data
///
public class Data
{
///
/// 基础信息
///
public Base_Info? base_info { get; set; }
///
/// 汇总信息
///
public Summary_Info? summary_info { get; set; }
///
/// 异常状态统计信息
///
public List? exception_infos { get; set; }
///
/// 假勤统计信息
///
public List? sp_items { get; set; }
///
/// 加班情况
///
public Overwork_Info? overwork_info { get; set; }
}
///
/// 成员基础信息
///
public class Base_Info
{
///
/// 记录类型:1-固定上下班;2-外出(此报表中不会出现外出打卡数据);3-按班次上下班;4-自由签到;5-加班;7-无规则
///
public int record_type { get; set; }
///
/// 打卡人员姓名
///
public string? name { get; set; }
///
/// 打卡人员别名
///
public string? name_ex { get; set; }
///
/// 打卡人员所在部门,会显示所有所在部门
///
public string? departs_name { get; set; }
///
/// 打卡人员账号,即userid
///
public string? acctid { get; set; }
///
/// 打卡人员所属规则信息
///
public Rule_Info? rule_info { get; set; }
}
///
/// 打卡人员所属规则信息
///
public class Rule_Info
{
///
/// 所属规则的id
///
public int groupid { get; set; }
///
/// 打卡规则名
///
public string? groupname { get; set; }
}
///
/// 汇总信息
///
public class Summary_Info
{
///
/// 应打卡天数
///
public int work_days { get; set; }
///
/// 正常天数
///
public int regular_days { get; set; }
///
/// 异常天数
///
public int except_days { get; set; }
///
/// 实际工作时长,为统计周期每日实际工作时长之和
///
public int regular_work_sec { get; set; }
///
/// 标准工作时长,为统计周期每日标准工作时长之和
///
public int standard_work_sec { get; set; }
}
///
/// 异常状态统计信息
///
public class Exception_Info
{
///
/// 异常类型:1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常
///
public int exception { get; set; }
///
/// 异常次数,为统计周期内每日此异常次数之和
///
public int count { get; set; }
///
/// 异常时长(迟到/早退/旷工才有值),为统计周期内每日此异常时长之和
///
public int duration { get; set; }
}
///
/// 假勤统计信息
///
public class Sp_Item
{
///
/// 假勤类型:1-请假;2-补卡;3-出差;4-外出;100-外勤
///
public int type { get; set; }
///
/// 具体请假类型,当type为1请假时,具体的请假类型id,可通过审批相关接口获取假期详情
///
public int vacation_id { get; set; }
///
/// 假勤次数,为统计周期内每日此假勤发生次数之和
///
public int count { get; set; }
///
/// 假勤时长,为统计周期内每日此假勤发生时长之和,时长单位为天直接除以86400即为天数,单位为小时直接除以3600即为小时数
///
public int duration { get; set; }
///
/// 时长单位:0-按天 1-按小时
///
public int time_type { get; set; }
///
/// 统计项名称
///
public string? name { get; set; }
}
///
/// 加班情况
///
public class Overwork_Info
{
///
/// 工作日加班时长
///
public int? workday_over_sec { get; set; }
///
/// 节假日加班时长
///
public int? holidays_over_sec { get; set; }
///
/// 休息日加班时长
///
public int? restdays_over_sec { get; set; }
}
public class AssessmentByUserListView : ResponseBase
{
public List Data { get; set; }
}
public class AssessmentByUserView
{
public string Name { get; set; }
public string Accid { get; set; }
public int Regular_days { get; set; }
public int Except_days { get; set; }
public List Exception_info_List { get; set; }
public int Work_days { get; set; }
}
public class Exception_info
{
public ErrorType Type { get; set; }
public DateTime Date { get; set; }
public string Info { get; set; }
}
public enum ErrorType
{
迟到 = 1, // 迟到
早退 = 2, // 早退
缺卡 = 3, // 缺卡
旷工 = 4, // 旷工
地点异常 = 5, // 地点异常
设备异常 = 6 // 设备异常
}
public class EmailResult
{
public int errcode { get; set; }
public string errmsg { get; set; }
}
}