From d3350f94c063e1b88fbff63c14f1c4c5f6f29573 Mon Sep 17 00:00:00 2001 From: cjy Date: Thu, 31 Oct 2024 16:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Code/Dtos/CodeThirdPartyReq.cs | 10 ++++++++++ .../DS.WMS.Core/Code/Dtos/CodeThirdPartyRes.cs | 10 ++++++++++ .../DS.WMS.Core/Code/Entity/CodeThirdParty.cs | 10 ++++++++++ .../Code/Method/CodeThirdPartyService.cs | 14 +++++++------- .../HangfireJob/Method/JobCommonService.cs | 12 ++++++------ .../Op/Method/SeaExportCommonService.cs | 12 ++++++------ 6 files changed, 49 insertions(+), 19 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyReq.cs index 82f24333..aa5cc316 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyReq.cs @@ -75,6 +75,16 @@ public class CodeThirdPartyReq /// 联系邮箱 /// public string RegistContractEmail { get; set; } + + /// + /// 用户ID + /// + public long UserId { get; set; } + + /// + /// 用户姓名 + /// + public string? UserName { get; set; } } /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyRes.cs index cdf14419..790424ac 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyRes.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeThirdPartyRes.cs @@ -77,4 +77,14 @@ public class CodeThirdPartyRes /// 联系邮箱 /// public string RegistContractEmail { get; set; } + + /// + /// 用户ID + /// + public long UserId { get; set; } + + /// + /// 用户姓名 + /// + public string? UserName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeThirdParty.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeThirdParty.cs index ad646a43..ead5829a 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeThirdParty.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeThirdParty.cs @@ -44,7 +44,17 @@ public class CodeThirdParty : BaseModel [SugarColumn(ColumnDescription = "账户密钥", IsNullable = true, Length = 200)] public string AppSecret { get; set; } + /// + /// 用户ID + /// + [SugarColumn(ColumnDescription = "用户ID", IsNullable = false)] + public long UserId { get; set; } + /// + /// 用户姓名 + /// + [SugarColumn(ColumnDescription = "用户姓名", Length = 200, IsNullable = true)] + public string? UserName { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeThirdPartyService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeThirdPartyService.cs index 532becdb..65652dc3 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeThirdPartyService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeThirdPartyService.cs @@ -45,14 +45,14 @@ namespace DS.WMS.Core.Code.Method public DataResult EditCodeThirdParty(CodeThirdPartyReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - if (req.Id == 0) - { - if (tenantDb.Queryable().Where(x => x.AccountType == req.AccountType.Trim()&& x.CustomerId == req.CustomerId).Any()) - { - return DataResult.Failed("第三方账号已存在!", MultiLanguageConst.CodeThirdPartyExist); - } + if (tenantDb.Queryable().Where(x => x.AccountType == req.AccountType.Trim() && x.CustomerId == req.CustomerId && x.UserId == req.UserId && x.Id!=req.Id).Any()) + { + return DataResult.Failed("第三方账号已存在!", MultiLanguageConst.CodeThirdPartyExist); + } + if (req.Id == 0) + { var data = req.Adapt(); var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); @@ -91,7 +91,7 @@ namespace DS.WMS.Core.Code.Method var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var data = await tenantDb.Queryable() - .Where(a => a.AccountType == AccountType && a.IsCompany == false && a.CreateBy == long.Parse(user.UserId)) + .Where(a => a.AccountType == AccountType && a.IsCompany == false && a.UserId == long.Parse(user.UserId)) .Select() .FirstAsync(); diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/JobCommonService.cs b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/JobCommonService.cs index 99cb2b4e..8b0e5b4e 100644 --- a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/JobCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/JobCommonService.cs @@ -112,9 +112,9 @@ namespace DS.WMS.Core.HangfireJob.Method var uId = long.Parse(userId); if (customerId == 0) { - if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) + if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).Any()) { - return tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).First(); + return tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).First(); } else { @@ -123,13 +123,13 @@ namespace DS.WMS.Core.HangfireJob.Method } else { - if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).Any()) + if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId && x.CustomerId == customerId).Any()) { - return tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).First(); + return tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId && x.CustomerId == customerId).First(); } - else if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) + else if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).Any()) { - return tenantDb.Queryable().First(x => x.AccountType == type && x.CreateBy == uId); + return tenantDb.Queryable().First(x => x.AccountType == type && x.UserId == uId); } else { diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index 66a4d54e..b1b131f7 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -476,9 +476,9 @@ namespace DS.WMS.Core.Op.Method var uId = long.Parse(userId); if (customerId == 0) { - if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) + if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).Any()) { - return tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).First(); + return tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).First(); } else { @@ -487,13 +487,13 @@ namespace DS.WMS.Core.Op.Method } else { - if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).Any()) + if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId && x.CustomerId == customerId).Any()) { - return tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).First(); + return tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId && x.CustomerId == customerId).First(); } - else if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) + else if (tenantDb.Queryable().Where(x => x.AccountType == type && x.UserId == uId).Any()) { - return tenantDb.Queryable().First(x => x.AccountType == type && x.CreateBy == uId); + return tenantDb.Queryable().First(x => x.AccountType == type && x.UserId == uId); } else {