158 lines
5.2 KiB
C#
158 lines
5.2 KiB
C#
/*
|
||
*接口编写处...
|
||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||
*如: [ApiActionPermission("HR_EmployeeSync",Enums.ActionPermissionOptions.Search)]
|
||
*/
|
||
using Azure.Core;
|
||
using Confluent.Kafka;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using Microsoft.AspNetCore.Http;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using Microsoft.Extensions.DependencyInjection;
|
||
//using Quartz.Logging;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using VOL.Core.Filters;
|
||
using VOL.Core.Services;
|
||
using VOL.DingTalk.Models.Biz;
|
||
using VOL.Entity.DomainModels;
|
||
using VOL.HR.IServices;
|
||
|
||
namespace VOL.HR.Controllers
|
||
{
|
||
public partial class HR_EmployeeSyncController
|
||
{
|
||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||
private readonly IHR_EmployeeSyncService _service;//访问业务代码
|
||
[ActivatorUtilitiesConstructor]
|
||
public HR_EmployeeSyncController(
|
||
IHR_EmployeeSyncService service,
|
||
IHttpContextAccessor httpContextAccessor
|
||
)
|
||
: base(service)
|
||
{
|
||
_service = service;
|
||
_httpContextAccessor = httpContextAccessor;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("GenEmpSystemShip")]
|
||
public async Task<IActionResult> GenEmpSystemShip()
|
||
{
|
||
await Service.GenEmpSystemShip();
|
||
return Json(new { });
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("/api/HR_DingTalkEmployees/getPageData")]
|
||
public async Task<IActionResult> GetAllDingTalkEmployees()
|
||
{
|
||
var emps = await Service.GetAllDingTalkEmployees();
|
||
return Json(emps);
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("/api/HR_YSEmployees/getPageData")]
|
||
public async Task<IActionResult> GetYSAllEmployees()
|
||
{
|
||
var emps = await Service.GetAllYSEmployees();
|
||
return Json(emps);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("UpdateEmpInfo")]
|
||
public async Task<IActionResult> UpdateEmpInfo(DingTalkEmployeeUpdate updateInfo)
|
||
{
|
||
await Service.UpdateEmpInfo(updateInfo);
|
||
return Json(new { });
|
||
}
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("SyncYSEmpToDingTalk")]
|
||
public async Task<IActionResult> SyncYSEmpToDingTalk([FromBody] string ysEmpId)
|
||
{
|
||
var result = await Service.SyncYSEmpToDingTalk(ysEmpId);
|
||
return Json(new { success=result });
|
||
}
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("/iuap-api-gateway/yonbip/digitalModel/product/integration/querylist"), AllowAnonymous]
|
||
public async Task<IActionResult> ErpApiTest( object obj)
|
||
{
|
||
Logger.Info(obj.ToString());
|
||
//var result = await Service.SyncYSEmpToDingTalk(ysEmpId);
|
||
return Json(new { message = "",code = 200 ,data=new { recordList = new List<Dictionary<string,object>>() } });
|
||
}
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpGet, Route("/iuap-api-auth/open-auth/selfAppAuth/getAccessToken"), AllowAnonymous]
|
||
public async Task<IActionResult> ErpApiTestgetAccessToken( string appKey, string timestamp,string signature)
|
||
{
|
||
//Logger.Info(obj.ToString());
|
||
//var result = await Service.SyncYSEmpToDingTalk(ysEmpId);
|
||
return Json(new { message = "00000",
|
||
code = "00000",
|
||
data=new {
|
||
access_token = "1111111111312",
|
||
expire = 60 * 60,
|
||
timeOutMills = DateTime.Now.AddSeconds(60*60).Microsecond } });
|
||
}
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("/iuap-api-gateway/yonbip/digitalModel/product/batchsave"), AllowAnonymous]
|
||
public async Task<IActionResult> ErpApiTestbatchsave(string access_token,[FromBody] object body)
|
||
{
|
||
//string body;
|
||
//using (var reader = new System.IO.StreamReader(Request.Body))
|
||
//{
|
||
// body = await reader.ReadToEndAsync();
|
||
//}
|
||
Logger.Info($"access_token:{access_token}");
|
||
Logger.Info($"body:{body}");
|
||
|
||
//Logger.Info(obj.ToString());
|
||
//var result = await Service.SyncYSEmpToDingTalk(ysEmpId);
|
||
return Json(new
|
||
{
|
||
message = "",
|
||
code = 200,
|
||
data = new
|
||
{
|
||
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|