You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
491 lines
15 KiB
C#
491 lines
15 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace HuizhongLibrary.Dingtalk
|
|
{
|
|
#region 用户信息
|
|
public class DingtalkUser
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public string userid { get; set; }
|
|
public string deviceId { get; set; }
|
|
public bool is_sys { get; set; }
|
|
public int sys_level { get; set; }
|
|
}
|
|
|
|
public class DingtalkUserZZD
|
|
{
|
|
public bool success { get; set; }
|
|
public DingtalkUserContentZZD content { get; set; }
|
|
}
|
|
public class DingtalkUserContentZZD
|
|
{
|
|
public string responseMessage { get; set; }
|
|
public DingtalkUserInfoZZD data { get; set; }
|
|
public string responseCode { get; set; }
|
|
}
|
|
public class DingtalkUserInfoZZD
|
|
{
|
|
public string account { get; set; }
|
|
public long accountId { get; set; }
|
|
public string employeeCode { get; set; }
|
|
public string lastName { get; set; }
|
|
public string nickNameCn { get; set; }
|
|
public long realmId { get; set; }
|
|
public string realmName { get; set; }
|
|
public string tenantUserId { get; set; }
|
|
public string openid { get; set; }
|
|
}
|
|
|
|
public class DingtalkUserInfo
|
|
{
|
|
public int errcode { get; set; }
|
|
public string openId { get; set; }
|
|
public string userid { get; set; }
|
|
public string mobile { get; set; }
|
|
public string name { get; set; }
|
|
}
|
|
#endregion
|
|
#region AccessToken
|
|
public class DingtalkAccessToken
|
|
{
|
|
public string access_token { get; set; }
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
}
|
|
|
|
public class DingtalkAccessTokenZZD
|
|
{
|
|
public string accessToken { get; set; }
|
|
}
|
|
public class DingtalkAccessTokenContentZZD
|
|
{
|
|
public string requestId { get; set; }
|
|
public bool success { get; set; }
|
|
public string responseMessage { get; set; }
|
|
public string responseCode { get; set; }
|
|
public DingtalkAccessTokenZZD data { get; set; }
|
|
}
|
|
public class DingtalkAccessTokenMessZZD
|
|
{
|
|
public bool success { get; set; }
|
|
public DingtalkAccessTokenContentZZD content { get; set; }
|
|
}
|
|
|
|
#endregion
|
|
#region 工作消息
|
|
public class DingtalkMessage
|
|
{
|
|
public int agent_id { get; set; }
|
|
public string userid_list { get; set; }
|
|
//public string dept_id_list { get; set; }
|
|
public bool to_all_user { get; set; }
|
|
public string msgtype { get; set; }
|
|
public string url { get; set; }
|
|
public string title { get; set; }
|
|
public string msg { get; set; }
|
|
|
|
public DingtalkMessage()
|
|
{
|
|
msgtype = "text";
|
|
}
|
|
|
|
public string ToJson()
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("{");
|
|
sb.Append("\"agent_id\":"+this.agent_id+",");
|
|
if (to_all_user == true)
|
|
{
|
|
sb.Append("\"to_all_user\":true,");
|
|
}
|
|
else
|
|
{
|
|
sb.Append("\"userid_list\":\"" + this.userid_list + "\",");
|
|
}
|
|
//sb.Append("\"userid_list\":\"" + this.userid_list + "\",");
|
|
//sb.Append("\"dept_id_list\":\"" + this.dept_id_list + "\",");
|
|
if (msgtype == "text")
|
|
{
|
|
sb.Append("\"msg\":{\"msgtype\":\"text\",\"text\":{\"content\":\""+this.msg + "\"}}");
|
|
}
|
|
if (msgtype == "action_card")
|
|
{
|
|
sb.Append("\"msg\":{\"msgtype\":\"action_card\",\"action_card\":{\"title\":\"" + this.title + "\",\"markdown\":\"" + this.msg + "\",\"single_title\":\"查看详情\",\"single_url\":\"" + this.url + "\"}}");
|
|
}
|
|
sb.Append("}");
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
#endregion
|
|
#region 消息结果
|
|
public class DingResult
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public int id { get; set; }
|
|
public bool hasMore { get; set; }
|
|
public string userid { get; set; }
|
|
public List<DingDepartMent> department { get; set; }
|
|
public List<DingUser> userlist { get; set; }
|
|
public LeaveTimeResult result { get; set; }
|
|
}
|
|
#endregion
|
|
#region 消息结果2
|
|
public class DingResult2
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public Exam_process_instance process_instance { get; set; }
|
|
}
|
|
#endregion
|
|
#region 部门
|
|
public class DingDepartMent
|
|
{
|
|
public int id { get; set; }
|
|
public string name { get; set; }
|
|
public string parentid { get; set; }
|
|
public string order { get; set; }
|
|
|
|
public string ToJson()
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("{");
|
|
if (id>0)sb.Append("\"id\":" + this.id + ",");
|
|
sb.Append("\"name\":\"" + this.name + "\",");
|
|
sb.Append("\"parentid\":\"" + this.parentid + "\",");
|
|
sb.Append("\"order\":\"" + this.order + "\"");
|
|
sb.Append("}");
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
#endregion
|
|
#region 员工
|
|
public class DingUser
|
|
{
|
|
public string userid { get; set; }
|
|
public string name { get; set; }
|
|
public List<int> department { get; set; }
|
|
public string mobile { get; set; }
|
|
|
|
public DingUser()
|
|
{
|
|
department = new List<int>();
|
|
}
|
|
}
|
|
public class DingUserGet
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public string userid { get; set; }
|
|
}
|
|
#endregion
|
|
#region 考勤请求
|
|
public class DingWorkRequest
|
|
{
|
|
public String workDateFrom { get; set; }
|
|
public String workDateTo { get; set; }
|
|
|
|
public String checkDateFrom { get; set; }
|
|
public String checkDateTo { get; set; }
|
|
public List<string> userIdList { get; set; }
|
|
public List<string> userIds { get; set; }
|
|
public int offset { get; set; }
|
|
public int limit { get; set; }
|
|
|
|
public DingWorkRequest()
|
|
{
|
|
limit = 50;
|
|
userIdList = new List<string>();
|
|
userIds = new List<string>();
|
|
}
|
|
}
|
|
#endregion
|
|
#region 考勤结果
|
|
public class DingWorkResult
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public bool hasMore { get; set; }
|
|
public List<DingWorkResult2> recordresult { get; set; }
|
|
}
|
|
public class DingWorkResult2
|
|
{
|
|
public long id { get; set; }
|
|
/// <summary>
|
|
/// 考勤组ID
|
|
/// </summary>
|
|
public long groupId { get; set; }
|
|
/// <summary>
|
|
/// 排班ID
|
|
/// </summary>
|
|
public long planId { get; set; }
|
|
/// <summary>
|
|
/// 打卡记录ID
|
|
/// </summary>
|
|
public long recordId { get; set; }
|
|
/// <summary>
|
|
/// 考勤日期
|
|
/// </summary>
|
|
public long workDate { get; set; }
|
|
public string userId { get; set; }
|
|
public string userAddress { get; set; }
|
|
/// <summary>
|
|
/// 打卡时间
|
|
/// </summary>
|
|
public Int64 userCheckTime { get; set; }
|
|
/// <summary>
|
|
/// OnDuty=上班,OffDuty=下班
|
|
/// </summary>
|
|
public string checkType { get; set; }
|
|
/// <summary>
|
|
/// Normal=范围内,Outside=范围外,NotSigned=未打卡
|
|
/// </summary>
|
|
public string locationResult { get; set; }
|
|
/// <summary>
|
|
/// Normal=正常,Early=早退,Late=迟到,SeriousLate=严重迟到,Absenteeism=旷工迟到,NotSigned=未打卡
|
|
/// </summary>
|
|
public string timeResult { get; set; }
|
|
|
|
public DateTime GetuserCheckTime()
|
|
{
|
|
return CustomIO.ConvertTimeStampToDateTime(userCheckTime);
|
|
}
|
|
|
|
public DingWorkResult2 Copy()
|
|
{
|
|
var model = new DingWorkResult2();
|
|
model.id = this.id;
|
|
model.groupId = this.groupId;
|
|
model.planId = this.planId;
|
|
model.recordId = this.recordId;
|
|
model.workDate = this.workDate;
|
|
model.userId = this.userId;
|
|
model.userCheckTime = this.userCheckTime;
|
|
model.checkType = this.checkType;
|
|
model.locationResult = this.locationResult;
|
|
model.timeResult = this.timeResult;
|
|
model.userAddress = this.userAddress;
|
|
return model;
|
|
}
|
|
public string deviceId { get; set; }
|
|
|
|
|
|
}
|
|
#endregion
|
|
#region 请假时长请求
|
|
public class LeaveTimeRequest
|
|
{
|
|
public string userid { get; set; }
|
|
public string from_date { get; set; }
|
|
public string to_date { get; set; }
|
|
}
|
|
#endregion
|
|
#region 请假时长
|
|
public class LeaveTimeResult
|
|
{
|
|
public int duration_in_minutes { get; set; }
|
|
}
|
|
#endregion
|
|
#region 审批请求
|
|
public class ExamIdRequest
|
|
{
|
|
public string process_code { get; set; }
|
|
public long start_time { get; set; }
|
|
public long end_time { get; set; }
|
|
public int size { get; set; }
|
|
public int cursor { get; set; }
|
|
//public List<string> userid_list { get; set; }
|
|
|
|
public ExamIdRequest()
|
|
{
|
|
size = 20;
|
|
}
|
|
|
|
public string ToJson()
|
|
{
|
|
return this.ToJsonString();
|
|
}
|
|
}
|
|
#endregion
|
|
#region 获取审批实例id
|
|
public class ExamIdResult
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public ExamIdResult2 result { get; set; }
|
|
}
|
|
public class ExamIdResult2
|
|
{
|
|
public int next_cursor { get; set; }
|
|
public List<string> list { get; set; }
|
|
}
|
|
#endregion
|
|
#region 获取审批实例详情
|
|
public class ExamResult
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public string process_instance_id { get; set; }
|
|
public ExamResult2 process_instance { get; set; }
|
|
}
|
|
public class ExamResult2
|
|
{
|
|
public string title { get; set; }
|
|
public string create_time { get; set; }
|
|
public string finish_time { get; set; }
|
|
public string originator_userid { get; set; }
|
|
public string originator_dept_id { get; set; }
|
|
public string status { get; set; }
|
|
public List<string> cc_userids { get; set; }
|
|
public List<ExamResult3_1> form_component_values { get; set; }
|
|
public string result { get; set; }
|
|
public string business_id { get; set; }
|
|
public List<ExamResult3_2> operation_records { get; set; }
|
|
public List<ExamResult3_3> tasks { get; set; }
|
|
public string originator_dept_name { get; set; }
|
|
public string biz_action { get; set; }
|
|
public List<string> attached_process_instance_ids { get; set; }
|
|
}
|
|
public class ExamResult3_1
|
|
{
|
|
public string component_type { get; set; }
|
|
public string name { get; set; }
|
|
public string value { get; set; }
|
|
public string ext_value { get; set; }
|
|
}
|
|
public class ExamResult3_2
|
|
{
|
|
public string userid { get; set; }
|
|
public string date { get; set; }
|
|
public string operation_type { get; set; }
|
|
public string operation_result { get; set; }
|
|
public string remark { get; set; }
|
|
}
|
|
public class ExamResult3_3
|
|
{
|
|
public string userid { get; set; }
|
|
public string task_status { get; set; }
|
|
public string task_result { get; set; }
|
|
public string create_time { get; set; }
|
|
public string finish_time { get; set; }
|
|
public string taskid { get; set; }
|
|
}
|
|
#endregion
|
|
#region 请假详情
|
|
public class LeaveResult
|
|
{
|
|
public string userid { get; set; }
|
|
public DateTime StartTime { get; set; }
|
|
public DateTime EndTime { get; set; }
|
|
public string LeaveType{get;set;}
|
|
public int LeaveDay { get; set; }
|
|
public string Cause { get; set; }
|
|
public int State { get; set; }
|
|
}
|
|
public class Exam_process_instance
|
|
{
|
|
public string originator_userid { get; set; }
|
|
public string result { get; set; }
|
|
public List<Exam_form_component_values> form_component_values { get; set; }
|
|
}
|
|
public class Exam_form_component_values
|
|
{
|
|
public string name { get; set; }
|
|
public string value { get; set; }
|
|
}
|
|
#endregion
|
|
#region 日志请求
|
|
public class DingLogRequest
|
|
{
|
|
public long start_time { get; set; }
|
|
public long end_time { get; set; }
|
|
public string template_name { get; set; }
|
|
public string userid { get; set; }
|
|
public long cursor { get; set; }
|
|
public int size { get; set; }
|
|
|
|
public DingLogRequest()
|
|
{
|
|
size = 20;
|
|
}
|
|
|
|
public string ToJson()
|
|
{
|
|
return this.ToJsonString();
|
|
}
|
|
}
|
|
#endregion
|
|
#region 日志结果
|
|
public class DingLogResult
|
|
{
|
|
public int errcode { get; set; }
|
|
public string errmsg { get; set; }
|
|
public DingLogResult2 result { get; set; }
|
|
}
|
|
public class DingLogResult2
|
|
{
|
|
public int size { get; set; }
|
|
/// <summary>
|
|
/// 是否还有下一页
|
|
/// </summary>
|
|
public bool has_more { get; set; }
|
|
/// <summary>
|
|
/// 下次查询起始页
|
|
/// </summary>
|
|
public long next_cursor { get; set; }
|
|
public List<DingLogResult3> data_list { get; set; }
|
|
}
|
|
public class DingLogResult3
|
|
{
|
|
/// <summary>
|
|
/// 日志唯一id
|
|
/// </summary>
|
|
public string report_id { get; set; }
|
|
/// <summary>
|
|
/// 日志创建时间
|
|
/// </summary>
|
|
public long create_time { get; set; }
|
|
/// <summary>
|
|
/// 日志创建人userid
|
|
/// </summary>
|
|
public string creator_id { get; set; }
|
|
/// <summary>
|
|
/// 日志创建人
|
|
/// </summary>
|
|
public string creator_name { get; set; }
|
|
/// <summary>
|
|
/// 部门
|
|
/// </summary>
|
|
public string dept_name { get; set; }
|
|
public string template_name { get; set; }
|
|
public string remark { get; set; }
|
|
public List<DingLogResult4> contents { get; set; }
|
|
|
|
public DingLogResult3 Copy()
|
|
{
|
|
var model=new DingLogResult3();
|
|
model.report_id = this.report_id;
|
|
model.create_time = this.create_time;
|
|
model.creator_id = this.creator_id;
|
|
model.creator_name = this.creator_name;
|
|
model.dept_name = this.dept_name;
|
|
model.template_name = this.template_name;
|
|
model.remark = this.remark;
|
|
model.contents = this.contents;
|
|
return model;
|
|
}
|
|
}
|
|
public class DingLogResult4
|
|
{
|
|
public string sort { get; set; }
|
|
public string type { get; set; }
|
|
public string key { get; set; }
|
|
public string value { get; set; }
|
|
}
|
|
#endregion
|
|
}
|