refactor 警告/提醒处理
This commit is contained in:
@@ -376,13 +376,13 @@ public class DeviceService : IDeviceService
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.Select((x, d) => new
|
||||
{
|
||||
UniqueNo = d.UniqueNo,
|
||||
d.UniqueNo,
|
||||
d.HeartbeatInterval,
|
||||
x.LastHeartbeatTime
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var OnlineDevices = deviceRegistries
|
||||
var onlineDevices = deviceRegistries
|
||||
.Where(x =>
|
||||
{
|
||||
if (x.HeartbeatInterval <= 0)
|
||||
@@ -395,11 +395,11 @@ public class DeviceService : IDeviceService
|
||||
})
|
||||
.Select(x => new
|
||||
{
|
||||
UniqueNo = x.UniqueNo,
|
||||
x.UniqueNo,
|
||||
})
|
||||
.ToList();
|
||||
var onlineUniqueNos = new List<string>();
|
||||
OnlineDevices.ForEach(x => onlineUniqueNos.Add(x.UniqueNo));
|
||||
onlineDevices.ForEach(x => onlineUniqueNos.Add(x.UniqueNo));
|
||||
|
||||
var offUniqueNos = deviceUniqueNos.Except(onlineUniqueNos).ToList();
|
||||
var list = devices.Where(x => offUniqueNos.Contains(x.UniqueNo)).ToList();
|
||||
@@ -518,7 +518,7 @@ public class DeviceService : IDeviceService
|
||||
{
|
||||
//获取近30天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
var times = new List<string>();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
|
||||
@@ -17,6 +17,7 @@ public class DishesCategoryService : IDishesCategoryService
|
||||
public DishesCategoryService(IDbContext dbContext, IBusinessPlacePermissionsService businessPlacePermissionsService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode)
|
||||
|
||||
@@ -206,7 +206,7 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
private IEnumerable<Guid> RecursionGetNext(DeviceGroupEntity current, List<DeviceGroupEntity> deviceGroups)
|
||||
private static IEnumerable<Guid> RecursionGetNext(DeviceGroupEntity current, List<DeviceGroupEntity> deviceGroups)
|
||||
{
|
||||
var next = deviceGroups.Where(x => x.PCode == current.Code).ToList();
|
||||
foreach (var item in next)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Packs;
|
||||
@@ -22,7 +19,7 @@ public class SqlSugarPack : BaseAppPack
|
||||
|
||||
return new List<ConnectionConfig>
|
||||
{
|
||||
new ConnectionConfig
|
||||
new()
|
||||
{
|
||||
ConfigId = "face",
|
||||
|
||||
@@ -36,7 +33,7 @@ public class SqlSugarPack : BaseAppPack
|
||||
DisableNvarchar = true,
|
||||
}
|
||||
},
|
||||
new ConnectionConfig
|
||||
new()
|
||||
{
|
||||
ConfigId = "log",
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SummaryService : ISummaryService
|
||||
|
||||
//获取近30天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
var times = new List<string>();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
@@ -125,7 +125,7 @@ public class SummaryService : ISummaryService
|
||||
public async Task<DoorDataResponse> GetDoorDataAsync()
|
||||
{
|
||||
var res = new DoorDataResponse();
|
||||
List<GainfoEntity> workingGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).ToListAsync();
|
||||
var workingGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).ToListAsync();
|
||||
var leaveGainfos = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave).ToListAsync();
|
||||
res.Employed = workingGainfos.Count;
|
||||
res.Unemployed = leaveGainfos.Count;
|
||||
@@ -134,8 +134,8 @@ public class SummaryService : ISummaryService
|
||||
var unemployedTrend = new List<TrendDto>();
|
||||
|
||||
//获取近7天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
var currentDate = DateTime.Now;
|
||||
var times = new List<string>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
|
||||
@@ -404,19 +404,18 @@ public class BalanceService : IBalanceService
|
||||
var lst = new List<BalanceRecordAnalysisRespones>();
|
||||
foreach (var first in pageinfo.GroupBy(record => record.CostDateTime.ToString("yyyy-MM-dd")))
|
||||
{
|
||||
var obj = new BalanceRecordAnalysisRespones()
|
||||
var obj = new BalanceRecordAnalysisRespones
|
||||
{
|
||||
CostDate = DateOnly.FromDateTime(Convert.ToDateTime(first.Key)),
|
||||
//每个餐次人数
|
||||
BreakfastNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Breakfast).Select(x => x.UserNo).Distinct().Count(),
|
||||
LunchNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Lunch).Select(x => x.UserNo).Distinct().Count(),
|
||||
DinnerNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Lunch).Select(x => x.UserNo).Distinct().Count(),
|
||||
LateNightNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Nightsnack).Select(x => x.UserNo).Distinct().Count(),
|
||||
|
||||
TotalNumberOfPeople = first.Where(x => x.CostDate.ToString("yyyy-MM-dd") == first.Key).Select(x => x.UserNo).Distinct().Count()
|
||||
};
|
||||
|
||||
//每个餐次人数
|
||||
obj.BreakfastNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Breakfast).Select(x => x.UserNo).Distinct().Count();
|
||||
obj.LunchNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Lunch).Select(x => x.UserNo).Distinct().Count();
|
||||
obj.DinnerNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Lunch).Select(x => x.UserNo).Distinct().Count();
|
||||
obj.LateNightNumberOfPeople = first.Where(x => x.ShiftType == ShiftEnumType.Nightsnack).Select(x => x.UserNo).Distinct().Count();
|
||||
|
||||
obj.TotalNumberOfPeople = first.Where(x => x.CostDate.ToString("yyyy-MM-dd") == first.Key).Select(x => x.UserNo).Distinct().Count();
|
||||
|
||||
lst.Add(obj);
|
||||
}
|
||||
// 分页操作
|
||||
@@ -624,7 +623,7 @@ public class BalanceService : IBalanceService
|
||||
/// <param name="bs"></param>
|
||||
/// <param name="userCode"></param>
|
||||
/// <returns></returns>
|
||||
private int SameDay(List<BalanceRecordEntity> bs, string userCode)
|
||||
private static int SameDay(List<BalanceRecordEntity> bs, string userCode)
|
||||
{
|
||||
var time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
var b = userCode.IsEmpty();
|
||||
@@ -858,13 +857,13 @@ public class BalanceService : IBalanceService
|
||||
/// <returns></returns>
|
||||
private List<string> GetMonthsOfYear()
|
||||
{
|
||||
List<string> months = new List<string>();
|
||||
var months = new List<string>();
|
||||
// 获取当前年份
|
||||
int year = DateTime.Now.Year;
|
||||
// 遍历12个月份并添加到列表中
|
||||
for (int month = 1; month <= 12; month++)
|
||||
{
|
||||
DateTime monthDate = new DateTime(year, month, 1);
|
||||
var monthDate = new DateTime(year, month, 1);
|
||||
months.Add(monthDate.ToString("yyyy-MM"));
|
||||
}
|
||||
return months;
|
||||
@@ -876,15 +875,15 @@ public class BalanceService : IBalanceService
|
||||
/// <returns></returns>
|
||||
private List<string> GetDaysOfMonth()
|
||||
{
|
||||
List<string> days = new List<string>();
|
||||
var days = new List<string>();
|
||||
|
||||
// 获取当前年份和月份
|
||||
int year = DateTime.Now.Year;
|
||||
int month = DateTime.Now.Month;
|
||||
|
||||
// 获取当前月份的第一天和最后一天
|
||||
DateTime firstDayOfMonth = new DateTime(year, month, 1);
|
||||
DateTime lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
|
||||
var firstDayOfMonth = new DateTime(year, month, 1);
|
||||
var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
|
||||
|
||||
// 遍历当前月的所有日期并添加到列表中
|
||||
for (DateTime date = firstDayOfMonth; date <= lastDayOfMonth; date = date.AddDays(1))
|
||||
@@ -909,7 +908,7 @@ public class BalanceService : IBalanceService
|
||||
}
|
||||
catch (Exception ex) when (ex is VersionExceptions)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
_logger.LogWarning(ex, "{message}", ex.Message);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -56,9 +56,8 @@ public abstract class BaseOrderService
|
||||
/// <summary>
|
||||
/// 设备并发更新 需要抛出VersionExceptions
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="func"></param>
|
||||
/// <param name="retry">并发冲突处理次数</param>
|
||||
/// <param name="retry"></param>
|
||||
/// <param name="errorMessage"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
@@ -73,7 +72,7 @@ public abstract class BaseOrderService
|
||||
}
|
||||
catch (Exception ex) when (ex is VersionExceptions)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
_logger.LogWarning(ex, "{message}", ex.Message);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Dlhis.Common.FileOperation.Controllers;
|
||||
[ApiController]
|
||||
public class ApkFileController : ControllerBase
|
||||
{
|
||||
private IApkFIileService _apkFIileService;
|
||||
private readonly IApkFIileService _apkFIileService;
|
||||
|
||||
public ApkFileController(IApkFIileService apkFIileService)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,6 @@ namespace Dlhis.Common.FileOperation.Response
|
||||
/// <summary>
|
||||
/// url
|
||||
/// </summary>
|
||||
public string? Url { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Dlhis.Common.FileOperation.Configurations;
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Minio;
|
||||
using Minio.DataModel.Args;
|
||||
@@ -81,7 +82,7 @@ public class MinioService : IMinioService
|
||||
{
|
||||
string fileName = request.formFile.FileName;
|
||||
|
||||
using (MemoryStream filestream = new MemoryStream())
|
||||
using (var filestream = new MemoryStream())
|
||||
{
|
||||
await request.formFile.CopyToAsync(filestream);
|
||||
filestream.Position = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SqlSugarPack : BaseAppPack
|
||||
var configuration = sp.GetService<IConfiguration>();
|
||||
return new List<ConnectionConfig>
|
||||
{
|
||||
new ConnectionConfig
|
||||
new()
|
||||
{
|
||||
ConfigId = "face",
|
||||
ConnectionString = configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value,
|
||||
@@ -28,7 +28,7 @@ public class SqlSugarPack : BaseAppPack
|
||||
DisableNvarchar = true,
|
||||
}
|
||||
},
|
||||
new ConnectionConfig
|
||||
new()
|
||||
{
|
||||
ConfigId = "log",
|
||||
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
|
||||
|
||||
@@ -18,16 +18,14 @@ public class MealSupplementHandler : IAsyncChannelHandler<MealSupplementMessage>
|
||||
|
||||
public async Task InvokeAsync(MealSupplementMessage message)
|
||||
{
|
||||
using (var scope = _serviceProvider.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||
|
||||
var existsIds = await db.Queryable<MealSupplementRecordEntity>().Select(x => x.UniqueId).ToListAsync();
|
||||
var items = message.Items.Where(x => !existsIds.Contains(x.UniqueId)).ToList();
|
||||
var existsIds = await db.Queryable<MealSupplementRecordEntity>().Select(x => x.UniqueId).ToListAsync();
|
||||
var items = message.Items.Where(x => !existsIds.Contains(x.UniqueId)).ToList();
|
||||
|
||||
var entities = items.Adapt<List<MealSupplementRecordEntity>>();
|
||||
await db.InsertAsync(entities);
|
||||
}
|
||||
var entities = items.Adapt<List<MealSupplementRecordEntity>>();
|
||||
await db.InsertAsync(entities);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,10 @@ namespace Dlhis.ScheduledTask.CommonJobs;
|
||||
public class HeartbeatJob
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ILogger<HeartbeatJob> _logger;
|
||||
|
||||
public HeartbeatJob(IDbContext dbContext, ILogger<HeartbeatJob> logger)
|
||||
public HeartbeatJob(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
@@ -38,7 +36,7 @@ public class HeartbeatJob
|
||||
await _dbContext.Updateable<DeviceRegistryEntity>().SetColumns(x => x.LastHeartbeatTime == DateTime.Now)
|
||||
.Where(x => x.DeviceUniqueNo == device.UniqueNo).ExecuteCommandAsync();
|
||||
|
||||
// _logger.LogInformation("心跳设备成功:{no}", device.UniqueNo);
|
||||
// _logger.LogInformation("心跳设备成功:{no}", device.UniqueNo);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -1,121 +1,121 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Kurisu.AspNetCore.Authentication.Options;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Options;
|
||||
//using Dlhis.Entity.Basic.Entity;
|
||||
//using Dlhis.Entity.Sys.Entities;
|
||||
//using Kurisu.AspNetCore.Authentication.Options;
|
||||
//using Kurisu.AspNetCore.Utils.Extensions;
|
||||
//using Kurisu.Core.DataAccess.Entity;
|
||||
//using Kurisu.SqlSugar.Services;
|
||||
//using Microsoft.AspNetCore.Identity;
|
||||
//using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Dlhis.ScheduledTask.CommonJobs
|
||||
{
|
||||
public class TempCreateUserJob
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ILogger<TempCreateUserJob> _logger;
|
||||
private readonly IdentityServerOptions _identityServerOptions;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
//namespace Dlhis.ScheduledTask.CommonJobs
|
||||
//{
|
||||
// public class TempCreateUserJob
|
||||
// {
|
||||
// private readonly IDbContext _dbContext;
|
||||
// private readonly ILogger<TempCreateUserJob> _logger;
|
||||
// private readonly IdentityServerOptions _identityServerOptions;
|
||||
// private readonly IHttpClientFactory _httpClientFactory;
|
||||
|
||||
public TempCreateUserJob(
|
||||
IDbContext dbContext,
|
||||
ILogger<TempCreateUserJob> logger,
|
||||
IOptions<IdentityServerOptions> options,
|
||||
IHttpClientFactory httpClientFactory)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_logger = logger;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_identityServerOptions = options.Value;
|
||||
}
|
||||
// public TempCreateUserJob(
|
||||
// IDbContext dbContext,
|
||||
// ILogger<TempCreateUserJob> logger,
|
||||
// IOptions<IdentityServerOptions> options,
|
||||
// IHttpClientFactory httpClientFactory)
|
||||
// {
|
||||
// _dbContext = dbContext;
|
||||
// _logger = logger;
|
||||
// _httpClientFactory = httpClientFactory;
|
||||
// _identityServerOptions = options.Value;
|
||||
// }
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
try
|
||||
{
|
||||
// public async Task RunAsync()
|
||||
// {
|
||||
// _dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
|
||||
// try
|
||||
// {
|
||||
|
||||
//var identityDbContext = _dbContext.ChangeDb("identity");
|
||||
// //var identityDbContext = _dbContext.ChangeDb("identity");
|
||||
|
||||
////HST0001
|
||||
//var users = await identityDbContext.Queryable<UserEntity>().Where(x => x.UserName != "HST0001")
|
||||
// .Where(x => x.Id > 21)
|
||||
// .ToListAsync();
|
||||
// ////HST0001
|
||||
// //var users = await identityDbContext.Queryable<UserEntity>().Where(x => x.UserName != "HST0001")
|
||||
// // .Where(x => x.Id > 21)
|
||||
// // .ToListAsync();
|
||||
|
||||
//var gainfos = await _dbContext.Queryable<GainfoEntity>().ToListAsync();
|
||||
// //var gainfos = await _dbContext.Queryable<GainfoEntity>().ToListAsync();
|
||||
|
||||
//var hasher = new PasswordHasher<UserEntity>();
|
||||
//foreach (var user in users)
|
||||
//{
|
||||
// var gainfo = gainfos.FirstOrDefault(x => x.Code == user.UserName);
|
||||
// if (gainfo != null && gainfo.IdNo.IsPresent())
|
||||
// {
|
||||
// var password = gainfo.IdNo.TakeLast(6).Join("");
|
||||
// password = hasher.HashPassword(user, password);
|
||||
// user.PasswordHash = password;
|
||||
// await identityDbContext.UpdateAsync(user);
|
||||
// }
|
||||
//}
|
||||
// //var hasher = new PasswordHasher<UserEntity>();
|
||||
// //foreach (var user in users)
|
||||
// //{
|
||||
// // var gainfo = gainfos.FirstOrDefault(x => x.Code == user.UserName);
|
||||
// // if (gainfo != null && gainfo.IdNo.IsPresent())
|
||||
// // {
|
||||
// // var password = gainfo.IdNo.TakeLast(6).Join("");
|
||||
// // password = hasher.HashPassword(user, password);
|
||||
// // user.PasswordHash = password;
|
||||
// // await identityDbContext.UpdateAsync(user);
|
||||
// // }
|
||||
// //}
|
||||
|
||||
//var userNames = await identityDbContext.Queryable<UserEntity>().Select(x => x.UserName).ToListAsync();
|
||||
//var newUser = await _dbContext.Queryable<GainfoEntity>()
|
||||
// .Where(x => !string.IsNullOrEmpty(x.Code))
|
||||
// .Where(x => !userNames.Contains(x.Code))
|
||||
// .Select(x => new
|
||||
// {
|
||||
// x.Code,
|
||||
// x.Factory,
|
||||
// x.Name,
|
||||
// })
|
||||
// .ToListAsync();
|
||||
// //var userNames = await identityDbContext.Queryable<UserEntity>().Select(x => x.UserName).ToListAsync();
|
||||
// //var newUser = await _dbContext.Queryable<GainfoEntity>()
|
||||
// // .Where(x => !string.IsNullOrEmpty(x.Code))
|
||||
// // .Where(x => !userNames.Contains(x.Code))
|
||||
// // .Select(x => new
|
||||
// // {
|
||||
// // x.Code,
|
||||
// // x.Factory,
|
||||
// // x.Name,
|
||||
// // })
|
||||
// // .ToListAsync();
|
||||
|
||||
//var httpClient = _httpClientFactory.CreateClient();
|
||||
//httpClient.BaseAddress = new Uri(_identityServerOptions.Authority);
|
||||
// //var httpClient = _httpClientFactory.CreateClient();
|
||||
// //httpClient.BaseAddress = new Uri(_identityServerOptions.Authority);
|
||||
|
||||
//var hasher = new PasswordHasher<UserEntity>();
|
||||
//foreach (var item in newUser)
|
||||
//{
|
||||
// var userName = item.Code;
|
||||
// var password = item.Code;
|
||||
// var factory = item.Factory;
|
||||
// //var hasher = new PasswordHasher<UserEntity>();
|
||||
// //foreach (var item in newUser)
|
||||
// //{
|
||||
// // var userName = item.Code;
|
||||
// // var password = item.Code;
|
||||
// // var factory = item.Factory;
|
||||
|
||||
// if (password.Length > 6)
|
||||
// {
|
||||
// password = string.Join("", password.TakeLast(6));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// password = password.PadLeft(6, '0');
|
||||
// }
|
||||
// var user = new UserEntity
|
||||
// {
|
||||
// UserName = userName,
|
||||
// NormalizedUserName = userName.ToUpper(),
|
||||
// ConcurrencyStamp = Guid.NewGuid().ToString(),
|
||||
// SecurityStamp = Guid.NewGuid().ToString(),
|
||||
// };
|
||||
// // if (password.Length > 6)
|
||||
// // {
|
||||
// // password = string.Join("", password.TakeLast(6));
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // password = password.PadLeft(6, '0');
|
||||
// // }
|
||||
// // var user = new UserEntity
|
||||
// // {
|
||||
// // UserName = userName,
|
||||
// // NormalizedUserName = userName.ToUpper(),
|
||||
// // ConcurrencyStamp = Guid.NewGuid().ToString(),
|
||||
// // SecurityStamp = Guid.NewGuid().ToString(),
|
||||
// // };
|
||||
|
||||
// password = hasher.HashPassword(user, password);
|
||||
// user.PasswordHash = password;
|
||||
// var id = (int)await identityDbContext.InsertReturnIdentityAsync(user);
|
||||
// // password = hasher.HashPassword(user, password);
|
||||
// // user.PasswordHash = password;
|
||||
// // var id = (int)await identityDbContext.InsertReturnIdentityAsync(user);
|
||||
|
||||
// await identityDbContext.InsertAsync(new UserTenantEntity() { UserId = id, TenantCode = factory });
|
||||
// await identityDbContext.InsertAsync(new List<UserClaimEntity>
|
||||
// {
|
||||
// new UserClaimEntity{ UserId = id , ClaimType ="preferred_username", ClaimValue = item.Name},
|
||||
// new UserClaimEntity{ UserId = id , ClaimType ="jinko-code", ClaimValue = item.Code},
|
||||
// });
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "创建用户失败:{message}", ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_dbContext.Client.QueryFilter.Restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
// // await identityDbContext.InsertAsync(new UserTenantEntity() { UserId = id, TenantCode = factory });
|
||||
// // await identityDbContext.InsertAsync(new List<UserClaimEntity>
|
||||
// // {
|
||||
// // new UserClaimEntity{ UserId = id , ClaimType ="preferred_username", ClaimValue = item.Name},
|
||||
// // new UserClaimEntity{ UserId = id , ClaimType ="jinko-code", ClaimValue = item.Code},
|
||||
// // });
|
||||
// //}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.LogError(ex, "创建用户失败:{message}", ex.Message);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// _dbContext.Client.QueryFilter.Restore();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
@@ -60,10 +60,10 @@ public class JobPack : BaseAppPack
|
||||
});
|
||||
|
||||
|
||||
RecurringJob.AddOrUpdate<TempCreateUserJob>("TempCreateUser", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
//RecurringJob.AddOrUpdate<TempCreateUserJob>("TempCreateUser", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
|
||||
//{
|
||||
// TimeZone = TimeZoneInfo.Local
|
||||
//});
|
||||
|
||||
//删除前三天前的日志
|
||||
RecurringJob.AddOrUpdate<DelApiLogTaskJob>("DelApiLogTask", s => s.RunAsync(), "0 0 */7 * *", new RecurringJobOptions
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SqlSugarPack : BaseAppPack
|
||||
|
||||
return new List<ConnectionConfig>
|
||||
{
|
||||
new ConnectionConfig
|
||||
new()
|
||||
{
|
||||
ConfigId = "identity",
|
||||
|
||||
@@ -30,8 +30,8 @@ public class SqlSugarPack : BaseAppPack
|
||||
DisableNvarchar = true,
|
||||
}
|
||||
},
|
||||
new ConnectionConfig
|
||||
{
|
||||
new()
|
||||
{
|
||||
ConfigId = "log",
|
||||
|
||||
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SapPersonComparer : IEqualityComparer<SapPersonItem>
|
||||
}
|
||||
|
||||
|
||||
private string SubString(string s, int len)
|
||||
private static string SubString(string s, int len)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public class SapPersonComparer : IEqualityComparer<SapPersonItem>
|
||||
}
|
||||
|
||||
|
||||
private DateTime? SafeParseDate(string str)
|
||||
private static DateTime? SafeParseDate(string str)
|
||||
{
|
||||
if (str == "0000-00-00" || str == "0001-01-01" || str == "1900-01-01")
|
||||
return null;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SyncPersonJob
|
||||
|
||||
foreach (var searchCodes in chunks)
|
||||
{
|
||||
_logger.LogInformation("SAP分批处理Chunk数量:{count}", searchCodes.Count());
|
||||
_logger.LogInformation("SAP分批处理Chunk数量:{count}", searchCodes.Length);
|
||||
var existsWorkCodes = dbContext.Queryable<GainfoSapEntity>()
|
||||
.Where(x => searchCodes.Contains(x.ename))
|
||||
.Select(x => x.ename)
|
||||
@@ -390,7 +390,7 @@ public class SyncPersonJob
|
||||
|
||||
return o;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -398,14 +398,14 @@ public class SyncPersonJob
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private string GetNative(string idno)
|
||||
private static string GetNative(string idno)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(idno) || idno.Length < 6) return null;
|
||||
idno = idno.TrimStart();
|
||||
return idno.Substring(0, 6);
|
||||
}
|
||||
|
||||
private DateTime? SafeParseDate(string str)
|
||||
private static DateTime? SafeParseDate(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
|
||||
@@ -210,12 +210,12 @@ public class AssignmentService : IAssignmentService
|
||||
Enable = true,
|
||||
Sections = new List<TimePeriodWeekDaySection>()
|
||||
{
|
||||
new TimePeriodWeekDaySection()
|
||||
new()
|
||||
{
|
||||
DayOfWeek= DayOfWeek.Monday,
|
||||
TimePeriods = new List<TimePeriod>()
|
||||
{
|
||||
new TimePeriod
|
||||
new()
|
||||
{
|
||||
Start = TimeOnly.Parse("08:00:00"),
|
||||
End = TimeOnly.Parse("17:30:00"),
|
||||
@@ -236,7 +236,7 @@ public class AssignmentService : IAssignmentService
|
||||
Name = "计划的一部分",
|
||||
Schedules = new List<ScheduleDto>
|
||||
{
|
||||
new ScheduleDto
|
||||
new()
|
||||
{
|
||||
Name = "国庆节",
|
||||
DateTimePeriod = new DateTimePeriod
|
||||
|
||||
@@ -97,7 +97,7 @@ public class RoleService : IRoleService
|
||||
}
|
||||
|
||||
|
||||
private async Task CheckDuplicateNameAsync(IDbContext db, RoleSaveRequest request)
|
||||
private static async Task CheckDuplicateNameAsync(IDbContext db, RoleSaveRequest request)
|
||||
{
|
||||
var exists = await db.Queryable<RoleEntity>()
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
|
||||
@@ -118,7 +118,7 @@ public class TenantService : ITenantService
|
||||
}
|
||||
|
||||
|
||||
private void RecursionGetNext(TenantTreeResponse current, List<TenantTreeResponse> data)
|
||||
private static void RecursionGetNext(TenantTreeResponse current, List<TenantTreeResponse> data)
|
||||
{
|
||||
var next = data.Where(x => x.PCode == current.Code).ToList();
|
||||
current.Next = next;
|
||||
|
||||
@@ -214,7 +214,7 @@ public class MenuService : IMenuService
|
||||
}
|
||||
|
||||
|
||||
private void RecursionGetNext(MenuResponse current, List<MenuResponse> menus)
|
||||
private static void RecursionGetNext(MenuResponse current, List<MenuResponse> menus)
|
||||
{
|
||||
var nextMenus = menus.Where(x => x.PCode == current.Code).ToList();
|
||||
current.Items = nextMenus;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Startup
|
||||
services.AddOcelot();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
|
||||
Reference in New Issue
Block a user