feat 例外人员权限增加到期时间,厂区配置增加生日券,外包自动离场报名单
This commit is contained in:
@@ -10,4 +10,8 @@ public interface IDingTalkApi
|
||||
{
|
||||
[Post("/api/messages/dingtalk/workmessage")]
|
||||
Task SendWorkMessageAsync(JinkoSendWorkMessageRequest request);
|
||||
|
||||
[Post("dingtalk/workgrid/workmessage")]
|
||||
Task SendWorkMessageByWorkGridAsync(JinkoSendWorkMessageRequest request);
|
||||
|
||||
}
|
||||
20
Src/Dlhis.Basic.Api/IFactorySettingApi.cs
Normal file
20
Src/Dlhis.Basic.Api/IFactorySettingApi.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
[RequestResultHandler]
|
||||
[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
|
||||
public interface IFactorySettingApi
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="Vouchers.Controllers.VouchersController.CreateAsync"/> <see cref="VoucherEnumType"/>
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
[Get("/api/factorySetting/enableBirthdayVoucherFactories")]
|
||||
Task<List<string>> GetEnableBirthdayVoucherFactoriesAsync();
|
||||
|
||||
|
||||
[Get("/api/factorySetting/enableUseBirthdayVoucherFactories")]
|
||||
Task<List<string>> GetEnableUseBirthdayVoucherFactoriesAsync(string factory);
|
||||
}
|
||||
@@ -9,22 +9,43 @@ namespace Dlhis.Basic.Api;
|
||||
[EnableRemoteClient(Name = "longRun-service", BaseUrl = "${InternalRequest:BasicRequestUrl}", PolicyHandler = typeof(LongRunClientHandler))]
|
||||
public interface ISyncApi
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据人事范围获取员工信息
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[Post("/api/sync/gainfo/werk")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task SyncGainfoByWerkAsync(string code);
|
||||
|
||||
/// <summary>
|
||||
/// 根据工号获取员工信息
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[Post("/api/sync/gainfo/user")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task SyncGainfoByUserCodeAsync(string code);
|
||||
|
||||
/// <summary>
|
||||
/// 获取组织架构数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Get("/api/sync/orgs")]
|
||||
Task<SapOrganizationResponse> SyncOrganizationsAsync();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取职位数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Get("/api/sync/positions")]
|
||||
Task<SapPositionResponse> GetPositionsAsync();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 差旅数据处理
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[Post("/api/sync/businessTrips")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task HandlerBusinessTripsAsync(string code);
|
||||
|
||||
@@ -41,6 +41,37 @@ public class SapOrganizationItem
|
||||
/// 事业部
|
||||
/// </summary>
|
||||
public string ORGID02 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一级部门
|
||||
/// </summary>
|
||||
public string ORGID03 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 二级部门
|
||||
/// </summary>
|
||||
public string ORGID04 { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 三级部门
|
||||
/// </summary>
|
||||
public string ORGID05 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 四级部门
|
||||
/// </summary>
|
||||
public string ORGID06 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 五级部门
|
||||
/// </summary>
|
||||
public string ORGID07 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 六级部门
|
||||
/// </summary>
|
||||
public string ORGID08 { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,4 +8,9 @@ public class DevicePermissionManuallyAddRequest
|
||||
|
||||
[Required]
|
||||
public string UserNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><>Ч<EFBFBD><D0A7>ʱ<EFBFBD><CAB1>
|
||||
/// </summary>
|
||||
public DateTime? ValidDateTime { get; set; }
|
||||
}
|
||||
@@ -14,6 +14,8 @@ public class DevicePermissionManuallyResponse
|
||||
|
||||
public DeviceTypeEnumType? Type { get; set; }
|
||||
|
||||
public DateTime? ValidDateTime { get; set; }
|
||||
|
||||
public string TypeDesc
|
||||
{
|
||||
get
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Basic.Device.Dtos;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Dlhis.Basic.DataPermissions;
|
||||
using Dlhis.Basic.Device.Dtos;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
|
||||
@@ -39,7 +39,8 @@ public class DevicePermissionManuallyService : IDevicePermissionManuallyService
|
||||
DeployPlace = d.DeployPlace,
|
||||
UserNo = x.UserNo,
|
||||
UserName = g.Code + " " + g.Name,
|
||||
Type = d.Type
|
||||
Type = d.Type,
|
||||
ValidDateTime = x.ValidDateTime
|
||||
});
|
||||
|
||||
return await query.ToPageListAsync(requestDto);
|
||||
@@ -59,7 +60,8 @@ public class DevicePermissionManuallyService : IDevicePermissionManuallyService
|
||||
await _dbContext.InsertAsync(new DevicePermissionManuallyEntity
|
||||
{
|
||||
DeviceCode = request.DeviceCode,
|
||||
UserNo = request.UserNo
|
||||
UserNo = request.UserNo,
|
||||
ValidDateTime = request.ValidDateTime,
|
||||
});
|
||||
|
||||
await _dbContext.InsertAsync(new DeviceTaskEntity
|
||||
|
||||
@@ -3,6 +3,7 @@ using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
|
||||
@@ -55,4 +55,20 @@ public class FactorySettingController : ControllerBase
|
||||
{
|
||||
return await _factorySettingService.GetFactorySettingAsync(factory, false);
|
||||
}
|
||||
|
||||
[IgnoreTenant]
|
||||
[AllowAnonymous]
|
||||
[HttpGet("enableBirthdayVoucherFactories")]
|
||||
public async Task<List<string>> GetEnableBirthdayVoucherFactoriesAsync()
|
||||
{
|
||||
return await _factorySettingService.GetEnableBirthdayVoucherFactoriesAsync();
|
||||
}
|
||||
|
||||
[IgnoreTenant]
|
||||
[AllowAnonymous]
|
||||
[HttpGet("enableUseBirthdayVoucherFactories")]
|
||||
public async Task<List<string>> GetEnableBirthdayVoucherFactoriesAsync(string factory)
|
||||
{
|
||||
return await _factorySettingService.GetEnableUseBirthdayVoucherFactoriesAsync(factory);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -18,10 +21,12 @@ namespace Dlhis.Basic.Organization.Controllers;
|
||||
public class GainfoOutsourceController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoOutsourceService _gainfoOutSourceService;
|
||||
private readonly IOutsourceWhiteListService _outsourceWhiteList;
|
||||
|
||||
public GainfoOutsourceController(IGainfoOutsourceService gainfoOutSourceService)
|
||||
public GainfoOutsourceController(IGainfoOutsourceService gainfoOutSourceService, IOutsourceWhiteListService outsourceWhiteList)
|
||||
{
|
||||
_gainfoOutSourceService = gainfoOutSourceService;
|
||||
_outsourceWhiteList = outsourceWhiteList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,7 +71,6 @@ public class GainfoOutsourceController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("info")]
|
||||
public async Task<GainfoOutSourceExternalInfoResponse> GetExternalInfoAsync([Required] string userNo)
|
||||
{
|
||||
@@ -83,4 +87,37 @@ public class GainfoOutsourceController : ControllerBase
|
||||
{
|
||||
await _gainfoOutSourceService.AutoResignAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取外包白名单分页数据
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("whiteListPage")]
|
||||
public async Task<Pagination<GainfoDto>> GetPageAsync(OutsourceWhiteListPageRequest request)
|
||||
{
|
||||
return await _outsourceWhiteList.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加外包白名单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("setWhiteList")]
|
||||
public async Task AddAsync(OutsourceWhiteListAddAndRemoveRequest request)
|
||||
{
|
||||
await _outsourceWhiteList.AddAsync(request.UserCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除外包白名单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("removeWhiteList")]
|
||||
public async Task RemoveAsync(OutsourceWhiteListAddAndRemoveRequest request)
|
||||
{
|
||||
await _outsourceWhiteList.RemoveAsync(request.UserCode);
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,11 @@ public class FactorySettingSaveRequest
|
||||
/// 访客自动离职天数(无通行记录)
|
||||
/// </summary>
|
||||
public int NoRecordAutoResignExternalDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用生日电子餐券
|
||||
/// </summary>
|
||||
public bool EnableBirthdayVoucher { get; set; }
|
||||
|
||||
public List<string> EnableUseBirthdayVoucherFactories { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class OutsourceWhiteListAddAndRemoveRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string UserCode { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class OutsourceWhiteListPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
@@ -32,4 +32,11 @@ public class FactorySettingResponse
|
||||
/// 外部人员自动离职天数(无通行记录)
|
||||
/// </summary>
|
||||
public int NoRecordAutoResignExternalDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用生日电子餐券
|
||||
/// </summary>
|
||||
public bool EnableBirthdayVoucher { get; set; }
|
||||
|
||||
public List<string> EnableUseBirthdayVoucherFactories { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Converters;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class GainfoOutSourceExternalInfoResponse : GainfoOutSourceExternalInfoDto
|
||||
{
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对接人姓名
|
||||
/// </summary>
|
||||
@@ -27,4 +29,6 @@ public class GainfoOutSourceExternalInfoResponse : GainfoOutSourceExternalInfoDt
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
|
||||
public bool IsWhiteListInAutoResign { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Converters;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -14,6 +14,12 @@ public interface IFactorySettingService : IScopeDependency
|
||||
Task<TimeOnly> GetWorkGridSetLimitAsync();
|
||||
|
||||
Task CheckWorkGridSetLimitAsync(DateOnly date);
|
||||
|
||||
|
||||
Task<bool> IsWorkGridSetLimitAsync(DateOnly date);
|
||||
|
||||
Task<bool> IsEnableBirthdayVoucherAsync(string factory, bool usePermission);
|
||||
|
||||
Task<List<string>> GetEnableBirthdayVoucherFactoriesAsync();
|
||||
|
||||
Task<List<string>> GetEnableUseBirthdayVoucherFactoriesAsync(string currentFactory);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IOutsourceWhiteListService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<GainfoDto>> GetPageAsync(OutsourceWhiteListPageRequest request);
|
||||
Task AddAsync(string userCode);
|
||||
Task RemoveAsync(string userCode);
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class FactorySettingService : IFactorySettingService
|
||||
if (setting == null)
|
||||
{
|
||||
setting = request.Adapt<FactorySettingEntity>();
|
||||
setting.EnableUseBirthdayVoucherFactories = request.EnableUseBirthdayVoucherFactories.ToJson();
|
||||
setting.TenantId = request.Factory;
|
||||
|
||||
await _dbContext.InsertAsync(setting);
|
||||
@@ -45,12 +46,19 @@ public class FactorySettingService : IFactorySettingService
|
||||
else
|
||||
{
|
||||
request.Adapt(setting);
|
||||
setting.EnableUseBirthdayVoucherFactories = request.EnableUseBirthdayVoucherFactories.ToJson();
|
||||
setting.TenantId = request.Factory;
|
||||
|
||||
await _dbContext.UpdateAsync(setting);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> IsEnableBirthdayVoucherAsync(string factory, bool usePermission)
|
||||
{
|
||||
var setting = await GetFactorySettingAsync(factory, usePermission);
|
||||
return setting.EnableBirthdayVoucher;
|
||||
}
|
||||
|
||||
|
||||
public async Task<FactorySettingResponse> GetFactorySettingAsync(string factory, bool usePermission)
|
||||
{
|
||||
@@ -102,6 +110,20 @@ public class FactorySettingService : IFactorySettingService
|
||||
return now >= setting;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<string>> GetEnableBirthdayVoucherFactoriesAsync()
|
||||
{
|
||||
var settings = await GetListAsync(false);
|
||||
return settings.Where(x => x.EnableBirthdayVoucher).Select(x => x.Factory).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetEnableUseBirthdayVoucherFactoriesAsync(string currentFactory)
|
||||
{
|
||||
var settings = await GetFactorySettingsAsync(currentFactory, false);
|
||||
var setting = settings.Where(x => x.EnableBirthdayVoucher).FirstOrDefault();
|
||||
return setting.EnableUseBirthdayVoucherFactories;
|
||||
}
|
||||
|
||||
//************************************************************************************************************************************************************
|
||||
|
||||
private async Task<List<FactorySettingResponse>> GetFactorySettingsAsync(string factory, bool usePermission)
|
||||
@@ -150,8 +172,11 @@ public class FactorySettingService : IFactorySettingService
|
||||
}).ToList()
|
||||
},
|
||||
NoRecordAutoResignOutsourceDays = currentSetting?.NoRecordAutoResignOutsourceDays ?? 30,
|
||||
NoRecordAutoResignExternalDays = currentSetting?.NoRecordAutoResignExternalDays ?? 0
|
||||
NoRecordAutoResignExternalDays = currentSetting?.NoRecordAutoResignExternalDays ?? 0,
|
||||
EnableBirthdayVoucher = currentSetting?.EnableBirthdayVoucher ?? false,
|
||||
EnableUseBirthdayVoucherFactories = (currentSetting?.EnableUseBirthdayVoucherFactories ?? "[]").ToObject<List<string>>()
|
||||
};
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Dlhis.Basic.Organization.Api;
|
||||
using Dlhis.Basic.Organization.Api.Request;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.ThirdParts;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Utils;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.AspNetCore.Cache;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Mapster;
|
||||
@@ -94,21 +95,28 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
|
||||
public async Task<GainfoOutSourceExternalInfoResponse> GetExternalInfoAsync(string userNo)
|
||||
{
|
||||
return await _dbContext.Queryable<OutsourceEntity>()
|
||||
.LeftJoin<GainfoEntity>((a, b) => a.Code == b.Code)
|
||||
.LeftJoin<GainfoEntity>((a, b, c) => a.SapCode == c.Code)
|
||||
.Where((a, b, c) => b.No == userNo)
|
||||
.Select((a, b, c) => new GainfoOutSourceExternalInfoResponse
|
||||
{
|
||||
Supplier = a.Supplier,
|
||||
SapCode = a.SapCode,
|
||||
SapPhone = a.SapPhone,
|
||||
SapName = c.Name,
|
||||
EntryDate = b.EntryDate,
|
||||
ResignationDate = b.ResignationDate,
|
||||
Factory = b.Factory
|
||||
})
|
||||
.SingleAsync();
|
||||
var data = await _dbContext.Queryable<OutsourceEntity>()
|
||||
.LeftJoin<GainfoEntity>((a, b) => a.Code == b.Code)
|
||||
.LeftJoin<GainfoEntity>((a, b, c) => a.SapCode == c.Code)
|
||||
.Where((a, b, c) => b.No == userNo)
|
||||
.Select((a, b, c) => new GainfoOutSourceExternalInfoResponse
|
||||
{
|
||||
UserCode = b.Code,
|
||||
Supplier = a.Supplier,
|
||||
SapCode = a.SapCode,
|
||||
SapPhone = a.SapPhone,
|
||||
SapName = c.Name,
|
||||
EntryDate = b.EntryDate,
|
||||
ResignationDate = b.ResignationDate,
|
||||
Factory = b.Factory
|
||||
})
|
||||
.SingleAsync();
|
||||
|
||||
data.IsWhiteListInAutoResign = await _dbContext.Queryable<OutsourceWhiteListEntity>()
|
||||
.Where(x => x.UserCode == data.UserCode)
|
||||
.AnyAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,11 +124,27 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
{
|
||||
var outsources = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.Type == GainfoUserTypeEnumType.Outsource)
|
||||
.Where(x => SqlFunc.Subqueryable<OutsourceWhiteListEntity>().Where(p => p.UserCode == x.Code).NotAny())//不存在白名单中
|
||||
.Select(x => new { x.Id, x.Code, x.Factory, x.CreateTime })
|
||||
.ToListAsync();
|
||||
|
||||
var settings = await _factorySettingService.GetListAsync(false);
|
||||
|
||||
var holidaies = await _dbContext
|
||||
.Queryable<HolidayEntity>()
|
||||
.Select(x => new
|
||||
{
|
||||
x.Type,
|
||||
Period = new DatePeriod
|
||||
{
|
||||
Start = x.Start,
|
||||
End = x.End
|
||||
}
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
var weekends = new List<DayOfWeek>() { DayOfWeek.Saturday, DayOfWeek.Sunday };
|
||||
foreach (var grp in outsources.GroupBy(x => x.Factory))
|
||||
{
|
||||
var setting = settings.First(x => x.Factory == grp.Key);
|
||||
@@ -138,26 +162,67 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
.Select(x => SqlFunc.IsNull(SqlFunc.AggregateMax(x.RaiseDateTime), default(DateTime?)))
|
||||
.SingleAsync();
|
||||
|
||||
if (raiseDateTime.HasValue && raiseDateTime.Value.AddDays(setting.NoRecordAutoResignOutsourceDays) < DateTime.Now)
|
||||
if (raiseDateTime.HasValue)
|
||||
{
|
||||
try
|
||||
var checkDates = GetDaysUntilToday(raiseDateTime.Value);
|
||||
var days = checkDates.Count;
|
||||
foreach (var date in checkDates)
|
||||
{
|
||||
await _gainfoService.ResignAsync(new GainfoResignRequest
|
||||
//date.DayOfWeek
|
||||
foreach (var holiday in holidaies)
|
||||
{
|
||||
Id = outsource.Id,
|
||||
Reason = $"{setting.NoRecordAutoResignOutsourceDays}天无通行记录",
|
||||
Date = DateTime.Now
|
||||
});
|
||||
var isPresent = date >= holiday.Period.Start && date <= holiday.Period.Start;
|
||||
if (isPresent)
|
||||
{
|
||||
if (holiday.Type == HolidayEnumType.Rest)
|
||||
{
|
||||
days--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weekends.Contains(date.DayOfWeek))
|
||||
{
|
||||
days--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
if (days >= setting.NoRecordAutoResignOutsourceDays)
|
||||
{
|
||||
_logger.LogError(e, "自动离职外包异常:{msg}", e.Message);
|
||||
try
|
||||
{
|
||||
await _gainfoService.ResignAsync(new GainfoResignRequest
|
||||
{
|
||||
Id = outsource.Id,
|
||||
Reason = $"{setting.NoRecordAutoResignOutsourceDays}天无通行记录",
|
||||
Date = DateTime.Now
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "自动离职外包异常:{msg}", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<DateOnly> GetDaysUntilToday(DateTime begin)
|
||||
{
|
||||
var start = DateOnly.FromDateTime(begin.Date);
|
||||
var today = DateOnly.FromDateTime(DateTime.Today);
|
||||
if (start > today) return new List<DateOnly>();
|
||||
|
||||
var days = new List<DateOnly>();
|
||||
for (var d = start; d <= today; d = d.AddDays(1))
|
||||
{
|
||||
days.Add(d);
|
||||
}
|
||||
|
||||
return days;
|
||||
}
|
||||
|
||||
//********************************************************************** help methods ***********************************************************************************
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
|
||||
var content = $"{workGrid.Name}的网格长,你好,检测到你网格中 {gainfo.Name}({gainfo.Code}),因发生离职或者异动,现已经删除该员工{dates}的排班信息,请前往系统处理!";
|
||||
|
||||
await _dingTalkApi.SendWorkMessageAsync(new DingTalkWorkMessageRequest
|
||||
await _dingTalkApi.SendWorkMessageByWorkGridAsync(new DingTalkWorkMessageRequest
|
||||
{
|
||||
Content = content,
|
||||
WorkCodes = new List<string> { workGrid.LeaderUserCode }
|
||||
@@ -409,7 +409,7 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
}).SingleAsync();
|
||||
var content = $"{workGrid.Name}的网格长,你好,检测到你网格中 {gainfo.Name}({gainfo.Code}),因发生离职或者异动,现已经删除该员工{dates}的排班信息,请前往系统处理!";
|
||||
|
||||
await _dingTalkApi.SendWorkMessageAsync(new DingTalkWorkMessageRequest
|
||||
await _dingTalkApi.SendWorkMessageByWorkGridAsync(new DingTalkWorkMessageRequest
|
||||
{
|
||||
Content = content,
|
||||
WorkCodes = new List<string> { workGrid.LeaderUserCode }
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class OutsourceWhiteListService : IOutsourceWhiteListService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public OutsourceWhiteListService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task AddAsync(string userCode)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == userCode).SingleAsync();
|
||||
gainfo.ThrowIfNull("人员信息不存在");
|
||||
(gainfo.Type == GainfoUserTypeEnumType.Outsource).ThrowIfFalse("人员类型不正确");
|
||||
if (!await _dbContext.Queryable<OutsourceWhiteListEntity>().Where(x => x.UserCode == userCode).AnyAsync())
|
||||
{
|
||||
await _dbContext.InsertAsync(new OutsourceWhiteListEntity
|
||||
{
|
||||
UserCode = userCode
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RemoveAsync(string userCode)
|
||||
{
|
||||
var whitelist = await _dbContext.Queryable<OutsourceWhiteListEntity>().Where(x => x.UserCode == userCode).SingleAsync();
|
||||
if (whitelist != null)
|
||||
{
|
||||
await _dbContext.DeleteAsync(whitelist);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Pagination<GainfoDto>> GetPageAsync(OutsourceWhiteListPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<OutsourceWhiteListEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserCode == ga.Code)
|
||||
.Select((x, ga) => new GainfoDto
|
||||
{
|
||||
Code = ga.Code,
|
||||
Name = ga.Name,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using System.Text;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using HttpUtil;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic;
|
||||
namespace Dlhis.Basic.ThirdParts;
|
||||
|
||||
public class HikService : IHikService
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace HttpUtil
|
||||
namespace Dlhis.Basic.ThirdParts
|
||||
{
|
||||
public class HttpUtillib
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace HttpUtil
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(_isHttps ? "https://" : "http://").Append(_ip).Append(":").Append(_port.ToString()).Append(uri);
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(sb.ToString());
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sb.ToString());
|
||||
req.KeepAlive = false;
|
||||
req.ProtocolVersion = HttpVersion.Version11;
|
||||
req.AllowAutoRedirect = false; // 不允许自动重定向
|
||||
@@ -73,7 +73,7 @@ namespace HttpUtil
|
||||
StreamReader sr = new StreamReader(rspStream);
|
||||
string strStream = sr.ReadToEnd();
|
||||
long streamLength = strStream.Length;
|
||||
byte[] response = System.Text.Encoding.UTF8.GetBytes(strStream);
|
||||
byte[] response = Encoding.UTF8.GetBytes(strStream);
|
||||
rsp.Close();
|
||||
return response;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace HttpUtil
|
||||
sb.Append(_isHttps ? "https://" : "http://").Append(_ip).Append(":").Append(_port.ToString()).Append(uri);
|
||||
|
||||
// 创建POST请求
|
||||
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(sb.ToString());
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sb.ToString());
|
||||
req.KeepAlive = false;
|
||||
req.ProtocolVersion = HttpVersion.Version11;
|
||||
req.AllowAutoRedirect = false; // 不允许自动重定向
|
||||
@@ -173,7 +173,7 @@ namespace HttpUtil
|
||||
StreamReader sr = new StreamReader(rspStream);
|
||||
string strStream = sr.ReadToEnd();
|
||||
long streamLength = strStream.Length;
|
||||
byte[] response = System.Text.Encoding.UTF8.GetBytes(strStream);
|
||||
byte[] response = Encoding.UTF8.GetBytes(strStream);
|
||||
rsp.Close();
|
||||
return response;
|
||||
}
|
||||
@@ -241,11 +241,11 @@ namespace HttpUtil
|
||||
}
|
||||
|
||||
// x-ca-timestamp
|
||||
string timestamp = ((DateTime.Now.Ticks - TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0)).Ticks) / 1000).ToString();
|
||||
string timestamp = ((DateTime.Now.Ticks - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0, 0)).Ticks) / 1000).ToString();
|
||||
header.Add("x-ca-timestamp", timestamp);
|
||||
|
||||
// x-ca-nonce
|
||||
string nonce = System.Guid.NewGuid().ToString();
|
||||
string nonce = Guid.NewGuid().ToString();
|
||||
header.Add("x-ca-nonce", nonce);
|
||||
|
||||
// x-ca-key
|
||||
@@ -261,7 +261,7 @@ namespace HttpUtil
|
||||
if (_isHttps)
|
||||
{
|
||||
// set remote certificate Validation auto pass
|
||||
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(remoteCertificateValidate);
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(remoteCertificateValidate);
|
||||
// FIX:修复不同.Net版对一些SecurityProtocolType枚举支持情况不一致导致编译失败等问题,这里统一使用数值
|
||||
//(SecurityProtocolType)48 |
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072 | (SecurityProtocolType)768 | (SecurityProtocolType)192;
|
||||
@@ -277,7 +277,7 @@ namespace HttpUtil
|
||||
private static string computeContentMd5(string body)
|
||||
{
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] result = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(body));
|
||||
byte[] result = md5.ComputeHash(Encoding.UTF8.GetBytes(body));
|
||||
return Convert.ToBase64String(result);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace HttpUtil
|
||||
/// <returns>HMAXH265计算结果字符串</returns>
|
||||
private static string computeForHMACSHA256(string str, string secret)
|
||||
{
|
||||
var encoder = new System.Text.UTF8Encoding();
|
||||
var encoder = new UTF8Encoding();
|
||||
byte[] secretBytes = encoder.GetBytes(secret);
|
||||
byte[] strBytes = encoder.GetBytes(str);
|
||||
var opertor = new HMACSHA256(secretBytes);
|
||||
@@ -325,25 +325,25 @@ namespace HttpUtil
|
||||
{
|
||||
if (null != header["Accept"])
|
||||
{
|
||||
sb.Append((string)header["Accept"]);
|
||||
sb.Append(header["Accept"]);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
if (header.Keys.Contains("Content-MD5") && null != header["Content-MD5"])
|
||||
{
|
||||
sb.Append((string)header["Content-MD5"]);
|
||||
sb.Append(header["Content-MD5"]);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
if (null != header["Content-Type"])
|
||||
{
|
||||
sb.Append((string)header["Content-Type"]);
|
||||
sb.Append(header["Content-Type"]);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
if (header.Keys.Contains("Date") && null != header["Date"])
|
||||
{
|
||||
sb.Append((string)header["Date"]);
|
||||
sb.Append(header["Date"]);
|
||||
sb.Append("\n");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
|
||||
namespace Dlhis.Basic;
|
||||
namespace Dlhis.Basic.ThirdParts;
|
||||
|
||||
public interface IHikService : IScopeDependency
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using Kurisu.AspNetCore.Cache;
|
||||
using Kurisu.AspNetCore.Utils.Converters;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic;
|
||||
namespace Dlhis.Basic.Utils;
|
||||
|
||||
public class ObfuscateProviderJsonConverter : ObfuscateJsonConverter
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic;
|
||||
namespace Dlhis.Basic.Utils;
|
||||
|
||||
public static class ParallelExtensions
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic;
|
||||
namespace Dlhis.Basic.Utils;
|
||||
|
||||
public static class RecursionHelper
|
||||
{
|
||||
@@ -233,7 +233,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
||||
{
|
||||
try
|
||||
{
|
||||
await _jinkoApiService.SendWorkMessageAsync(new DingTalkWorkMessageRequest
|
||||
await _jinkoApiService.SendWorkMessageByWorkGridAsync(new DingTalkWorkMessageRequest
|
||||
{
|
||||
Content = $"{gainfo.Name}({gainfo.Code})你好,系统检测到你被{workGridName}网格的网格长{workGridLeaderName}({workGridLeaderCode})安排了{date.ToString("yyyy年MM月dd日")}{periodType.GetDescription()},请按时上班",
|
||||
WorkCodes = new List<string> { gainfo.Code }
|
||||
@@ -333,7 +333,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
||||
{
|
||||
try
|
||||
{
|
||||
await _jinkoApiService.SendWorkMessageAsync(new DingTalkWorkMessageRequest
|
||||
await _jinkoApiService.SendWorkMessageByWorkGridAsync(new DingTalkWorkMessageRequest
|
||||
{
|
||||
Content = $"{gainfo.Name}({gainfo.Code})你好,系统检测到你被{workGrid.Name}网格的网格长{workGrid.LeaderUserName}({workGrid.LeaderUserCode})删除了{request.Date.ToString("yyyy年MM月dd日")}{request.PeriodType.GetDescription()},如有疑问,请联系网格长!",
|
||||
WorkCodes = new List<string> { gainfo.Code }
|
||||
|
||||
Reference in New Issue
Block a user