确定是否为最后审批人

dev
嵇文龙 1 month ago
parent b2b8f7c633
commit fd5658e20e

@ -209,7 +209,11 @@ namespace DS.Module.Core
/// <summary>
/// 释放网络连接
/// </summary>
public void Dispose() => http?.Dispose();
public void Dispose()
{
http?.Dispose();
GC.SuppressFinalize(this);
}
}
/// <summary>

@ -11,6 +11,15 @@ namespace DS.WMS.Core.Flow.Interface;
/// </summary>
public interface IClientFlowInstanceService
{
/// <summary>
/// 确定是否为最后审批人
/// </summary>
/// <param name="taskType">任务类型</param>
/// <param name="bsId">业务ID</param>
/// <param name="bsType">业务类型</param>
/// <returns></returns>
DataResult<bool> IsLastMarker(TaskBaseTypeEnum taskType, long bsId, BusinessType? bsType);
/// <summary>
/// 确定工作流是否正在运行中
/// </summary>

@ -74,6 +74,25 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
return data;
}
/// <summary>
/// 确定是否为最后审批人
/// </summary>
/// <param name="taskType">任务类型</param>
/// <param name="bsId">业务ID</param>
/// <param name="bsType">业务类型</param>
/// <returns></returns>
public DataResult<bool> IsLastMarker(TaskBaseTypeEnum taskType, long bsId, BusinessType? bsType)
{
var flow = Db.Queryable<FlowInstance>().Where(x => x.AuditType == taskType && x.BusinessId == bsId && x.BusinessType == bsType && x.FlowStatus == FlowStatusEnum.Running)
.Select(x => new { x.Id, x.MakerList }).First();
bool isLastMarker = default;
if (flow != null && flow.MakerList == User.UserId)
isLastMarker = true;
return DataResult<bool>.Success(isLastMarker);
}
public DataResult EditFlowInstance(FlowInstanceReq req)
{
if (req.Id == 0)

@ -17,6 +17,7 @@ namespace DS.WMS.Core.HangfireJob.Method
ISqlSugarClient? db;
IConfiguration configuration;
static FeeCustTemplateJobService()
{
api = new ApiFox();
@ -40,48 +41,39 @@ namespace DS.WMS.Core.HangfireJob.Method
{
db.QueryFilter.Clear();
var dbLinks = await db.Queryable<Module.SqlSugar.SysTenantLink>().ToListAsync();
SqlSugarClient? tenantDb = null;
try
foreach (var dbLink in dbLinks)
{
foreach (var dbLink in dbLinks)
{
var adminUser = await db.Queryable<SysUser>()
.Where(x => x.TenantId == dbLink.TenantId && x.Status == 0 && x.UserType == 1)
.OrderByDescending(x => x.CreateTime)
.Select(x => new
{
x.Id,
x.UserName,
x.Password,
x.DefaultOrgId,
x.DefaultOrgName,
x.TenantId,
x.TenantName
}).FirstAsync();
if (adminUser == null)
var adminUser = await db.Queryable<SysUser>()
.Where(x => x.TenantId == dbLink.TenantId && x.Status == 0 && x.UserType == 1)
.OrderByDescending(x => x.CreateTime)
.Select(x => new
{
Console.WriteLine($"未能获取租户系统管理员租户ID{dbLink.TenantId}");
continue;
}
x.Id,
x.UserName,
x.Password,
x.DefaultOrgId,
x.DefaultOrgName,
x.TenantId,
x.TenantName
}).FirstAsync();
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = adminUser.Id.ToString(),
Name = adminUser.UserName,
OrgId = adminUser.DefaultOrgId.ToString(),
TenantId = adminUser.TenantId.ToString(),
TenantName = adminUser.TenantName
};
var token = JwtHelper.Encrypt(tokenModel, false, true);
await SendRequestAsync(token);
if (adminUser == null)
{
Console.WriteLine($"未能获取租户系统管理员租户ID{dbLink.TenantId}");
continue;
}
}
finally
{
tenantDb?.Dispose();
}
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = adminUser.Id.ToString(),
Name = adminUser.UserName,
OrgId = adminUser.DefaultOrgId.ToString(),
TenantId = adminUser.TenantId.ToString(),
TenantName = adminUser.TenantName
};
var token = JwtHelper.Encrypt(tokenModel, false, true);
await SendRequestAsync(token);
}
}
internal async Task SendRequestAsync(string token)

@ -0,0 +1,78 @@
using DS.Module.Core;
using DS.WMS.Core.Sys.Entity;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.HangfireJob.Method
{
/// <summary>
/// WSL报表服务
/// </summary>
public class WSLReportJobService
{
static readonly ApiFox api;
ISqlSugarClient? db;
IConfiguration configuration;
IWebHostEnvironment hostEnvironment;
static WSLReportJobService()
{
api = new ApiFox();
}
/// <summary>
/// 初始化
/// </summary>
/// <param name="serviceProvider"></param>
public WSLReportJobService(IServiceProvider serviceProvider)
{
db = serviceProvider.GetRequiredService<ISqlSugarClient>();
configuration = serviceProvider.GetRequiredService<IConfiguration>();
hostEnvironment = serviceProvider.GetRequiredService<IWebHostEnvironment>();
}
/// <summary>
/// 生成报表
/// </summary>
/// <returns></returns>
public async Task GeneratReportAsync()
{
db.QueryFilter.Clear();
var dbLinks = await db.Queryable<Module.SqlSugar.SysTenantLink>().ToListAsync();
SqlSugarClient? tenantDb = null;
try
{
foreach (var dbLink in dbLinks)
{
var adminUser = await db.Queryable<SysUser>()
.Where(x => x.TenantId == dbLink.TenantId && x.Status == 0 && x.UserType == 1)
.OrderByDescending(x => x.CreateTime)
.Select(x => new
{
x.Id,
x.UserName,
x.Password,
x.DefaultOrgId,
x.DefaultOrgName,
x.TenantId,
x.TenantName
}).FirstAsync();
if (adminUser == null)
{
Console.WriteLine($"未能获取租户系统管理员租户ID{dbLink.TenantId}");
continue;
}
}
}
finally
{
tenantDb?.Dispose();
}
}
}
}

@ -332,8 +332,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
info.Main.TaskDesp = info.Main.TaskDesp ?? info.Main.TaskTitle;
//费用审核且多个接收人需拆分任务
if (FeeTypes.Contains(request.TaskType) && info.Main.RecvUserInfoList.Count > 1)
//费用审核需拆分任务
if (FeeTypes.Contains(request.TaskType))
{
var fee = await TenantDb.Queryable<FeeRecord>().Where(x => x.Id == request.BusinessId)
.Select(x => new

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-10-11T09:00:54.0916209Z||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;True|2024-09-14T11:19:13.1037012+08:00||;True|2024-09-13T14:31:12.4598160+08:00||;True|2024-09-13T10:44:56.1241214+08:00||;False|2024-09-13T10:44:26.6088271+08:00||;False|2024-09-13T10:44:06.1615137+08:00||;False|2024-09-13T10:43:19.2432517+08:00||;False|2024-09-13T10:38:18.1663387+08:00||;True|2024-09-06T18:49:17.9435308+08:00||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;</History>
<History>True|2024-10-12T05:33:32.4412583Z||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;True|2024-09-14T11:19:13.1037012+08:00||;True|2024-09-13T14:31:12.4598160+08:00||;True|2024-09-13T10:44:56.1241214+08:00||;False|2024-09-13T10:44:26.6088271+08:00||;False|2024-09-13T10:44:06.1615137+08:00||;False|2024-09-13T10:43:19.2432517+08:00||;False|2024-09-13T10:38:18.1663387+08:00||;True|2024-09-06T18:49:17.9435308+08:00||;True|2024-09-06T17:01:39.6646353+08:00||;True|2024-09-06T10:27:36.9990456+08:00||;True|2024-09-06T09:48:23.4236094+08:00||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -64,7 +64,7 @@
"BaseUrl": "http://47.105.115.105:26650"
},
"AutoFeeTemplate": {
"BaseUrl": "http://localhost:5295",
"BaseUrl": "http://118.190.144.189:3008",
"GenerateFeesUrl": "/feeApi/FeeCustTemplate/GenerateFees"
},
"HangfireSettings": {

@ -22,6 +22,19 @@ public class ClientFlowInstanceController : ApiController
_invokeService = invokeService;
}
/// <summary>
/// 确定是否为最后审批人
/// </summary>
/// <param name="taskType">任务类型</param>
/// <param name="bsId">业务ID</param>
/// <param name="bsType">业务类型(可空)</param>
/// <returns></returns>
[HttpGet, Route("IsLastMarker")]
public DataResult<bool> IsLastMarker([FromQuery]TaskBaseTypeEnum taskType, [FromQuery] long bsId, [FromQuery] BusinessType? bsType)
{
return _invokeService.IsLastMarker(taskType, bsId, bsType);
}
/// <summary>
/// 列表
/// </summary>

Loading…
Cancel
Save