|
@@ -15,6 +15,7 @@ using Hotline.Identity.Accounts;
|
|
|
using Hotline.Identity.Roles;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Repository.SqlSugar;
|
|
|
+using Hotline.Repository.SqlSugar.Snapshot;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Settings.Hotspots;
|
|
|
using Hotline.Share.Dtos.File;
|
|
@@ -64,8 +65,10 @@ public class OrderControllerTest : TestBase
|
|
|
private readonly IRepository<CallidRelation> _callIdRelationRepository;
|
|
|
private readonly XingTangCallApplication _defaultCallApplication;
|
|
|
private readonly ISqlSugarClient _capSqlClient;
|
|
|
+ private readonly IIndustryRepository _industryRepository;
|
|
|
+ private readonly IOrderSnapshotRepository _orderSnapshotRepository;
|
|
|
|
|
|
- public OrderControllerTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IRepository<Hotspot> hotspotRepository, OrderController orderController, IOrderRepository orderRepository, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, OrderServiceMock orderServiceMock, IRepository<OrderPublish> orderPublishRepository, INotificationHandler<EndWorkflowNotify> orderPublishEndWorkflowHandler, IOrderVisitRepository orderVisitRepository, IRepository<SystemSetting> systemSettingRepository, ISystemSettingCacheManager systemSettingCacheManager, IRepository<CallNative> callNativeRepository, IRepository<CallidRelation> callIdRelationRepository, XingTangCallApplication defaultCallApplication, ISugarUnitOfWork<CapDbContext> capDbContext, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount)
|
|
|
+ public OrderControllerTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IRepository<Hotspot> hotspotRepository, OrderController orderController, IOrderRepository orderRepository, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, OrderServiceMock orderServiceMock, IRepository<OrderPublish> orderPublishRepository, INotificationHandler<EndWorkflowNotify> orderPublishEndWorkflowHandler, IOrderVisitRepository orderVisitRepository, IRepository<SystemSetting> systemSettingRepository, ISystemSettingCacheManager systemSettingCacheManager, IRepository<CallNative> callNativeRepository, IRepository<CallidRelation> callIdRelationRepository, XingTangCallApplication defaultCallApplication, ISugarUnitOfWork<CapDbContext> capDbContext, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount, IIndustryRepository industryRepository, IOrderSnapshotRepository orderSnapshotRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount)
|
|
|
{
|
|
|
_hotspotRepository = hotspotRepository;
|
|
|
_orderController = orderController;
|
|
@@ -84,6 +87,8 @@ public class OrderControllerTest : TestBase
|
|
|
_callIdRelationRepository = callIdRelationRepository;
|
|
|
_defaultCallApplication = defaultCallApplication;
|
|
|
_capSqlClient = capDbContext.Db;
|
|
|
+ _industryRepository = industryRepository;
|
|
|
+ _orderSnapshotRepository = orderSnapshotRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -102,7 +107,7 @@ public class OrderControllerTest : TestBase
|
|
|
.With(m => m.Id, Ulid.NewUlid().ToString())
|
|
|
.With(m => m.CallNo, callNo)
|
|
|
.With(m => m.Direction, ECallDirection.In)
|
|
|
- .With(m => m.IsDeleted , false)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
.Create();
|
|
|
await _callNativeRepository.AddAsync(inDto);
|
|
|
|
|
@@ -111,7 +116,7 @@ public class OrderControllerTest : TestBase
|
|
|
.With(m => m.Direction, ECallDirection.Out)
|
|
|
.With(m => m.CallNo, callNo)
|
|
|
.With(m => m.AudioFile, string.Empty)
|
|
|
- .With(m => m.IsDeleted , false)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
.Create();
|
|
|
await _callNativeRepository.AddAsync(inDto2);
|
|
|
var callOrder = new CallidRelation
|
|
@@ -167,6 +172,36 @@ public class OrderControllerTest : TestBase
|
|
|
order.ShouldNotBeNull();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 创建随手拍工单
|
|
|
+ /// 验证随手拍工单是否能正常创建
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Fact]
|
|
|
+ public async Task OrderSnapshot_Test()
|
|
|
+ {
|
|
|
+ var industryItems = await _industryRepository.Queryable() .Select(d => new { d.Id, d.Name, }) .ToListAsync();
|
|
|
+ var industry = industryItems.First();
|
|
|
+
|
|
|
+ SetZuoXi();
|
|
|
+ var order = _orderServiceMock.CreateOrder(industryId:industry.Id, industryName: industry.Name)
|
|
|
+ .办理到派单员()
|
|
|
+ .办理到归档(SetPaiDanYuan, data =>
|
|
|
+ {
|
|
|
+ data.IsEvasive = true;
|
|
|
+ data.IsInactively = true;
|
|
|
+ })
|
|
|
+ .GetCreateResult();
|
|
|
+ var orderEntity = await _orderRepository.GetAsync(order.Id);
|
|
|
+ orderEntity.ShouldNotBeNull();
|
|
|
+
|
|
|
+ var snapshot = await _orderSnapshotRepository.GetAsync(m => m.Id == order.Id);
|
|
|
+ snapshot.ShouldNotBeNull();
|
|
|
+ snapshot.IndustryId.ShouldBe(industry.Id);
|
|
|
+ snapshot.IndustryName.ShouldBe(industry.Name);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 验证中心直办工单归档后 自动发布
|
|
|
/// 是否推诿, 是否不积极
|