qinchaoyue 4 周之前
父節點
當前提交
a85c9946a4

+ 0 - 9
src/Hotline.Api/Controllers/OrderController.cs

@@ -4100,15 +4100,6 @@ public class OrderController : BaseController
             }
         }
 
-        if (_systemSettingCacheManager.Snapshot)
-        {
-            await _orderSnapshotRepository.Queryable()
-                .Where(m => m.Id == id)
-                .Select(m => new { m.IndustryId, m.IndustryName })
-                .FirstAsync(HttpContext.RequestAborted)
-                .Then(m => { dto.IndustryName = m.IndustryName; dto.IndustryId = m.IndustryId; });
-        }
-
         return _sessionContext.OrgIsCenter ? dto : dto.DataMask();
     }
 

+ 10 - 1
test/Hotline.Tests/Application/OrderSnapshotApplicationTest.cs

@@ -19,6 +19,7 @@ using Hotline.ThirdAccountDomainServices;
 using Hotline.ThirdAccountDomainServices.Interfaces;
 using Hotline.Users;
 using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.DependencyInjection;
 using NPOI.SS.Formula.Functions;
 using Shouldly;
@@ -48,8 +49,9 @@ public class OrderSnapshotApplicationTest : TestBase
     private readonly IIndustryCaseRepository _industryCaseRepository;
     private readonly ISnapshotPointsRecordRepository _pointsRecordRepository;
     private readonly IIndustryRepository _industryRepository;
+    private readonly OrderController _orderController;
 
-    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository, IOrderSnapshotApplication orderSnapshotApplication, ISnapshotApplication snapshotApplication, IIndustryLogRepository industryLogRepository, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, ITypedCache<SystemSetting> cacheSettingData, IRedPackApplication redPackApplication, IOrderRepository orderRepository, ThirdAccounSupplierFactory thirdAccountDomainFactory, IIndustryCaseRepository industryCaseRepository, ISnapshotPointsRecordRepository pointsRecordRepository, IIndustryRepository industryRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository, cacheSettingData, thirdAccountDomainFactory)
+    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository, IOrderSnapshotApplication orderSnapshotApplication, ISnapshotApplication snapshotApplication, IIndustryLogRepository industryLogRepository, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, ITypedCache<SystemSetting> cacheSettingData, IRedPackApplication redPackApplication, IOrderRepository orderRepository, ThirdAccounSupplierFactory thirdAccountDomainFactory, IIndustryCaseRepository industryCaseRepository, ISnapshotPointsRecordRepository pointsRecordRepository, IIndustryRepository industryRepository, OrderController orderController) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository, cacheSettingData, thirdAccountDomainFactory)
     {
         _orderServiceMock = orderServiceMock;
         _systemDicDataCacheManager = systemDicDataCacheManager;
@@ -66,6 +68,11 @@ public class OrderSnapshotApplicationTest : TestBase
         _industryCaseRepository = industryCaseRepository;
         _pointsRecordRepository = pointsRecordRepository;
         _industryRepository = industryRepository;
+        _orderController = orderController;
+        _orderController.ControllerContext = new ControllerContext
+        {
+            HttpContext = new DefaultHttpContext()
+        };
     }
 
     /// <summary>
@@ -166,6 +173,8 @@ public class OrderSnapshotApplicationTest : TestBase
             .StepHandle(async order => {
                 var snapshot = await _orderSnapshotRepository.GetAsync(order.Id);
                 snapshot.IndustryCase.ShouldBe(industryCase.Id);
+                var orderDetail = await _orderController.Get(order.Id);
+                orderDetail.IndustryName.Contains(" ").ShouldBeTrue();
             })
             .发布工单(SetZuoXi, inputLable.Select(m => new Kv(m.DicDataName, m.DicDataName)).ToList())
             .StepHandle(async order =>