remove 移除海宁餐补处理
This commit is contained in:
@@ -37,8 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Scheduled.Api", "Src\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen.Api", "Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj", "{D4043506-7247-4DDC-9751-927403515669}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Message", "Message", "{65E76F97-E78A-4C95-B788-4091236B1A79}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Message", "Message", "{65E76F97-E78A-4C95-B788-4091236B1A79}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Message", "Src\Dlhis.Message\Dlhis.Message.csproj", "{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Message", "Src\Dlhis.Message\Dlhis.Message.csproj", "{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}"
|
||||||
@@ -105,10 +103,6 @@ Global
|
|||||||
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D4043506-7247-4DDC-9751-927403515669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D4043506-7247-4DDC-9751-927403515669}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D4043506-7247-4DDC-9751-927403515669}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D4043506-7247-4DDC-9751-927403515669}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -144,7 +138,6 @@ Global
|
|||||||
{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5} = {489252FB-A44B-46EE-B065-21CDCB724441}
|
{8472596E-0DE7-4A17-93D6-F0FC7D44FDF5} = {489252FB-A44B-46EE-B065-21CDCB724441}
|
||||||
{9EA85FB2-F320-4F97-B278-00652CF35BD8} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
|
{9EA85FB2-F320-4F97-B278-00652CF35BD8} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
|
||||||
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||||
{D4043506-7247-4DDC-9751-927403515669} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
|
||||||
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5} = {65E76F97-E78A-4C95-B788-4091236B1A79}
|
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5} = {65E76F97-E78A-4C95-B788-4091236B1A79}
|
||||||
{4D656761-8CE7-4316-A3DF-8C1722D69CCE} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
{4D656761-8CE7-4316-A3DF-8C1722D69CCE} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||||
{A501D16E-638F-4156-989C-2BACCC2FAC2B} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
{A501D16E-638F-4156-989C-2BACCC2FAC2B} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.4.2" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Dlhis.Canteen.Api.Request;
|
|
||||||
using Dlhis.Canteen.Api.Response;
|
|
||||||
using Kurisu.RemoteCall.Attributes;
|
|
||||||
|
|
||||||
namespace Dlhis.Canteen.Api;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 海宁餐补API
|
|
||||||
/// </summary>
|
|
||||||
[EnableRemoteClient(Name = "haining-service", BaseUrl = "https://pay.aizhuhotel.com")]
|
|
||||||
public interface IHainingMealSupplementApi
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 餐补写入
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Post("/jingke/api/canteen/InputCredit")]
|
|
||||||
Task<HainingResponse<object>> AddMealSupplementAsync(AddHainingMealSupplementRequest request);
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 海宁储能
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Post("/jschuneng/api/canteen/InputCredit")]
|
|
||||||
Task<HainingResponse<object>> AddHsChuNengMealSupplementAsync(AddHainingMealSupplementRequest request);
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Dlhis.Canteen.Api.Request;
|
|
||||||
|
|
||||||
public class AddHainingMealSupplementRequest
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 流水号
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
[JsonProperty("orderNo")]
|
|
||||||
public string UniqueId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工号
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
[JsonProperty("ename")]
|
|
||||||
public string Code { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 餐补金额
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("credit")]
|
|
||||||
public decimal Amount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 考勤日期
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
[JsonProperty("sysdate")]
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("payRef")]
|
|
||||||
public string Remark { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
namespace Dlhis.Canteen.Api.Response;
|
|
||||||
|
|
||||||
public class HainingResponse<T>
|
|
||||||
{
|
|
||||||
public int Code { get; set; }
|
|
||||||
|
|
||||||
public string Message { get; set; }
|
|
||||||
|
|
||||||
public T Data { get; set; }
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
<ProjectReference Include="..\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
||||||
<ProjectReference Include="..\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj" />
|
|
||||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||||
<ProjectReference Include="..\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
<ProjectReference Include="..\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ ARG BUILD_CONFIGURATION=Release
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
||||||
COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"]
|
COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"]
|
||||||
COPY ["Src/Dlhis.Canteen.Api/Dlhis.Canteen.Api.csproj", "Src/Dlhis.Canteen.Api/"]
|
|
||||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||||
COPY ["Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.Sys.Api/"]
|
COPY ["Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.Sys.Api/"]
|
||||||
RUN dotnet restore "./Src/Dlhis.ScheduledTask/./Dlhis.ScheduledTask.csproj"
|
RUN dotnet restore "./Src/Dlhis.ScheduledTask/./Dlhis.ScheduledTask.csproj"
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
// using Dlhis.Canteen.Api;
|
|
||||||
// using Dlhis.Canteen.Api.Request;
|
|
||||||
// using Dlhis.Entity.Basic.Entity;
|
|
||||||
// using Dlhis.Entity.Basic.Enums;
|
|
||||||
// using Dlhis.Entity.Canteen.Entities;
|
|
||||||
// using Dlhis.Entity.Canteen.Enums;
|
|
||||||
// using Dlhis.ScheduledTask.Attributes;
|
|
||||||
// using Dlhis.ScheduledTask.Common.Request;
|
|
||||||
// using Dlhis.ScheduledTask.Common.Services;
|
|
||||||
// using Hangfire;
|
|
||||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
|
||||||
// using Kurisu.AspNetCore.Utils;
|
|
||||||
// using Kurisu.AspNetCore.Utils.Extensions;
|
|
||||||
//
|
|
||||||
// namespace Dlhis.ScheduledTask.Jobs;
|
|
||||||
//
|
|
||||||
// /// <summary>
|
|
||||||
// /// 餐补核算
|
|
||||||
// /// </summary>
|
|
||||||
// [RecurringJob(nameof(MealChunengSupplementHandlerJob), "0 0/30 * * * ?", Name = "储能餐补核算")]
|
|
||||||
// public class MealChunengSupplementHandlerJob : BaseJob
|
|
||||||
// {
|
|
||||||
// private readonly IHainingMealSupplementApi _hainingMealSupplementApi;
|
|
||||||
// private readonly IJinkoJIPService _jinkoJIPService;
|
|
||||||
//
|
|
||||||
// public MealChunengSupplementHandlerJob(IServiceProvider serviceProvider,
|
|
||||||
// IHainingMealSupplementApi hainingMealSupplementApi,
|
|
||||||
// IJinkoJIPService jinkoJIPService) : base(serviceProvider)
|
|
||||||
// {
|
|
||||||
// _hainingMealSupplementApi = hainingMealSupplementApi;
|
|
||||||
// _jinkoJIPService = jinkoJIPService;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// protected override async Task RunAsync(IServiceProvider serviceProvider)
|
|
||||||
// {
|
|
||||||
// //查询待处理餐补
|
|
||||||
// var mealSupplements = await DbContext.Queryable<MealSupplementRecordEntity>()
|
|
||||||
// .Where(x => x.Status == MealSupplementStatusEnumtype.Wait || x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .Where(x => x.Workplace == "5" && x.Factory == "501")//储能
|
|
||||||
// .Where(x => !x.Sync)
|
|
||||||
// .ToListAsync();
|
|
||||||
//
|
|
||||||
// foreach (var item in mealSupplements)
|
|
||||||
// {
|
|
||||||
// var gainfo = await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == item.Code).SingleAsync();
|
|
||||||
// if (gainfo == null)
|
|
||||||
// {
|
|
||||||
// gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync();
|
|
||||||
//
|
|
||||||
// if (gainfo == null)
|
|
||||||
// {
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .SetColumns(x => x.Result == "人员档案不存在")
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == item.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
//
|
|
||||||
// //后台任务获取人员
|
|
||||||
// BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoByCodeAsync(item.Code));
|
|
||||||
//
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// else if (gainfo.ResignationDate < item.Date)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
|
||||||
// {
|
|
||||||
// new()
|
|
||||||
// {
|
|
||||||
// UniqueId = item.UniqueId,
|
|
||||||
// Status = "FAIL",
|
|
||||||
// Msg = "人员离职"
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Result == r)
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
|
||||||
// .SetColumns(x => x.Sync == true)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == item.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //创建余额数据
|
|
||||||
// var mealUser = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
|
||||||
// if (mealUser == null)
|
|
||||||
// {
|
|
||||||
// mealUser = new GainfoMealEntity
|
|
||||||
// {
|
|
||||||
// Balance = 0,
|
|
||||||
// BalanceOfRecharge = 0,
|
|
||||||
// BalanceOfSubsidies = 0,
|
|
||||||
// UserCode = gainfo.Code,
|
|
||||||
// Version = 0,
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// await DbContext.InsertAsync(mealUser);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// await SetHainingMealSupplementAsync(item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
|
|
||||||
// {
|
|
||||||
// await DbContext.Client.Ado.BeginTranAsync();
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var hnResponse = await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
|
|
||||||
// {
|
|
||||||
// Code = mealSupplement.Code,
|
|
||||||
// Amount = mealSupplement.Amount,
|
|
||||||
// Date = mealSupplement.Date.Date,
|
|
||||||
// Remark = mealSupplement.Remark,
|
|
||||||
// UniqueId = mealSupplement.UniqueId
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// (hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);
|
|
||||||
//
|
|
||||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
|
||||||
// {
|
|
||||||
// new()
|
|
||||||
// {
|
|
||||||
// UniqueId = mealSupplement.UniqueId,
|
|
||||||
// Status = "SUCCESS",
|
|
||||||
// Msg = "操作成功"
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// //更新餐补信息为成功(同步成功)
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Result == r)
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
|
||||||
// .SetColumns(x => x.Sync == true)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
//
|
|
||||||
// await DbContext.Client.Ado.CommitTranAsync();
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// await DbContext.Client.Ado.RollbackTranAsync();
|
|
||||||
//
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .SetColumns(x => x.Result == ex.Message + " " + ex.StackTrace)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
// using Dlhis.Canteen.Api;
|
|
||||||
// using Dlhis.Canteen.Api.Request;
|
|
||||||
// using Dlhis.Entity.Basic.Entity;
|
|
||||||
// using Dlhis.Entity.Basic.Enums;
|
|
||||||
// using Dlhis.Entity.Canteen.Entities;
|
|
||||||
// using Dlhis.Entity.Canteen.Enums;
|
|
||||||
// using Dlhis.ScheduledTask.Attributes;
|
|
||||||
// using Dlhis.ScheduledTask.Common.Request;
|
|
||||||
// using Dlhis.ScheduledTask.Common.Services;
|
|
||||||
// using Hangfire;
|
|
||||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
|
||||||
// using Kurisu.AspNetCore.Utils;
|
|
||||||
// using Kurisu.AspNetCore.Utils.Extensions;
|
|
||||||
//
|
|
||||||
// namespace Dlhis.ScheduledTask.Jobs;
|
|
||||||
//
|
|
||||||
// /// <summary>
|
|
||||||
// /// 餐补核算
|
|
||||||
// /// </summary>
|
|
||||||
// [RecurringJob(nameof(MealHainingSupplementHandlerJob), "0 0/30 * * * ?", Name = "海宁餐补核算")]
|
|
||||||
// public class MealHainingSupplementHandlerJob : BaseJob
|
|
||||||
// {
|
|
||||||
// private readonly IHainingMealSupplementApi _hainingMealSupplementApi;
|
|
||||||
// private readonly IJinkoJIPService _jinkoJIPService;
|
|
||||||
//
|
|
||||||
// public MealHainingSupplementHandlerJob(IServiceProvider serviceProvider,
|
|
||||||
// IHainingMealSupplementApi hainingMealSupplementApi,
|
|
||||||
// IJinkoJIPService jinkoJIPService) : base(serviceProvider)
|
|
||||||
// {
|
|
||||||
// _hainingMealSupplementApi = hainingMealSupplementApi;
|
|
||||||
// _jinkoJIPService = jinkoJIPService;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// protected override async Task RunAsync(IServiceProvider serviceProvider)
|
|
||||||
// {
|
|
||||||
// //查询待处理餐补
|
|
||||||
// var mealSupplements = await DbContext.Queryable<MealSupplementRecordEntity>()
|
|
||||||
// .Where(x => x.Status == MealSupplementStatusEnumtype.Wait || x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .Where(x => x.Workplace == "5" && x.Factory != "501") //非储能
|
|
||||||
// .Where(x => !x.Sync)
|
|
||||||
// .ToListAsync();
|
|
||||||
//
|
|
||||||
// foreach (var item in mealSupplements)
|
|
||||||
// {
|
|
||||||
// var gainfo = await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == item.Code).SingleAsync();
|
|
||||||
// if (gainfo == null)
|
|
||||||
// {
|
|
||||||
// gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync();
|
|
||||||
//
|
|
||||||
// if (gainfo == null)
|
|
||||||
// {
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .SetColumns(x => x.Result == "人员档案不存在")
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == item.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
//
|
|
||||||
// //后台任务获取人员
|
|
||||||
// BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoByCodeAsync(item.Code));
|
|
||||||
//
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (gainfo.ResignationDate < item.Date)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
|
||||||
// {
|
|
||||||
// new()
|
|
||||||
// {
|
|
||||||
// UniqueId = item.UniqueId,
|
|
||||||
// Status = "FAIL",
|
|
||||||
// Msg = "人员离职"
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Result == r)
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
|
||||||
// .SetColumns(x => x.Sync == true)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == item.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //创建余额数据
|
|
||||||
// var mealUser = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
|
||||||
// if (mealUser == null)
|
|
||||||
// {
|
|
||||||
// mealUser = new GainfoMealEntity
|
|
||||||
// {
|
|
||||||
// Balance = 0,
|
|
||||||
// BalanceOfRecharge = 0,
|
|
||||||
// BalanceOfSubsidies = 0,
|
|
||||||
// UserCode = gainfo.Code,
|
|
||||||
// Version = 0,
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// await DbContext.InsertAsync(mealUser);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// await SetHainingMealSupplementAsync(item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
|
|
||||||
// {
|
|
||||||
// await DbContext.Client.Ado.BeginTranAsync();
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var hnResponse = await _hainingMealSupplementApi.AddMealSupplementAsync(new AddHainingMealSupplementRequest
|
|
||||||
// {
|
|
||||||
// Code = mealSupplement.Code,
|
|
||||||
// Amount = mealSupplement.Amount,
|
|
||||||
// Date = mealSupplement.Date.Date,
|
|
||||||
// Remark = mealSupplement.Remark,
|
|
||||||
// UniqueId = mealSupplement.UniqueId
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// (hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);
|
|
||||||
//
|
|
||||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
|
||||||
// {
|
|
||||||
// new()
|
|
||||||
// {
|
|
||||||
// UniqueId = mealSupplement.UniqueId,
|
|
||||||
// Status = "SUCCESS",
|
|
||||||
// Msg = "操作成功"
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// //更新餐补信息为成功(同步成功)
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Result == r)
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
|
||||||
// .SetColumns(x => x.Sync == true)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
//
|
|
||||||
// await DbContext.Client.Ado.CommitTranAsync();
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// await DbContext.Client.Ado.RollbackTranAsync();
|
|
||||||
//
|
|
||||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
|
||||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
|
||||||
// .SetColumns(x => x.Result == ex.Message + " " + ex.StackTrace)
|
|
||||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
|
||||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
|
||||||
// .ExecuteCommandAsync();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Reference in New Issue
Block a user