fix 优化手动获取人员
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.Common;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using System.Text;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Comparers;
|
||||
namespace Dlhis.ScheduledTask.Common.Comparers;
|
||||
|
||||
/// <summary>
|
||||
/// 人员信息比较器
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// sap机构信息
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
public class SapOrganizationItem
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
public class SapPerson<T>
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto
|
||||
namespace Dlhis.ScheduledTask.Common.Dto
|
||||
{
|
||||
public class SapPersonDepartmentStatus
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
public class SapPersonItem
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto
|
||||
namespace Dlhis.ScheduledTask.Common.Dto
|
||||
{
|
||||
public class SapPersonJobStatus
|
||||
{
|
||||
10
Src/Dlhis.ScheduledTask/Common/Dto/SapPersonNoRequest.cs
Normal file
10
Src/Dlhis.ScheduledTask/Common/Dto/SapPersonNoRequest.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
public class SapPersonNoRequest
|
||||
{
|
||||
|
||||
[Required]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
namespace Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
public class SapPosition
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Dto
|
||||
namespace Dlhis.ScheduledTask.Common.Dto
|
||||
{
|
||||
public class SapPositionItem
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo;
|
||||
namespace Dlhis.ScheduledTask.Common;
|
||||
|
||||
internal static class GetHashCodeExtensions
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo;
|
||||
namespace Dlhis.ScheduledTask.Common.Request;
|
||||
|
||||
public class SyncMealSupplementRecordRequest
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo
|
||||
namespace Dlhis.ScheduledTask.Common.Request
|
||||
{
|
||||
public class UploadAttendanceRequest
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
namespace Dlhis.ScheduledTask.Common.Response;
|
||||
|
||||
public class SapOrganizationResponse
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
namespace Dlhis.ScheduledTask.Common.Response;
|
||||
|
||||
public class SapPersonResponse
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
namespace Dlhis.ScheduledTask.Common.Response;
|
||||
|
||||
public class SapPositionResponse
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Response
|
||||
namespace Dlhis.ScheduledTask.Common.Response
|
||||
{
|
||||
public class UploadAttendanceResponse
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
namespace Dlhis.ScheduledTask.Common.Services;
|
||||
|
||||
public interface IGainfoUpdateService : IScopeDependency
|
||||
{
|
||||
16
Src/Dlhis.ScheduledTask/Common/Services/IHangfireService.cs
Normal file
16
Src/Dlhis.ScheduledTask/Common/Services/IHangfireService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Common.Services;
|
||||
|
||||
/// <summary>
|
||||
/// hangfire调度服务
|
||||
/// </summary>
|
||||
public interface IHangfireService : ISingletonDependency
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建sap人员同步后台任务
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task CreateSapPersonSyncBackgroundJobAsync(SapPersonNoRequest request);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
using Dlhis.ScheduledTask.Common.Request;
|
||||
using Dlhis.ScheduledTask.Common.Response;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
namespace Dlhis.ScheduledTask.Common.Services;
|
||||
|
||||
public interface IJinkoJIPService : ISingletonDependency
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
using Dlhis.ScheduledTask.Common.Response;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
namespace Dlhis.ScheduledTask.Common.Services;
|
||||
|
||||
public interface IJinkoSapService : IScopeDependency
|
||||
{
|
||||
@@ -2,15 +2,15 @@
|
||||
using Dlhis.Basic.Api;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Comparers;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using System.Text;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
using Dlhis.Sys.Api.Response;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Comparers;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services.Implements;
|
||||
namespace Dlhis.ScheduledTask.Common.Services.Implements;
|
||||
|
||||
public class GainfoUpdateService : IGainfoUpdateService
|
||||
{
|
||||
@@ -368,7 +368,7 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
remark = rmk,
|
||||
native = native,
|
||||
sex = sex,
|
||||
//web = SubString(position?.Name ?? "", 30),
|
||||
web = person.PLANS,
|
||||
logdate = DateTime.Now,
|
||||
isowner = int.Parse(person.ZSTATUS) < 5 ? "T" : "F",
|
||||
@class = "C",
|
||||
@@ -0,0 +1,26 @@
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Hangfire;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Common.Services.Implements;
|
||||
|
||||
public class HangfireService : IHangfireService
|
||||
{
|
||||
private readonly RedisCache _redisCache;
|
||||
|
||||
public HangfireService(RedisCache redisCache)
|
||||
{
|
||||
_redisCache = redisCache;
|
||||
}
|
||||
|
||||
public async Task CreateSapPersonSyncBackgroundJobAsync(SapPersonNoRequest request)
|
||||
{
|
||||
var jobKey = $"hangfire:background:{request.Code}";
|
||||
|
||||
using var handler = await _redisCache.LockAsync(jobKey);
|
||||
if (handler.Acquired)
|
||||
{
|
||||
BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoAsync(request.Code));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
using Dlhis.ScheduledTask.Common.Request;
|
||||
using Dlhis.ScheduledTask.Common.Response;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services.Implements;
|
||||
namespace Dlhis.ScheduledTask.Common.Services.Implements;
|
||||
|
||||
public class JinkoJIPService : IJinkoJIPService
|
||||
{
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Response;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.ScheduledTask.SyncSapInfo.Services.Implements;
|
||||
namespace Dlhis.ScheduledTask.Common.Services.Implements;
|
||||
|
||||
public class JinkoSapService : IJinkoSapService
|
||||
{
|
||||
@@ -4,8 +4,8 @@ using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Dlhis.ScheduledTask.Common.Request;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Scheduled;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Hangfire;
|
||||
using Kurisu.Scheduled;
|
||||
using Kurisu.Scheduled.Attributes;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Dlhis.ScheduledTask.Common.Request;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Scheduled;
|
||||
using Kurisu.Scheduled.Attributes;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Kurisu.Scheduled;
|
||||
using Kurisu.Scheduled.Attributes;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Kurisu.Scheduled;
|
||||
using Kurisu.Scheduled.Attributes;
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using Dlhis.ScheduledTask.SyncSapInfo.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Controllers;
|
||||
|
||||
[Authorize(Roles = "admin")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GainfoTasksController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoUpdateService _gainfoUpdateService;
|
||||
|
||||
public GainfoTasksController(IGainfoUpdateService gainfoUpdateService)
|
||||
{
|
||||
_gainfoUpdateService = gainfoUpdateService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动获取人员
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ManuallySync")]
|
||||
public async Task ManuallySync(string code)
|
||||
{
|
||||
await _gainfoUpdateService.TodoAsync(code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Dlhis.ScheduledTask.Common.Dto;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Controllers;
|
||||
|
||||
[Authorize(Roles = "admin")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class HangfireController : ControllerBase
|
||||
{
|
||||
private readonly IHangfireService _hangfireService;
|
||||
|
||||
public HangfireController(IHangfireService hangfireService)
|
||||
{
|
||||
_hangfireService = hangfireService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动获取人员
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("sap/person/no")]
|
||||
public async Task ManuallySync(SapPersonNoRequest request)
|
||||
{
|
||||
await _hangfireService.CreateSapPersonSyncBackgroundJobAsync(request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user