106 lines
3.9 KiB
C#
106 lines
3.9 KiB
C#
|
|
using E_ZKEcc.Domian;
|
|||
|
|
using E_ZKEccSDK.Request;
|
|||
|
|
using E_ZKEccSDK.Response;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace E_ZKEcc.Service
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 记录对接
|
|||
|
|
/// </summary>
|
|||
|
|
public class TransactionService : BaseService
|
|||
|
|
{
|
|||
|
|
public TransactionService(ApiInfoDomian apiInfo) : base(apiInfo, "transaction")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#region 获取考勤记录
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取考勤记录
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="starttime">必填 开始时间 开始时间结束时间跨度不得超过一个月 格式:%Y-%m-%d %H:%M:%S 示例:2018-04-25 00:00:01</param>
|
|||
|
|
/// <param name="endtime">必填 结束时间</param>
|
|||
|
|
/// <param name="pin">人员编号</param>
|
|||
|
|
/// <param name="sn">设备序列号</param>
|
|||
|
|
/// <param name="id">记录流水号 1.建议同步考勤记录到第三方数据库时使用id 2.记录流水号自动递增 3.存在id或number时,开始时间和结束时间可为非必选参数</param>
|
|||
|
|
/// <param name="number">每次请求获取的记录数,建议控制在每次2000条以内</param>
|
|||
|
|
/// <param name="uploadPic">是否传考勤照片 1.是 0.否</param>
|
|||
|
|
/// <param name="getTemperature">是否传体温与是否佩戴口罩 1.是 0.否</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian<TransactionGetResponse> GetTransaction(string starttime, string endtime, string pin = null, string sn = null, long? id = null, int? number = null, int? uploadPic = null, int? getTemperature = null)
|
|||
|
|
{
|
|||
|
|
_actionName = "get";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var request = new TransactionGetRequest();
|
|||
|
|
request.starttime = starttime;
|
|||
|
|
request.endtime = endtime;
|
|||
|
|
request.pin = pin;
|
|||
|
|
request.sn = sn;
|
|||
|
|
request.id = id;
|
|||
|
|
request.number = number;
|
|||
|
|
request.uploadPic = uploadPic;
|
|||
|
|
request.getTemperature = getTemperature;
|
|||
|
|
|
|||
|
|
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
|||
|
|
|
|||
|
|
var resultJson = this.DoExecute(dataJson);
|
|||
|
|
|
|||
|
|
var result = JsonConvert.DeserializeObject<ResultDomian<TransactionGetResponse>>(resultJson);
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取考勤记录
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="starttime">必填 开始时间 开始时间结束时间跨度不得超过一个月 格式:%Y-%m-%d %H:%M:%S 示例:2018-04-25 00:00:01</param>
|
|||
|
|
/// <param name="endtime">必填 结束时间</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian<TransactionGetResponse> GetTransaction(DateTime starttime, DateTime endtime)
|
|||
|
|
{
|
|||
|
|
return GetTransaction(starttime.ToString("yyyy-MM-dd HH:MM"), endtime.ToString("yyyy-MM-dd HH:MM"));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取考勤记录
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="request"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian<TransactionGetResponse> GetTransaction(TransactionGetRequest request)
|
|||
|
|
{
|
|||
|
|
_actionName = "get";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
|||
|
|
|
|||
|
|
var resultJson = this.DoExecute(dataJson);
|
|||
|
|
|
|||
|
|
var result = JsonConvert.DeserializeObject<ResultDomian<TransactionGetResponse>>(resultJson);
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|