Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -156,5 +156,9 @@ public class ModuleConsts
|
||||
/// 模块标识-盘点任务
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCHECKTASK_ID = "27582377555221";
|
||||
/// <summary>
|
||||
/// 模块标识-库存报表
|
||||
/// </summary>
|
||||
public const string MODULE_WMSSTOCKREPORT_ID = "27895417124373";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 库存报表条码表
|
||||
/// </summary>
|
||||
[SugarTable("wms_stock_report_code")]
|
||||
public partial class WmsStockReportCode : BaseEntity<string>
|
||||
{
|
||||
public WmsStockReportCode()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 主表ID
|
||||
/// </summary>
|
||||
public string? report_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string? carry_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码编号
|
||||
/// </summary>
|
||||
public string? barcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public decimal? codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public DateTime? time_stamp { get; set; }
|
||||
|
||||
}
|
||||
113
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.cs
Normal file
113
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 库存报表
|
||||
/// </summary>
|
||||
[SugarTable("wms_stock_report_h")]
|
||||
public partial class WmsStockReportH : BaseEntity<string>
|
||||
{
|
||||
public WmsStockReportH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
public string? warehouse_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 现有库存
|
||||
/// </summary>
|
||||
public decimal? existing_stock_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大库存
|
||||
/// </summary>
|
||||
public int? max_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存
|
||||
/// </summary>
|
||||
public int? safe_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小库存
|
||||
/// </summary>
|
||||
public int? min_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存有效期(天)
|
||||
/// </summary>
|
||||
public int? storage_valid_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预警提前期(天)
|
||||
/// </summary>
|
||||
public int? early_warn_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 过期预警数量
|
||||
/// </summary>
|
||||
public decimal? expired_warning_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程任务Id
|
||||
/// </summary>
|
||||
public string? f_flowtaskid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程引擎Id
|
||||
/// </summary>
|
||||
public string? f_flowid { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DataEncryption;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
@@ -49,6 +52,19 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Task<ClaimsPrincipal> GetUserIdentity(string aToken)
|
||||
{
|
||||
var claims = JWTEncryption.ReadJwtToken(aToken)?.Claims;
|
||||
ClaimsIdentity toKen = new ClaimsIdentity();
|
||||
foreach (Claim item in claims)
|
||||
{
|
||||
toKen.AddClaim(item);
|
||||
}
|
||||
var curUser = new ClaimsPrincipal(toKen);
|
||||
return Task.FromResult(curUser);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断最终目标库位是否可以放置当前载具
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class ConditionalBackgroundService : IHostedService
|
||||
{
|
||||
private readonly IHostedService _backgroundService;
|
||||
//private readonly Func<bool> _condition;
|
||||
|
||||
public ConditionalBackgroundService(IHostedService backgroundService)
|
||||
{
|
||||
_backgroundService = backgroundService;
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await _backgroundService.StartAsync(cancellationToken);
|
||||
}
|
||||
public async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await _backgroundService.StopAsync(cancellationToken);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,31 +25,30 @@ namespace Tnb.WarehouseMgr
|
||||
public class TimedTaskBackgroundService : BackgroundService
|
||||
{
|
||||
private ISendMessageService? _sendService;
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
|
||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
_sendService = App.GetRequiredService<ISendMessageService>();
|
||||
var userManager = App.GetRequiredService<IUserManager>();
|
||||
List<string> toUserIds = new List<string>() { "25398501929509" };
|
||||
//生成任务执行
|
||||
CancellationTokenSource genTaskCTS = new();
|
||||
CancellationTokenSource kittingOutAddCts = new();
|
||||
CancellationTokenSource kittingOutShippedCts = new();
|
||||
CancellationTokenSource setSortingCts = new();
|
||||
return Task.Run(() =>
|
||||
{
|
||||
//_sendService = App.GetRequiredService<ISendMessageService>();
|
||||
List<string> toUserIds = new List<string>() { "25398501929509" };
|
||||
//生成任务执行
|
||||
CancellationTokenSource genTaskCTS = new();
|
||||
CancellationTokenSource kittingOutAddCts = new();
|
||||
CancellationTokenSource kittingOutShippedCts = new();
|
||||
CancellationTokenSource setSortingCts = new();
|
||||
|
||||
var wareHouseService = App.GetRequiredService<IWareHouseService>();
|
||||
TimedTask(cts => wareHouseService.GenTaskExecute(cts), genTaskCTS, toUserIds);
|
||||
//齐套出库
|
||||
var wareHouseService = App.GetRequiredService<IWareHouseService>();
|
||||
TimedTask(cts => wareHouseService.GenTaskExecute(cts), genTaskCTS, toUserIds);
|
||||
//齐套出库
|
||||
|
||||
var kittingOutService = App.GetRequiredService<IWmskittingOutService>();
|
||||
TimedTask(cts => kittingOutService.KittingOutByAdd(cts), kittingOutAddCts, toUserIds);
|
||||
TimedTask(cts => kittingOutService.KittingOutByIsToBeShipped(cts), kittingOutShippedCts, toUserIds);
|
||||
//齐套分拣
|
||||
var setSortingService = App.GetRequiredService<IWmsSetSortingService>();
|
||||
TimedTask(cts => setSortingService.PackSortingByAdd(cts), setSortingCts, toUserIds);
|
||||
});
|
||||
var kittingOutService = App.GetRequiredService<IWmskittingOutService>();
|
||||
TimedTask(cts => kittingOutService.KittingOutByAdd(cts), kittingOutAddCts, toUserIds);
|
||||
TimedTask(cts => kittingOutService.KittingOutByIsToBeShipped(cts), kittingOutShippedCts, toUserIds);
|
||||
//齐套分拣
|
||||
var setSortingService = App.GetRequiredService<IWmsSetSortingService>();
|
||||
TimedTask(cts => setSortingService.PackSortingByAdd(cts), setSortingCts, toUserIds);
|
||||
});
|
||||
}
|
||||
private Task TimedTask(Func<CancellationTokenSource, Task> action, CancellationTokenSource cts, List<string>? toUserIds = default)
|
||||
{
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task GenTaskExecute(CancellationTokenSource? cts = default)
|
||||
{
|
||||
|
||||
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
var db = _db.CopyNew();
|
||||
try
|
||||
@@ -283,7 +283,6 @@ namespace Tnb.WarehouseMgr
|
||||
start = end;
|
||||
end = Math.Min((end + moveNum), arrary.Length);
|
||||
}
|
||||
|
||||
foreach (var arr in arrList)
|
||||
{
|
||||
for (int j = 1, len = arr.Length; j <= len; j++)
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace Tnb.WarehouseMgr
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.location_id)] = carry!.location_id!;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult();
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.source_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.source_code;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.bill_code;
|
||||
|
||||
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingout.location_id);
|
||||
|
||||
30
WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs
Normal file
30
WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using MimeKit.Cryptography;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存报表服务类
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSSTOCKREPORT_ID)]
|
||||
public class WmsStockReportService:BaseWareHouseService
|
||||
{
|
||||
public WmsStockReportService()
|
||||
{
|
||||
OverideFuncs.GetListAsync = GetListAsync;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,25 @@ using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Net.Http;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DataEncryption;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.LinqBuilder;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -45,14 +52,23 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IWmsCarryService _carryService;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private const string BizTypeId = "26169472620837";
|
||||
public WmskittingOutService(ISqlSugarRepository<WmsKittingoutH> repository, IWareHouseService warehouseService, IUserManager userManager, IBillRullService billRullService, IWmsCarryService carryService)
|
||||
public WmskittingOutService(
|
||||
ISqlSugarRepository<WmsKittingoutH> repository,
|
||||
IWareHouseService warehouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService,
|
||||
IWmsCarryService carryService,
|
||||
ICacheManager cacheManager
|
||||
)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_warehouseService = warehouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
_carryService = carryService;
|
||||
_cacheManager = cacheManager;
|
||||
}
|
||||
/// <summary>
|
||||
/// 齐套出库(新增状态)
|
||||
@@ -61,6 +77,10 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task KittingOutByAdd(CancellationTokenSource? cts = default)
|
||||
{
|
||||
var aToken = await _cacheManager.GetAsync("AsscessToken");
|
||||
if (aToken.IsNullOrWhiteSpace()) return;
|
||||
var curUser = await GetUserIdentity(aToken);
|
||||
|
||||
var curDb = _db.CopyNew();
|
||||
try
|
||||
{
|
||||
@@ -114,8 +134,8 @@ namespace Tnb.WarehouseMgr
|
||||
setSortingH.id = SnowflakeIdHelper.NextId();
|
||||
setSortingH.kittingout_id = ko.id;
|
||||
setSortingH.seq = ko.seq;
|
||||
setSortingH.org_id = _userManager.User.OrganizeId;
|
||||
setSortingH.create_id = _userManager.UserId;
|
||||
setSortingH.org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value;
|
||||
setSortingH.create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!;
|
||||
setSortingH.create_time = DateTime.Now;
|
||||
await curDb.Insertable(setSortingH).ExecuteCommandAsync();
|
||||
|
||||
@@ -155,6 +175,10 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task KittingOutByIsToBeShipped(CancellationTokenSource? cts = default)
|
||||
{
|
||||
var aToken = await _cacheManager.GetAsync("AsscessToken");
|
||||
if (aToken.IsNullOrWhiteSpace()) return;
|
||||
var curUser = await GetUserIdentity(aToken);
|
||||
|
||||
var curDb = _db.CopyNew();
|
||||
try
|
||||
{
|
||||
@@ -193,7 +217,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
WmsPretaskH preTask = new()
|
||||
{
|
||||
org_id = _userManager.User.OrganizeId,
|
||||
org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value,
|
||||
startlocation_id = sPoint?.location_id!,
|
||||
startlocation_code = sPoint?.location_code!,
|
||||
endlocation_id = ePoint?.location_id!,
|
||||
@@ -214,7 +238,7 @@ namespace Tnb.WarehouseMgr
|
||||
area_code = it.Key,
|
||||
require_id = ko.id,
|
||||
require_code = ko.bill_code,
|
||||
create_id = _userManager.UserId,
|
||||
create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!,
|
||||
create_time = DateTime.Now,
|
||||
source_id = ko.source_id,
|
||||
source_code = ko.source_code
|
||||
@@ -234,14 +258,6 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("无可用的载具", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("无可用的库位", 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,9 +63,10 @@ public class Startup : AppStartup
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
|
||||
#if !DEBUG
|
||||
//定时任务
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace JNPF.Common.Core.Manager;
|
||||
/// <summary>
|
||||
/// 用户管理 .
|
||||
/// </summary>
|
||||
public class UserManager : IUserManager, IScoped
|
||||
public partial class UserManager : IUserManager, IScoped
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户表仓储.
|
||||
@@ -76,7 +76,6 @@ public class UserManager : IUserManager, IScoped
|
||||
public UserEntity User
|
||||
{
|
||||
get => _repository.GetSingle(u => u.Id == UserId);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
27
common/Tnb.Common.Core/Manager/User/UserManager.part.cs
Normal file
27
common/Tnb.Common.Core/Manager/User/UserManager.part.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Models.Authorize;
|
||||
using JNPF.Common.Models.User;
|
||||
using JNPF.Common.Net;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DataEncryption;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Systems.Entitys.Entity.Permission;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace JNPF.Common.Core.Manager;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理 .
|
||||
/// </summary>
|
||||
public partial class UserManager
|
||||
{
|
||||
public static string AsscessToken { get; set; }
|
||||
}
|
||||
@@ -41,6 +41,8 @@ using JNPF.Common.Core.Handlers;
|
||||
using JNPF.Message.Interfaces.Message;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using Aop.Api.Domain;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace JNPF.OAuth;
|
||||
|
||||
@@ -140,6 +142,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
|
||||
private readonly IMHandler _imHandler;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个<see cref="OAuthService"/>类型的新实例.
|
||||
/// </summary>
|
||||
@@ -382,6 +386,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
[HttpGet("Logout")]
|
||||
public async Task Logout([FromQuery] string ticket)
|
||||
{
|
||||
await _cacheManager.DelAsync("AsscessToken");
|
||||
|
||||
var tenantId = _userManager.TenantId ?? "default";
|
||||
var userId = _userManager.UserId ?? "admim";
|
||||
var httpContext = _httpContextAccessor.HttpContext;
|
||||
@@ -600,6 +606,10 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
{ ClaimConst.LOGINTYPE,input.login_type}
|
||||
}, tokenTimeout);
|
||||
|
||||
//modify by ly on 20230804
|
||||
UserManager.AsscessToken = accessToken;
|
||||
await _cacheManager.SetAsync("AsscessToken", accessToken,TimeSpan.FromMinutes(30));
|
||||
|
||||
// 单点登录标识缓存
|
||||
if (_oauthOptions.Enabled) _cacheManager.Set("OnlineTicket_" + input.online_ticket, options.ConfigId);
|
||||
|
||||
@@ -671,7 +681,6 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
theme = user.Theme == null ? "classic" : user.Theme,
|
||||
|
||||
@@ -302,7 +302,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
// 非多租户模式启动自启任务
|
||||
if (!KeyVariable.MultiTenancy)
|
||||
{
|
||||
_repository.AsQueryable().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607
|
||||
_repository.AsSugarClient().CopyNew().Queryable<TimeTaskEntity>().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user