using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;
using Zxd.Crm.Domain.Dto;
using Zxd.Crm.Domain.Impl;
using static Zxd.Crm.Domain.SSOEmployeeDomain;
namespace Zxd.Crm.WebApi.Controllers
{
[ApiSignatureFilterForbid]
public class SSOController : BaseController
{
private readonly ISSOEmployeeDomain _sourceDomain;
public SSOController(ISSOEmployeeDomain sourceDomain)
{
_sourceDomain = sourceDomain;
}
///
/// 通过eid获取事业部名称
///
///
///
[HttpGet("GetDeptNameByEid")]
public async Task> GetDeptNameByEid(string? eidList)
{
var res = await _sourceDomain.GetDeptmentByEid(eidList);
return res;
}
///
/// 获取通过坐席id获取对应坐席员工的产品授权情况
///
[HttpGet("GetEmpowerment")]
public async Task> GetEmpowerment([FromQuery] GetEmpowermentByAppidDto dto)
{
var res = await _sourceDomain.GetEmpowerment(dto);
return res;
}
[HttpGet("RemoveEidCache")]
public async Task RemoveEidCache(string? activeModel)
{
var res = await _sourceDomain.RemoveEidCache(activeModel);
return res;
}
///
/// 中心点 添加【授权情况】,和更新【授权日志】
///
[HttpPost("SetEmpowerment")]
public async Task> SetEmpowerment(SetEmpowermentDto dto)
{
var res = await _sourceDomain.SetEmpowerment(dto);
return res;
}
[HttpGet("Async")]
public async Task AsyncEmplyeeData([Required] string eid)
{
await _sourceDomain.AsyncEmplyeeData(eid);
}
///
/// 更新员工与手机绑定账号上次赋权的时间
///
[HttpPost("UpdateLastEmpowerTime")]
public async Task> UpdateLastEmpowerTime(UpdateLastEmpowerTime dto)
{
var res = await _sourceDomain.UpdateLastEmpowerTime(dto.residString, dto.timestamp != null ? dto.timestamp : null);
return res;
}
///
/// 更新员工手机绑定的软件用户名
///
[HttpPost("UpdateAppusername")]
public async Task> UpdateAppusername(List UpdateAppusernameList)
{
var res = await _sourceDomain.UpdateAppusername(UpdateAppusernameList);
return res;
}
///
/// 通过员工id获取软件用户名
///
/// 员工id
///
///
[HttpGet("GetAppuserByEid")]
public async Task>> GetAppuserByEid(int eid)
{
var res = await _sourceDomain.GetAppuserByEid(eid);
return res;
}
///
/// 增加员工软件用户的绑定数据
///
/// 被操作员工id
/// 资源id
/// 脱敏后电话
/// 操作类型 bind: 绑定或更新 unbind 解绑
/// 操作员工id
/// 是否为主账号
///
///
[HttpPost("AddSoftEmployeeBind")]
public async Task> AddSoftEmployeeBind(SoftEmployeeBindChangeDto data)
{
return await _sourceDomain.AddSoftEmployeeBind(data.to_by_eid, data.resid, data.show_phone, data.from_by_eid);
}
///
/// 解绑员工软件用户的绑定数据
///
/// 被操作员工id
/// 资源id
/// 脱敏后电话
/// 操作员工id
/// 是否为主账号
///
///
[HttpPost("DeleteSoftEmployeeBind")]
public async Task> DeleteSoftEmployeeBind(SoftEmployeeBindChangeDto data)
{
return await _sourceDomain.DeleteSoftEmployeeBind(data.to_by_eid, data.resid, data.show_phone, data.from_by_eid);
}
/////
///// 记录员工软件用户字典
/////
/////
/////
//[HttpPost("SetEmployeeSoftDict")]
//public async Task> SetEmployeeSoftDict(EMPLOYEE_SOFT_DICT data)
//{
// return await _sourceDomain.SetEmployeeSoftDict(data);
//}
}
}