From 76c2ad8cc5dea04c7eb9e5178755d6a007a0976e Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 18 Nov 2025 16:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CCTJExportDatas/CCTJLMPAppService.cs | 12 ++++++------ .../CustomerOrgs/CustomerOrgAppService.cs | 6 ++---- src/Shentun.Peis.Domain/CacheService.cs | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Shentun.Peis.Application/CCTJExportDatas/CCTJLMPAppService.cs b/src/Shentun.Peis.Application/CCTJExportDatas/CCTJLMPAppService.cs index 2f5954f..9e57c77 100644 --- a/src/Shentun.Peis.Application/CCTJExportDatas/CCTJLMPAppService.cs +++ b/src/Shentun.Peis.Application/CCTJExportDatas/CCTJLMPAppService.cs @@ -473,7 +473,7 @@ namespace Shentun.Peis.CCTJExportDatas Address = row["address"].ToString(), Bank = row["bank"].ToString(), DisplayName = row["org_name"].ToString(), - DisplayOrder = oldCustomerOrgList.Rows.IndexOf(row) + 1, + DisplayOrder = Convert.ToInt32(row["display_order"].ToString()), Fax = row["fax"].ToString(), InvoiceName = row["org_name"].ToString(), IsActive = 'Y', @@ -481,7 +481,7 @@ namespace Shentun.Peis.CCTJExportDatas MedicalCenterId = defaultMedicalCenterId, OrgTypeId = defaultOrgTypeId, //默认为私营 ParentId = null, - PathCode = (oldCustomerOrgList.Rows.IndexOf(row) + 1).ToString().PadLeft(5, '0'), + PathCode = _customerOrgManager.CreatePathCode(null).GetAwaiter().GetResult(), PostalCode = row["postalcode"].ToString(), Remark = remark, ShortName = row["short_name"].ToString(), @@ -575,7 +575,7 @@ namespace Shentun.Peis.CCTJExportDatas Address = row["address"].ToString(), Bank = row["bank"].ToString(), DisplayName = row["org_name"].ToString(), - DisplayOrder = oldCustomerOrgList.Rows.IndexOf(row) + 1, + DisplayOrder = Convert.ToInt32(row["display_order"].ToString()), Fax = row["fax"].ToString(), InvoiceName = row["org_name"].ToString(), IsActive = 'Y', @@ -583,7 +583,7 @@ namespace Shentun.Peis.CCTJExportDatas MedicalCenterId = defaultMedicalCenterId, OrgTypeId = defaultOrgTypeId, //默认为私营 ParentId = parentId, - PathCode = _customerOrgManager.CreatePathCode(parentId).Result, + PathCode = _customerOrgManager.CreatePathCode(parentId).GetAwaiter().GetResult(), PostalCode = row["postalcode"].ToString(), Remark = remark, ShortName = row["short_name"].ToString(), @@ -677,7 +677,7 @@ namespace Shentun.Peis.CCTJExportDatas Address = row["address"].ToString(), Bank = row["bank"].ToString(), DisplayName = row["org_name"].ToString(), - DisplayOrder = oldCustomerOrgList.Rows.IndexOf(row) + 1, + DisplayOrder = Convert.ToInt32(row["display_order"].ToString()), Fax = row["fax"].ToString(), InvoiceName = row["org_name"].ToString(), IsActive = 'Y', @@ -685,7 +685,7 @@ namespace Shentun.Peis.CCTJExportDatas MedicalCenterId = defaultMedicalCenterId, OrgTypeId = defaultOrgTypeId, //默认为私营 ParentId = parentId, - PathCode = _customerOrgManager.CreatePathCode(parentId).Result, + PathCode = _customerOrgManager.CreatePathCode(parentId).GetAwaiter().GetResult(), PostalCode = row["postalcode"].ToString(), Remark = remark, ShortName = row["short_name"].ToString(), diff --git a/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs b/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs index 3aef39f..7e8175e 100644 --- a/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs +++ b/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs @@ -657,10 +657,8 @@ namespace Shentun.Peis.CustomerOrgs /// public async Task GetParent(Guid CustomerOrgId) { - var entity = await GetAsync(CustomerOrgId); - var parentEntity = (await Repository.GetQueryableAsync()).Where(o => o.PathCode == entity.PathCode.Substring(0, 5)).Single(); - return parentEntity.Id; - //return EntityHelper.GetParentNoSql(await Repository.GetListAsync(), CustomerOrgId); + var topCustomerOrgId = await _cacheService.GetTopCustomerOrgIdAsync(CustomerOrgId); + return topCustomerOrgId; } diff --git a/src/Shentun.Peis.Domain/CacheService.cs b/src/Shentun.Peis.Domain/CacheService.cs index 8b1a3cd..a04581a 100644 --- a/src/Shentun.Peis.Domain/CacheService.cs +++ b/src/Shentun.Peis.Domain/CacheService.cs @@ -703,7 +703,7 @@ namespace Shentun.Peis if (customerOrgDisplayMode == "0") { - entity = await _customerOrgRepository.GetAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); + entity = await _customerOrgRepository.FirstOrDefaultAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); } else { @@ -731,7 +731,7 @@ namespace Shentun.Peis if (entity.PathCode.Length > 5) { - entity = await _customerOrgRepository.GetAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); + entity = await _customerOrgRepository.FirstOrDefaultAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); topCustomerOrgId = entity.Id; }