|
@@ -1,10 +1,13 @@
|
|
|
-using Hotline.Orders;
|
|
|
+using AngleSharp.Text;
|
|
|
+using Hotline.Orders;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Settings.TimeLimitDomain;
|
|
|
using Hotline.Settings.TimeLimitDomain.Repository;
|
|
|
using Hotline.Share.Dtos.Settings;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
+using Hotline.Share.Tools;
|
|
|
using Mapster;
|
|
|
using Shouldly;
|
|
|
using XF.Domain.Repository;
|
|
@@ -25,65 +28,31 @@ public class ZiGongExpireTimeTest
|
|
|
_timeLimitSettingInventoryRepository = timeLimitSettingInventoryRepository;
|
|
|
}
|
|
|
|
|
|
- //[Theory]
|
|
|
- //// 24小时件
|
|
|
- //[InlineData("24小时件", "2024-09-04 14:00:00", "CenterToOrg", "08dccc8f-37b0-40d8-8112-1afb2230c5a3", "2024-09-05 14:00:00")]
|
|
|
- //// 疫情件
|
|
|
- //[InlineData("疫情件", "2024-09-05 14:01:01", "CenterToOrg", "08dccd5c-9bda-4e7d-8d63-82039dcfbde7", "2024-09-09 14:01:01")]
|
|
|
- //public async Task CalcExpiredTime_Test(string tip, string beginTxt, string flowTxt, string orderId, string expected)
|
|
|
- //{
|
|
|
- // var beginTime = DateTime.Parse(beginTxt);
|
|
|
- // if (orderId.Equals("08dccc8f-37b0-40d8-8112-1afb2230c5a3"))
|
|
|
- // await InitOrderData(orderId);
|
|
|
- // var order = await _orderRepository.Queryable().Where(m => m.Id == orderId).FirstAsync();
|
|
|
- // Enum.TryParse(flowTxt, out EFlowDirection flow);
|
|
|
- // var time = await _ziGongExpireTimeLimit.CalcExpiredTime(beginTime, flow, order.Adapt<OrderTimeClacInfo>());
|
|
|
- // time.ShouldNotBeNull();
|
|
|
- // time.ExpiredTime.ShouldBe(DateTime.Parse(expected), $"{tip} 期满时间错误");
|
|
|
- //}
|
|
|
-
|
|
|
[Theory]
|
|
|
- [InlineData("企业咨询件单元测试", "2024-09-04 14:00:00", "CenterToOrg", "2024-09-05 14:00:00")]
|
|
|
- [InlineData("企业建议件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
- [InlineData("企业求助件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
- [InlineData("企业表扬件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
- [InlineData("企业举报件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
- [InlineData("企业投诉件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
- [InlineData("四川省12345咨询件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-06 14:00:00")]
|
|
|
- [InlineData("四川省12345建议件单元测试", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-10 14:00:00")]
|
|
|
- [InlineData("中心到中心24小时", "2024-09-12 14:00:00", "CenterToCenter", "2024-09-13 14:00:00")]
|
|
|
- public async Task CalcExpiredTime_Test(string title, string beginTxt, string flowTxt, string expected)
|
|
|
+ [InlineData("企业咨询件单元测试", false, "Enterprise","10","互联网", "2024-09-04 14:00:00", "CenterToOrg", "2024-09-05 14:00:00")]
|
|
|
+ [InlineData("企业建议件单元测试", false, "Enterprise","15","互联网", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
+ [InlineData("企业求助件单元测试", false, "Enterprise","20","互联网", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
+ [InlineData("企业表扬件单元测试", false, "Enterprise","25","互联网", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
+ [InlineData("企业举报件单元测试", false, "Enterprise","30","互联网", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
+ [InlineData("企业投诉件单元测试", false, "Enterprise","35","互联网", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-09 14:00:00")]
|
|
|
+ [InlineData("四川省12345咨询件单测试",false, "Citizen", "10","四川省12345", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-06 14:00:00")]
|
|
|
+ [InlineData("四川省12345建议件单测试",false, "Citizen", "15","四川省12345", "2024-09-05 14:00:00", "CenterToOrg", "2024-09-10 14:00:00")]
|
|
|
+ [InlineData("中心到中心24小时", true, "Citizen", "10","四川省12345", "2024-09-12 14:00:00", "CenterToCenter", "2024-09-13 14:00:00")]
|
|
|
+ public async Task CalcExpiredTime_Test(string title, bool is24, string identityType,string acceptTypeCode, string sourceChannel, string beginTxt, string flowTxt, string expected)
|
|
|
{
|
|
|
var beginTime = DateTime.Parse(beginTxt);
|
|
|
- var order = await _orderRepository.Queryable().Where(m => m.Title == title).FirstAsync();
|
|
|
- order.ShouldNotBeNull($"{title} 测试数据不存在");
|
|
|
Enum.TryParse(flowTxt, out EFlowDirection flow);
|
|
|
- var time = await _ziGongExpireTimeLimit.CalcExpiredTime(beginTime, flow, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ var inDto = new OrderTimeClacInfo
|
|
|
+ {
|
|
|
+ IdentityType = identityType.ToEnum<EIdentityType>(),
|
|
|
+ AcceptTypeCode = acceptTypeCode,
|
|
|
+ SourceChannel = sourceChannel,
|
|
|
+ FlowDirection = flow,
|
|
|
+ Is24HoursComplete = is24
|
|
|
+ };
|
|
|
+ var time = await _ziGongExpireTimeLimit.CalcExpiredTime(beginTime, flow, inDto);
|
|
|
time.ShouldNotBeNull();
|
|
|
- time.ExpiredTime.ShouldBe(DateTime.Parse(expected), $"{title} 期满时间错误 AcceptTypeCode:{order.AcceptTypeCode}");
|
|
|
- time.TimeText.ShouldBe(order.Content, $"{title} 内容结果比对失败 AcceptTypeCode:{order.AcceptTypeCode}");
|
|
|
- }
|
|
|
-
|
|
|
- [Theory]
|
|
|
- [InlineData("求助三个工作日", "2024-09-12 22:01:28", "CenterToOrg", "2024-09-20 08:30:00")]
|
|
|
- [InlineData("string", "2024-09-12 22:01:28", "CenterToOrg", "2024-09-20 08:30:00")]
|
|
|
- public async Task CalcExpiredTime_Release_Test(string title, string beginTxt, string flowTxt, string expected)
|
|
|
- {
|
|
|
- var beginTime = DateTime.Parse(beginTxt);
|
|
|
- var order = await _orderRepository.Queryable().Where(m => m.Title == title).FirstAsync();
|
|
|
- order.ShouldNotBeNull($"{title} 测试数据不存在");
|
|
|
- Enum.TryParse(flowTxt, out EFlowDirection flow);
|
|
|
- var time = await _ziGongExpireTimeLimit.CalcExpiredTime(beginTime, flow, order.Adapt<OrderTimeClacInfo>());
|
|
|
- time.ShouldNotBeNull();
|
|
|
- time.ExpiredTime.ShouldBe(DateTime.Parse(expected), $"{title} 期满时间错误 AcceptTypeCode:{order.AcceptTypeCode}");
|
|
|
- }
|
|
|
-
|
|
|
- public async Task InitOrderData(string orderId)
|
|
|
- {
|
|
|
- var order = await _orderRepository.Queryable().Where(m => m.Id == orderId).FirstAsync();
|
|
|
- if (order.Is24HoursComplete) return;
|
|
|
- order.Is24HoursComplete = true;
|
|
|
- await _orderRepository.UpdateAsync(order);
|
|
|
+ time.ExpiredTime.ShouldBe(DateTime.Parse(expected), $"{title} 期满时间错误 AcceptTypeCode:{acceptTypeCode}");
|
|
|
}
|
|
|
|
|
|
[Theory]
|
|
@@ -94,6 +63,7 @@ public class ZiGongExpireTimeTest
|
|
|
[InlineData("20", "IdentityType", "Enterprise", false)]
|
|
|
public async Task InitTimeLimitData_Test(string busCode, string name, string value, bool isCommon)
|
|
|
{
|
|
|
+ return;
|
|
|
var attributeEntity = new TimeLimitSettingAttribute { BusCode = busCode, Name = name, Value = value, IsCommon = isCommon };
|
|
|
var dataEntity = await _timeLimitSettingAttributeRepository.GetAsync(attributeEntity.BusCode, attributeEntity.Name, attributeEntity.Value);
|
|
|
if (dataEntity is null) await _timeLimitSettingAttributeRepository.AddAsync(attributeEntity);
|
|
@@ -121,6 +91,7 @@ public class ZiGongExpireTimeTest
|
|
|
[InlineData("", "SourceChannel", "中国政府网", "WorkDay", 3, "中国政府网 '非咨询' 件3个工作日")]
|
|
|
public async Task InitTimeLimitInventory_Test(string busCode, string name, string value, string timeType, int timeValue, string remark)
|
|
|
{
|
|
|
+ return;
|
|
|
var attributeEntity = new TimeLimitSettingAttribute { BusCode = busCode, Name = name, Value = value, IsCommon = false };
|
|
|
var dataEntity = await _timeLimitSettingAttributeRepository.GetAsync(attributeEntity.BusCode, attributeEntity.Name, attributeEntity.Value);
|
|
|
if (dataEntity is null) await _timeLimitSettingAttributeRepository.AddAsync(attributeEntity);
|