142 lines
4.3 KiB
C#
142 lines
4.3 KiB
C#
|
|
using E_ZKEcc.Domian;
|
|||
|
|
using ExtensionMethods;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.CompilerServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Runtime.Serialization;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
using E_ZKEccSDK.Response;
|
|||
|
|
using E_ZKEccSDK.Request;
|
|||
|
|
|
|||
|
|
namespace E_ZKEcc.Service
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 人员对接
|
|||
|
|
/// </summary>
|
|||
|
|
public class EmployeeService : BaseService
|
|||
|
|
{
|
|||
|
|
public EmployeeService(ApiInfoDomian apiInfo) : base(apiInfo, "employee")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 人员更新
|
|||
|
|
/// <summary>
|
|||
|
|
/// 人员更新
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="list"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian UpdateEmployee(List<EmployeeUpdateRequest> list)
|
|||
|
|
{
|
|||
|
|
_actionName = "update";
|
|||
|
|
ResultDomian result;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var dataJson = JsonConvert.SerializeObject(list, Formatting.None, _serializerSettings);
|
|||
|
|
|
|||
|
|
var resultJson = this.DoExecute(dataJson);
|
|||
|
|
|
|||
|
|
result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 人员离职
|
|||
|
|
/// <summary>
|
|||
|
|
/// 人员离职
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="pin">人员编号</param>
|
|||
|
|
/// <param name="leavedate">离职日期 yyyy-MM-dd HH:MM</param>
|
|||
|
|
/// <param name="leavetype">离职类型 0 自离 1 辞退 2 辞职 3 调离 4 停薪留职 5 退休 6 死亡</param>
|
|||
|
|
/// <param name="reason">离职原因</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian LeaveEmployee(string pin, string leavedate, int leavetype, string reason = null)
|
|||
|
|
{
|
|||
|
|
_actionName = "leave";
|
|||
|
|
ResultDomian result;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
object data = new
|
|||
|
|
{
|
|||
|
|
pin,
|
|||
|
|
leavedate,
|
|||
|
|
leavetype,
|
|||
|
|
reason
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var dataJson = JsonConvert.SerializeObject(data, Formatting.None, _serializerSettings);
|
|||
|
|
|
|||
|
|
var resultJson = this.DoExecute(dataJson);
|
|||
|
|
|
|||
|
|
result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 人员离职
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="pin">人员编号</param>
|
|||
|
|
/// <param name="leavedate">离职日期 yyyy-MM-dd HH:MM</param>
|
|||
|
|
/// <param name="leavetype">离职类型 0 自离 1 辞退 2 辞职 3 调离 4 停薪留职 5 退休 6 死亡</param>
|
|||
|
|
/// <param name="reason">离职原因</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian LeaveEmployee(string pin, DateTime leavedate, int leavetype, string reason = null)
|
|||
|
|
{
|
|||
|
|
return LeaveEmployee(pin, leavedate.ToString("yyyy-MM-dd HH:MM"), leavetype, reason);
|
|||
|
|
}
|
|||
|
|
#endregion 人员离职
|
|||
|
|
|
|||
|
|
#region 获取人员信息
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取人员信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="pinlist"></param>
|
|||
|
|
/// <param name="offduty"></param>
|
|||
|
|
/// <param name="deptnumberlist"></param>
|
|||
|
|
/// <param name="fetch_child"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public ResultDomian<EmployeeGetResponse> GetEmployee(string pinlist, int offduty = 2, string deptnumberlist = null, int fetch_child = 0)
|
|||
|
|
{
|
|||
|
|
_actionName = "get";
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var data = new EmployeeGetRequest
|
|||
|
|
{
|
|||
|
|
pinlist = pinlist,
|
|||
|
|
offduty = offduty,
|
|||
|
|
deptnumberlist = deptnumberlist,
|
|||
|
|
fetch_child = fetch_child
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var dataJson = JsonConvert.SerializeObject(data, Formatting.None, _serializerSettings);
|
|||
|
|
|
|||
|
|
var resultJson = this.DoExecute(dataJson);
|
|||
|
|
|
|||
|
|
var result = JsonConvert.DeserializeObject<ResultDomian<EmployeeGetResponse>>(resultJson);
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
throw ex;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|